Commit d5499b57f6
Verified · cmc
Layout: unified · split
gitbay/Views/Account/NotificationsView.swift +11 −1
| @@ -64,7 +64,17 @@ struct NotificationsView: View { | ||
| 64 | 64 | // switch there. |
| 65 | 65 | .onChange(of: scenePhase) { _, newPhase in |
| 66 | 66 | guard newPhase == .active else { return } |
| 67 | Task { authorization = await registrar.authorizationStatus() } | |
| 67 | Task { | |
| 68 | let status = await registrar.authorizationStatus() | |
| 69 | // Granting in Settings is the one route to .authorized | |
| 70 | // that never passes through the toggle, so it is also | |
| 71 | // the one route that never asks iOS for a device | |
| 72 | // token. Without this the toggle turns on, the server | |
| 73 | // preference is set, and no `device add` is ever sent. | |
| 74 | let justGranted = status == .authorized && authorization != .authorized | |
| 75 | authorization = status | |
| 76 | if justGranted { await registrar.registerIfAlreadyAuthorized() } | |
| 77 | } | |
| 68 | 78 | } |
| 69 | 79 | .refreshable { |
| 70 | 80 | await model.load() |