From 3ba18d3890c4a1a8d0cfc9800fd2da1031666078 Mon Sep 17 00:00:00 2001 From: Ben Baron Date: Wed, 8 May 2024 11:15:57 -0500 Subject: [PATCH] feat: Improve Privacy Manifest support for iOS 17 (#13) --- .gitignore | 3 +- Cartfile | 2 + Cartfile.resolved | 2 + Package.swift | 30 +++++++++ Podfile | 12 ---- mParticle-Apptimize.podspec | 3 +- mParticle-Apptimize.xcodeproj/project.pbxproj | 58 +++------------- .../xcschemes/mParticle-Apptimize.xcscheme | 67 +++++++++++++++++++ mParticle-Apptimize/MPKitApptimize.m | 6 +- mParticle-Apptimize/PrivacyInfo.xcprivacy | 8 +-- mParticle-Apptimize/mParticle_Apptimize.h | 7 +- 11 files changed, 127 insertions(+), 71 deletions(-) create mode 100644 Cartfile create mode 100644 Cartfile.resolved create mode 100644 Package.swift delete mode 100644 Podfile create mode 100644 mParticle-Apptimize.xcodeproj/xcshareddata/xcschemes/mParticle-Apptimize.xcscheme diff --git a/.gitignore b/.gitignore index 175d329..3d1aaf0 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ playground.xcworkspace # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. # Packages/ .build/ +Package.resolved # CocoaPods # @@ -65,4 +66,4 @@ fastlane/test_output **/Podfile.lock **/*.xcworkspace **/*.DS_Store -*.DS_Store \ No newline at end of file +*.DS_Store diff --git a/Cartfile b/Cartfile new file mode 100644 index 0000000..67eaf49 --- /dev/null +++ b/Cartfile @@ -0,0 +1,2 @@ +binary "https://raw.githubusercontent.com/urbanairship/apptimize-ios-kit/master/Apptimize.json" ~> 3.5 +binary "https://raw.githubusercontent.com/mParticle/mparticle-apple-sdk/main/mParticle_Apple_SDK.json" ~> 8.22 diff --git a/Cartfile.resolved b/Cartfile.resolved new file mode 100644 index 0000000..cfea52f --- /dev/null +++ b/Cartfile.resolved @@ -0,0 +1,2 @@ +binary "https://raw.githubusercontent.com/mParticle/mparticle-apple-sdk/main/mParticle_Apple_SDK.json" "8.24.0" +binary "https://raw.githubusercontent.com/urbanairship/apptimize-ios-kit/master/Apptimize.json" "3.5.24" diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..28dcf30 --- /dev/null +++ b/Package.swift @@ -0,0 +1,30 @@ +// swift-tools-version: 5.9 +import PackageDescription + +let package = Package( + name: "mParticle-Apptimize", + platforms: [ .iOS(.v11) ], + products: [ + .library( + name: "mParticle-Apptimize", + targets: ["mParticle-Apptimize"]), + ], + dependencies: [ + .package(url: "https://github.com/mParticle/mparticle-apple-sdk", + .upToNextMajor(from: "8.22.0")), + .package(url: "https://github.com/urbanairship/apptimize-ios-kit", + .upToNextMajor(from: "3.5.25")), + ], + targets: [ + .target( + name: "mParticle-Apptimize", + dependencies: [ + .product(name: "mParticle-Apple-SDK", package: "mparticle-apple-sdk"), + .product(name: "Apptimize", package: "apptimize-ios-kit"), + ], + path: "mParticle-Apptimize", + exclude: ["Info.plist"], + resources: [.process("PrivacyInfo.xcprivacy")], + publicHeadersPath: ".") + ] +) diff --git a/Podfile b/Podfile deleted file mode 100644 index 47761c2..0000000 --- a/Podfile +++ /dev/null @@ -1,12 +0,0 @@ -# Uncomment the next line to define a global platform for your project -# platform :ios, '9.0' - -target 'mParticle-Apptimize' do - # Comment the next line if you don't want to use dynamic frameworks - use_frameworks! - - # Pods for mParticle-Apptimize - pod 'mParticle-Apple-SDK/mParticle', '~> 8.0' - pod 'Apptimize', '~> 3.5.25' - -end diff --git a/mParticle-Apptimize.podspec b/mParticle-Apptimize.podspec index 2998fd4..164d575 100644 --- a/mParticle-Apptimize.podspec +++ b/mParticle-Apptimize.podspec @@ -15,7 +15,8 @@ Pod::Spec.new do |s| s.ios.deployment_target = "11.0" s.ios.source_files = 'mParticle-Apptimize/*.{h,m,mm}' - s.ios.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.0' + s.ios.resource_bundles = { 'mParticle-Apptimize-Privacy' => ['mParticle-Apptimize/PrivacyInfo.xcprivacy'] } + s.ios.dependency 'mParticle-Apple-SDK/mParticle', '~> 8.22' s.ios.dependency 'Apptimize', '~> 3.5' end diff --git a/mParticle-Apptimize.xcodeproj/project.pbxproj b/mParticle-Apptimize.xcodeproj/project.pbxproj index 04f4320..06257ff 100644 --- a/mParticle-Apptimize.xcodeproj/project.pbxproj +++ b/mParticle-Apptimize.xcodeproj/project.pbxproj @@ -3,28 +3,27 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 60; objects = { /* Begin PBXBuildFile section */ - 27B46C39177A6EE98630695A /* Pods_mParticle_Apptimize.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC81CBB3A99FAD1126C5BA51 /* Pods_mParticle_Apptimize.framework */; }; + 53034BE42BEAD62000AA62CE /* Apptimize.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53034BE22BEAD62000AA62CE /* Apptimize.xcframework */; }; + 53034BE52BEAD62000AA62CE /* mParticle_Apple_SDK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53034BE32BEAD62000AA62CE /* mParticle_Apple_SDK.xcframework */; }; 53E9ACCD2BBF0F7E0062A03A /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 53E9ACCC2BBF0F7E0062A03A /* PrivacyInfo.xcprivacy */; }; D37EFA9924F43B970091B75B /* mParticle_Apptimize.h in Headers */ = {isa = PBXBuildFile; fileRef = D37EFA9724F43B970091B75B /* mParticle_Apptimize.h */; settings = {ATTRIBUTES = (Public, ); }; }; D37EFAA124F43C780091B75B /* MPKitApptimize.m in Sources */ = {isa = PBXBuildFile; fileRef = D37EFA9F24F43C780091B75B /* MPKitApptimize.m */; }; - D37EFAA224F43C780091B75B /* MPKitApptimize.h in Headers */ = {isa = PBXBuildFile; fileRef = D37EFAA024F43C780091B75B /* MPKitApptimize.h */; }; + D37EFAA224F43C780091B75B /* MPKitApptimize.h in Headers */ = {isa = PBXBuildFile; fileRef = D37EFAA024F43C780091B75B /* MPKitApptimize.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 27D8AA1C689E5CD6D5103589 /* Pods-mParticle-Apptimize.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-mParticle-Apptimize.release.xcconfig"; path = "Target Support Files/Pods-mParticle-Apptimize/Pods-mParticle-Apptimize.release.xcconfig"; sourceTree = ""; }; + 53034BE22BEAD62000AA62CE /* Apptimize.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:PGJV57GD94:Urban Airship Inc."; lastKnownFileType = wrapper.xcframework; name = Apptimize.xcframework; path = Carthage/Build/Apptimize.xcframework; sourceTree = ""; }; + 53034BE32BEAD62000AA62CE /* 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 = ""; }; 53E9ACCC2BBF0F7E0062A03A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; - AA05C6D0B18A689C357B7448 /* Pods-mParticle-Apptimize.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-mParticle-Apptimize.debug.xcconfig"; path = "Target Support Files/Pods-mParticle-Apptimize/Pods-mParticle-Apptimize.debug.xcconfig"; sourceTree = ""; }; D37EFA9424F43B970091B75B /* mParticle_Apptimize.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = mParticle_Apptimize.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D37EFA9724F43B970091B75B /* mParticle_Apptimize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mParticle_Apptimize.h; sourceTree = ""; }; D37EFA9824F43B970091B75B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; D37EFA9F24F43C780091B75B /* MPKitApptimize.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPKitApptimize.m; sourceTree = ""; }; D37EFAA024F43C780091B75B /* MPKitApptimize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPKitApptimize.h; sourceTree = ""; }; - D37EFAA424F442E00091B75B /* mParticle_Apple_SDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mParticle_Apple_SDK.framework; path = Carthage/Build/iOS/mParticle_Apple_SDK.framework; sourceTree = ""; }; - FC81CBB3A99FAD1126C5BA51 /* Pods_mParticle_Apptimize.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_mParticle_Apptimize.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -32,29 +31,20 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 27B46C39177A6EE98630695A /* Pods_mParticle_Apptimize.framework in Frameworks */, + 53034BE42BEAD62000AA62CE /* Apptimize.xcframework in Frameworks */, + 53034BE52BEAD62000AA62CE /* mParticle_Apple_SDK.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 556ED8B199C57862917404B1 /* Pods */ = { - isa = PBXGroup; - children = ( - AA05C6D0B18A689C357B7448 /* Pods-mParticle-Apptimize.debug.xcconfig */, - 27D8AA1C689E5CD6D5103589 /* Pods-mParticle-Apptimize.release.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; D37EFA8A24F43B970091B75B = { isa = PBXGroup; children = ( D37EFA9624F43B970091B75B /* mParticle-Apptimize */, D37EFA9524F43B970091B75B /* Products */, D37EFAA324F442E00091B75B /* Frameworks */, - 556ED8B199C57862917404B1 /* Pods */, ); sourceTree = ""; }; @@ -81,8 +71,8 @@ D37EFAA324F442E00091B75B /* Frameworks */ = { isa = PBXGroup; children = ( - D37EFAA424F442E00091B75B /* mParticle_Apple_SDK.framework */, - FC81CBB3A99FAD1126C5BA51 /* Pods_mParticle_Apptimize.framework */, + 53034BE22BEAD62000AA62CE /* Apptimize.xcframework */, + 53034BE32BEAD62000AA62CE /* mParticle_Apple_SDK.xcframework */, ); name = Frameworks; sourceTree = ""; @@ -106,7 +96,6 @@ isa = PBXNativeTarget; buildConfigurationList = D37EFA9C24F43B970091B75B /* Build configuration list for PBXNativeTarget "mParticle-Apptimize" */; buildPhases = ( - D29EE7C56E0B79CECE2AFB9A /* [CP] Check Pods Manifest.lock */, D37EFA8F24F43B970091B75B /* Headers */, D37EFA9024F43B970091B75B /* Sources */, D37EFA9124F43B970091B75B /* Frameworks */, @@ -163,31 +152,6 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - D29EE7C56E0B79CECE2AFB9A /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-mParticle-Apptimize-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ D37EFA9024F43B970091B75B /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -322,7 +286,6 @@ }; D37EFA9D24F43B970091B75B /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = AA05C6D0B18A689C357B7448 /* Pods-mParticle-Apptimize.debug.xcconfig */; buildSettings = { CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; @@ -349,7 +312,6 @@ }; D37EFA9E24F43B970091B75B /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 27D8AA1C689E5CD6D5103589 /* Pods-mParticle-Apptimize.release.xcconfig */; buildSettings = { CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; diff --git a/mParticle-Apptimize.xcodeproj/xcshareddata/xcschemes/mParticle-Apptimize.xcscheme b/mParticle-Apptimize.xcodeproj/xcshareddata/xcschemes/mParticle-Apptimize.xcscheme new file mode 100644 index 0000000..5633037 --- /dev/null +++ b/mParticle-Apptimize.xcodeproj/xcshareddata/xcschemes/mParticle-Apptimize.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mParticle-Apptimize/MPKitApptimize.m b/mParticle-Apptimize/MPKitApptimize.m index 0494727..60eb605 100644 --- a/mParticle-Apptimize/MPKitApptimize.m +++ b/mParticle-Apptimize/MPKitApptimize.m @@ -1,5 +1,9 @@ #import "MPKitApptimize.h" -#import +#if defined(__has_include) && __has_include() + #import +#else + #import "Apptimize.h" +#endif @interface MPKitApptimize() @property (nonatomic, unsafe_unretained) BOOL started; diff --git a/mParticle-Apptimize/PrivacyInfo.xcprivacy b/mParticle-Apptimize/PrivacyInfo.xcprivacy index eb3b0ea..2009fb7 100644 --- a/mParticle-Apptimize/PrivacyInfo.xcprivacy +++ b/mParticle-Apptimize/PrivacyInfo.xcprivacy @@ -7,12 +7,8 @@ NSPrivacyTrackingDomains NSPrivacyCollectedDataTypes - - - + NSPrivacyAccessedAPITypes - - - + diff --git a/mParticle-Apptimize/mParticle_Apptimize.h b/mParticle-Apptimize/mParticle_Apptimize.h index 0cc09d7..4bd0868 100644 --- a/mParticle-Apptimize/mParticle_Apptimize.h +++ b/mParticle-Apptimize/mParticle_Apptimize.h @@ -13,5 +13,8 @@ FOUNDATION_EXPORT double mParticle_ApptimizeVersionNumber; //! Project version string for mParticle_Apptimize. FOUNDATION_EXPORT const unsigned char mParticle_ApptimizeVersionString[]; -// In this header, you should import all the public headers of your framework using statements like #import -#import +#if defined(__has_include) && __has_include() + #import +#else + #import "MPKitApptimize.h" +#endif