@@ -23,7 +23,6 @@ class OneSignal {
23
23
/// Note that the iOS and Android native libraries are static,
24
24
/// so if you create multiple instances of OneSignal, they will
25
25
/// mostly share the same state.
26
- static OneSignal shared = new OneSignal ();
27
26
static OneSignalDebug Debug = new OneSignalDebug ();
28
27
static OneSignalUser User = new OneSignalUser ();
29
28
static OneSignalNotifications Notifications = new OneSignalNotifications ();
@@ -33,13 +32,13 @@ class OneSignal {
33
32
static OneSignalLiveActivities LiveActivities = new OneSignalLiveActivities ();
34
33
35
34
// private channels used to bridge to ObjC/Java
36
- MethodChannel _channel = const MethodChannel ('OneSignal' );
35
+ static MethodChannel _channel = const MethodChannel ('OneSignal' );
37
36
38
37
/// The initializer for OneSignal.
39
38
///
40
39
/// The initializer accepts an [appId] which the developer can get
41
40
/// from the OneSignal consoleas well as a dictonary of [launchOptions]
42
- void initialize (String appId) {
41
+ static void initialize (String appId) {
43
42
_channel.invokeMethod ('OneSignal#initialize' , {'appId' : appId});
44
43
InAppMessages .lifecycleInit ();
45
44
User .pushSubscription.lifecycleInit ();
@@ -50,7 +49,7 @@ class OneSignal {
50
49
///
51
50
/// The act of logging a user into the OneSignal SDK will switch the
52
51
/// user context to that specific user.
53
- Future <void > login (String externalId) async {
52
+ static Future <void > login (String externalId) async {
54
53
return await _channel
55
54
.invokeMethod ('OneSignal#login' , {'externalId' : externalId});
56
55
}
@@ -59,7 +58,7 @@ class OneSignal {
59
58
///
60
59
/// The act of logging a user into the OneSignal SDK will switch the
61
60
/// 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 {
63
62
if (Platform .isAndroid) {
64
63
return await _channel.invokeMethod (
65
64
'OneSignal#loginWithJWT' , {'externalId' : externalId, 'jwt' : jwt});
@@ -71,23 +70,23 @@ class OneSignal {
71
70
/// references a new device-scoped user. A device-scoped user has no user identity
72
71
/// that can later be retrieved, except through this device as long as the app
73
72
/// remains installed and the app data is not cleared.
74
- Future <void > logout () async {
73
+ static Future <void > logout () async {
75
74
return await _channel.invokeMethod ('OneSignal#logout' );
76
75
}
77
76
78
77
/// Sets the whether or not privacy consent has been [granted]
79
78
///
80
79
/// This field is only relevant when the application has
81
80
/// opted into data privacy protections. See [consentRequired] .
82
- Future <void > consentGiven (bool granted) async {
81
+ static Future <void > consentGiven (bool granted) async {
83
82
return await _channel
84
83
.invokeMethod ("OneSignal#consentGiven" , {'granted' : granted});
85
84
}
86
85
87
86
/// Allows you to completely disable the SDK until your app calls the
88
87
/// OneSignal.consentGiven(true) function. This is useful if you want
89
88
/// 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 {
91
90
return await _channel
92
91
.invokeMethod ("OneSignal#consentRequired" , {'required' : require});
93
92
}
@@ -96,7 +95,7 @@ class OneSignal {
96
95
/// within the application. Set to true to launch all notifications with a URL
97
96
/// in the app instead of the default web browser. Make sure to call setLaunchURLsInApp
98
97
/// before the initialize call.
99
- Future <void > setLaunchURLsInApp (bool launchUrlsInApp) async {
98
+ static Future <void > setLaunchURLsInApp (bool launchUrlsInApp) async {
100
99
if (Platform .isIOS) {
101
100
return await _channel.invokeMethod (
102
101
'OneSignal#setLaunchURLsInApp' , {'launchUrlsInApp' : launchUrlsInApp});
0 commit comments