Skip to content

Commit

Permalink
Merge branch 'release/3.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Apr 13, 2018
2 parents ef0ce41 + 51f5bb0 commit fd9d83e
Show file tree
Hide file tree
Showing 13 changed files with 249 additions and 84 deletions.
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "SRGSSR/SRGMediaPlayer-iOS" "2.3"
github "SRGSSR/srgdataprovider-ios" "5.6.1"
github "SRGSSR/SRGMediaPlayer-iOS" "2.3.1"
github "SRGSSR/srgdataprovider-ios" "6.0"
github "SRGSSR/tagcommander-ios" "4.1.5_4.1.3"
github "comScore/ComScore-iOS-SDK" "92f34897cd7659d56bb5a3e9e85b808cf3758bda"
6 changes: 3 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
github "Mantle/Mantle" "2.1.0"
github "SRGSSR/MAKVONotificationCenter" "d5af67218b3b7b49660a43edef5e6eb9c437d670"
github "SRGSSR/SRGMediaPlayer-iOS" "2.3"
github "SRGSSR/SRGMediaPlayer-iOS" "2.3.1"
github "SRGSSR/libextobjc" "46f179fbba8dde2a3eb3da284919789b78aac441"
github "SRGSSR/srgdataprovider-ios" "5.6.1"
github "SRGSSR/srglogger-ios" "1.0.1"
github "SRGSSR/srgdataprovider-ios" "6.0"
github "SRGSSR/srglogger-ios" "1.0.2"
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: 0 additions & 6 deletions Demo/Sources/Simple/SimpleViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,4 @@ NS_ASSUME_NONNULL_BEGIN

@end

@interface SimpleViewController (Unavailable)

- (instancetype)init NS_UNAVAILABLE;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ withAnalyticsLabels:(nullable SRGAnalyticsStreamLabels *)analyticsLabels
*/
@property (nonatomic, getter=isTracked) BOOL tracked;

/**
* The analytics player name label associated with the player.
*
* @discussion Default value is `SRGMediaPlayer`.
*/
@property (nonatomic, copy, null_resettable) NSString *analyticsPlayerName;

/**
* The analytics player version label associated with the player.
*
* @discussion Default value is `SRGMediaPlayerMarketingVersion()`.
*/
@property (nonatomic, copy, null_resettable) NSString *analyticsPlayerVersion;

