Skip to content

Commit d45a79b

Browse files
committed
optedIn and enabled will consider provisional as true
* Provisional permission means notifications can be displayed. * In this case, even though the user has not explicitly accepted push notification permissions, we will consider `optedIn` and `enabled` as true * In addition, the server also considers this user to be subscribed with provisional permission * Update the `_accepted` property on a push subscription model to reflect `reachable` instead of `accepted`
1 parent 9afbd4c commit d45a79b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

iOS_SDK/OneSignalSDK/OneSignalNotifications/OSPermission.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ + (void)fireChangesObserver:(OSPermissionStateInternal*)state {
237237
// Update the push subscription's _accepted property
238238
// TODO: This can be called before the User Manager has set itself as the delegate
239239
if (OSNotificationsManager.delegate && [OSNotificationsManager.delegate respondsToSelector:@selector(setAccepted:)]) {
240-
[OSNotificationsManager.delegate setAccepted:state.accepted];
240+
[OSNotificationsManager.delegate setAccepted:state.reachable];
241241
}
242242
}
243243

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModel.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,13 @@ class OSSubscriptionModel: OSModel {
162162
self.set(property: "notificationTypes", newValue: notificationTypes)
163163
}
164164
}
165+
165166
// swiftlint:disable identifier_name
166-
// This is set by the permission state changing
167-
// Defaults to true for email & SMS, defaults to false for push
167+
/**
168+
This is set by the permission state changing.
169+
Defaults to true for email & SMS, defaults to false for push.
170+
Note that this property reflects the `reachable` property of a permission state. As provisional permission is considered to be `optedIn` and `enabled`.
171+
*/
168172
var _accepted: Bool {
169173
didSet {
170174
guard self.type == .push && _accepted != oldValue else {

0 commit comments

Comments
 (0)