Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve Privacy Manifest support for iOS 17 #27

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let package = Package(
dependencies: [
.package(name: "mParticle-Apple-SDK",
url: "https://github.com/mParticle/mparticle-apple-sdk",
.upToNextMajor(from: "8.0.0")),
.upToNextMajor(from: "8.22.0")),
.package(name: "Firebase",
url: "https://github.com/firebase/firebase-ios-sdk.git",
.upToNextMajor(from: "10.6.0")),
Expand All @@ -31,6 +31,7 @@ let package = Package(
],
path: "mParticle-Google-Analytics-Firebase-GA4",
exclude: ["Info.plist", "dummy.swift"],
resources: [.process("PrivacyInfo.xcprivacy")],
publicHeadersPath: "."),
.target(
name: "mParticle-Google-Analytics-Firebase-GA4-NoLocation",
Expand All @@ -40,6 +41,7 @@ let package = Package(
],
path: "SPM/mParticle-Google-Analytics-Firebase-GA4-NoLocation",
exclude: ["Info.plist", "dummy.swift"],
resources: [.process("PrivacyInfo.xcprivacy")],
publicHeadersPath: "."),
]
)
6 changes: 4 additions & 2 deletions mParticle-Google-Analytics-Firebase-GA4.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ Pod::Spec.new do |s|

s.ios.deployment_target = "11.0"
s.ios.source_files = 'mParticle-Google-Analytics-Firebase-GA4/*.{h,m,mm}'
s.ios.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.0'
s.ios.resource_bundles = { 'mParticle-Google-Analytics-Firebase-GA4-Privacy' => ['mParticle-Google-Analytics-Firebase-GA4/PrivacyInfo.xcprivacy'] }
s.ios.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.22'
s.ios.frameworks = 'CoreTelephony', 'SystemConfiguration'
s.libraries = 'z'
s.ios.dependency 'Firebase/Core', '~> 10.23'

