Skip to content

Commit

Permalink
Merge branch 'release/1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Jun 7, 2019
2 parents f0a6ec9 + db3b9b2 commit c08c529
Show file tree
Hide file tree
Showing 128 changed files with 9,925 additions and 1,596 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "SRGSSR/srgidentity-ios" "1.0"
github "SRGSSR/srgidentity-ios" "1.0.1"
5 changes: 4 additions & 1 deletion Cartfile.private.common
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
github "SRGSSR/srgletterbox-ios" "1.13"
github "onmyway133/DeepDiff" "2.2.0"
# Fork from AliSoftware/OHHTTPStubs to support Xcode 9.x and Swift 4.
github "rckoenes/OHHTTPStubs" ~> 6.1.1
github "SRGSSR/srgletterbox-ios" "1.14"
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.2"
github "SRGSSR/srgcontentprotection-ios" "1.2.1"
2 changes: 1 addition & 1 deletion Cartfile.private.public
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "SRGSSR/srgcontentprotection-fake-ios" "1.2"
github "SRGSSR/srgcontentprotection-fake-ios" "1.2.1"
34 changes: 18 additions & 16 deletions Cartfile.resolved.proprietary
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
github "Mantle/Mantle" "2.1.0"
github "SRGSSR/FXReachability" "1.3.2_srg2"
github "SRGSSR/MAKVONotificationCenter" "1.0_srg2"
github "SRGSSR/ComScore-iOS-watchOS-tvOS" "5.8.4"
github "SRGSSR/FXReachability" "1.3.2_srg3"
github "SRGSSR/MAKVONotificationCenter" "1.0_srg3"
github "SRGSSR/Masonry" "v1.1.0_srg1"
github "SRGSSR/UICKeyChainStore" "v2.1.2_srg1"
github "SRGSSR/YYWebImage" "1.0.5_srg1"
github "SRGSSR/libextobjc" "0.6_srg1"
github "SRGSSR/srganalytics-ios" "3.6.3"
github "SRGSSR/srgappearance-ios" "1.1.9"
github "SRGSSR/srgcontentprotection-ios" "1.2"
github "SRGSSR/srgdataprovider-ios" "6.5"
github "SRGSSR/srganalytics-ios" "3.7"
github "SRGSSR/srgappearance-ios" "1.1.10"
github "SRGSSR/srgcontentprotection-ios" "1.2.1"
github "SRGSSR/srgdataprovider-ios" "6.5.1"
github "SRGSSR/srgdiagnostics-ios" "1.0.1"
github "SRGSSR/srgidentity-ios" "1.0"
github "SRGSSR/srgletterbox-ios" "1.13"
github "SRGSSR/srglogger-ios" "1.0.8"
github "SRGSSR/srgmediaplayer-ios" "2.5.6"
github "SRGSSR/srgnetwork-ios" "1.0"
github "SRGSSR/tagcommander-ios" "4.1.5_4.1.3"
github "SnapKit/Masonry" "v1.1.0"
github "comScore/ComScore-iOS-SDK" "92f34897cd7659d56bb5a3e9e85b808cf3758bda"
github "ibireme/YYWebImage" "1.0.5"
github "kishikawakatsumi/UICKeyChainStore" "v2.1.2"
github "SRGSSR/srgidentity-ios" "1.0.1"
github "SRGSSR/srgletterbox-ios" "1.14"
github "SRGSSR/srglogger-ios" "1.0.9"
github "SRGSSR/srgmediaplayer-ios" "2.6"
github "SRGSSR/srgnetwork-ios" "1.0.1"
github "SRGSSR/tagcommander-ios" "4.3.1_4.3.1"
github "onmyway133/DeepDiff" "2.2.0"
github "rckoenes/OHHTTPStubs" "6.1.1"
34 changes: 18 additions & 16 deletions Cartfile.resolved.public
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
github "Mantle/Mantle" "2.1.0"
github "SRGSSR/FXReachability" "1.3.2_srg2"
github "SRGSSR/MAKVONotificationCenter" "1.0_srg2"
github "SRGSSR/ComScore-iOS-watchOS-tvOS" "5.8.4"
github "SRGSSR/FXReachability" "1.3.2_srg3"
github "SRGSSR/MAKVONotificationCenter" "1.0_srg3"
github "SRGSSR/Masonry" "v1.1.0_srg1"
github "SRGSSR/UICKeyChainStore" "v2.1.2_srg1"
github "SRGSSR/YYWebImage" "1.0.5_srg1"
github "SRGSSR/libextobjc" "0.6_srg1"
github "SRGSSR/srganalytics-ios" "3.6.3"
github "SRGSSR/srgappearance-ios" "1.1.9"
github "SRGSSR/srgcontentprotection-fake-ios" "1.2"
github "SRGSSR/srgdataprovider-ios" "6.5"
github "SRGSSR/srganalytics-ios" "3.7"
github "SRGSSR/srgappearance-ios" "1.1.10"
github "SRGSSR/srgcontentprotection-fake-ios" "1.2.1"
github "SRGSSR/srgdataprovider-ios" "6.5.1"
github "SRGSSR/srgdiagnostics-ios" "1.0.1"
github "SRGSSR/srgidentity-ios" "1.0"
github "SRGSSR/srgletterbox-ios" "1.13"
github "SRGSSR/srglogger-ios" "1.0.8"
github "SRGSSR/srgmediaplayer-ios" "2.5.6"
github "SRGSSR/srgnetwork-ios" "1.0"
github "SRGSSR/tagcommander-ios" "4.1.5_4.1.3"
github "SnapKit/Masonry" "v1.1.0"
github "comScore/ComScore-iOS-SDK" "92f34897cd7659d56bb5a3e9e85b808cf3758bda"
github "ibireme/YYWebImage" "1.0.5"
github "kishikawakatsumi/UICKeyChainStore" "v2.1.2"
github "SRGSSR/srgidentity-ios" "1.0.1"
github "SRGSSR/srgletterbox-ios" "1.14"
github "SRGSSR/srglogger-ios" "1.0.9"
github "SRGSSR/srgmediaplayer-ios" "2.6"
github "SRGSSR/srgnetwork-ios" "1.0.1"
github "SRGSSR/tagcommander-ios" "4.3.1_4.3.1"
github "onmyway133/DeepDiff" "2.2.0"
github "rckoenes/OHHTTPStubs" "6.1.1"
15 changes: 15 additions & 0 deletions Demo/Resources/Images.xcassets/playlist_22.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "playlist-22.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
15 changes: 15 additions & 0 deletions Demo/Resources/Images.xcassets/playlists_30.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "playlists_30.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
15 changes: 15 additions & 0 deletions Demo/Resources/Images.xcassets/playlists_48.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "playlists_48.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "settings_30.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "watch_later-22.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
18 changes: 14 additions & 4 deletions Demo/Sources/Application/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#import "HistoryViewController.h"
#import "MediasViewController.h"
#import "PlaylistsViewController.h"
#import "PreferencesViewController.h"

