diff --git a/Sources/mParticle-Appboy/MPKitAppboy.m b/Sources/mParticle-Appboy/MPKitAppboy.m index fd2f345..af631a1 100644 --- a/Sources/mParticle-Appboy/MPKitAppboy.m +++ b/Sources/mParticle-Appboy/MPKitAppboy.m @@ -1,20 +1,20 @@ #import "MPKitAppboy.h" #if SWIFT_PACKAGE - #if TARGET_OS_IOS == 1 + #ifdef TARGET_OS_IOS import BrazeKit import BrazeKitCompat import BrazeUI - #elif TARGET_OS_TV == 1 + #else import BrazeKit import BrazeKitCompat #endif #else - #if TARGET_OS_IOS == 1 + #ifdef TARGET_OS_IOS @import BrazeKit; @import BrazeKitCompat; @import BrazeUI; - #elif TARGET_OS_TV == 1 + #else @import BrazeKit; @import BrazeKitCompat; #endif @@ -51,7 +51,9 @@ // User Attribute key with reserved functionality for Braze kit static NSString *const brazeUserAttributeDob = @"dob"; +#ifdef TARGET_OS_IOS __weak static id inAppMessageControllerDelegate = nil; +#endif __weak static id urlDelegate = nil; @interface MPKitAppboy() { @@ -77,6 +79,7 @@ + (void)load { [MParticle registerExtension:kitRegister]; } +#ifdef TARGET_OS_IOS + (void)setInAppMessageControllerDelegate:(id)delegate { inAppMessageControllerDelegate = (id)delegate; } @@ -84,6 +87,7 @@ + (void)setInAppMessageControllerDelegate:(id)delegate { + (id)inAppMessageControllerDelegate { return inAppMessageControllerDelegate; } +#endif + (void)setURLDelegate:(id)delegate { urlDelegate = (id)delegate; @@ -254,7 +258,7 @@ - (MPKitExecStatus *)didFinishLaunchingWithConfiguration:(NSDictionary *)configu _host = configuration[hostConfigKey]; _enableTypeDetection = [configuration[enableTypeDetectionKey] boolValue]; - //If Braze is already initialize, immediately "start" the kit, this + //If Braze is already initialized, immediately "start" the kit, this //is here for: // 1. Apps that initialize Braze prior to mParticle, and/or // 2. Apps that initialize mParticle too late, causing the SDK to miss @@ -298,7 +302,7 @@ - (void)start { [self->appboyInstance setAdTrackingEnabled:[self isAdvertisingTrackingEnabled]]; } -#if TARGET_OS_IOS == 1 +#ifdef TARGET_OS_IOS if ([MPKitAppboy inAppMessageControllerDelegate]) { BrazeInAppMessageUI *inAppMessageUI = [[BrazeInAppMessageUI alloc] init]; inAppMessageUI.delegate = [MPKitAppboy inAppMessageControllerDelegate]; @@ -367,7 +371,7 @@ - (void)start { optionsDictionary[ABKSDKFlavorKey] = @(MPARTICLE); #pragma clang diagnostic pop -#if TARGET_OS_IOS == 1 +#ifdef TARGET_OS_IOS optionsDictionary[ABKEnableAutomaticLocationCollectionKey] = @(YES); if (self.configuration[@"ABKDisableAutomaticLocationCollectionKey"]) { if ([self.configuration[@"ABKDisableAutomaticLocationCollectionKey"] caseInsensitiveCompare:@"true"] == NSOrderedSame) { @@ -377,16 +381,6 @@ - (void)start { #pragma clang diagnostic pop } } -#elif TARGET_OS_TVOS == 1 - optionsDictionary[ABKDisableAutomaticLocationCollectionKey] = @(NO); - if (self.configuration[@"ABKDisableAutomaticLocationCollectionKey"]) { - if ([self.configuration[@"ABKDisableAutomaticLocationCollectionKey"] caseInsensitiveCompare:@"true"] == NSOrderedSame) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wincompatible-pointer-types" - optionsDictionary[ABKDisableAutomaticLocationCollectionKey] = @(YES); -#pragma clang diagnostic pop - } - } #endif if ([MPKitAppboy urlDelegate]) { @@ -498,7 +492,7 @@ - (MPKitExecStatus *)logScreen:(MPEvent *)event { - (MPKitExecStatus *)receivedUserNotification:(NSDictionary *)userInfo { MPKitExecStatus *execStatus = [[MPKitExecStatus alloc] initWithSDKCode:@(MPKitInstanceAppboy) returnCode:MPKitReturnCodeSuccess]; -#if TARGET_OS_IOS == 1 +#ifdef TARGET_OS_IOS if (![appboyInstance.notifications handleBackgroundNotificationWithUserInfo:userInfo fetchCompletionHandler:^(UIBackgroundFetchResult fetchResult) {}]) { execStatus = [[MPKitExecStatus alloc] initWithSDKCode:@(MPKitInstanceAppboy) returnCode:MPKitReturnCodeFail]; } @@ -515,7 +509,7 @@ - (MPKitExecStatus *)removeUserAttribute:(NSString *)key { } - (MPKitExecStatus *)setDeviceToken:(NSData *)deviceToken { -#if TARGET_OS_IOS == 1 +#ifdef TARGET_OS_IOS [appboyInstance.notifications registerDeviceToken:deviceToken]; #endif @@ -868,7 +862,7 @@ - (MPKitExecStatus *)setUserIdentity:(NSString *)identityString identityType:(MP return [[MPKitExecStatus alloc] initWithSDKCode:@(MPKitInstanceAppboy) returnCode:MPKitReturnCodeSuccess]; } -#if TARGET_OS_IOS == 1 && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 +#ifdef TARGET_OS_IOS - (nonnull MPKitExecStatus *)userNotificationCenter:(nonnull UNUserNotificationCenter *)center didReceiveNotificationResponse:(nonnull UNNotificationResponse *)response API_AVAILABLE(ios(10.0)) { MPKitExecStatus *execStatus = [[MPKitExecStatus alloc] initWithSDKCode:@(MPKitInstanceAppboy) returnCode:MPKitReturnCodeSuccess]; diff --git a/mParticle-Appboy.podspec b/mParticle-Appboy.podspec index a526a86..2dbdd3e 100755 --- a/mParticle-Appboy.podspec +++ b/mParticle-Appboy.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "mParticle-Appboy" - s.version = "8.0.16" + s.version = "8.1.0" s.summary = "Appboy integration for mParticle" s.description = <<-DESC @@ -12,8 +12,9 @@ Pod::Spec.new do |s| s.author = { "mParticle" => "support@mparticle.com" } s.source = { :git => "https://github.com/mparticle-integrations/mparticle-apple-integration-appboy.git", :tag => s.version.to_s } s.social_media_url = "https://twitter.com/mparticle" + s.static_framework = true - s.ios.deployment_target = "9.0" + s.ios.deployment_target = "11.0" s.ios.source_files = 'Sources/**/*.{h,m,mm}' s.ios.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.0' s.ios.frameworks = 'CoreTelephony', 'SystemConfiguration' @@ -21,20 +22,13 @@ Pod::Spec.new do |s| s.ios.dependency 'BrazeKit', '~> 5.9' s.ios.dependency 'BrazeKitCompat', '~> 5.9' s.ios.dependency 'BrazeUI', '~> 5.9' - - s.tvos.deployment_target = "9.0" - s.tvos.source_files = 'Sources/**/*.{h,m,mm}' - s.tvos.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.0' - s.tvos.frameworks = 'SystemConfiguration' - s.tvos.dependency 'BrazeKit', '~> 5.9' - s.tvos.dependency 'BrazeKitCompat', '~> 5.9' - s.tvos.pod_target_xcconfig = { - 'EXCLUDED_ARCHS[sdk=appletvsimulator*]' => 'arm64' - } - s.tvos.user_target_xcconfig = { - 'EXCLUDED_ARCHS[sdk=appletvsimulator*]' => 'arm64' - } +# s.tvos.deployment_target = "11.0" +# s.tvos.source_files = 'Sources/**/*.{h,m,mm}' +# s.tvos.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.0' +# s.tvos.frameworks = 'SystemConfiguration' +# s.tvos.dependency 'BrazeKit', '~> 5.9' +# s.tvos.dependency 'BrazeKitCompat', '~> 5.9' end