Skip to content

Commit

Permalink
Merge branch 'release/9.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Jan 25, 2024
2 parents 45343b6 + 761d9cd commit 0e48e8e
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
LastUpgradeVersion = "1520"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion .xcode-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15.0
15.0.1
2 changes: 1 addition & 1 deletion Demo/Demo.xcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Version information
MARKETING_VERSION = 9.0.2
MARKETING_VERSION = 9.1.0

// Deployment targets
IPHONEOS_DEPLOYMENT_TARGET = 12.0
Expand Down
4 changes: 3 additions & 1 deletion Demo/SRGAnalytics-demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
CLASSPREFIX = SRG;
LastUpgradeCheck = 1500;
LastUpgradeCheck = 1520;
ORGANIZATIONNAME = "SRG SSR";
TargetAttributes = {
E6FC7E871D61F95C00A55085 = {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down Expand Up @@ -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"
}
},
{
Expand Down
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down Expand Up @@ -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"
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import PackageDescription

struct ProjectSettings {
static let marketingVersion: String = "9.0.2"
static let marketingVersion: String = "9.1.0"
}

let package = Package(
Expand Down Expand Up @@ -38,11 +38,11 @@ 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")),
.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(
Expand Down
31 changes: 29 additions & 2 deletions Sources/SRGAnalytics/SRGAnalyticsTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -172,7 +176,7 @@ - (void)startCommandersActWithConfiguration:(SRGAnalyticsConfiguration *)configu
return labels.copy;
}

- (SRGAnalyticsLabels *)dataSourceLabels
- (SRGAnalyticsLabels *)dataSourceLabels
{
return self.dataSource.srg_globalLabels;
}
Expand All @@ -197,7 +201,10 @@ - (NSString *)pageIdWithTitle:(NSString *)title levels:(NSArray<NSString *> *)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) {
Expand All @@ -211,6 +218,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down Expand Up @@ -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"
}
},
{
Expand Down
5 changes: 4 additions & 1 deletion Tests/SRGAnalyticsTests/MediaPlayerTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}];

Expand Down
21 changes: 21 additions & 0 deletions Tests/SRGAnalyticsTests/TrackerTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#import "TrackerSingletonSetup.h"
#import "XCTestCase+Tests.h"

@import TCServerSide_noIDFA;

@interface TrackerTestCase : XCTestCase

@end
Expand All @@ -33,10 +35,26 @@ - (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) {
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;
}];
Expand All @@ -49,7 +67,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;
}];

Expand Down
2 changes: 1 addition & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e48e8e

Please sign in to comment.