/**
* The analytics labels associated with the playback.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#import <objc/runtime.h>

static void *s_trackedKey = &s_trackedKey;
static void *s_analyticsPlayerNameKey = &s_analyticsPlayerNameKey;
static void *s_analyticsPlayerVersionKey = &s_analyticsPlayerVersionKey;

@implementation SRGMediaPlayerController (SRGAnalytics_MediaPlayer)

Expand Down Expand Up @@ -84,6 +86,28 @@ - (void)setTracked:(BOOL)tracked
objc_setAssociatedObject(self, s_trackedKey, @(tracked), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (NSString *)analyticsPlayerName
{
NSString *analyticsPlayerName = objc_getAssociatedObject(self, s_analyticsPlayerNameKey);
return analyticsPlayerName ?: @"SRGMediaPlayer";
}

- (void)setAnalyticsPlayerName:(NSString *)analyticsPlayerName
{
objc_setAssociatedObject(self, s_analyticsPlayerNameKey, analyticsPlayerName, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (NSString *)analyticsPlayerVersion
{
NSString *analyticsPlayerVersion = objc_getAssociatedObject(self, s_analyticsPlayerVersionKey);
return analyticsPlayerVersion ?: SRGMediaPlayerMarketingVersion();
}

- (void)setAnalyticsPlayerVersion:(NSString *)analyticsPlayerVersion
{
objc_setAssociatedObject(self, s_analyticsPlayerVersionKey, analyticsPlayerVersion, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (SRGAnalyticsStreamLabels *)analyticsLabels
{
return self.userInfo[SRGAnalyticsMediaPlayerLabelsKey];
Expand Down
9 changes: 7 additions & 2 deletions Framework_MediaPlayer/Sources/SRGMediaPlayerTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,17 @@ - (id)initWithMediaPlayerController:(SRGMediaPlayerController *)mediaPlayerContr
return self;
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"

- (id)init
{
[self doesNotRecognizeSelector:_cmd];
return [self initWithMediaPlayerController:nil];
}

#pragma clang diagnostic pop

#pragma mark Tracking

- (void)start
Expand Down Expand Up @@ -139,8 +144,8 @@ - (void)updateWithState:(SRGAnalyticsStreamState)state position:(NSTimeInterval)
- (SRGAnalyticsStreamLabels *)labelsWithSegment:(id<SRGSegment>)segment userInfo:(NSDictionary *)userInfo
{
SRGAnalyticsStreamLabels *playerLabels = [[SRGAnalyticsStreamLabels alloc] init];
playerLabels.playerName = @"SRGMediaPlayer";
playerLabels.playerVersion = SRGMediaPlayerMarketingVersion();
playerLabels.playerName = self.mediaPlayerController.analyticsPlayerName;
playerLabels.playerVersion = self.mediaPlayerController.analyticsPlayerVersion;

AVPlayerItem *playerItem = self.mediaPlayerController.player.currentItem;
AVMediaSelectionGroup *legibleGroup = [playerItem.asset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];
Expand Down
10 changes: 7 additions & 3 deletions SRGAnalytics.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = SRG;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "SRG SSR";
TargetAttributes = {
6FB331E51D9BFB00001469F2 = {
Expand Down Expand Up @@ -1174,12 +1174,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -1209,7 +1211,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MARKETING_VERSION = 3.3.1;
MARKETING_VERSION = 3.3.2;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
Expand All @@ -1228,12 +1230,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand All @@ -1256,7 +1260,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MARKETING_VERSION = 3.3.1;
MARKETING_VERSION = 3.3.2;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
Expand Down Expand Up @@ -54,8 +54,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down
12 changes: 6 additions & 6 deletions Tests/Sources/ComScoreDataProviderTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ - (void)testPrepareToPlayMediaComposition
{
XCTestExpectation *expectation = [self expectationWithDescription:@"Ready to play"];

SRGDataProvider *dataProvider = [[SRGDataProvider alloc] initWithServiceURL:ServiceTestURL() businessUnitIdentifier:SRGDataProviderBusinessUnitIdentifierSWI];
[[dataProvider videoMediaCompositionWithUid:@"42297626" chaptersOnly:NO completionBlock:^(SRGMediaComposition * _Nullable mediaComposition, NSError * _Nullable error) {
SRGDataProvider *dataProvider = [[SRGDataProvider alloc] initWithServiceURL:ServiceTestURL()];
[[dataProvider mediaCompositionForURN:@"urn:swi:video:42297626" standalone:NO withCompletionBlock:^(SRGMediaComposition * _Nullable mediaComposition, NSError * _Nullable error) {
XCTAssertNotNil(mediaComposition);

[self.mediaPlayerController prepareToPlayMediaComposition:mediaComposition withPreferredStreamingMethod:SRGStreamingMethodNone streamType:SRGStreamTypeNone quality:SRGQualityHD startBitRate:0 userInfo:nil resume:YES completionHandler:^(NSError * _Nonnull error) {
Expand Down Expand Up @@ -73,8 +73,8 @@ - (void)testPlayMediaComposition
{
XCTestExpectation *expectation = [self expectationWithDescription:@"Ready to play"];

SRGDataProvider *dataProvider = [[SRGDataProvider alloc] initWithServiceURL:ServiceTestURL() businessUnitIdentifier:SRGDataProviderBusinessUnitIdentifierSWI];
[[dataProvider videoMediaCompositionWithUid:@"42297626" chaptersOnly:NO completionBlock:^(SRGMediaComposition * _Nullable mediaComposition, NSError * _Nullable error) {
SRGDataProvider *dataProvider = [[SRGDataProvider alloc] initWithServiceURL:ServiceTestURL()];
[[dataProvider mediaCompositionForURN:@"urn:swi:video:42297626" standalone:NO withCompletionBlock:^(SRGMediaComposition * _Nullable mediaComposition, NSError * _Nullable error) {
XCTAssertNotNil(mediaComposition);

[self.mediaPlayerController playMediaComposition:mediaComposition withPreferredStreamingMethod:SRGStreamingMethodNone streamType:SRGStreamTypeNone quality:SRGQualityHD startBitRate:0 userInfo:nil resume:YES completionHandler:^(NSError * _Nonnull error) {
Expand All @@ -99,8 +99,8 @@ - (void)testPlaySegmentInMediaComposition
return YES;
}];

SRGDataProvider *dataProvider = [[SRGDataProvider alloc] initWithServiceURL:ServiceTestURL() businessUnitIdentifier:SRGDataProviderBusinessUnitIdentifierSRF];
[[dataProvider videoMediaCompositionWithUid:@"985aa94a-587c-494e-b484-3cd746032264" chaptersOnly:NO completionBlock:^(SRGMediaComposition * _Nullable mediaComposition, NSError * _Nullable error) {
SRGDataProvider *dataProvider = [[SRGDataProvider alloc] initWithServiceURL:ServiceTestURL()];
[[dataProvider mediaCompositionForURN:@"urn:srf:video:985aa94a-587c-494e-b484-3cd746032264" standalone:NO withCompletionBlock:^(SRGMediaComposition * _Nullable mediaComposition, NSError * _Nullable error) {
XCTAssertNotNil(mediaComposition);

[self.mediaPlayerController playMediaComposition:mediaComposition withPreferredStreamingMethod:SRGStreamingMethodNone streamType:SRGStreamTypeNone quality:SRGQualityHD startBitRate:0 userInfo:nil resume:YES completionHandler:^(NSError * _Nonnull error) {
Expand Down
59 changes: 59 additions & 0 deletions Tests/Sources/ComScoreMediaPlayerTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,59 @@ - (void)testCommonLabels
[self waitForExpectationsWithTimeout:20. handler:nil];
}

- (void)testCommonLabelsOverride
{
[self expectationForComScoreHiddenEventNotificationWithHandler:^BOOL(NSString *event, NSDictionary *labels) {
XCTAssertEqualObjects(labels[@"ns_st_ev"], @"play");
XCTAssertEqualObjects(labels[@"ns_st_mp"], @"CustomPlayer");
XCTAssertEqualObjects(labels[@"ns_st_mv"], @"1.0");
return YES;
}];

self.mediaPlayerController.analyticsPlayerName = @"CustomPlayer";
self.mediaPlayerController.analyticsPlayerVersion = @"1.0";

[self.mediaPlayerController playURL:OnDemandTestURL()];

[self waitForExpectationsWithTimeout:20. handler:nil];

[self expectationForComScoreHiddenEventNotificationWithHandler:^BOOL(NSString *event, NSDictionary *labels) {
XCTAssertEqualObjects(labels[@"ns_st_ev"], @"end");
XCTAssertEqualObjects(labels[@"ns_st_mp"], @"CustomPlayer");
XCTAssertEqualObjects(labels[@"ns_st_mv"], @"1.0");
return YES;
}];

[self.mediaPlayerController reset];

[self waitForExpectationsWithTimeout:20. handler:nil];

[self expectationForComScoreHiddenEventNotificationWithHandler:^BOOL(NSString *event, NSDictionary *labels) {
XCTAssertEqualObjects(labels[@"ns_st_ev"], @"play");
XCTAssertEqualObjects(labels[@"ns_st_mp"], @"CustomPlayer");
XCTAssertEqualObjects(labels[@"ns_st_mv"], @"1.0");
return YES;
}];

[self.mediaPlayerController playURL:OnDemandTestURL()];

[self waitForExpectationsWithTimeout:20. handler:nil];

[self expectationForComScoreHiddenEventNotificationWithHandler:^BOOL(NSString *event, NSDictionary *labels) {
XCTAssertEqualObjects(labels[@"ns_st_ev"], @"end");
XCTAssertEqualObjects(labels[@"ns_st_mp"], @"SRGMediaPlayer");
XCTAssertEqualObjects(labels[@"ns_st_mv"], SRGMediaPlayerMarketingVersion());
return YES;
}];

self.mediaPlayerController.analyticsPlayerName = nil;
self.mediaPlayerController.analyticsPlayerVersion = nil;

[self.mediaPlayerController reset];

[self waitForExpectationsWithTimeout:20. handler:nil];
}

- (void)testOnDemandLabels
{
// Check that these labels are constant between states (for some, the value might differ, but they must
Expand Down Expand Up @@ -372,6 +425,12 @@ - (void)testOnDemandLabels

- (void)testLiveLabels
{
// FIXME: See https://github.com/SRGSSR/SRGMediaPlayer-iOS/issues/50. Workaround so that the test passes on iOS 11.3.
NSOperatingSystemVersion operatingSystemVersion = [NSProcessInfo processInfo].operatingSystemVersion;
if (operatingSystemVersion.majorVersion == 11 && operatingSystemVersion.minorVersion == 3) {
self.mediaPlayerController.minimumDVRWindowLength = 40.;
}

// Check that these labels are constant between states (for some, the value might differ, but they must
// in which case we test they are constantly availble or unavailable)
void (^checkMainLabels)(NSDictionary *) = ^(NSDictionary *labels) {
Expand Down
Loading

0 comments on commit fd9d83e

Please sign in to comment.