@@ -23,7 +23,6 @@ class OneSignal {
2323 /// Note that the iOS and Android native libraries are static,
2424 /// so if you create multiple instances of OneSignal, they will
2525 /// mostly share the same state.
26- static OneSignal shared = new OneSignal ();
2726 static OneSignalDebug Debug = new OneSignalDebug ();
2827 static OneSignalUser User = new OneSignalUser ();
2928 static OneSignalNotifications Notifications = new OneSignalNotifications ();
@@ -33,13 +32,13 @@ class OneSignal {
3332 static OneSignalLiveActivities LiveActivities = new OneSignalLiveActivities ();
3433
3534 // private channels used to bridge to ObjC/Java
36- MethodChannel _channel = const MethodChannel ('OneSignal' );
35+ static MethodChannel _channel = const MethodChannel ('OneSignal' );
3736
3837 /// The initializer for OneSignal.
3938 ///
4039 /// The initializer accepts an [appId] which the developer can get
4140 /// from the OneSignal consoleas well as a dictonary of [launchOptions]
42- void initialize (String appId) {
41+ static void initialize (String appId) {
4342 _channel.invokeMethod ('OneSignal#initialize' , {'appId' : appId});
4443 InAppMessages .lifecycleInit ();
4544 User .pushSubscription.lifecycleInit ();
@@ -50,7 +49,7 @@ class OneSignal {
5049 ///
5150 /// The act of logging a user into the OneSignal SDK will switch the
5251 /// user context to that specific user.
53- Future <void > login (String externalId) async {
52+ static Future <void > login (String externalId) async {
5453 return await _channel
5554 .invokeMethod ('OneSignal#login' , {'externalId' : externalId});
5655 }
@@ -59,7 +58,7 @@ class OneSignal {
5958 ///
6059 /// The act of logging a user into the OneSignal SDK will switch the
6160 /// user context to that specific user.
62- Future <void > loginWithJWT (String externalId, String jwt) async {
61+ static Future <void > loginWithJWT (String externalId, String jwt) async {
6362 if (Platform .isAndroid) {
6463 return await _channel.invokeMethod (
6564 'OneSignal#loginWithJWT' , {'externalId' : externalId, 'jwt' : jwt});
@@ -71,23 +70,23 @@ class OneSignal {
7170 /// references a new device-scoped user. A device-scoped user has no user identity
7271 /// that can later be retrieved, except through this device as long as the app
7372 /// remains installed and the app data is not cleared.
74- Future <void > logout () async {
73+ static Future <void > logout () async {
7574 return await _channel.invokeMethod ('OneSignal#logout' );
7675 }
7776
7877 /// Sets the whether or not privacy consent has been [granted]
7978 ///
8079 /// This field is only relevant when the application has
8180 /// opted into data privacy protections. See [consentRequired] .
82- Future <void > consentGiven (bool granted) async {
81+ static Future <void > consentGiven (bool granted) async {
8382 return await _channel
8483 .invokeMethod ("OneSignal#consentGiven" , {'granted' : granted});
8584 }
8685
8786 /// Allows you to completely disable the SDK until your app calls the
8887 /// OneSignal.consentGiven(true) function. This is useful if you want
8988 /// to show a Terms and Conditions or privacy popup for GDPR.
90- Future <void > consentRequired (bool require) async {
89+ static Future <void > consentRequired (bool require) async {
9190 return await _channel
9291 .invokeMethod ("OneSignal#consentRequired" , {'required' : require});
9392 }
@@ -96,7 +95,7 @@ class OneSignal {
9695 /// within the application. Set to true to launch all notifications with a URL
9796 /// in the app instead of the default web browser. Make sure to call setLaunchURLsInApp
9897 /// before the initialize call.
99- Future <void > setLaunchURLsInApp (bool launchUrlsInApp) async {
98+ static Future <void > setLaunchURLsInApp (bool launchUrlsInApp) async {
10099 if (Platform .isIOS) {
101100 return await _channel.invokeMethod (
102101 'OneSignal#setLaunchURLsInApp' , {'launchUrlsInApp' : launchUrlsInApp});
0 commit comments