patch editprivacy

This commit is contained in:
cheykrym 2025-10-08 02:56:35 +03:00
parent 06bdcac917
commit dd5680742c
2 changed files with 17 additions and 4 deletions

View File

@ -142,8 +142,17 @@ struct ProfilePermissionsRequestPayload: Encodable {
try container.encode(groupInvitePermission, forKey: .groupInvitePermission)
try container.encode(callPermission, forKey: .callPermission)
try container.encode(forceAutoDeleteMessagesInPrivate, forKey: .forceAutoDeleteMessagesInPrivate)
try container.encodeIfPresent(maxMessageAutoDeleteSeconds, forKey: .maxMessageAutoDeleteSeconds)
try container.encodeIfPresent(autoDeleteAfterDays, forKey: .autoDeleteAfterDays)
if let seconds = maxMessageAutoDeleteSeconds {
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)
}
}
}

View File

@ -76,8 +76,6 @@ final class ProfileService {
func updateProfile(_ payload: ProfileUpdateRequestPayload, completion: @escaping (Result<String, Error>) -> Void) {
let encoder = JSONEncoder()
encoder.keyEncodingStrategy = .convertToSnakeCase
print("payload \(payload)")
guard let body = try? encoder.encode(payload) else {
let message = NSLocalizedString("Не удалось подготовить данные запроса.", comment: "Profile update encoding error")
@ -85,6 +83,12 @@ final class ProfileService {
return
}
if let jsonString = String(data: body, encoding: .utf8) {
print("📤 Request Body JSON:\n\(jsonString)")
} else {
print("⚠️ Не удалось преобразовать тело запроса в строку")
}
client.request(
path: "/v1/profile/edit",
method: .put,