Skip to content

Commit

Permalink
Ignore live activities code for mac catalyst
Browse files Browse the repository at this point in the history
  • Loading branch information
jennantilla committed Jul 2, 2024
1 parent 47faaad commit 60d5930
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ios/RCTOneSignal/RCTOneSignalEventEmitter.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {

RCT_EXPORT_METHOD(setPushToStartToken:(NSString *)activityType
withToken:(NSString *)token) {
#if !TARGET_OS_MACCATALYST
NSError* err=nil;

if (@available(iOS 17.2, *)) {
[OneSignalLiveActivitiesManagerImpl setPushToStartToken:activityType withToken:token error:&err];
if (err) {
Expand All @@ -143,11 +143,12 @@ + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {
} else {
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot setPushToStartToken on iOS < 17.2"]];
}
#endif
}

RCT_EXPORT_METHOD(removePushToStartToken:(NSString *)activityType) {
#if !TARGET_OS_MACCATALYST
NSError* err=nil;

if (@available(iOS 17.2, *)) {
[OneSignalLiveActivitiesManagerImpl removePushToStartToken:activityType error:&err];
if (err) {
Expand All @@ -156,11 +157,12 @@ + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {
} else {
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot removePushToStartToken on iOS < 17.2"]];
}
#endif
}

RCT_EXPORT_METHOD(setupDefaultLiveActivity:(NSDictionary * _Nullable)options) {
#if !TARGET_OS_MACCATALYST
LiveActivitySetupOptions *laOptions = nil;

if (options != nil) {
laOptions = [LiveActivitySetupOptions alloc];
[laOptions setEnablePushToStart:[options[@"enablePushToStart"] boolValue]];
Expand All @@ -172,17 +174,19 @@ + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {
} else {
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot setupDefault on iOS < 16.1"]];
}
#endif
}

RCT_EXPORT_METHOD(startDefaultLiveActivity:(NSString *)activityId
withAttributes:(NSDictionary * _Nonnull)attributes
withContent:(NSDictionary * _Nonnull)content) {

#if !TARGET_OS_MACCATALYST
if (@available(iOS 16.1, *)) {
[OneSignalLiveActivitiesManagerImpl startDefault:activityId attributes:attributes content:content];
} else {
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot startDefault on iOS < 16.1"]];
}
#endif
}

RCT_EXPORT_METHOD(setPrivacyConsentGiven:(BOOL)granted) {
Expand Down

0 comments on commit 60d5930

Please sign in to comment.