@@ -69,8 +69,6 @@ class _MyAppState extends State<MyApp> with OneSignalPushSubscriptionObserver {
69
69
});
70
70
});
71
71
72
- OneSignal .InAppMessages .paused (false );
73
-
74
72
OneSignal .InAppMessages
75
73
.setInAppMessageClickedHandler ((OSInAppMessageAction action) {
76
74
this .setState (() {
@@ -120,19 +118,6 @@ class _MyAppState extends State<MyApp> with OneSignalPushSubscriptionObserver {
120
118
print (stateChanges.jsonRepresentation ());
121
119
}
122
120
123
- void _handleGetTags () {
124
- // OneSignal.shared.getTags().then((tags) {
125
- // if (tags == null) return;
126
-
127
- // setState((() {
128
- // _debugLabelString = "$tags";
129
- // }));
130
- // }).catchError((error) {
131
- // setState(() {
132
- // _debugLabelString = "$error";
133
- // });
134
- // });
135
- }
136
121
137
122
void _handleSendTags () {
138
123
print ("Sending tags" );
@@ -143,6 +128,14 @@ class _MyAppState extends State<MyApp> with OneSignalPushSubscriptionObserver {
143
128
OneSignal .User .addTags (sendTags);
144
129
}
145
130
131
+ void _handleRemoveTag () {
132
+ print ("Deleting tag" );
133
+ OneSignal .User .removeTag ("test2" );
134
+
135
+ print ("Deleting tags array" );
136
+ OneSignal .User .removeTags (['test' ]);
137
+ }
138
+
146
139
void _handlePromptForPushPermission () {
147
140
print ("Prompting for Permission" );
148
141
OneSignal .Notifications .requestPermission (true );
@@ -208,13 +201,7 @@ class _MyAppState extends State<MyApp> with OneSignalPushSubscriptionObserver {
208
201
OneSignal .Location .setShared (true );
209
202
}
210
203
211
- void _handleRemoveTag () {
212
- print ("Deleting tag" );
213
- OneSignal .User .removeTag ("test2" );
214
-
215
- print ("Deleting tags array" );
216
- OneSignal .User .removeTags (['test' ]);
217
- }
204
+
218
205
219
206
void _handleSetExternalUserId () {
220
207
print ("Setting external user ID" );
@@ -287,33 +274,35 @@ class _MyAppState extends State<MyApp> with OneSignalPushSubscriptionObserver {
287
274
}
288
275
289
276
oneSignalInAppMessagingTriggerExamples () async {
290
- // /// Example addTrigger call for IAM
291
- // /// This will add 1 trigger so if there are any IAM satisfying it, it
292
- // /// will be shown to the user
293
- // OneSignal.shared.addTrigger("trigger_1", "one");
294
-
295
- // /// Example addTriggers call for IAM
296
- // /// This will add 2 triggers so if there are any IAM satisfying these, they
297
- // /// will be shown to the user
298
- // Map<String, Object> triggers = new Map<String, Object>();
299
- // triggers["trigger_2"] = "two";
300
- // triggers["trigger_3"] = "three";
301
- // OneSignal.shared.addTriggers(triggers);
302
-
303
- // // Removes a trigger by its key so if any future IAM are pulled with
304
- // // these triggers they will not be shown until the trigger is added back
305
- // OneSignal.shared.removeTriggerForKey("trigger_2");
306
-
307
- // // Get the value for a trigger by its key
308
- // Object? triggerValue = await OneSignal.shared.getTriggerValueForKey("trigger_3");
309
- // print("'trigger_3' key trigger value: ${triggerValue?.toString()}");
310
-
311
- // // Create a list and bulk remove triggers based on keys supplied
312
- // List<String> keys = ["trigger_1", "trigger_3"];
313
- // OneSignal.shared.removeTriggersForKeys(keys);
314
-
315
- // // Toggle pausing (displaying or not) of IAMs
316
- // OneSignal.shared.pauseInAppMessages(false);
277
+ /// Example addTrigger call for IAM
278
+ /// This will add 1 trigger so if there are any IAM satisfying it, it
279
+ /// will be shown to the user
280
+ OneSignal .InAppMessages .addTrigger ("trigger_1" , "one" );
281
+
282
+ /// Example addTriggers call for IAM
283
+ /// This will add 2 triggers so if there are any IAM satisfying these, they
284
+ /// will be shown to the user
285
+ Map <String , Object > triggers = new Map <String , Object >();
286
+ triggers["trigger_2" ] = "two" ;
287
+ triggers["trigger_3" ] = "three" ;
288
+ OneSignal .InAppMessages .addTriggers (triggers);
289
+
290
+ // Removes a trigger by its key so if any future IAM are pulled with
291
+ // these triggers they will not be shown until the trigger is added back
292
+ OneSignal .InAppMessages .removeTrigger ("trigger_2" );
293
+
294
+
295
+ // Create a list and bulk remove triggers based on keys supplied
296
+ List <String > keys = ["trigger_1" , "trigger_3" ];
297
+ OneSignal .InAppMessages .removeTriggers (keys);
298
+
299
+ OneSignal .InAppMessages .clearTriggers ();
300
+
301
+ // Toggle pausing (displaying or not) of IAMs
302
+ OneSignal .InAppMessages .paused (false );
303
+ var arePaused = await OneSignal .InAppMessages .arePaused ();
304
+ print ('Notifications paused ${arePaused }' );
305
+
317
306
}
318
307
319
308
oneSignalOutcomeExamples () async {
0 commit comments