@@ -82,26 +82,34 @@ - (void)exitLiveActivity:(FlutterMethodCall *)call withResult:(FlutterResult)res
82
82
- (void )setPushToStartToken : (FlutterMethodCall *)call withResult : (FlutterResult)result {
83
83
NSString *activityType = call.arguments [@" activityType" ];
84
84
NSString *token = call.arguments [@" token" ];
85
+ NSError * err=nil ;
85
86
86
- @autoreleasepool {
87
- NSError * err=nil ;
87
+ if (@available (iOS 17.2 , *)) {
88
88
[OneSignalLiveActivitiesManagerImpl setPushToStartToken: activityType withToken: token error: &err];
89
89
if (err) {
90
90
[OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" activityType must be the name of your ActivityAttributes struct" ]];
91
91
}
92
+ } else {
93
+ [OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" cannot setPushToStartToken on iOS < 17.2" ]];
92
94
}
95
+
96
+ result (nil );
93
97
}
94
98
95
99
- (void )removePushToStartToken : (FlutterMethodCall *)call withResult : (FlutterResult)result {
96
100
NSString *activityType = call.arguments [@" activityType" ];
101
+ NSError * err=nil ;
97
102
98
- @autoreleasepool {
99
- NSError * err=nil ;
103
+ if (@available (iOS 17.2 , *)) {
100
104
[OneSignalLiveActivitiesManagerImpl removePushToStartToken: activityType error: &err];
101
105
if (err) {
102
106
[OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" activityType must be the name of your ActivityAttributes struct" ]];
103
107
}
108
+ } else {
109
+ [OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" cannot removePushToStartToken on iOS < 17.2" ]];
104
110
}
111
+
112
+ result (nil );
105
113
}
106
114
107
115
- (void )setupDefault : (FlutterMethodCall *)call withResult : (FlutterResult)result {
@@ -120,6 +128,8 @@ - (void)setupDefault:(FlutterMethodCall *)call withResult:(FlutterResult)result
120
128
} else {
121
129
[OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" cannot setupDefault on iOS < 16.1" ]];
122
130
}
131
+
132
+ result (nil );
123
133
}
124
134
125
135
- (void )startDefault : (FlutterMethodCall *)call withResult : (FlutterResult)result {
@@ -132,6 +142,8 @@ - (void)startDefault:(FlutterMethodCall *)call withResult:(FlutterResult)result
132
142
} else {
133
143
[OneSignalLog onesignalLog: ONE_S_LL_ERROR message: [NSString stringWithFormat: @" cannot startDefault on iOS < 16.1" ]];
134
144
}
145
+
146
+ result (nil );
135
147
}
136
148
137
149
@end
0 commit comments