Skip to content

Commit c636009

Browse files
committed
update listener logs
1 parent d53ed41 commit c636009

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ private void init(Context context, BinaryMessenger messenger) {
2929
channel = new MethodChannel(messenger, "OneSignal");
3030
channel.setMethodCallHandler(this);
3131

32-
channel = new MethodChannel(messenger, "OneSignal");
33-
channel.setMethodCallHandler(this);
34-
3532
OneSignalDebug.registerWith(messenger);
3633
OneSignalLocation.registerWith(messenger);
3734
OneSignalSession.registerWith(messenger);
@@ -96,6 +93,11 @@ private void setConsentGiven(MethodCall call, Result reply) {
9693
replySuccess(reply, null);
9794
}
9895

96+
private void login(MethodCall call, Result result) {
97+
OneSignal.login((String) call.argument("externalId"));
98+
replySuccess(result, null);
99+
}
100+
99101
private void loginWithJWT(MethodCall call, Result result) {
100102
OneSignal.login((String) call.argument("externalId"), (String) call.argument("jwt"));
101103
replySuccess(result, null);

example/lib/main.dart

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,13 @@ class _MyAppState extends State<MyApp> {
6666
});
6767

6868
OneSignal.Notifications.addClickListener((event) {
69-
print('NOTIFICATION CLICK LISTENER CALLED WITH EVENT: $event');
70-
this.setState(() {
71-
_debugLabelString =
72-
"Clicked notification: \n${event.notification.jsonRepresentation().replaceAll("\\n", "\n")}";
73-
});
69+
print(
70+
'NOTIFICATION CLICK LISTENER CALLED WITH EVENT: ${event.notification.title}');
7471
});
7572

7673
OneSignal.Notifications.addForegroundWillDisplayListener((event) {
77-
print("YO222222!");
78-
// print(
79-
// 'NOTIFICATION WILL DISPLAY LISTENER CALLED WITH: ${event.notification.jsonRepresentation()}');
74+
print(
75+
'NOTIFICATION WILL DISPLAY LISTENER CALLED WITH: ${event.notification.title}');
8076

8177
/// Display Notification, preventDefault to not display
8278
event.preventDefault();

0 commit comments

Comments
 (0)