From b274f954be94420902745a3c6c0d3121497c1167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20De=CC=81fago?= Date: Fri, 24 Nov 2023 09:16:20 +0100 Subject: [PATCH 1/8] Bump version number --- Demo/Demo.xcconfig | 2 +- Package.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Demo/Demo.xcconfig b/Demo/Demo.xcconfig index 87544d28..3d0257a8 100644 --- a/Demo/Demo.xcconfig +++ b/Demo/Demo.xcconfig @@ -1,5 +1,5 @@ // Version information -MARKETING_VERSION = 9.0.2 +MARKETING_VERSION = 9.0.3 // Deployment targets IPHONEOS_DEPLOYMENT_TARGET = 12.0 diff --git a/Package.swift b/Package.swift index be1a2b7c..ca00c82b 100644 --- a/Package.swift +++ b/Package.swift @@ -3,7 +3,7 @@ import PackageDescription struct ProjectSettings { - static let marketingVersion: String = "9.0.2" + static let marketingVersion: String = "9.0.3" } let package = Package( From 5f5e809d47ece2a4c919910f3e2bc2262533cd37 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Date: Mon, 4 Dec 2023 22:27:58 +0100 Subject: [PATCH 2/8] Build and test with Xcode 15.0.1 (#82) --- .xcode-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.xcode-version b/.xcode-version index 3d3be3c3..9dc738e6 100644 --- a/.xcode-version +++ b/.xcode-version @@ -1 +1 @@ -15.0 \ No newline at end of file +15.0.1 \ No newline at end of file From 8251819ac43bbc83a9ec9ae6962a9a64e4ee5b2e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Date: Thu, 25 Jan 2024 10:36:42 +0100 Subject: [PATCH 3/8] Add support to desktop navigation device (#83) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Walid Kayhal <3347810+waliid@users.noreply.github.com> Co-authored-by: Samuel Défago --- Sources/SRGAnalytics/SRGAnalyticsTracker.m | 27 +++++++++++++++++-- Tests/SRGAnalyticsTests/MediaPlayerTestCase.m | 5 +++- Tests/SRGAnalyticsTests/TrackerTestCase.m | 5 ++++ fastlane/Fastfile | 2 +- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Sources/SRGAnalytics/SRGAnalyticsTracker.m b/Sources/SRGAnalytics/SRGAnalyticsTracker.m index 164222a8..41753b87 100644 --- a/Sources/SRGAnalytics/SRGAnalyticsTracker.m +++ b/Sources/SRGAnalytics/SRGAnalyticsTracker.m @@ -172,7 +172,7 @@ - (void)startCommandersActWithConfiguration:(SRGAnalyticsConfiguration *)configu return labels.copy; } -- (SRGAnalyticsLabels *)dataSourceLabels +- (SRGAnalyticsLabels *)dataSourceLabels { return self.dataSource.srg_globalLabels; } @@ -197,7 +197,10 @@ - (NSString *)pageIdWithTitle:(NSString *)title levels:(NSArray *)le - (NSString *)device { - if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone) { + if ([self isMacCatalystApp] || [self isiOSAppOnMac]) { + return @"desktop"; + } + else if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone) { return @"phone"; } else if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { @@ -211,6 +214,26 @@ - (NSString *)device } } +- (BOOL)isMacCatalystApp +{ + if (@available(iOS 13, tvOS 13, *)) { + return NSProcessInfo.processInfo.isMacCatalystApp; + } + else { + return NO; + } +} + +- (BOOL)isiOSAppOnMac +{ + if (@available(iOS 14, tvOS 14, *)) { + return NSProcessInfo.processInfo.isiOSAppOnMac; + } + else { + return NO; + } +} + #pragma mark General event tracking (internal use only) - (void)sendCommandersActPageViewEventWithTitle:(NSString *)title diff --git a/Tests/SRGAnalyticsTests/MediaPlayerTestCase.m b/Tests/SRGAnalyticsTests/MediaPlayerTestCase.m index 7e40132b..bedaa502 100644 --- a/Tests/SRGAnalyticsTests/MediaPlayerTestCase.m +++ b/Tests/SRGAnalyticsTests/MediaPlayerTestCase.m @@ -548,12 +548,15 @@ - (void)testWithoutLabels - (void)testCommonLabels { [self expectationForPlayerEventNotificationWithHandler:^BOOL(NSString *event, NSDictionary *labels) { + XCTAssertEqualObjects(labels[@"app_library_version"], SRGAnalyticsMarketingVersion()); XCTAssertEqualObjects(labels[@"navigation_app_site_name"], @"srg-test-analytics-apple"); + XCTAssertTrue(([@[@"phone", @"tvbox", @"tablet", @"desktop"] containsObject:labels[@"navigation_device"]])); + XCTAssertEqualObjects(labels[@"consent_services"], @"service1,service2,service3"); + XCTAssertEqualObjects(event, @"play"); XCTAssertEqualObjects(labels[@"media_player_display"], @"SRGMediaPlayer"); XCTAssertEqualObjects(labels[@"media_player_version"], SRGMediaPlayerMarketingVersion()); XCTAssertEqualObjects(labels[@"test_label"], @"test_value"); - XCTAssertEqualObjects(labels[@"consent_services"], @"service1,service2,service3"); return YES; }]; diff --git a/Tests/SRGAnalyticsTests/TrackerTestCase.m b/Tests/SRGAnalyticsTests/TrackerTestCase.m index 34926996..32fad646 100644 --- a/Tests/SRGAnalyticsTests/TrackerTestCase.m +++ b/Tests/SRGAnalyticsTests/TrackerTestCase.m @@ -36,7 +36,9 @@ - (void)testNoHiddenAdSupportFramework - (void)testCommonLabelsForEvent { [self expectationForEventNotificationWithHandler:^BOOL(NSString *event, NSDictionary *labels) { + XCTAssertEqualObjects(labels[@"app_library_version"], SRGAnalyticsMarketingVersion()); XCTAssertEqualObjects(labels[@"navigation_app_site_name"], @"srg-test-analytics-apple"); + XCTAssertTrue(([@[@"phone", @"tvbox", @"tablet", @"desktop"] containsObject:labels[@"navigation_device"]])); XCTAssertEqualObjects(labels[@"consent_services"], @"service1,service2,service3"); return YES; }]; @@ -49,7 +51,10 @@ - (void)testCommonLabelsForEvent - (void)testCommonLabelsForPageView { [self expectationForPageViewEventNotificationWithHandler:^BOOL(NSString *event, NSDictionary *labels) { + XCTAssertEqualObjects(labels[@"app_library_version"], SRGAnalyticsMarketingVersion()); XCTAssertEqualObjects(labels[@"navigation_app_site_name"], @"srg-test-analytics-apple"); + XCTAssertTrue(([@[@"phone", @"tvbox", @"tablet", @"desktop"] containsObject:labels[@"navigation_device"]])); + XCTAssertEqualObjects(labels[@"consent_services"], @"service1,service2,service3"); return YES; }]; diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 43a6e104..44eba153 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -27,7 +27,7 @@ platform :ios do clean_derived_data iphone14 = Device.new('iOS', 'iPhone 14') - appletv = Device.new('tvOS', 'Apple TV') + appletv = Device.new('tvOS', 'Apple TV,OS=17.0') devices = [iphone14, appletv] scheme = swift_package_name From 8e2d6d86b89e2c089ed1df36b72c8b64d6d0e500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20D=C3=A9fago?= Date: Thu, 25 Jan 2024 10:37:22 +0100 Subject: [PATCH 4/8] Use common Commanders Act unique identifier between v4 and v5 (#85) --- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- Package.resolved | 4 ++-- Package.swift | 2 +- Sources/SRGAnalytics/SRGAnalyticsTracker.m | 4 ++++ .../xcshareddata/swiftpm/Package.resolved | 4 ++-- Tests/SRGAnalyticsTests/TrackerTestCase.m | 16 ++++++++++++++++ 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Demo/SRGAnalytics-demo.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Demo/SRGAnalytics-demo.xcworkspace/xcshareddata/swiftpm/Package.resolved index e5bec161..340aab57 100644 --- a/Demo/SRGAnalytics-demo.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Demo/SRGAnalytics-demo.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/CommandersAct/iOSV5.git", "state": { "branch": null, - "revision": "921c98e57e3044377ee955db5282406e11e6a787", - "version": "5.4.1" + "revision": "1350bca4163cfdd62d1508068601817d86d9f4a5", + "version": "5.4.4" } }, { diff --git a/Package.resolved b/Package.resolved index e5bec161..340aab57 100644 --- a/Package.resolved +++ b/Package.resolved @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/CommandersAct/iOSV5.git", "state": { "branch": null, - "revision": "921c98e57e3044377ee955db5282406e11e6a787", - "version": "5.4.1" + "revision": "1350bca4163cfdd62d1508068601817d86d9f4a5", + "version": "5.4.4" } }, { diff --git a/Package.swift b/Package.swift index ca00c82b..05792d9d 100644 --- a/Package.swift +++ b/Package.swift @@ -42,7 +42,7 @@ let package = Package( .package(name: "SRGIdentity", url: "https://github.com/SRGSSR/srgidentity-apple.git", .upToNextMinor(from: "3.3.0")), .package(name: "SRGLogger", url: "https://github.com/SRGSSR/srglogger-apple.git", .upToNextMinor(from: "3.1.0")), .package(name: "SRGMediaPlayer", url: "https://github.com/SRGSSR/srgmediaplayer-apple.git", .upToNextMinor(from: "7.2.0")), - .package(name: "TagCommander", url: "https://github.com/CommandersAct/iOSV5.git", .upToNextMinor(from: "5.4.0")) + .package(name: "TagCommander", url: "https://github.com/CommandersAct/iOSV5.git", .upToNextMinor(from: "5.4.4")) ], targets: [ .target( diff --git a/Sources/SRGAnalytics/SRGAnalyticsTracker.m b/Sources/SRGAnalytics/SRGAnalyticsTracker.m index 41753b87..957d8b28 100644 --- a/Sources/SRGAnalytics/SRGAnalyticsTracker.m +++ b/Sources/SRGAnalytics/SRGAnalyticsTracker.m @@ -126,6 +126,10 @@ - (void)startCommandersActWithConfiguration:(SRGAnalyticsConfiguration *)configu [self.serverSide addPermanentData:@"app_library_version" withValue:SRGAnalyticsMarketingVersion()]; [self.serverSide addPermanentData:@"navigation_app_site_name" withValue:configuration.siteName]; [self.serverSide addPermanentData:@"navigation_device" withValue:[self device]]; + + // Use the legacy V4 identifier as unique identifier in V5. + TCDevice.sharedInstance.sdkID = TCPredefinedVariables.sharedInstance.uniqueIdentifier; + [TCPredefinedVariables.sharedInstance useLegacyUniqueIDForAnonymousID]; } #pragma mark Labels diff --git a/Tests/SRGAnalyticsIdentity-tests.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Tests/SRGAnalyticsIdentity-tests.xcworkspace/xcshareddata/swiftpm/Package.resolved index dd784ced..785b49b5 100644 --- a/Tests/SRGAnalyticsIdentity-tests.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Tests/SRGAnalyticsIdentity-tests.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/CommandersAct/iOSV5.git", "state": { "branch": null, - "revision": "921c98e57e3044377ee955db5282406e11e6a787", - "version": "5.4.1" + "revision": "1350bca4163cfdd62d1508068601817d86d9f4a5", + "version": "5.4.4" } }, { diff --git a/Tests/SRGAnalyticsTests/TrackerTestCase.m b/Tests/SRGAnalyticsTests/TrackerTestCase.m index 32fad646..c0523546 100644 --- a/Tests/SRGAnalyticsTests/TrackerTestCase.m +++ b/Tests/SRGAnalyticsTests/TrackerTestCase.m @@ -8,6 +8,8 @@ #import "TrackerSingletonSetup.h" #import "XCTestCase+Tests.h" +@import TCServerSide_noIDFA; + @interface TrackerTestCase : XCTestCase @end @@ -33,6 +35,20 @@ - (void)testNoHiddenAdSupportFramework XCTAssertNil(NSClassFromString(@"ASIdentifierManager")); } +- (void)testUniqueIdentifier +{ + NSString *uniqueIdentifier = TCPredefinedVariables.sharedInstance.uniqueIdentifier; + [self expectationForEventNotificationWithHandler:^BOOL(NSString *event, NSDictionary *labels) { + XCTAssertEqualObjects(labels[@"context"][@"device"][@"sdk_id"], uniqueIdentifier); + XCTAssertEqualObjects(labels[@"user"][@"consistent_anonymous_id"], uniqueIdentifier); + return YES; + }]; + + [SRGAnalyticsTracker.sharedTracker trackEventWithName:@"Event"]; + + [self waitForExpectationsWithTimeout:20. handler:nil]; +} + - (void)testCommonLabelsForEvent { [self expectationForEventNotificationWithHandler:^BOOL(NSString *event, NSDictionary *labels) { From c6d702e9810aa1c26f905da67b079db5ea7ab1db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20De=CC=81fago?= Date: Thu, 25 Jan 2024 14:11:03 +0100 Subject: [PATCH 5/8] =?UTF-8?q?Update=20data=20provider=20to=2019.0.0?= =?UTF-8?q?=E2=80=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- Package.resolved | 4 ++-- Package.swift | 2 +- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Demo/SRGAnalytics-demo.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Demo/SRGAnalytics-demo.xcworkspace/xcshareddata/swiftpm/Package.resolved index 340aab57..8a3aaeeb 100644 --- a/Demo/SRGAnalytics-demo.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Demo/SRGAnalytics-demo.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -78,8 +78,8 @@ "repositoryURL": "https://github.com/SRGSSR/srgdataprovider-apple.git", "state": { "branch": null, - "revision": "a7380a80cab17b9c3f84e1b32d6c403b0bedc2be", - "version": "18.1.0" + "revision": "ae92436f7861651e66de5d33d2c0d1cf7d73345e", + "version": "19.0.0" } }, { diff --git a/Package.resolved b/Package.resolved index 340aab57..8a3aaeeb 100644 --- a/Package.resolved +++ b/Package.resolved @@ -78,8 +78,8 @@ "repositoryURL": "https://github.com/SRGSSR/srgdataprovider-apple.git", "state": { "branch": null, - "revision": "a7380a80cab17b9c3f84e1b32d6c403b0bedc2be", - "version": "18.1.0" + "revision": "ae92436f7861651e66de5d33d2c0d1cf7d73345e", + "version": "19.0.0" } }, { diff --git a/Package.swift b/Package.swift index 05792d9d..56528567 100644 --- a/Package.swift +++ b/Package.swift @@ -38,7 +38,7 @@ let package = Package( dependencies: [ .package(name: "ComScore", url: "https://github.com/comScore/Comscore-Swift-Package-Manager.git", .upToNextMinor(from: "6.11.0")), .package(name: "SRGContentProtection", url: "https://github.com/SRGSSR/srgcontentprotection-apple.git", .upToNextMinor(from: "3.1.0")), - .package(name: "SRGDataProvider", url: "https://github.com/SRGSSR/srgdataprovider-apple.git", .upToNextMinor(from: "18.1.0")), + .package(name: "SRGDataProvider", url: "https://github.com/SRGSSR/srgdataprovider-apple.git", .upToNextMinor(from: "19.0.0")), .package(name: "SRGIdentity", url: "https://github.com/SRGSSR/srgidentity-apple.git", .upToNextMinor(from: "3.3.0")), .package(name: "SRGLogger", url: "https://github.com/SRGSSR/srglogger-apple.git", .upToNextMinor(from: "3.1.0")), .package(name: "SRGMediaPlayer", url: "https://github.com/SRGSSR/srgmediaplayer-apple.git", .upToNextMinor(from: "7.2.0")), diff --git a/Tests/SRGAnalyticsIdentity-tests.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Tests/SRGAnalyticsIdentity-tests.xcworkspace/xcshareddata/swiftpm/Package.resolved index 785b49b5..d5b739f1 100644 --- a/Tests/SRGAnalyticsIdentity-tests.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Tests/SRGAnalyticsIdentity-tests.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -87,8 +87,8 @@ "repositoryURL": "https://github.com/SRGSSR/srgdataprovider-apple.git", "state": { "branch": null, - "revision": "a7380a80cab17b9c3f84e1b32d6c403b0bedc2be", - "version": "18.1.0" + "revision": "ae92436f7861651e66de5d33d2c0d1cf7d73345e", + "version": "19.0.0" } }, { From 4f89e4dd764573cffc9323a84efc7b509e735352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20De=CC=81fago?= Date: Thu, 25 Jan 2024 14:19:56 +0100 Subject: [PATCH 6/8] Bump version number --- Demo/Demo.xcconfig | 2 +- Package.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Demo/Demo.xcconfig b/Demo/Demo.xcconfig index 3d0257a8..7418dddb 100644 --- a/Demo/Demo.xcconfig +++ b/Demo/Demo.xcconfig @@ -1,5 +1,5 @@ // Version information -MARKETING_VERSION = 9.0.3 +MARKETING_VERSION = 9.1.0 // Deployment targets IPHONEOS_DEPLOYMENT_TARGET = 12.0 diff --git a/Package.swift b/Package.swift index 56528567..b425e466 100644 --- a/Package.swift +++ b/Package.swift @@ -3,7 +3,7 @@ import PackageDescription struct ProjectSettings { - static let marketingVersion: String = "9.0.3" + static let marketingVersion: String = "9.1.0" } let package = Package( From f21b5dbbac4c8af0672bd77dbd913ef150ff275a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20De=CC=81fago?= Date: Thu, 25 Jan 2024 14:22:43 +0100 Subject: [PATCH 7/8] Avoid warnings in 3rd party frameworks --- Demo/SRGAnalytics-demo.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Demo/SRGAnalytics-demo.xcodeproj/project.pbxproj b/Demo/SRGAnalytics-demo.xcodeproj/project.pbxproj index 3a1d3c90..bba32f46 100644 --- a/Demo/SRGAnalytics-demo.xcodeproj/project.pbxproj +++ b/Demo/SRGAnalytics-demo.xcodeproj/project.pbxproj @@ -443,6 +443,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = "$(APP_ICONS_SOURCE)"; CLANG_ANALYZER_NONNULL = YES; CLANG_ENABLE_MODULES = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = ABW92QGFZ7; GCC_NO_COMMON_BLOCKS = YES; @@ -465,6 +466,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = "$(APP_ICONS_SOURCE)"; CLANG_ANALYZER_NONNULL = YES; CLANG_ENABLE_MODULES = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ABW92QGFZ7; GCC_NO_COMMON_BLOCKS = YES; From 761d9cd6a02432f45c14e24ec9a0d36ded2e0a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20De=CC=81fago?= Date: Thu, 25 Jan 2024 14:23:35 +0100 Subject: [PATCH 8/8] Modernize project with Xcode 15.2 --- .../xcode/xcshareddata/xcschemes/SRGAnalytics-Package.xcscheme | 2 +- Demo/SRGAnalytics-demo.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/xcschemes/SRGAnalytics-demo.xcscheme | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/SRGAnalytics-Package.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/SRGAnalytics-Package.xcscheme index 2de19151..87b7209d 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/SRGAnalytics-Package.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/SRGAnalytics-Package.xcscheme @@ -1,6 +1,6 @@