Commit 04486aa
authored
Add Authorization Options for Provisional Notifications (#442)
* Add Authorization Options for Provisional Notifications
• When using provisional notifications, when a user receives a notifications and taps 'Deliver Prominently', they should be able to receive normal notifications with sound, badge, etc.
• However it appears that with the current SDK, when a user taps 'Deliver Prominently', the notifications don't make sounds/badges until the user opens the app again.
• This can be fixed by requesting full authorization options immediately when registering for provisional notifications
* Fix Permission State
• The last commit did not correctly detect the new value for provisional notifications' UNAuthorizationOption in the UNUserNotificationCenter+OneSignal category requestAuthorizationWithOptions swizzle.
• This resulted in the permission state not getting updated correctly and caused tests to fail.
* Correctly Check for Enum Membership
• We have a swizzled implementation of requestAuthorizationWithOptions: in case developers call it directly instead of using our SDK's prompt methods
• We needed to check if the app was requesting provisional authorization which would cause the prompt not to be shown.
• However we were incorrectly evaluating equality of the raw value for the provisional authorization enum case instead of checking for enum membership (which would be a bitmask that could potentially contain multiple cases)1 parent 9f455db commit 04486aa
File tree
4 files changed
+16
-5
lines changed- iOS_SDK/OneSignalSDK
- Source
- UnitTests
4 files changed
+16
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
179 | 181 | | |
180 | 182 | | |
181 | | - | |
182 | | - | |
| 183 | + | |
| 184 | + | |
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
186 | 188 | | |
187 | 189 | | |
188 | | - | |
| 190 | + | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
97 | 99 | | |
98 | 100 | | |
99 | | - | |
| 101 | + | |
| 102 | + | |
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| |||
0 commit comments