Skip to content

Commit

Permalink
Merge branch 'release/0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Feb 16, 2017
2 parents 5ad4a21 + 8c152bc commit df78e67
Show file tree
Hide file tree
Showing 61 changed files with 3,165 additions and 1,792 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Carthage
xcuserdata
.DS_Store
*.xcscmblueprint
*.xcscmblueprint
report.xml
3 changes: 2 additions & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
github "ashaman/libextobjc" "e24f2be3af2cf7fc88a78295f116ef98d0832bcf"
github "ibireme/YYWebImage" ~> 1.0.4
github "SnapKit/Masonry" ~> 1.0.2
github "SRGSSR/ASValueTrackingSlider" "840137273ef2b66abfd3db304e4ac7c93ab31568"
github "SRGSSR/ASValueTrackingSlider" "e3a7efddc2ce1f4c1e830740be6221f5b3f1c4fe"
github "SRGSSR/MAKVONotificationCenter" "4a127e52997889729286510103f7e27100223730"
github "SRGSSR/FXReachability" "3cad7998f717145c90ff97eef552053d66063339"
github "SRGSSR/srganalytics-ios" "develop"
github "SRGSSR/srgdataprovider-ios" "develop"
Expand Down
9 changes: 5 additions & 4 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
github "comScore/ComScore-iOS-SDK" "92f34897cd7659d56bb5a3e9e85b808cf3758bda"
github "SRGSSR/FXReachability" "3cad7998f717145c90ff97eef552053d66063339"
github "SRGSSR/MAKVONotificationCenter" "4a127e52997889729286510103f7e27100223730"
github "Mantle/Mantle" "2.1.0"
github "SnapKit/Masonry" "v1.0.2"
github "ibireme/YYWebImage" "1.0.5"
github "ashaman/libextobjc" "e24f2be3af2cf7fc88a78295f116ef98d0832bcf"
github "SRGSSR/srglogger-ios" "9a911766b46432d9a21d8b04fd4325b537b6e7b2"
github "SRGSSR/SRGMediaPlayer-iOS" "7f14810089e69cf01494fc77dc659dc44895487d"
github "SRGSSR/ASValueTrackingSlider" "840137273ef2b66abfd3db304e4ac7c93ab31568"
github "SRGSSR/srgdataprovider-ios" "8c709ff74674aecd225750bd795313a48e229eef"
github "SRGSSR/srganalytics-ios" "ea545eac25d20761e8a32ec0fa7a927d90c4691c"
github "SRGSSR/SRGMediaPlayer-iOS" "ecad1e8627a5f1797e680557149dd54630fe7f5a"
github "SRGSSR/srgdataprovider-ios" "56d847490633ec4a017cd99a7996942e85935e52"
github "SRGSSR/ASValueTrackingSlider" "e3a7efddc2ce1f4c1e830740be6221f5b3f1c4fe"
github "SRGSSR/srganalytics-ios" "63e09739a63cdded176b5834a23ad34e881ce0cf"
1 change: 1 addition & 0 deletions Demo/Cartfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "bitstadium/HockeySDK-iOS" ~> 4.1.3
1 change: 1 addition & 0 deletions Demo/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "bitstadium/HockeySDK-iOS" "4.1.3"
2 changes: 2 additions & 0 deletions Demo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSPhotoLibraryUsageDescription</key>
<string>For HockeyApp Feedbacks</string>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
Expand Down
3 changes: 1 addition & 2 deletions Demo/Sources/Application/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
// License information is available from the LICENSE file.
//

#import <SRGLetterbox/SRGLetterbox.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface AppDelegate : UIResponder <SRGLetterboxServicePictureInPictureDelegate, UIApplicationDelegate>
@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (nonatomic) UIWindow *window;

Expand Down
80 changes: 6 additions & 74 deletions Demo/Sources/Application/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,100 +7,32 @@
#import "AppDelegate.h"

#import "DemosViewController.h"
#import "ModalPlayerViewController.h"
#import "SimplePlayerViewController.h"

#import <SRGAnalytics/SRGAnalytics.h>
#import <SRGDataProvider/SRGDataProvider.h>

@interface AppDelegate ()

@property (nonatomic) Class restorationClass;

@property (nonatomic, readonly) UINavigationController *navigationController;
@property (nonatomic, readonly) UIViewController *topPresentedViewController;

