From 60d59301f614816f47976754870e53d3c121def6 Mon Sep 17 00:00:00 2001 From: Jenna Antilla <46546946+jennantilla@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:02:25 -0700 Subject: [PATCH] Ignore live activities code for mac catalyst --- ios/RCTOneSignal/RCTOneSignalEventEmitter.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ios/RCTOneSignal/RCTOneSignalEventEmitter.m b/ios/RCTOneSignal/RCTOneSignalEventEmitter.m index 4221cea4..536f5d89 100644 --- a/ios/RCTOneSignal/RCTOneSignalEventEmitter.m +++ b/ios/RCTOneSignal/RCTOneSignalEventEmitter.m @@ -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) { @@ -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) { @@ -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]]; @@ -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) {