Skip to content

Commit

Permalink
Merge branch 'release/3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Sep 28, 2018
2 parents d8ec851 + 33855e9 commit 2cff065
Show file tree
Hide file tree
Showing 45 changed files with 429 additions and 358 deletions.
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*.xcscmblueprint
xcuserdata

archive
build
/archive
/build

Carthage
Cartfile.private
Cartfile.resolved
/Carthage
/Cartfile.private
/Cartfile.resolved

fastlane/report.xml
fastlane/test_output
/fastlane/report.xml
/fastlane/test_output
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "SRGSSR/srgdataprovider-ios" "6.2.1"
github "SRGSSR/SRGMediaPlayer-iOS" "2.5.1"
github "SRGSSR/srgdataprovider-ios" "6.3"
github "SRGSSR/SRGMediaPlayer-iOS" "2.5.2"
github "SRGSSR/tagcommander-ios" "4.1.5_4.1.3"
github "comScore/ComScore-iOS-SDK" "92f34897cd7659d56bb5a3e9e85b808cf3758bda"
2 changes: 1 addition & 1 deletion Cartfile.private.proprietary
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "SRGSSR/srgcontentprotection-ios" "1.0.1"
github "SRGSSR/srgcontentprotection-ios" "1.1"
1 change: 1 addition & 0 deletions Cartfile.private.public
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "SRGSSR/srgcontentprotection-fake-ios" "1.1"
11 changes: 6 additions & 5 deletions Cartfile.resolved.proprietary
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
github "Mantle/Mantle" "2.1.0"
github "SRGSSR/MAKVONotificationCenter" "1.0_srg2"
github "SRGSSR/SRGMediaPlayer-iOS" "2.5.1"
github "SRGSSR/SRGMediaPlayer-iOS" "2.5.2"
github "SRGSSR/libextobjc" "0.6_srg1"
github "SRGSSR/srgcontentprotection-ios" "1.0.1"
github "SRGSSR/srgdataprovider-ios" "6.2.1"
github "SRGSSR/srglogger-ios" "1.0.6"
github "SRGSSR/srgnetwork-ios" "0.2"
github "SRGSSR/srgcontentprotection-ios" "1.1"
github "SRGSSR/srgdataprovider-ios" "6.3"
github "SRGSSR/srgdiagnostics-ios" "1.0"
github "SRGSSR/srglogger-ios" "1.0.7"
github "SRGSSR/srgnetwork-ios" "0.2.1"
github "SRGSSR/tagcommander-ios" "4.1.5_4.1.3"
github "comScore/ComScore-iOS-SDK" "92f34897cd7659d56bb5a3e9e85b808cf3758bda"
github "kif-framework/KIF" "v3.6.0"
10 changes: 6 additions & 4 deletions Cartfile.resolved.public
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
github "Mantle/Mantle" "2.1.0"
github "SRGSSR/MAKVONotificationCenter" "1.0_srg2"
github "SRGSSR/SRGMediaPlayer-iOS" "2.5.1"
github "SRGSSR/SRGMediaPlayer-iOS" "2.5.2"
github "SRGSSR/libextobjc" "0.6_srg1"
github "SRGSSR/srgdataprovider-ios" "6.2.1"
github "SRGSSR/srglogger-ios" "1.0.6"
github "SRGSSR/srgnetwork-ios" "0.2"
github "SRGSSR/srgcontentprotection-fake-ios" "1.1"
github "SRGSSR/srgdataprovider-ios" "6.3"
github "SRGSSR/srgdiagnostics-ios" "1.0"
github "SRGSSR/srglogger-ios" "1.0.7"
github "SRGSSR/srgnetwork-ios" "0.2.1"
github "SRGSSR/tagcommander-ios" "4.1.5_4.1.3"
github "comScore/ComScore-iOS-SDK" "92f34897cd7659d56bb5a3e9e85b808cf3758bda"
github "kif-framework/KIF" "v3.6.0"
6 changes: 3 additions & 3 deletions Demo/Sources/Application/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ @implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor blackColor];
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
self.window.backgroundColor = UIColor.blackColor;
[self.window makeKeyAndVisible];