@end
#import <HockeySDK/HockeySDK.h>

@implementation AppDelegate

#pragma mark Getters and setters

- (UINavigationController *)navigationController
{
return (UINavigationController *)self.window.rootViewController;
}

- (UIViewController *)topPresentedViewController
{
UIViewController *topPresentedViewController = self.window.rootViewController;
while (topPresentedViewController.presentedViewController) {
topPresentedViewController = topPresentedViewController.presentedViewController;
}
return topPresentedViewController;
}

#pragma mark Application lifecycle

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

[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"7bf489539f6e44739133ae456c41dc2c"];
[[BITHockeyManager sharedHockeyManager] startManager];
[[BITHockeyManager sharedHockeyManager].authenticator authenticateInstallation];

[[SRGAnalyticsTracker sharedTracker] startWithBusinessUnitIdentifier:SRGAnalyticsBusinessUnitIdentifierTEST
comScoreVirtualSite:@"app-test-v"
netMetrixIdentifier:@"test"];

[SRGLetterboxService sharedService].pictureInPictureDelegate = self;

DemosViewController *demosViewController = [[DemosViewController alloc] init];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:demosViewController];
return YES;
}

#pragma mark SRGLetterboxServicePictureInPictureDelegate protocol

- (BOOL)letterboxShouldRestoreUserInterfaceForPictureInPicture
{
return ! [self.topPresentedViewController isKindOfClass:[ModalPlayerViewController class]]
&& ! [self.navigationController.topViewController isKindOfClass:[SimplePlayerViewController class]];
}

- (void)letterboxRestoreUserInterfaceForPictureInPictureWithCompletionHandler:(void (^)(BOOL))completionHandler
{
if (self.restorationClass == [ModalPlayerViewController class]) {
ModalPlayerViewController *playerViewController = [[ModalPlayerViewController alloc] init];
[self.topPresentedViewController presentViewController:playerViewController animated:YES completion:^{
completionHandler(YES);
}];
}
else if (self.restorationClass == [SimplePlayerViewController class]) {
SimplePlayerViewController *playerViewController = [[SimplePlayerViewController alloc] init];
[self.navigationController pushViewController:playerViewController animated:YES];
completionHandler(YES);
// FIXME: Call completion handler at the end of the transition animation!!
}
}

- (void)letterboxDidStartPictureInPicture
{
[[SRGAnalyticsTracker sharedTracker] trackHiddenEventWithTitle:@"pip_start"];

if ([self.topPresentedViewController isKindOfClass:[ModalPlayerViewController class]]) {
self.restorationClass = [ModalPlayerViewController class];
[self.topPresentedViewController dismissViewControllerAnimated:YES completion:nil];
}
else if ([self.navigationController.topViewController isKindOfClass:[SimplePlayerViewController class]]) {
self.restorationClass = [SimplePlayerViewController class];
[self.navigationController popViewControllerAnimated:YES];
}
}

- (void)letterboxDidStopPictureInPicture
{
[[SRGAnalyticsTracker sharedTracker] trackHiddenEventWithTitle:@"pip_stop"];
self.restorationClass = Nil;
return YES;
}

@end
110 changes: 82 additions & 28 deletions Demo/Sources/Demos/DemosViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#import "DemosViewController.h"

#import "ModalPlayerViewController.h"
#import "MultiPlayerViewController.h"
#import "SimplePlayerViewController.h"
#import "StandalonePlayerViewController.h"

@implementation DemosViewController

Expand Down Expand Up @@ -39,53 +41,105 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}

case 1: {
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:swi:video:42844052"];
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:srf:video:db741834-044f-443e-901a-e2fc03a4ef25"];
SimplePlayerViewController *playerViewController = [[SimplePlayerViewController alloc] initWithURN:URN];
[self.navigationController pushViewController:playerViewController animated:YES];
break;
}

case 2: {
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:swi:video:41981254"];
ModalPlayerViewController *playerViewController = [[ModalPlayerViewController alloc] initWithURN:URN media:nil];
[self presentViewController:playerViewController animated:YES completion:nil];
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:swi:video:1234567"];
SimplePlayerViewController *playerViewController = [[SimplePlayerViewController alloc] initWithURN:URN];
[self.navigationController pushViewController:playerViewController animated:YES];
break;
}

