@@ -133,22 +133,28 @@ + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {
133
133
134
134
RCT_EXPORT_METHOD (setPushToStartToken:(NSString *)activityType
135
135
withToken:(NSString *)token) {
136
- @autoreleasepool {
137
- NSError * err=nil ;
136
+ NSError * err=nil ;
137
+
138
+ if (@available (iOS 17.2 , *)) {
138
139
[OneSignalLiveActivitiesManagerImpl setPushToStartToken: activityType withToken: token error: &err];
139
140
if (err) {
140
141
[OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" activityType must be the name of your ActivityAttributes struct" ]];
141
142
}
143
+ } else {
144
+ [OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" cannot setPushToStartToken on iOS < 17.2" ]];
142
145
}
143
146
}
144
147
145
148
RCT_EXPORT_METHOD (removePushToStartToken:(NSString *)activityType) {
146
- @autoreleasepool {
147
- NSError * err=nil ;
149
+ NSError * err=nil ;
150
+
151
+ if (@available (iOS 17.2 , *)) {
148
152
[OneSignalLiveActivitiesManagerImpl removePushToStartToken: activityType error: &err];
149
153
if (err) {
150
154
[OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" activityType must be the name of your ActivityAttributes struct" ]];
151
155
}
156
+ } else {
157
+ [OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" cannot removePushToStartToken on iOS < 17.2" ]];
152
158
}
153
159
}
154
160
@@ -161,14 +167,22 @@ + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {
161
167
[laOptions setEnablePushToUpdate: [options[@" enablePushToUpdate" ] boolValue ]];
162
168
}
163
169
164
- [OneSignalLiveActivitiesManagerImpl setupDefaultWithOptions: laOptions];
170
+ if (@available (iOS 16.1 , *)) {
171
+ [OneSignalLiveActivitiesManagerImpl setupDefaultWithOptions: laOptions];
172
+ } else {
173
+ [OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" cannot setupDefault on iOS < 16.1" ]];
174
+ }
165
175
}
166
176
167
177
RCT_EXPORT_METHOD (startDefaultLiveActivity:(NSString *)activityId
168
178
withAttributes:(NSDictionary * _Nonnull)attributes
169
179
withContent:(NSDictionary * _Nonnull)content) {
170
180
171
- [OneSignalLiveActivitiesManagerImpl startDefault: activityId attributes: attributes content: content];
181
+ if (@available (iOS 16.1 , *)) {
182
+ [OneSignalLiveActivitiesManagerImpl startDefault: activityId attributes: attributes content: content];
183
+ } else {
184
+ [OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" cannot startDefault on iOS < 16.1" ]];
185
+ }
172
186
}
173
187
174
188
RCT_EXPORT_METHOD (setPrivacyConsentGiven:(BOOL )granted) {
0 commit comments