Skip to content

Commit

Permalink
Merge branch 'release/3.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Dec 15, 2017
2 parents 11f8c0c + 114c72f commit e9b72e9
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 9 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.2"
github "SRGSSR/SRGMediaPlayer-iOS" "2.2.1"
github "SRGSSR/srgdataprovider-ios" "5.5.2"
github "SRGSSR/tagcommander-ios" "4.1.3_4.1.1"
github "SRGSSR/tagcommander-ios" "4.1.5_4.1.3"
github "comScore/ComScore-iOS-SDK" "92f34897cd7659d56bb5a3e9e85b808cf3758bda"
4 changes: 2 additions & 2 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.2"
github "SRGSSR/SRGMediaPlayer-iOS" "2.2.1"
github "SRGSSR/libextobjc" "46f179fbba8dde2a3eb3da284919789b78aac441"
github "SRGSSR/srgdataprovider-ios" "5.5.2"
github "SRGSSR/srglogger-ios" "1.0"
github "SRGSSR/tagcommander-ios" "4.1.3_4.1.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: 6 additions & 0 deletions Documentation/Getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,9 @@ Correctly conforming to all SRG SSR guidelines is not a trivial task, though. Pl
## Thread-safety
The library is intended to be used from the main thread only. Trying to use if from background threads results in undefined behavior.
## App Transport Security (ATS)
In a near future, Apple will favor HTTPS over HTTP, and require applications to explicitly declare potentially insecure connections. These guidelines are referred to as [App Transport Security (ATS)](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33).
For information about how you should configure your application to access our services, please refer to the dedicated [SRG Data Provider wiki topic](https://github.com/SRGSSR/srgdataprovider-ios/wiki/App-Transport-Security-(ATS)).
1 change: 1 addition & 0 deletions Framework/Sources/Core/SRGAnalyticsTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ - (void)startTagCommanderTrackerWithConfiguration:(SRGAnalyticsConfiguration *)c
{
if (! configuration.unitTesting) {
self.tagCommander = [[TagCommander alloc] initWithSiteID:(int)configuration.site andContainerID:(int)configuration.container];
[self.tagCommander enableRunningInBackground];
[self.tagCommander addPermanentData:@"app_library_version" withValue:SRGAnalyticsMarketingVersion()];
[self.tagCommander addPermanentData:@"navigation_app_site_name" withValue:configuration.comScoreVirtualSite];
[self.tagCommander addPermanentData:@"navigation_environment" withValue:[NSBundle srg_isProductionVersion] ? @"prod" : @"preprod"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ - (SRGRequest *)loadMediaComposition:(SRGMediaComposition *)mediaComposition
orderedStreamTypes = [[orderedStreamTypes mtl_arrayByRemovingObject:@(streamType)] arrayByAddingObject:@(streamType)];
}

NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@keypath(SRGResource.new, streamType) ascending:NO comparator:^(NSNumber * _Nonnull streamType1, NSNumber * _Nonnull streamType2) {
NSSortDescriptor *streamTypeSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@keypath(SRGResource.new, streamType) ascending:NO comparator:^(NSNumber * _Nonnull streamType1, NSNumber * _Nonnull streamType2) {
// Don't simply compare enum values as integers since their order might change.
NSUInteger index1 = [orderedStreamTypes indexOfObject:streamType1];
NSUInteger index2 = [orderedStreamTypes indexOfObject:streamType2];
Expand All @@ -98,7 +98,32 @@ - (SRGRequest *)loadMediaComposition:(SRGMediaComposition *)mediaComposition
return NSOrderedDescending;
}
}];
resources = [resources sortedArrayUsingDescriptors:@[sortDescriptor]];

NSSortDescriptor *URLSchemeSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@keypath(SRGResource.new, URL) ascending:NO comparator:^NSComparisonResult(NSURL * _Nonnull URL1, NSURL * _Nonnull URL2) {
// Only declare ordering for important URL schemes. For other schemes the initial order will be preserved
NSArray<NSString *> *orderedURLSchemes = @[@"http", @"https"];

NSUInteger index1 = [orderedURLSchemes indexOfObject:URL1.scheme];
NSUInteger index2 = [orderedURLSchemes indexOfObject:URL2.scheme];
if (index1 == index2) {
return NSOrderedSame;
}
// Unknown scheme < known scheme
else if (index1 == NSNotFound) {
return NSOrderedAscending;
}
// Known scheme > unknown scheme
else if (index2 == NSNotFound) {
return NSOrderedDescending;
}
else if (index1 < index2) {
return NSOrderedAscending;
}
else {
return NSOrderedDescending;
}
}];
resources = [resources sortedArrayUsingDescriptors:@[streamTypeSortDescriptor, URLSchemeSortDescriptor]];

// Resources are initially ordered by quality (see `-resourcesForStreamingMethod:` documentation), and this order
// is kept stable by the stream type sort descriptor above. We therefore attempt to find a proper match for the specified
Expand Down
4 changes: 2 additions & 2 deletions SRGAnalytics.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MARKETING_VERSION = 3.2;
MARKETING_VERSION = 3.2.1;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
Expand Down Expand Up @@ -1252,7 +1252,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MARKETING_VERSION = 3.2;
MARKETING_VERSION = 3.2.1;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
Expand Down
21 changes: 20 additions & 1 deletion Tests/Sources/DataProviderTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ - (void)testPlay360InMediaComposition
{
[self expectationForHiddenEventNotificationWithHandler:^BOOL(NSString *event, NSDictionary *labels) {
XCTAssertEqualObjects(labels[@"event_id"], @"play");
XCTAssertEqualObjects(labels[@"media_segment"], @"360 Gothard");
XCTAssertEqualObjects(labels[@"media_urn"], @"urn:rts:video:8414077");
return YES;
}];
Expand Down Expand Up @@ -690,4 +689,24 @@ - (void)testNonExistingQuality
XCTAssertEqual(self.mediaPlayerController.quality, SRGQualityHD);
}

- (void)testPreferHTTPSResources
{
XCTestExpectation *expectation = [self expectationWithDescription:@"Ready to play"];

// The following audio has two equivalent resources for the playback default settings (one in HTTP, the other in HTTPS). The order of these resources in the JSON is not reliable,
// but we want to select always the HTTPS resource first
SRGDataProvider *dataProvider = [[SRGDataProvider alloc] initWithServiceURL:ServiceTestURL() businessUnitIdentifier:SRGDataProviderBusinessUnitIdentifierSRF];
[[dataProvider audioMediaCompositionWithUid:@"d7dd9454-23c8-4160-81ff-ace459dd53c0" chaptersOnly:NO completionBlock:^(SRGMediaComposition * _Nullable mediaComposition, NSError * _Nullable error) {
XCTAssertNotNil(mediaComposition);

[self.mediaPlayerController playMediaComposition:mediaComposition withPreferredStreamingMethod:SRGStreamingMethodNone streamType:SRGStreamTypeNone quality:SRGQualityNone startBitRate:0 userInfo:nil resume:YES completionHandler:^(NSError * _Nonnull error) {
[expectation fulfill];
}];
}] resume];

[self waitForExpectationsWithTimeout:20. handler:nil];

XCTAssertEqualObjects(self.mediaPlayerController.contentURL.scheme, @"https");
}

@end

0 comments on commit e9b72e9

Please sign in to comment.