Skip to content

Commit

Permalink
feat: Update to Partner Version 18.2 and add Privacy Manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonStalnaker committed May 8, 2024
1 parent 2e29913 commit fe5a344
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -25,6 +25,7 @@ let package = Package(
.product(name: "AirshipCore", package: "Airship"),
],
path: "mParticle-UrbanAirship",
resources: [.process("PrivacyInfo.xcprivacy")],
publicHeadersPath: "."),
]
)
3 changes: 2 additions & 1 deletion mParticle-UrbanAirship.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

38 changes: 25 additions & 13 deletions mParticle-UrbanAirship/MPKitUrbanAirship.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ - (void)start {

[UAirship takeOff:config launchOptions:_launchOptions];
UAirship.push.userPushNotificationsEnabled = YES;
[[UAirship push] updateRegistration];

NSDictionary *userInfo = @{mParticleKitInstanceKey:[[self class] kitCode]};

Expand All @@ -171,7 +170,7 @@ - (void)start {

[notificationCenter addObserver:self
selector:@selector(updateChannelIntegration)
name:UAChannel.channelCreatedEvent
name:UAirshipNotificationChannelCreated.name
object:nil];

[self updateChannelIntegration];
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -672,7 +676,9 @@ - (void)setTagMappings:(NSArray<MPUATagMapping *> *)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];
}];
}];
}
}
Expand All @@ -690,7 +696,9 @@ - (void)setTagMappings:(NSArray<MPUATagMapping *> *)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];
}];
}];
}
}
Expand Down Expand Up @@ -725,8 +733,10 @@ - (void)setTagMappings:(NSArray<MPUATagMapping *> *)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];
}];
}
}];
}
Expand All @@ -753,8 +763,10 @@ - (void)setTagMappings:(NSArray<MPUATagMapping *> *)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];
}];
}
}];
}
Expand Down
14 changes: 14 additions & 0 deletions mParticle-UrbanAirship/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array/>
</dict>
</plist>

0 comments on commit fe5a344

Please sign in to comment.