Skip to content

Commit da4a412

Browse files
committed
Remove cold start handling from Android
* Cold start handling is being done by native Android implementation
1 parent 4bef2a0 commit da4a412

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ public class OneSignalPlugin
4343
OneSignal.OSNotificationWillShowInForegroundHandler {
4444

4545
/** Plugin registration. */
46-
private OSNotificationOpenedResult coldStartNotificationResult;
4746
private OSInAppMessageAction inAppMessageClickedResult;
48-
private boolean hasSetNotificationOpenedHandler = false;
4947
private boolean hasSetInAppMessageClickedHandler = false;
5048
private boolean hasSetNotificationWillShowInForegroundHandler = false;
5149
private boolean hasSetRequiresPrivacyConsent = false;
@@ -157,7 +155,6 @@ private void addObservers() {
157155
OneSignal.addEmailSubscriptionObserver(this);
158156
OneSignal.addPermissionObserver(this);
159157
OneSignal.setNotificationWillShowInForegroundHandler(this);
160-
OneSignal.setNotificationOpenedHandler(this);
161158
}
162159

163160
private void setLogLevel(MethodCall call, Result reply) {
@@ -337,11 +334,7 @@ public void onFailure(OneSignal.ExternalIdError error) {
337334
}
338335

339336
private void initNotificationOpenedHandlerParams() {
340-
this.hasSetNotificationOpenedHandler = true;
341-
if (this.coldStartNotificationResult != null) {
342-
this.notificationOpened(this.coldStartNotificationResult);
343-
this.coldStartNotificationResult = null;
344-
}
337+
OneSignal.setNotificationOpenedHandler(this);
345338
}
346339

347340
private void initInAppMessageClickedHandlerParams() {
@@ -403,11 +396,6 @@ public void onOSPermissionChanged(OSPermissionStateChanges stateChanges) {
403396

404397
@Override
405398
public void notificationOpened(OSNotificationOpenedResult result) {
406-
if (!this.hasSetNotificationOpenedHandler) {
407-
this.coldStartNotificationResult = result;
408-
return;
409-
}
410-
411399
try {
412400
invokeMethodOnUiThread("OneSignal#handleOpenedNotification", OneSignalSerializer.convertNotificationOpenResultToMap(result));
413401
} catch (JSONException e) {

0 commit comments

Comments
 (0)