Skip to content

Commit 0bd6fb8

Browse files
committed
Review feedback
1 parent a9020b6 commit 0bd6fb8

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

MIGRATION_GUIDE.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ The current device’s push subscription can be retrieved via:
108108

109109
To receive push notifications on the device, call the push subscription’s `optIn` method. If needed, this method will prompt the user for push notifications permission.
110110

111-
Note: For greater control over prompting for push notification permission, you may use the `OneSignal.Notifications.requestPermission` method detailed below in the API Reference.
112-
113111

114112
**Flutter**
115113
```dart
@@ -223,12 +221,12 @@ The Push Subscription name space is accessible via `OneSignal.User.pushSubscript
223221
| `var optedIn = OneSignal.User.pushSubscription.optedIn` | *Gets a boolean value indicating whether the current user is opted in to push notifications. This returns `true` when the app has notifications permission and `optedOut` is called. ***Note:*** Does not take into account the existence of the subscription ID and push token. This boolean may return `true` but push notifications may still not be received by the user.* |
224222
| `OneSignal.User.pushSubscription.optIn();` | *Call this method to receive push notifications on the device or to resume receiving of push notifications after calling `optOut`. If needed, this method will prompt the user for push notifications permission.* |
225223
| `OneSignal.User.pushSubscription.optOut();` | *If at any point you want the user to stop receiving push notifications on the current device (regardless of system-level permission status), you can call this method to opt out.* |
226-
| `wOneSignal.User.pushSubscription.addObserver();`<br><br>***See below for usage*** | *The `OSPushSubscriptionObserver.onOSPushSubscriptionChanged` method will be fired on the passed-in object when the push subscription changes. This method returns the current `OSPushSubscriptionState` at the time of adding this observer.* |
224+
| `wOneSignal.User.pushSubscription.addObserver();`<br><br>***See below for usage*** | *The `OneSignalPushSubscriptionObserver.onOSPushSubscriptionChangedWithState` method will be fired on the passed-in object when the push subscription changes. This method returns the current `OSPushSubscriptionState` at the time of adding this observer.* |
227225
| `OneSignal.User.pushSubscription.removeObserver();`<br><br>***See below for usage*** | *Remove a push subscription observer that has been previously added.* |
228226

229227
### Push Subscription Observer
230228

231-
Any object implementing the `OSPushSubscriptionObserver` protocol can be added as an observer. You can call `removeObserver` to remove any existing listeners.
229+
Any object implementing the `OneSignalPushSubscriptionObserver` protocol can be added as an observer. You can call `removeObserver` to remove any existing listeners.
232230

233231
**Flutter**
234232
```dart
@@ -259,7 +257,7 @@ The Notifications namespace is accessible via `OneSignal.Notifications` and prov
259257
| **Flutter** | **Description** |
260258
|---------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|
261259
| `var permission = Notifications.permission` | *Whether this app has push notification permission.* |
262-
| `var canRequest = await OneSignal.Notifications.canRequestPermission();` | *Whether attempting to request notification permission will show a prompt. Returns `true` if the device has not been prompted for push notification permission already.* |
260+
| `var canRequest = await OneSignal.Notifications.canRequest();` | *Whether attempting to request notification permission will show a prompt. Returns `true` if the device has not been prompted for push notification permission already.* |
263261
| `OneSignal.Notifications.clearAll();` | *Removes all OneSignal notifications.*|
264262
| `OneSignal.Notifications.removeNotification(int x);` | *(Android only) Cancels a single OneSignal notification based on its Android notification integer ID. Use instead of Android's [android.app.NotificationManager.cancel], otherwise the notification will be restored when your app is restarted.*|
265263
| `OneSignal.Notifications.removeGroupedNotifications("GROUP_KEY");` | *(Android only) Cancels a group of OneSignal notifications with the provided group key. Grouping notifications is a OneSignal concept, there is no [android.app.NotificationManager] equivalent.*|

ios/Classes/OSFlutterNotifications.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ - (void)clearAll:(FlutterMethodCall *)call withResult:(FlutterResult)result {
8282
}
8383

8484
- (void)requestPermission:(FlutterMethodCall *)call withResult:(FlutterResult)result {
85-
NSLog(@"henryhenryhenryrequestPermission");
8685
BOOL fallbackToSettings = [call.arguments[@"fallbackToSettings"] boolValue];
8786

8887
[OneSignal.Notifications requestPermission:^(BOOL accepted) {

lib/src/notifications.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ class OneSignalNotifications {
3434
/// Whether attempting to request notification permission will show a prompt.
3535
/// Returns true if the device has not been prompted for push notification permission already.
3636
Future<bool> canRequest() async {
37-
return await _channel.invokeMethod("OneSignal#canRequest");
37+
if (Platform.isIOS) {
38+
return await _channel.invokeMethod("OneSignal#canRequest");
39+
} else {
40+
return false;
41+
}
3842
}
3943

4044
/// Removes a single notification.

0 commit comments

Comments
 (0)