[SRGLogger setLogHandler:SRGNSLogHandler()];
Expand All @@ -34,7 +34,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
comScoreVirtualSite:@"rts-app-test-v"
netMetrixIdentifier:@"test"];
configuration.unitTesting = (NSClassFromString(@"XCTestCase") != Nil);
[[SRGAnalyticsTracker sharedTracker] startWithConfiguration:configuration];
[SRGAnalyticsTracker.sharedTracker startWithConfiguration:configuration];

DemosViewController *demosViewController = [[DemosViewController alloc] init];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:demosViewController];
Expand Down
2 changes: 1 addition & 1 deletion Demo/Sources/Application/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
return UIApplicationMain(argc, argv, nil, NSStringFromClass(AppDelegate.class));
}
}
2 changes: 1 addition & 1 deletion Demo/Sources/Demos/DemosViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ @implementation DemosViewController

- (instancetype)init
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:NSStringFromClass([self class]) bundle:nil];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:NSStringFromClass(self.class) bundle:nil];
return [storyboard instantiateInitialViewController];
}

Expand Down
2 changes: 1 addition & 1 deletion Demo/Sources/Simple/SimpleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ - (instancetype)initWithTitle:(NSString *)title
openedFromPushNotification:(BOOL)openedFromPushNotification
trackedAutomatically:(BOOL)trackedAutomatically
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:NSStringFromClass([self class]) bundle:nil];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:NSStringFromClass(self.class) bundle:nil];
SimpleViewController *viewController = [storyboard instantiateInitialViewController];
viewController.title = title;
viewController.levels = levels;
Expand Down
6 changes: 3 additions & 3 deletions DemoTests/Sources/ComScoreViewEventTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ - (void)testAutomaticTracking
[tester tapRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] inTableViewWithAccessibilityIdentifier:@"tableView"];

[self waitForExpectationsWithTimeout:5. handler:nil];

[tester tapViewWithAccessibilityLabel:@"Back"];
[tester waitForTimeInterval:2.];
}
Expand Down Expand Up @@ -196,7 +196,7 @@ - (void)testManualTracking

- (void)testMissingTitle
{
id eventObserver = [[NSNotificationCenter defaultCenter] addObserverForName:SRGAnalyticsComScoreRequestNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
id eventObserver = [NSNotificationCenter.defaultCenter addObserverForName:SRGAnalyticsComScoreRequestNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
XCTFail(@"No event must be sent when the title is empty");
}];

Expand All @@ -205,7 +205,7 @@ - (void)testMissingTitle
[tester tapRowAtIndexPath:[NSIndexPath indexPathForRow:5 inSection:0] inTableViewWithAccessibilityIdentifier:@"tableView"];

[self waitForExpectationsWithTimeout:5. handler:^(NSError * _Nullable error) {
[[NSNotificationCenter defaultCenter] removeObserver:eventObserver];
[NSNotificationCenter.defaultCenter removeObserver:eventObserver];
}];

[tester tapViewWithAccessibilityLabel:@"Back"];
Expand Down
6 changes: 3 additions & 3 deletions DemoTests/Sources/ViewEventTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ - (void)testAutomaticTracking
[tester tapRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] inTableViewWithAccessibilityIdentifier:@"tableView"];

[self waitForExpectationsWithTimeout:5. handler:nil];

[tester tapViewWithAccessibilityLabel:@"Back"];
[tester waitForTimeInterval:2.];
}
Expand Down Expand Up @@ -174,7 +174,7 @@ - (void)testManualTracking

