@@ -6,49 +6,38 @@ class OneSignalLiveActivities {
6
6
// private channels used to bridge to ObjC/Java
7
7
MethodChannel _channel = const MethodChannel ('OneSignal#liveactivities' );
8
8
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.
17
13
Future <void > enterLiveActivity (String activityId, String token) async {
18
14
if (Platform .isIOS) {
19
15
return await _channel.invokeMethod ("OneSignal#enterLiveActivity" ,
20
16
{'activityId' : activityId, 'token' : token});
21
17
}
22
18
}
23
19
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.
31
23
Future <void > exitLiveActivity (String activityId) async {
32
24
if (Platform .isIOS) {
33
25
return await _channel.invokeMethod (
34
26
"OneSignal#exitLiveActivity" , {'activityId' : activityId});
35
27
}
36
28
}
37
29
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.
52
41
Future <void > setupDefault ({LiveActivitySetupOptions ? options= null }) async {
53
42
if (Platform .isIOS) {
54
43
dynamic optionsMap = null ;
@@ -65,53 +54,37 @@ class OneSignalLiveActivities {
65
54
}
66
55
}
67
56
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.
80
63
Future <void > startDefault (String activityId, dynamic attributes, dynamic content) async {
81
64
if (Platform .isIOS) {
82
65
return await _channel.invokeMethod (
83
66
"OneSignal#startDefault" , { 'activityId' : activityId, 'attributes' : attributes, 'content' : content });
84
67
}
85
68
}
86
69
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.
98
76
Future <void > setPushToStartToken (String activityType, String token) async {
99
77
if (Platform .isIOS) {
100
78
return await _channel.invokeMethod ("OneSignal#setPushToStartToken" ,
101
79
{'activityType' : activityType, 'token' : token});
102
80
}
103
81
}
104
82
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.
115
88
Future <void > removePushToStartToken (String activityType) async {
116
89
if (Platform .isIOS) {
117
90
return await _channel.invokeMethod (
@@ -120,9 +93,7 @@ class OneSignalLiveActivities {
120
93
}
121
94
}
122
95
123
- /**
124
- * The setup options for `OneSignal.LiveActivities.setupDefault` .
125
- */
96
+ /// The setup options for [OneSignal.LiveActivities.setupDefault] .
126
97
class LiveActivitySetupOptions {
127
98
bool _enablePushToStart = true ;
128
99
bool _enablePushToUpdate = true ;
@@ -132,16 +103,12 @@ class LiveActivitySetupOptions {
132
103
this ._enablePushToUpdate = enablePushToUpdate;
133
104
}
134
105
135
- /**
136
- * When true, OneSignal will listen for pushToStart tokens.
137
- */
106
+ /// When true, OneSignal will listen for pushToStart tokens.
138
107
bool get enablePushToStart {
139
108
return this ._enablePushToStart;
140
109
}
141
110
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.
145
112
bool get enablePushToUpdate {
146
113
return this ._enablePushToUpdate;
147
114
}
0 commit comments