fix: address code review feedback
- SettingsView: replace broken Toggle+constant with a Button that directly opens system notification settings (Toggle was bound to .constant(true) and onChange never fired) - HTTPClient: append query parameters to URL for GET requests instead of putting them in the request body (body is ignored for GET) - PushNotificationService: document why info-severity alerts skip Live Activities - NotificationsViewModel: document polling page-reset behavior Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user