diff --git a/Mayday/Services/HTTPClient.swift b/Mayday/Services/HTTPClient.swift index 4ccd95d..54b1bb2 100644 --- a/Mayday/Services/HTTPClient.swift +++ b/Mayday/Services/HTTPClient.swift @@ -150,8 +150,18 @@ actor HTTPClient { urlRequest.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization") } - if let body = endpoint.body, endpoint.method != "GET" { - urlRequest.httpBody = try? JSONSerialization.data(withJSONObject: body) + if let body = endpoint.body { + if endpoint.method == "GET" { + // Append query parameters to URL for GET requests + if var components = URLComponents(url: url, resolvingAgainstBaseURL: false) { + components.queryItems = body.map { key, value in + URLQueryItem(name: key, value: "\(value)") + } + urlRequest.url = components.url + } + } else { + urlRequest.httpBody = try? JSONSerialization.data(withJSONObject: body) + } } let (data, response): (Data, URLResponse) diff --git a/Mayday/Services/PushNotificationService.swift b/Mayday/Services/PushNotificationService.swift index 0f25f00..9b3b532 100644 --- a/Mayday/Services/PushNotificationService.swift +++ b/Mayday/Services/PushNotificationService.swift @@ -76,6 +76,8 @@ class PushNotificationService: NSObject, ObservableObject, UNUserNotificationCen let severityStr = attributes["severity"] as? String, let severity = Severity(rawValue: severityStr) else { return } + // Info-level alerts don't warrant a persistent Live Activity — they are low-priority + // and should only appear as a standard banner notification. guard severity != .info else { return } // Limit to 3 concurrent activities diff --git a/Mayday/ViewModels/NotificationsViewModel.swift b/Mayday/ViewModels/NotificationsViewModel.swift index 8ea9a21..58e0700 100644 --- a/Mayday/ViewModels/NotificationsViewModel.swift +++ b/Mayday/ViewModels/NotificationsViewModel.swift @@ -70,6 +70,8 @@ class NotificationsViewModel: ObservableObject { } func startPolling() { + // Polling always reloads page 1 to pick up new notifications. + // Users who have scrolled to older pages will have the list reset on each interval. pollingTask = Task { while !Task.isCancelled { try? await Task.sleep(for: .seconds(30)) diff --git a/Mayday/Views/Settings/SettingsView.swift b/Mayday/Views/Settings/SettingsView.swift index 5c05ba4..b1a1365 100644 --- a/Mayday/Views/Settings/SettingsView.swift +++ b/Mayday/Views/Settings/SettingsView.swift @@ -22,14 +22,13 @@ struct SettingsView: View { showChangePassword = true } - Toggle(isOn: .constant(true)) { - Label("Push-уведомления", systemImage: "bell.badge") - } - .onChange(of: true) { _, _ in - // Open system settings + Button { if let url = URL(string: UIApplication.openNotificationSettingsURLString) { UIApplication.shared.open(url) } + } label: { + Label("Push-уведомления", systemImage: "bell.badge") + .foregroundStyle(.primary) } }