Skip to content

Commit 4f4fa65

Browse files
committed
Adding testing and fixes for android
1 parent 77a218a commit 4f4fa65

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

example/lib/main.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ class _MyAppState extends State<MyApp>
4040
// NOTE: Replace with your own app ID from https://www.onesignal.com
4141
OneSignal.shared.initialize("77e32082-ea27-42e3-a898-c72e141824ef");
4242

43+
// AndroidOnly stat only
44+
// OneSignal.Notifications.removeNotification(1);
45+
// OneSignal.Notifications.removeGroupedNotifications("group5");
46+
47+
OneSignal.Notifications.clearAll();
48+
4349
OneSignal.User.pushSubscription.addObserver(this);
4450
OneSignal.Notifications.addPermssionObserver(this);
4551

@@ -194,10 +200,12 @@ class _MyAppState extends State<MyApp>
194200
print("Setting external user ID");
195201
if (_externalUserId == null) return;
196202
OneSignal.shared.login(_externalUserId!);
203+
OneSignal.User.addAlias("fb_id", "1341524");
197204
}
198205

199206
void _handleLogout() {
200207
OneSignal.shared.logout();
208+
OneSignal.User.removeAlias("fb_id");
201209
}
202210

203211
oneSignalInAppMessagingTriggerExamples() async {

ios/Classes/OneSignalPlugin.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
5858

5959
// TODO version
6060
[OneSignal setMSDKType:@"flutter"];
61-
61+
[OneSignal sdkVersion: @"050000"];
62+
6263
OneSignalPlugin.sharedInstance.channel = [FlutterMethodChannel
6364
methodChannelWithName:@"OneSignal"
6465
binaryMessenger:[registrar messenger]];

lib/src/notifications.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class OneSignalNotifications {
4848
/// Removes a grouped notification.
4949
Future<void> removeGroupedNotifications(String notificationGroup) async {
5050
if (Platform.isAndroid) {
51-
return await _channel.invokeMethod("OneSignal#removeGroupedNotification",
51+
return await _channel.invokeMethod("OneSignal#removeGroupedNotifications",
5252
{'notificationGroup': notificationGroup});
5353
}
5454
}

lib/src/user.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ class OneSignalUser {
3333
///
3434
/// If any alias already exists, it will be overwritten to the new values.
3535
Future<void> addAliases(Map<String, dynamic> aliases) async {
36-
return await _channel.invokeMethod("OneSignal#addAlias", aliases);
36+
return await _channel.invokeMethod("OneSignal#addAliases", aliases);
3737
}
3838

3939
/// Remove an [alias] from the current user.
40-
Future<void> removeAlias(String alias, dynamic id) async {
41-
return await this.removeAliases({alias: id});
40+
Future<void> removeAlias(String label) async {
41+
return await this.removeAliases([label]);
4242
}
4343

4444
/// Remove [aliases] from the current user.
45-
Future<void> removeAliases(Map<String, dynamic> aliases) async {
45+
Future<void> removeAliases(List<String> aliases) async {
4646
return await _channel.invokeMethod("OneSignal#removeAliases", aliases);
4747
}
4848

0 commit comments

Comments
 (0)