- (void)testMissingTitle
{
id eventObserver = [[NSNotificationCenter defaultCenter] addObserverForName:SRGAnalyticsRequestNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
id eventObserver = [NSNotificationCenter.defaultCenter addObserverForName:SRGAnalyticsRequestNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
XCTFail(@"No event must be sent when the title is empty");
}];

Expand All @@ -183,7 +183,7 @@ - (void)testMissingTitle
[tester tapRowAtIndexPath:[NSIndexPath indexPathForRow:5 inSection:0] inTableViewWithAccessibilityIdentifier:@"tableView"];

[self waitForExpectationsWithTimeout:5. handler:^(NSError * _Nullable error) {
[[NSNotificationCenter defaultCenter] removeObserver:eventObserver];
[NSNotificationCenter.defaultCenter removeObserver:eventObserver];
}];

[tester tapViewWithAccessibilityLabel:@"Back"];
Expand Down
16 changes: 8 additions & 8 deletions Framework/Sources/Core/SRGAnalyticsConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ - (NSInteger)site
static dispatch_once_t s_onceToken;
dispatch_once(&s_onceToken, ^{
s_sites = @{ SRGAnalyticsBusinessUnitIdentifierRSI : @3668,
SRGAnalyticsBusinessUnitIdentifierRTR : @3666, // Under the SRG umbrella
SRGAnalyticsBusinessUnitIdentifierRTS : @3669,
SRGAnalyticsBusinessUnitIdentifierSRF : @3667,
SRGAnalyticsBusinessUnitIdentifierSRG : @3666,
SRGAnalyticsBusinessUnitIdentifierSWI : @3670 };
SRGAnalyticsBusinessUnitIdentifierRTR : @3666, // Under the SRG umbrella
SRGAnalyticsBusinessUnitIdentifierRTS : @3669,
SRGAnalyticsBusinessUnitIdentifierSRF : @3667,
SRGAnalyticsBusinessUnitIdentifierSRG : @3666,
SRGAnalyticsBusinessUnitIdentifierSWI : @3670 };
});

NSString *businessUnitIdentifier = self.centralized ? SRGAnalyticsBusinessUnitIdentifierSRG : self.businessUnitIdentifier;
Expand All @@ -79,7 +79,7 @@ - (NSString *)netMetrixDomain

