From fe5a3440d9a35c81ffccda3915b16c6d7887cd68 Mon Sep 17 00:00:00 2001 From: Brandon Stalnaker Date: Wed, 8 May 2024 09:17:34 -0400 Subject: [PATCH] feat: Update to Partner Version 18.2 and add Privacy Manifest --- Package.swift | 3 +- mParticle-UrbanAirship.podspec | 3 +- mParticle-UrbanAirship/MPKitUrbanAirship.m | 38 +++++++++++++------- mParticle-UrbanAirship/PrivacyInfo.xcprivacy | 14 ++++++++ 4 files changed, 43 insertions(+), 15 deletions(-) create mode 100644 mParticle-UrbanAirship/PrivacyInfo.xcprivacy diff --git a/Package.swift b/Package.swift index 27afbeb..1e3e400 100644 --- a/Package.swift +++ b/Package.swift @@ -15,7 +15,7 @@ let package = Package( .upToNextMajor(from: "8.0.0")), .package(name: "Airship", url: "https://github.com/urbanairship/ios-library", - .upToNextMajor(from: "16.7.0")), + .upToNextMajor(from: "18.2.0")), ], targets: [ .target( @@ -25,6 +25,7 @@ let package = Package( .product(name: "AirshipCore", package: "Airship"), ], path: "mParticle-UrbanAirship", + resources: [.process("PrivacyInfo.xcprivacy")], publicHeadersPath: "."), ] ) diff --git a/mParticle-UrbanAirship.podspec b/mParticle-UrbanAirship.podspec index d4bdd98..80bbfed 100755 --- a/mParticle-UrbanAirship.podspec +++ b/mParticle-UrbanAirship.podspec @@ -15,7 +15,8 @@ Pod::Spec.new do |s| s.ios.deployment_target = "14.0" s.ios.source_files = 'mParticle-UrbanAirship/*.{h,m,mm}' + s.ios.resource_bundles = { 'mParticle-Localytics-Privacy' => ['mParticle-Localytics/PrivacyInfo.xcprivacy'] } s.ios.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.0' - s.ios.dependency 'Airship', '~> 17.7' + s.ios.dependency 'Airship', '~> 18.2' end diff --git a/mParticle-UrbanAirship/MPKitUrbanAirship.m b/mParticle-UrbanAirship/MPKitUrbanAirship.m index 7c86321..721adc1 100755 --- a/mParticle-UrbanAirship/MPKitUrbanAirship.m +++ b/mParticle-UrbanAirship/MPKitUrbanAirship.m @@ -160,7 +160,6 @@ - (void)start { [UAirship takeOff:config launchOptions:_launchOptions]; UAirship.push.userPushNotificationsEnabled = YES; - [[UAirship push] updateRegistration]; NSDictionary *userInfo = @{mParticleKitInstanceKey:[[self class] kitCode]}; @@ -171,7 +170,7 @@ - (void)start { [notificationCenter addObserver:self selector:@selector(updateChannelIntegration) - name:UAChannel.channelCreatedEvent + name:UAirshipNotificationChannelCreated.name object:nil]; [self updateChannelIntegration]; @@ -183,7 +182,8 @@ - (void)dealloc { } - (id const)providerKitInstance { - return [self started] ? [UAirship shared] : nil; + // Urban Airship no longer provides a shared instance. Instead their API's now all work as class methods on UAirship + return nil; } - (void)setConfiguration:(NSDictionary *)configuration { @@ -351,7 +351,9 @@ - (MPKitExecStatus *)setUserAttribute:(NSString *)key value:(NSString *)value { } if (uaTag) { - [[UAirship channel] addTag:uaTag]; + [UAirship.channel editTags:^(UATagEditor *editor) { + [editor addTag:uaTag]; + }]; returnCode = MPKitReturnCodeSuccess; } else { @@ -375,7 +377,9 @@ - (MPKitExecStatus *)setUserTag:(NSString *)tag { } if (uaTag) { - [[UAirship channel] addTag:uaTag]; + [UAirship.channel editTags:^(UATagEditor *editor) { + [editor addTag:uaTag]; + }]; returnCode = MPKitReturnCodeSuccess; } else { @@ -432,9 +436,9 @@ - (MPKitExecStatus *)setUserIdentity:(NSString *)identityString identityType:(MP - (MPKitExecStatus *)setOptOut:(BOOL)optOut { if(!optOut) { - [UAirship shared].privacyManager.enabledFeatures = UAFeaturesAll; + UAirship.privacyManager.enabledFeatures = UAFeaturesAll; } else { - [UAirship shared].privacyManager.enabledFeatures = UAFeaturesNone; + UAirship.privacyManager.enabledFeatures = UAFeaturesNone; } return [[MPKitExecStatus alloc] initWithSDKCode:[MPKitUrbanAirship kitCode] @@ -672,7 +676,9 @@ - (void)setTagMappings:(NSArray *)tagMappings forCommerceEvent if (matchTagMappings.count > 0) { [matchTagMappings enumerateObjectsUsingBlock:^(MPUATagMapping * _Nonnull tagMapping, NSUInteger idx, BOOL * _Nonnull stop) { - [[UAirship channel] addTag:tagMapping.value]; + [UAirship.channel editTags:^(UATagEditor *editor) { + [editor addTag:tagMapping.value]; + }]; }]; } } @@ -690,7 +696,9 @@ - (void)setTagMappings:(NSArray *)tagMappings forEvent:(MPEven if (matchTagMappings.count > 0) { [matchTagMappings enumerateObjectsUsingBlock:^(MPUATagMapping * _Nonnull tagMapping, NSUInteger idx, BOOL * _Nonnull stop) { - [[UAirship channel] addTag:tagMapping.value]; + [UAirship.channel editTags:^(UATagEditor *editor) { + [editor addTag:tagMapping.value]; + }]; }]; } } @@ -725,8 +733,10 @@ - (void)setTagMappings:(NSArray *)tagMappings forAttributesInC if (attributeString) { NSString *tagPlusAttributeValue = [NSString stringWithFormat:@"%@-%@", tagMapping.value, attributeString]; - [[UAirship channel] addTag:tagPlusAttributeValue]; - [[UAirship channel] addTag:tagMapping.value]; + [UAirship.channel editTags:^(UATagEditor *editor) { + [editor addTag:tagPlusAttributeValue]; + [editor addTag:tagMapping.value]; + }]; } }]; } @@ -753,8 +763,10 @@ - (void)setTagMappings:(NSArray *)tagMappings forAttributesInE if (attributeString) { NSString *tagPlusAttributeValue = [NSString stringWithFormat:@"%@-%@", tagMapping.value, attributeString]; - [[UAirship channel] addTag:tagPlusAttributeValue]; - [[UAirship channel] addTag:tagMapping.value]; + [UAirship.channel editTags:^(UATagEditor *editor) { + [editor addTag:tagPlusAttributeValue]; + [editor addTag:tagMapping.value]; + }]; } }]; } diff --git a/mParticle-UrbanAirship/PrivacyInfo.xcprivacy b/mParticle-UrbanAirship/PrivacyInfo.xcprivacy new file mode 100644 index 0000000..2009fb7 --- /dev/null +++ b/mParticle-UrbanAirship/PrivacyInfo.xcprivacy @@ -0,0 +1,14 @@ + + + + + NSPrivacyTracking + + NSPrivacyTrackingDomains + + NSPrivacyCollectedDataTypes + + NSPrivacyAccessedAPITypes + + +