patch editprivacy
This commit is contained in:
parent
06bdcac917
commit
dd5680742c
@ -142,8 +142,17 @@ struct ProfilePermissionsRequestPayload: Encodable {
|
|||||||
try container.encode(groupInvitePermission, forKey: .groupInvitePermission)
|
try container.encode(groupInvitePermission, forKey: .groupInvitePermission)
|
||||||
try container.encode(callPermission, forKey: .callPermission)
|
try container.encode(callPermission, forKey: .callPermission)
|
||||||
try container.encode(forceAutoDeleteMessagesInPrivate, forKey: .forceAutoDeleteMessagesInPrivate)
|
try container.encode(forceAutoDeleteMessagesInPrivate, forKey: .forceAutoDeleteMessagesInPrivate)
|
||||||
try container.encodeIfPresent(maxMessageAutoDeleteSeconds, forKey: .maxMessageAutoDeleteSeconds)
|
if let seconds = maxMessageAutoDeleteSeconds {
|
||||||
try container.encodeIfPresent(autoDeleteAfterDays, forKey: .autoDeleteAfterDays)
|
try container.encode(seconds, forKey: .maxMessageAutoDeleteSeconds)
|
||||||
|
} else {
|
||||||
|
try container.encodeNil(forKey: .maxMessageAutoDeleteSeconds)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let days = autoDeleteAfterDays {
|
||||||
|
try container.encode(days, forKey: .autoDeleteAfterDays)
|
||||||
|
} else {
|
||||||
|
try container.encodeNil(forKey: .autoDeleteAfterDays)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,14 +77,18 @@ final class ProfileService {
|
|||||||
let encoder = JSONEncoder()
|
let encoder = JSONEncoder()
|
||||||
encoder.keyEncodingStrategy = .convertToSnakeCase
|
encoder.keyEncodingStrategy = .convertToSnakeCase
|
||||||
|
|
||||||
print("payload \(payload)")
|
|
||||||
|
|
||||||
guard let body = try? encoder.encode(payload) else {
|
guard let body = try? encoder.encode(payload) else {
|
||||||
let message = NSLocalizedString("Не удалось подготовить данные запроса.", comment: "Profile update encoding error")
|
let message = NSLocalizedString("Не удалось подготовить данные запроса.", comment: "Profile update encoding error")
|
||||||
completion(.failure(ProfileServiceError.encoding(message)))
|
completion(.failure(ProfileServiceError.encoding(message)))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let jsonString = String(data: body, encoding: .utf8) {
|
||||||
|
print("📤 Request Body JSON:\n\(jsonString)")
|
||||||
|
} else {
|
||||||
|
print("⚠️ Не удалось преобразовать тело запроса в строку")
|
||||||
|
}
|
||||||
|
|
||||||
client.request(
|
client.request(
|
||||||
path: "/v1/profile/edit",
|
path: "/v1/profile/edit",
|
||||||
method: .put,
|
method: .put,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user