s.tvos.deployment_target = "12.0"
s.tvos.source_files = 'mParticle-Google-Analytics-Firebase-GA4/*.{h,m,mm}'
s.tvos.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.0'
s.ios.resource_bundles = { 'mParticle-Google-Analytics-Firebase-GA4-Privacy' => ['mParticle-Google-Analytics-Firebase-GA4/PrivacyInfo.xcprivacy'] }
s.tvos.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.22'
s.tvos.frameworks = 'SystemConfiguration'
s.libraries = 'z'
s.tvos.dependency 'Firebase/Core', '~> 10.23'
Expand Down
28 changes: 11 additions & 17 deletions mParticle-Google-Analytics-Firebase-GA4.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 60;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -16,8 +16,6 @@
D3C2105829FC1E3600DBB6D8 /* FirebaseAnalytics.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3C2104C29FC1E3400DBB6D8 /* FirebaseAnalytics.xcframework */; };
D3C2105929FC1E3600DBB6D8 /* FirebaseCoreInternal.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3C2104D29FC1E3400DBB6D8 /* FirebaseCoreInternal.xcframework */; };
D3C2105A29FC1E3600DBB6D8 /* FirebaseCoreInternal.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3C2104D29FC1E3400DBB6D8 /* FirebaseCoreInternal.xcframework */; };
D3C2105B29FC1E3600DBB6D8 /* FirebaseAnalyticsSwift.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3C2104E29FC1E3400DBB6D8 /* FirebaseAnalyticsSwift.xcframework */; };
D3C2105C29FC1E3600DBB6D8 /* FirebaseAnalyticsSwift.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3C2104E29FC1E3400DBB6D8 /* FirebaseAnalyticsSwift.xcframework */; };
D3C2105D29FC1E3600DBB6D8 /* FBLPromises.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3C2104F29FC1E3400DBB6D8 /* FBLPromises.xcframework */; };
D3C2105E29FC1E3600DBB6D8 /* FBLPromises.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3C2104F29FC1E3400DBB6D8 /* FBLPromises.xcframework */; };
D3C2105F29FC1E3600DBB6D8 /* FirebaseCore.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3C2105029FC1E3500DBB6D8 /* FirebaseCore.xcframework */; };
Expand Down Expand Up @@ -69,17 +67,16 @@
D316BD4D217F67BC00688E56 /* MPKitFirebaseGA4Analytics.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPKitFirebaseGA4Analytics.m; sourceTree = "<group>"; };
D32861EC2BA487FD0075AFF0 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
D39C3DE428C78D5B00432A0C /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dummy.swift; sourceTree = "<group>"; };
D3C2104C29FC1E3400DBB6D8 /* FirebaseAnalytics.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = FirebaseAnalytics.xcframework; path = Carthage/Build/FirebaseAnalytics.xcframework; sourceTree = "<group>"; };
D3C2104D29FC1E3400DBB6D8 /* FirebaseCoreInternal.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = FirebaseCoreInternal.xcframework; path = Carthage/Build/FirebaseCoreInternal.xcframework; sourceTree = "<group>"; };
D3C2104E29FC1E3400DBB6D8 /* FirebaseAnalyticsSwift.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = FirebaseAnalyticsSwift.xcframework; path = Carthage/Build/FirebaseAnalyticsSwift.xcframework; sourceTree = "<group>"; };
D3C2104F29FC1E3400DBB6D8 /* FBLPromises.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = FBLPromises.xcframework; path = Carthage/Build/FBLPromises.xcframework; sourceTree = "<group>"; };
D3C2105029FC1E3500DBB6D8 /* FirebaseCore.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = FirebaseCore.xcframework; path = Carthage/Build/FirebaseCore.xcframework; sourceTree = "<group>"; };
D3C2105129FC1E3500DBB6D8 /* mParticle_Apple_SDK.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = mParticle_Apple_SDK.xcframework; path = Carthage/Build/mParticle_Apple_SDK.xcframework; sourceTree = "<group>"; };
D3C2105229FC1E3500DBB6D8 /* FirebaseInstallations.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = FirebaseInstallations.xcframework; path = Carthage/Build/FirebaseInstallations.xcframework; sourceTree = "<group>"; };
D3C2105329FC1E3500DBB6D8 /* GoogleAppMeasurement.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = GoogleAppMeasurement.xcframework; path = Carthage/Build/GoogleAppMeasurement.xcframework; sourceTree = "<group>"; };
D3C2105429FC1E3500DBB6D8 /* GoogleUtilities.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = GoogleUtilities.xcframework; path = Carthage/Build/GoogleUtilities.xcframework; sourceTree = "<group>"; };
D3C2105529FC1E3500DBB6D8 /* nanopb.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = nanopb.xcframework; path = Carthage/Build/nanopb.xcframework; sourceTree = "<group>"; };
D3C2105629FC1E3500DBB6D8 /* GoogleAppMeasurementIdentitySupport.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = GoogleAppMeasurementIdentitySupport.xcframework; path = Carthage/Build/GoogleAppMeasurementIdentitySupport.xcframework; sourceTree = "<group>"; };
D3C2104C29FC1E3400DBB6D8 /* FirebaseAnalytics.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:EQHXZ8M8AV:Google LLC"; lastKnownFileType = wrapper.xcframework; name = FirebaseAnalytics.xcframework; path = Carthage/Build/FirebaseAnalytics.xcframework; sourceTree = "<group>"; };
D3C2104D29FC1E3400DBB6D8 /* FirebaseCoreInternal.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:EQHXZ8M8AV:Google LLC"; lastKnownFileType = wrapper.xcframework; name = FirebaseCoreInternal.xcframework; path = Carthage/Build/FirebaseCoreInternal.xcframework; sourceTree = "<group>"; };
D3C2104F29FC1E3400DBB6D8 /* FBLPromises.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:EQHXZ8M8AV:Google LLC"; lastKnownFileType = wrapper.xcframework; name = FBLPromises.xcframework; path = Carthage/Build/FBLPromises.xcframework; sourceTree = "<group>"; };
D3C2105029FC1E3500DBB6D8 /* FirebaseCore.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:EQHXZ8M8AV:Google LLC"; lastKnownFileType = wrapper.xcframework; name = FirebaseCore.xcframework; path = Carthage/Build/FirebaseCore.xcframework; sourceTree = "<group>"; };
D3C2105129FC1E3500DBB6D8 /* mParticle_Apple_SDK.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:DLD43Y3TRP:mParticle, inc"; lastKnownFileType = wrapper.xcframework; name = mParticle_Apple_SDK.xcframework; path = Carthage/Build/mParticle_Apple_SDK.xcframework; sourceTree = "<group>"; };
D3C2105229FC1E3500DBB6D8 /* FirebaseInstallations.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:EQHXZ8M8AV:Google LLC"; lastKnownFileType = wrapper.xcframework; name = FirebaseInstallations.xcframework; path = Carthage/Build/FirebaseInstallations.xcframework; sourceTree = "<group>"; };
D3C2105329FC1E3500DBB6D8 /* GoogleAppMeasurement.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:EQHXZ8M8AV:Google LLC"; lastKnownFileType = wrapper.xcframework; name = GoogleAppMeasurement.xcframework; path = Carthage/Build/GoogleAppMeasurement.xcframework; sourceTree = "<group>"; };
D3C2105429FC1E3500DBB6D8 /* GoogleUtilities.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:EQHXZ8M8AV:Google LLC"; lastKnownFileType = wrapper.xcframework; name = GoogleUtilities.xcframework; path = Carthage/Build/GoogleUtilities.xcframework; sourceTree = "<group>"; };
D3C2105529FC1E3500DBB6D8 /* nanopb.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:EQHXZ8M8AV:Google LLC"; lastKnownFileType = wrapper.xcframework; name = nanopb.xcframework; path = Carthage/Build/nanopb.xcframework; sourceTree = "<group>"; };
D3C2105629FC1E3500DBB6D8 /* GoogleAppMeasurementIdentitySupport.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:EQHXZ8M8AV:Google LLC"; lastKnownFileType = wrapper.xcframework; name = GoogleAppMeasurementIdentitySupport.xcframework; path = Carthage/Build/GoogleAppMeasurementIdentitySupport.xcframework; sourceTree = "<group>"; };
D3C7855221FF6CEB00FE47D2 /* mParticle-Google-Analytics-Firebase-GA4Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "mParticle-Google-Analytics-Firebase-GA4Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
D3C7855421FF6CEC00FE47D2 /* MPKitFirebaseGA4AnalyticsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPKitFirebaseGA4AnalyticsTests.m; sourceTree = "<group>"; };
D3C7855621FF6CEC00FE47D2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand All @@ -92,7 +89,6 @@
files = (
D3C2105D29FC1E3600DBB6D8 /* FBLPromises.xcframework in Frameworks */,
D3C2106129FC1E3600DBB6D8 /* mParticle_Apple_SDK.xcframework in Frameworks */,
D3C2105B29FC1E3600DBB6D8 /* FirebaseAnalyticsSwift.xcframework in Frameworks */,
D3C2106929FC1E3600DBB6D8 /* nanopb.xcframework in Frameworks */,
D3C2105F29FC1E3600DBB6D8 /* FirebaseCore.xcframework in Frameworks */,
D3C2106329FC1E3600DBB6D8 /* FirebaseInstallations.xcframework in Frameworks */,
Expand All @@ -118,7 +114,6 @@
D3C2106829FC1E3600DBB6D8 /* GoogleUtilities.xcframework in Frameworks */,
D3C2105A29FC1E3600DBB6D8 /* FirebaseCoreInternal.xcframework in Frameworks */,
D3C2105E29FC1E3600DBB6D8 /* FBLPromises.xcframework in Frameworks */,
D3C2105C29FC1E3600DBB6D8 /* FirebaseAnalyticsSwift.xcframework in Frameworks */,
D3C2106229FC1E3600DBB6D8 /* mParticle_Apple_SDK.xcframework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -162,7 +157,6 @@
children = (
D3C2104F29FC1E3400DBB6D8 /* FBLPromises.xcframework */,
D3C2104C29FC1E3400DBB6D8 /* FirebaseAnalytics.xcframework */,
D3C2104E29FC1E3400DBB6D8 /* FirebaseAnalyticsSwift.xcframework */,
D3C2105029FC1E3500DBB6D8 /* FirebaseCore.xcframework */,
D3C2104D29FC1E3400DBB6D8 /* FirebaseCoreInternal.xcframework */,
D3C2105229FC1E3500DBB6D8 /* FirebaseInstallations.xcframework */,
Expand Down
8 changes: 2 additions & 6 deletions mParticle-Google-Analytics-Firebase-GA4/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict/>
</array>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict/>
</array>
<array/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ - (void)testSanitization {
XCTAssertEqualObjects([exampleKit standardizeNameOrKey:badStart forEvent:YES], @"event_name");
}