case 3: {
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:swi:video:42844052"];
ModalPlayerViewController *playerViewController = [[ModalPlayerViewController alloc] initWithURN:URN media:nil];
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:swi:video:41981254"];
ModalPlayerViewController *playerViewController = [[ModalPlayerViewController alloc] initWithURN:URN];

// Since might be reused, ensure we are not trying to present the same view controller while still dismissed
// (might happen if presenting and dismissing fast)
if (playerViewController.presentingViewController) {
return;
}

[self presentViewController:playerViewController animated:YES completion:nil];
break;
}

case 4: {
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:srf:ais:video:db741834-044f-443e-901a-e2fc03a4ef25"];
ModalPlayerViewController *playerViewController = [[ModalPlayerViewController alloc] initWithURN:URN media:nil];
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:srf:video:db741834-044f-443e-901a-e2fc03a4ef25"];
ModalPlayerViewController *playerViewController = [[ModalPlayerViewController alloc] initWithURN:URN];

// Since might be reused, ensure we are not trying to present the same view controller while still dismissed
// (might happen if presenting and dismissing fast)
if (playerViewController.presentingViewController) {
return;
}

[self presentViewController:playerViewController animated:YES completion:nil];
break;
}

case 5: {
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:swi:video:1234567"];
ModalPlayerViewController *playerViewController = [[ModalPlayerViewController alloc] initWithURN:URN];

// Since might be reused, ensure we are not trying to present the same view controller while still dismissed
// (might happen if presenting and dismissing fast)
if (playerViewController.presentingViewController) {
return;
}

[self presentViewController:playerViewController animated:YES completion:nil];
break;
}

case 6: {
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:swi:video:41981254"];
SRGDataProvider *dataProvider = [[SRGDataProvider alloc] initWithServiceURL:[SRGDataProvider serviceURL]
businessUnitIdentifier:SRGDataProviderBusinessUnitIdentifierForVendor(URN.vendor)];
[[dataProvider videosWithUids:@[URN.uid] completionBlock:^(NSArray<SRGMedia *> * _Nullable medias, NSError * _Nullable error) {
if (error) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Error"
message:error.localizedDescription preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:nil];
[alertController addAction:defaultAction];

[self presentViewController:alertController animated:YES completion:^{
[self.tableView deselectRowAtIndexPath:[NSIndexPath indexPathForRow:5 inSection:0] animated:NO];
}];
return;
}

ModalPlayerViewController *playerViewController = [[ModalPlayerViewController alloc] initWithURN:nil media:medias.firstObject];
[self presentViewController:playerViewController animated:YES completion:nil];
}] resume];
StandalonePlayerViewController *playerViewController = [[StandalonePlayerViewController alloc] initWithURN:URN];
[self.navigationController pushViewController:playerViewController animated:YES];
break;
}

case 7: {
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:srf:video:db741834-044f-443e-901a-e2fc03a4ef25"];
StandalonePlayerViewController *playerViewController = [[StandalonePlayerViewController alloc] initWithURN:URN];
[self.navigationController pushViewController:playerViewController animated:YES];
break;
}

case 8: {
MultiPlayerViewController *playerViewController = [[MultiPlayerViewController alloc] init];

// Since might be reused, ensure we are not trying to present the same view controller while still dismissed
// (might happen if presenting and dismissing fast)
if (playerViewController.presentingViewController) {
return;
}
[self presentViewController:playerViewController animated:YES completion:nil];
break;
}

case 9: {
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:rts:video:1967124"];
SimplePlayerViewController *playerViewController = [[SimplePlayerViewController alloc] initWithURN:URN];
[self.navigationController pushViewController:playerViewController animated:YES];
break;
}

case 10: {
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:srf:video:c49c1d73-2f70-0001-138a-15e0c4ccd3d0"];
SimplePlayerViewController *playerViewController = [[SimplePlayerViewController alloc] initWithURN:URN];
[self.navigationController pushViewController:playerViewController animated:YES];
break;
}

case 11: {
SRGMediaURN *URN = [SRGMediaURN mediaURNWithString:@"urn:rtr:audio:a029e818-77a5-4c2e-ad70-d573bb865e31"];
SimplePlayerViewController *playerViewController = [[SimplePlayerViewController alloc] initWithURN:URN];
[self.navigationController pushViewController:playerViewController animated:YES];
break;
}

Expand Down
Loading

0 comments on commit df78e67

Please sign in to comment.