#import <SRGDataProvider/SRGDataProvider.h>
#import <SRGIdentity/SRGIdentity.h>
Expand All @@ -28,7 +30,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
NSString *libraryDirectory = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES).firstObject;
NSURL *fileURL = [[NSURL fileURLWithPath:libraryDirectory] URLByAppendingPathComponent:@"UserData-demo.sqlite"];
SRGUserData.currentUserData = [[SRGUserData alloc] initWithStoreFileURL:fileURL
historyServiceURL:[NSURL URLWithString:@"https://profil.rts.ch/api/history"]
serviceURL:[NSURL URLWithString:@"https://profil.rts.ch/api"]
identityService:SRGIdentityService.currentIdentityService];

SRGDataProvider.currentDataProvider = [[SRGDataProvider alloc] initWithServiceURL:SRGIntegrationLayerProductionServiceURL()];
Expand All @@ -44,10 +46,18 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

HistoryViewController *historyViewController = [[HistoryViewController alloc] init];
UINavigationController *historyNavigationController = [[UINavigationController alloc] initWithRootViewController:historyViewController];
historyNavigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"History", nil) image:[UIImage imageNamed:@"history_30"] tag:0];
historyNavigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"History", nil) image:[UIImage imageNamed:@"history_30"] tag:1];

PlaylistsViewController *playlistsViewController = [[PlaylistsViewController alloc] init];
UINavigationController *playlistsNavigationController = [[UINavigationController alloc] initWithRootViewController:playlistsViewController];
playlistsNavigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"Playlists", nil) image:[UIImage imageNamed:@"playlists_30"] tag:2];

PreferencesViewController *preferencesViewController = [[PreferencesViewController alloc] initWithPath:nil inDomain:@"userdata-demo"];
UINavigationController *preferencesNavigationController = [[UINavigationController alloc] initWithRootViewController:preferencesViewController];
preferencesNavigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"Preferences", nil) image:[UIImage imageNamed:@"preferences_30"] tag:2];

UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = @[mediasNavigationController, historyNavigationController];
tabBarController.viewControllers = @[mediasNavigationController, historyNavigationController, playlistsNavigationController, preferencesNavigationController];

self.window.rootViewController = tabBarController;
return YES;
Expand All @@ -61,7 +71,7 @@ - (void)userDidLogout:(NSNotification *)notification
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Information", nil)
message:NSLocalizedString(@"You have been logged out. Please login again to synchronize your data.", nil)
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Dismiss", nil) style:UIAlertActionStyleDefault handler:nil]];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Dismiss", nil) style:UIAlertActionStyleCancel handler:nil]];
[self.window.rootViewController presentViewController:alertController animated:YES completion:nil];
}
}
Expand Down
31 changes: 31 additions & 0 deletions Demo/Sources/Bridges/DeepDiffBridge.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// Copyright (c) SRG SSR. All rights reserved.
//
// License information is available from the LICENSE file.
//

import DeepDiff
import UIKit

extension NSObject: DiffAware {
public var diffId: Int {
return self.hashValue
}

public static func compareContent(_ a: NSObject, _ b: NSObject) -> Bool {
return a == b
}
}

extension UITableView {
@objc public func reloadDataAnimated(oldObjects: [NSObject], newObjects: [NSObject], section: Int = 0, updateData: () -> Void) {
if !oldObjects.isEmpty && !newObjects.isEmpty && oldObjects != newObjects {
let changes = diff(old: oldObjects, new: newObjects)
self.reload(changes: changes, section: section, insertionAnimation: .automatic, deletionAnimation: .automatic, replacementAnimation: .automatic, updateData: updateData, completion: nil)
}
else {
updateData()
self.reloadData()
}
}
}
4 changes: 4 additions & 0 deletions Demo/Sources/Bridges/SRGUserData-demo-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

26 changes: 26 additions & 0 deletions Demo/Sources/Helpers/DataViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright (c) SRG SSR. All rights reserved.
//
// License information is available from the LICENSE file.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface DataViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, weak, nullable) IBOutlet UITableView *tableView;

@end

@interface DataViewController (Subclassing)

- (void)refresh;
- (void)cancelRefresh;

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView NS_REQUIRES_SUPER;

@end

NS_ASSUME_NONNULL_END
99 changes: 99 additions & 0 deletions Demo/Sources/Helpers/DataViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
//
// Copyright (c) SRG SSR. All rights reserved.
//
// License information is available from the LICENSE file.
//

#import "DataViewController.h"

@interface DataViewController ()

@property (nonatomic, weak) UIRefreshControl *refreshControl;
@property (nonatomic, getter=isRefreshTriggered) BOOL refreshTriggered;

@end

@implementation DataViewController

#pragma mark View lifecycle

- (void)viewDidLoad
{
[super viewDidLoad];

self.tableView.dataSource = self;
self.tableView.delegate = self;

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
refreshControl.layer.zPosition = -1.f; // Ensure the refresh control appears behind the cells, see http://stackoverflow.com/a/25829016/760435
[refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
[self.tableView insertSubview:refreshControl atIndex:0];
self.refreshControl = refreshControl;
}

- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];

[self refresh];
}

- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];

if (self.movingFromParentViewController || self.beingDismissed) {
[self cancelRefresh];
}
}

#pragma mark Default implementations

- (void)refresh
{}

- (void)cancelRefresh
{}

#pragma mark UIScrollViewDelegate protocol

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
if (self.refreshTriggered) {
[self refresh];
self.refreshTriggered = NO;
}
}

#pragma mark UITableViewDataSource protocol

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSAssert(NO, @"Not implemented");
return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSAssert(NO, @"Not implemented");
return nil;
}

#pragma mark Actions

- (void)refresh:(id)sender
{
// When reloading a table view with animations and if a refresh control is used to trigger the reload,
// a glitch makes the table jump down when the refresh control value changed event is triggered. To
// solve this issue, we only mark the table as required a refresh when this event is triggered, and
// perform the refresh when the table is released.
//
// Note that applying the same strategy with a UITableViewController does not work, we have to build
// the table and the refresh control ourselves.
if (self.refreshControl.refreshing) {
[self.refreshControl endRefreshing];
}
self.refreshTriggered = YES;
}

@end
Loading

0 comments on commit c08c529

Please sign in to comment.