OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
623 stars 213 forks source link

[Bug]:On Android lifecycleInit() never complete a Future. #937

Open victorvhpg opened 3 months ago

victorvhpg commented 3 months ago

What happened?

In Android all lifecycleInit method don't complete the Future, java needs a result like iOS do.

iOS https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/7e921f0b0d34745963464b51979c89466fb2b715/ios/Classes/OSFlutterNotifications.m#L106

- (void)lifecycleInit:(FlutterMethodCall *)call withResult:(FlutterResult)result {
    [OneSignal.Notifications addForegroundLifecycleListener:self];
    [OneSignal.Notifications addPermissionObserver:self];
    result(nil);
}

Android https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/7e921f0b0d34745963464b51979c89466fb2b715/android/src/main/java/com/onesignal/flutter/OneSignalNotifications.java#L195

    private void lifecycleInit() {
        OneSignal.getNotifications().addForegroundLifecycleListener(this);
        OneSignal.getNotifications().addPermissionObserver(this);
    }

Steps to reproduce?

this Future never completes on Android      
 await OneSignal.Notifications.lifecycleInit();

What did you expect to happen?

complete the Future

OneSignal Flutter SDK version

Release 5.2.3

Which platform(s) are affected?

Relevant log output

No response

Code of Conduct

jennantilla commented 3 months ago

@victorvhpg thanks for reaching out! We'll look into this.