NSString *tooLong = @"abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890";
NSString *tooLong = @"abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890";
XCTAssertEqual(40, [exampleKit standardizeNameOrKey:tooLong forEvent:YES].length);
XCTAssertEqual(24, [exampleKit standardizeNameOrKey:tooLong forEvent:NO].length);
XCTAssertEqual(100, [exampleKit standardizeValue:tooLong forEvent:YES].length);
XCTAssertEqual(500, [exampleKit standardizeValue:tooLong forEvent:YES].length);
XCTAssertEqual(36, [exampleKit standardizeValue:tooLong forEvent:NO].length);

NSArray *emptyStrings = @[@"!@#$%^&*()_+=[]{}|'\"?><:;",
Expand Down Expand Up @@ -240,41 +240,24 @@ - (void)testSanitizationMax {
XCTAssertEqual([parameters count], 25);
XCTAssertEqualObjects(parameters, testFinalAttributes);

NSDictionary *testExcessiveAttributes = @{ @"test1": @"parameter",
@"test2": @"parameter",
@"test3": @"parameter",
@"test4": @"parameter",
@"test5": @"parameter",
@"test6": @"parameter",
@"test7": @"parameter",
@"test8": @"parameter",
@"test9": @"parameter",
@"test10": @"parameter",
@"test11": @"parameter",
@"test12": @"parameter",
@"test13": @"parameter",
@"test14": @"parameter",
@"test15": @"parameter",
@"test16": @"parameter",
@"test17": @"parameter",
@"test18": @"parameter",
@"test19": @"parameter",
@"test20": @"parameter",
@"test21": @"parameter",
@"test22": @"parameter",
@"test23": @"parameter",
@"test24": @"parameter",
@"z1": @"parameter",
@"z2": @"parameter",
@"z3": @"parameter",
@"z4": @"parameter",
@"z5": @"parameter"
};
NSMutableDictionary *testExcessiveAttributes = [[NSMutableDictionary alloc] initWithCapacity:125];
for (int i = 0; i < 125; i++) {
NSString *key = [NSString stringWithFormat:@"test%03d", i];
testExcessiveAttributes[key] = @"parameter";
}

NSMutableDictionary *testExcessiveFinalAttributes = [[NSMutableDictionary alloc] initWithCapacity:125];
for (int i = 0; i <99 ; i++) {
NSString *key = [NSString stringWithFormat:@"test%03d", i];
testExcessiveFinalAttributes[key] = @"parameter";
}
testExcessiveFinalAttributes[@"currency"] = @"USD";

event.customAttributes = testExcessiveAttributes;

parameters = [exampleKit getParameterForCommerceEvent:event];
XCTAssertEqual([parameters count], 25);
XCTAssertEqualObjects(parameters, testFinalAttributes);
XCTAssertEqual([parameters count], 100);
XCTAssertEqualObjects(parameters, testExcessiveFinalAttributes);


MPKitExecStatus *execStatus = [exampleKit logBaseEvent:event];
Expand Down