- (id)copyWithZone:(NSZone *)zone
{
SRGAnalyticsConfiguration *configuration = [[self class] allocWithZone:zone];
SRGAnalyticsConfiguration *configuration = [self.class allocWithZone:zone];
configuration.businessUnitIdentifier = self.businessUnitIdentifier;
configuration.container = self.container;
configuration.comScoreVirtualSite = self.comScoreVirtualSite;
Expand All @@ -93,8 +93,8 @@ - (id)copyWithZone:(NSZone *)zone

- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p; businessUnitIdentifier: %@; site: %@; container: %@; comScoreVurtualSite: %@; netMetrixIdentifier: %@>",
[self class],
return [NSString stringWithFormat:@"<%@: %p; businessUnitIdentifier = %@; site = %@; container = %@; comScoreVurtualSite = %@; netMetrixIdentifier = %@>",
self.class,
self,
self.businessUnitIdentifier,
@(self.site),
Expand Down
8 changes: 4 additions & 4 deletions Framework/Sources/Core/SRGAnalyticsLabels.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ @implementation SRGAnalyticsLabels

- (id)copyWithZone:(NSZone *)zone
{
SRGAnalyticsLabels *labels = [[[self class] allocWithZone:zone] init];
SRGAnalyticsLabels *labels = [[self.class allocWithZone:zone] init];
labels.customInfo = self.customInfo;
labels.comScoreCustomInfo = self.comScoreCustomInfo;
return labels;
Expand All @@ -44,7 +44,7 @@ - (id)copyWithZone:(NSZone *)zone

- (BOOL)isEqual:(id)object
{
if (! object || ! [object isKindOfClass:[self class]]) {
if (! [object isKindOfClass:self.class]) {
return NO;
}

Expand All @@ -62,8 +62,8 @@ - (NSUInteger)hash

- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p; labelsDictionary: %@; comScoreLabelsDictionary: %@>",
[self class],
return [NSString stringWithFormat:@"<%@: %p; labelsDictionary = %@; comScoreLabelsDictionary = %@>",
self.class,
self,
self.labelsDictionary,
self.comScoreLabelsDictionary];
Expand Down
16 changes: 8 additions & 8 deletions Framework/Sources/Core/SRGAnalyticsNetMetrixTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,28 @@ - (void)trackView

// The app language must be sent, not the device language. This is sadly not documented in https://www.net-metrix.ch/fr/service/directives/directives-supplementaires-pour-les-applications,
// but this information was obtained from a NetMetrix technician.
[request setValue:[NSBundle mainBundle].preferredLocalizations.firstObject forHTTPHeaderField:@"Accept-Language"];
[request setValue:NSBundle.mainBundle.preferredLocalizations.firstObject forHTTPHeaderField:@"Accept-Language"];

SRGAnalyticsLogDebug(@"NetMetrix", @"Request %@ started", request.URL);
[[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
SRGAnalyticsLogDebug(@"NetMetrix", @"Request %@ ended with error %@", request.URL, error);
}] resume];
}
else {
[[NSNotificationCenter defaultCenter] postNotificationName:SRGAnalyticsNetmetrixRequestNotification
object:nil
userInfo:@{ SRGAnalyticsNetmetrixURLKey : netMetrixURL }];
[NSNotificationCenter.defaultCenter postNotificationName:SRGAnalyticsNetmetrixRequestNotification
object:nil
userInfo:@{ SRGAnalyticsNetmetrixURLKey : netMetrixURL }];
}
}

#pragma mark Information

- (NSString *)device
{
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
return @"phone";
}
else if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
else if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
return @"tablet";
}
else {
Expand All @@ -88,10 +88,10 @@ - (NSString *)device

- (NSString *)operatingSystem
{
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
return @"iPhone OS";
}
else if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
else if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
return @"iPad OS";
}
else {
Expand Down
2 changes: 1 addition & 1 deletion Framework/Sources/Core/SRGAnalyticsStreamLabels.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ @implementation SRGAnalyticsStreamLabels
{
NSMutableDictionary<NSString *, NSString *> *dictionary = [NSMutableDictionary dictionary];

[dictionary srg_safelySetString:[NSBundle srg_isProductionVersion] ? @"prod" : @"preprod" forKey:@"media_embedding_environment"];
[dictionary srg_safelySetString:NSBundle.srg_isProductionVersion ? @"prod" : @"preprod" forKey:@"media_embedding_environment"];

[dictionary srg_safelySetString:self.playerName forKey:@"media_player_display"];
[dictionary srg_safelySetString:self.playerVersion forKey:@"media_player_version"];
Expand Down
4 changes: 2 additions & 2 deletions Framework/Sources/Core/SRGAnalyticsStreamTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ - (void)updateTagCommanderWithStreamState:(SRGAnalyticsStreamState)state
// Restore the heartbeat timer when transitioning to play again.
if (state == SRGAnalyticsStreamStatePlaying) {
if (! self.heartbeatTimer) {
SRGAnalyticsConfiguration *configuration = [SRGAnalyticsTracker sharedTracker].configuration;
SRGAnalyticsConfiguration *configuration = SRGAnalyticsTracker.sharedTracker.configuration;
NSTimeInterval heartbeatInterval = configuration.unitTesting ? 3. : 30.;
self.heartbeatTimer = [NSTimer scheduledTimerWithTimeInterval:heartbeatInterval
target:self
Expand Down Expand Up @@ -206,7 +206,7 @@ - (void)trackTagCommanderMediaPlayerEventWithUid:(NSString *)eventUid withPositi
[fullLabelsDictionary addEntriesFromDictionary:labelsDictionary];
}

[[SRGAnalyticsTracker sharedTracker] trackTagCommanderEventWithLabels:[fullLabelsDictionary copy]];
[SRGAnalyticsTracker.sharedTracker trackTagCommanderEventWithLabels:[fullLabelsDictionary copy]];
}

#pragma mark Playback duration
Expand Down
2 changes: 1 addition & 1 deletion Framework/Sources/Core/SRGAnalyticsTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* The tracker singleton.
*/
+ (instancetype)sharedTracker;
@property (class, nonatomic, readonly) SRGAnalyticsTracker *sharedTracker;

/**
* Start the tracker. This is required to specify for which business unit you are tracking events, as well as to
Expand Down
Loading

0 comments on commit 2cff065

Please sign in to comment.