@@ -6,49 +6,38 @@ class OneSignalLiveActivities {
66 // private channels used to bridge to ObjC/Java
77 MethodChannel _channel = const MethodChannel ('OneSignal#liveactivities' );
88
9- /**
10- * Indicate this device has exited a live activity, identified within OneSignal by the `activityId` .
11- *
12- * Only applies to iOS
13- *
14- * @param activityId: The activity identifier the live activity on this device will receive updates for.
15- * @param token: The activity's update token to receive the updates.
16- **/
9+ /// Indicate this device has exited a live activity, identified within OneSignal by the [activityId] . The
10+ /// [token] is the ActivityKit's update token that will be used to update the live activity.
11+ ///
12+ /// Only applies to iOS.
1713 Future <void > enterLiveActivity (String activityId, String token) async {
1814 if (Platform .isIOS) {
1915 return await _channel.invokeMethod ("OneSignal#enterLiveActivity" ,
2016 {'activityId' : activityId, 'token' : token});
2117 }
2218 }
2319
24- /**
25- * Indicate this device has exited a live activity, identified within OneSignal by the `activityId` .
26- *
27- * Only applies to iOS
28- *
29- * @param activityId: The activity identifier the live activity on this device will no longer receive updates for.
30- **/
20+ /// Indicate this device has exited a live activity, identified within OneSignal by the [activityId] .
21+ ///
22+ /// Only applies to iOS.
3123 Future <void > exitLiveActivity (String activityId) async {
3224 if (Platform .isIOS) {
3325 return await _channel.invokeMethod (
3426 "OneSignal#exitLiveActivity" , {'activityId' : activityId});
3527 }
3628 }
3729
38- /**
39- * Enable the OneSignalSDK to setup the default`DefaultLiveActivityAttributes` structure,
40- * which conforms to the `OneSignalLiveActivityAttributes` . When using this function, the
41- * widget attributes are owned by the OneSignal SDK, which will allow the SDK to handle the
42- * entire lifecycle of the live activity. All that is needed from an app-perspective is to
43- * create a Live Activity widget in a widget extension, with a `ActivityConfiguration` for
44- * `DefaultLiveActivityAttributes` . This is most useful for users that (1) only have one Live
45- * Activity widget and (2) are using a cross-platform framework and do not want to create the
46- * cross-platform <-> iOS native bindings to manage ActivityKit.
47- *
48- * Only applies to iOS
49- *
50- * @param options: An optional structure to provide for more granular setup options.
51- */
30+ /// Enable the OneSignalSDK to setup the default`DefaultLiveActivityAttributes` structure,
31+ /// which conforms to the `OneSignalLiveActivityAttributes` . When using this function, the
32+ /// widget attributes are owned by the OneSignal SDK, which will allow the SDK to handle the
33+ /// entire lifecycle of the live activity. All that is needed from an app-perspective is to
34+ /// create a Live Activity widget in a widget extension, with a `ActivityConfiguration` for
35+ /// `DefaultLiveActivityAttributes` . This is most useful for users that (1) only have one Live
36+ /// Activity widget and (2) are using a cross-platform framework and do not want to create the
37+ /// cross-platform <-> iOS native bindings to manage ActivityKit. An optional [options]
38+ /// parameter can be provided for more granular setup options.
39+ ///
40+ /// Only applies to iOS.
5241 Future <void > setupDefault ({LiveActivitySetupOptions ? options= null }) async {
5342 if (Platform .isIOS) {
5443 dynamic optionsMap = null ;
@@ -65,53 +54,37 @@ class OneSignalLiveActivities {
6554 }
6655 }
6756
68- /**
69- * Start a new LiveActivity that is modelled by the default`DefaultLiveActivityAttributes`
70- * structure. The `DefaultLiveActivityAttributes` is initialized with the dynamic `attributes`
71- * and `content` passed in.
72- *
73- * Only applies to iOS
74- *
75- * @param activityId: The activity identifier the live activity on this device will be started
76- * and eligible to receive updates for.
77- * @param attributes: A dynamic type containing the static attributes passed into `DefaultLiveActivityAttributes` .
78- * @param content: A dynamic type containing the content attributes passed into `DefaultLiveActivityAttributes` .
79- */
57+ /// Start a new LiveActivity that is modelled by the default`DefaultLiveActivityAttributes`
58+ /// structure. The `DefaultLiveActivityAttributes` is initialized with the dynamic [attributes]
59+ /// and [content] passed in. The live activity started can be updated with the [activityId]
60+ /// provided.
61+ ///
62+ /// Only applies to iOS.
8063 Future <void > startDefault (String activityId, dynamic attributes, dynamic content) async {
8164 if (Platform .isIOS) {
8265 return await _channel.invokeMethod (
8366 "OneSignal#startDefault" , { 'activityId' : activityId, 'attributes' : attributes, 'content' : content });
8467 }
8568 }
8669
87- /**
88- * Indicate this device is capable of receiving pushToStart live activities for the
89- * `activityType` . The `activityType` **must** be the name of the struct conforming
90- * to `ActivityAttributes` that will be used to start the live activity.
91- *
92- * Only applies to iOS
93- *
94- * @param activityType: The name of the specific `ActivityAttributes` structure tied
95- * to the live activity.
96- * @param token: The activity type's pushToStart token.
97- */
70+ /// Indicate this device is capable of receiving pushToStart live activities for the
71+ /// [activityType] . The [activityType] **must** be the name of the struct conforming
72+ /// to `ActivityAttributes` that will be used to start the live activity. The [token]
73+ /// is ActivityKit's pushToStart token that will be used to start the live activity.
74+ ///
75+ /// Only applies to iOS.
9876 Future <void > setPushToStartToken (String activityType, String token) async {
9977 if (Platform .isIOS) {
10078 return await _channel.invokeMethod ("OneSignal#setPushToStartToken" ,
10179 {'activityType' : activityType, 'token' : token});
10280 }
10381 }
10482
105- /**
106- * Indicate this device is no longer capable of receiving pushToStart live activities
107- * for the `activityType` . The `activityType` **must** be the name of the struct conforming
108- * to `ActivityAttributes` that will be used to start the live activity.
109- *
110- * Only applies to iOS
111- *
112- * @param activityType: The name of the specific `ActivityAttributes` structure tied
113- * to the live activity.
114- */
83+ /// Indicate this device is no longer capable of receiving pushToStart live activities
84+ /// for the [activityType] . The [activityType] **must** be the name of the struct conforming
85+ /// to `ActivityAttributes` that will be used to start the live activity.
86+ ///
87+ /// Only applies to iOS.
11588 Future <void > removePushToStartToken (String activityType) async {
11689 if (Platform .isIOS) {
11790 return await _channel.invokeMethod (
@@ -120,9 +93,7 @@ class OneSignalLiveActivities {
12093 }
12194}
12295
123- /**
124- * The setup options for `OneSignal.LiveActivities.setupDefault` .
125- */
96+ /// The setup options for [OneSignal.LiveActivities.setupDefault] .
12697class LiveActivitySetupOptions {
12798 bool _enablePushToStart = true ;
12899 bool _enablePushToUpdate = true ;
@@ -132,16 +103,12 @@ class LiveActivitySetupOptions {
132103 this ._enablePushToUpdate = enablePushToUpdate;
133104 }
134105
135- /**
136- * When true, OneSignal will listen for pushToStart tokens.
137- */
106+ /// When true, OneSignal will listen for pushToStart tokens.
138107 bool get enablePushToStart {
139108 return this ._enablePushToStart;
140109 }
141110
142- /**
143- * When true, OneSignal will listen for pushToUpdate tokens for each started live activity.
144- */
111+ /// When true, OneSignal will listen for pushToUpdate tokens for each started live activity.
145112 bool get enablePushToUpdate {
146113 return this ._enablePushToUpdate;
147114 }
0 commit comments