Pārlūkot izejas kodu

GoogleDrive: remove deprecated Google SDK and adapt Apis to new SDK

Caro 6 gadi atpakaļ
vecāks
revīzija
342bf22625

+ 1 - 1
Podfile

@@ -22,7 +22,7 @@ target 'VLC-iOS' do
   pod 'InAppSettingsKit', :git => 'git://github.com/fkuehne/InAppSettingsKit.git', :commit => '415ea6bb' #tvOS fix
   pod 'HockeySDK', '~>5.1.4', :subspecs => ['CrashOnlyLib']
   pod 'PAPasscode', '~>1.0'
-  pod 'GoogleAPIClient/Drive'
+  pod 'GoogleAPIClientForREST/Drive'
   pod 'MobileVLCKit', '3.2.0'
   pod 'VLCMediaLibraryKit'
   pod 'MediaLibraryKit-prod'

+ 15 - 15
Podfile.lock

@@ -14,19 +14,19 @@ PODS:
   - AFNetworking/Serialization (3.1.0)
   - AFNetworking/UIKit (3.1.0):
     - AFNetworking/NSURLSession
-  - AppAuth (0.92.0)
+  - AppAuth (0.95.0)
   - box-ios-sdk-v2 (1.2.3):
     - box-ios-sdk-v2/no-arc (= 1.2.3)
   - box-ios-sdk-v2/no-arc (1.2.3)
   - CocoaHTTPServer (2.3)
-  - GoogleAPIClient/Core (1.0.5):
-    - GTMSessionFetcher (~> 1.1)
-  - GoogleAPIClient/Drive (1.0.5):
-    - GoogleAPIClient/Core
-    - GTMSessionFetcher (~> 1.1)
+  - GoogleAPIClientForREST/Core (1.3.8):
+    - GTMSessionFetcher (>= 1.1.7)
+  - GoogleAPIClientForREST/Drive (1.3.8):
+    - GoogleAPIClientForREST/Core
+    - GTMSessionFetcher (>= 1.1.7)
   - GRKArrayDiff (2.2.1)
-  - GTMAppAuth (0.7.0):
-    - AppAuth (~> 0.92.0)
+  - GTMAppAuth (0.7.1):
+    - AppAuth (~> 0.95)
     - GTMSessionFetcher (~> 1.1)
   - GTMSessionFetcher (1.2.1):
     - GTMSessionFetcher/Full (= 1.2.1)
@@ -64,7 +64,7 @@ PODS:
 DEPENDENCIES:
   - box-ios-sdk-v2 (from `git://github.com/fkuehne/box-ios-sdk-v2.git`)
   - CocoaHTTPServer (from `git://github.com/fkuehne/CocoaHTTPServer.git`)
-  - GoogleAPIClient/Drive
+  - GoogleAPIClientForREST/Drive
   - GRKArrayDiff (~> 2.1)
   - GTMAppAuth
   - HockeySDK-tvOS (~> 5.1.0)
@@ -90,7 +90,7 @@ SPEC REPOS:
   https://github.com/cocoapods/specs.git:
     - AFNetworking
     - AppAuth
-    - GoogleAPIClient
+    - GoogleAPIClientForREST
     - GRKArrayDiff
     - GTMAppAuth
     - GTMSessionFetcher
@@ -145,12 +145,12 @@ CHECKOUT OPTIONS:
 
 SPEC CHECKSUMS:
   AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
-  AppAuth: 3f4f1d6d85ad631d0bbf15ffcdc10c447face97a
+  AppAuth: 137f6bb6fc9dfbaf2cf9f6fcff1d336ff0163bc6
   box-ios-sdk-v2: 9423bd75373350ea40b92f3d2d6e89f81d96d634
   CocoaHTTPServer: 07df8b05a8bde406fe367d22c90a24a2fd4ca49f
-  GoogleAPIClient: 77df755d41d70ee5a99b7b752614fbb439f19438
+  GoogleAPIClientForREST: 5447a194eae517986cafe6421a5330b80b820591
   GRKArrayDiff: 7522e374edcc55c1731a219e428847164b04cfab
-  GTMAppAuth: 8d724be29ab8f2f6d35b2bf929d76340c9d1f1b1
+  GTMAppAuth: c5e41aaf039ac1ccc41543e6ea2ef7abd255ad41
   GTMSessionFetcher: 32aeca0aa144acea523e1c8e053089dec2cb98ca
   HockeySDK: 15afe6bc0a5bfe3a531fd73dbf082095f37dac3b
   HockeySDK-tvOS: 62e86233bfa7356c5ac5cd946816d1ca0e9033f6
@@ -173,6 +173,6 @@ SPEC CHECKSUMS:
   XKKeychain: 852ef663c56a7194c73d3c68e8d9d4f07b121d4f
   xmlrpc: 109bb21d15ed6d108b2c1ac5973a6a223a50f5f4
 
-PODFILE CHECKSUM: 99a368ae7deed97b93e1cf2cb58b93e29bad2985
+PODFILE CHECKSUM: b38ab2b05e12d1dc790aec6fd5ad9816f055b40c
 
-COCOAPODS: 1.5.3
+COCOAPODS: 1.6.0

+ 2 - 2
Sources/URLHandler.swift

@@ -50,14 +50,14 @@ class DropBoxURLHandler: NSObject, VLCURLHandler {
 
 class GoogleURLHandler: NSObject, VLCURLHandler {
 
-    @objc var currentGoogleAuthorizationFlow: OIDAuthorizationFlowSession?
+    @objc var currentGoogleAuthorizationFlow: OIDExternalUserAgentSession?
 
     @objc func canHandleOpen(url: URL, options: [UIApplication.OpenURLOptionsKey: AnyObject]) -> Bool {
         return url.scheme == "com.googleusercontent.apps.CLIENT"
     }
 
     @objc func performOpen(url: URL, options: [UIApplication.OpenURLOptionsKey: AnyObject]) -> Bool {
-        if currentGoogleAuthorizationFlow?.resumeAuthorizationFlow(with: url) == true {
+        if currentGoogleAuthorizationFlow?.resumeExternalUserAgentFlow(with: url) == true {
             currentGoogleAuthorizationFlow = nil
             return true
         }

+ 2 - 2
Sources/VLCCloudStorageTableViewCell.h

@@ -15,7 +15,7 @@
 #import "VLCOneDriveObject.h"
 #import <BoxSDK/BoxSDK.h>
 #if TARGET_OS_IOS
-#import "GTLDrive.h"
+#import "GTLRDrive.h"
 #endif
 
 @class VLCNetworkImageView;
@@ -34,7 +34,7 @@
 @property (nonatomic, retain) VLCOneDriveObject *oneDriveFile;
 @property (nonatomic, retain) BoxItem *boxFile;
 #if TARGET_OS_IOS
-@property (nonatomic, retain) GTLDriveFile *driveFile;
+@property (nonatomic, retain) GTLRDrive_File *driveFile;
 #endif
 
 @property (nonatomic, readwrite) BOOL isDownloadable;

+ 1 - 1
Sources/VLCCloudStorageTableViewCell.m

@@ -40,7 +40,7 @@
 }
 
 #if TARGET_OS_IOS
-- (void)setDriveFile:(GTLDriveFile *)driveFile
+- (void)setDriveFile:(GTLRDrive_File *)driveFile
 {
     if (driveFile != _driveFile)
         _driveFile = driveFile;

+ 4 - 4
Sources/VLCGoogleDriveController.h

@@ -11,17 +11,17 @@
  * Refer to the COPYING file of the official project for license.
  *****************************************************************************/
 
-#import "GTLDrive.h"
+#import "GTLRDrive.h"
 #import "VLCCloudStorageController.h"
 #import "VLCGoogleDriveConstants.h"
 
 @interface VLCGoogleDriveController : VLCCloudStorageController
 
-@property (nonatomic, retain) GTLServiceDrive *driveService;
+@property (nonatomic, retain) GTLRDriveService *driveService;
 
 - (void)stopSession;
-- (void)streamFile:(GTLDriveFile *)file;
-- (void)downloadFileToDocumentFolder:(GTLDriveFile *)file;
+- (void)streamFile:(GTLRDrive_File *)file;
+- (void)downloadFileToDocumentFolder:(GTLRDrive_File *)file;
 - (BOOL)hasMoreFiles;
 
 @end

+ 15 - 18
Sources/VLCGoogleDriveController.m

@@ -19,13 +19,13 @@
 #import "VLC-Swift.h"
 #import <XKKeychain/XKKeychain.h>
 
-#import <AppAuth/AppAuth.h>
 #import <GTMAppAuth/GTMAppAuth.h>
+#import <GTMSessionFetcher/GTMSessionFetcherService.h>
 
 @interface VLCGoogleDriveController ()
 {
-    GTLDriveFileList *_fileList;
-    GTLServiceTicket *_fileListTicket;
+    GTLRDrive_FileList *_fileList;
+    GTLRServiceTicket *_fileListTicket;
 
     NSArray *_currentFileList;
 
@@ -61,7 +61,7 @@
 - (void)startSession
 {
     [self restoreFromSharedCredentials];
-    self.driveService = [GTLServiceDrive new];
+    self.driveService = [GTLRDriveService new];
     self.driveService.authorizer = [GTMAppAuthFetcherAuthorization authorizationFromKeychainForName:kKeychainItemName];
 }
 
@@ -156,7 +156,7 @@
     return _nextPageToken != nil;
 }
 
-- (void)downloadFileToDocumentFolder:(GTLDriveFile *)file
+- (void)downloadFileToDocumentFolder:(GTLRDrive_File *)file
 {
     if (file == nil)
         return;
@@ -178,16 +178,13 @@
 {
     _fileList = nil;
     _folderId = folderId;
-    GTLQueryDrive *query;
+    GTLRDriveQuery_FilesList *query;
     NSString *parentName = @"root";
 
-    query = [GTLQueryDrive queryForFilesList];
+    query = [GTLRDriveQuery_FilesList query];
     query.pageToken = _nextPageToken;
     //the results don't come in alphabetical order when paging. So the maxresult (default 100) is set to 1000 in order to get a few more files at once.
     //query.pageSize = 1000;
-    query.includeDeleted = NO;
-    query.includeRemoved = NO;
-    query.restrictToMyDrive = YES;
     query.fields = @"files(*)";
 
     if (![_folderId isEqualToString:@""]) {
@@ -196,8 +193,8 @@
     query.q = [NSString stringWithFormat:@"'%@' in parents", parentName];
 
     _fileListTicket = [self.driveService executeQuery:query
-                          completionHandler:^(GTLServiceTicket *ticket,
-                                              GTLDriveFileList *fileList,
+                          completionHandler:^(GTLRServiceTicket *ticket,
+                                              GTLRDrive_FileList *fileList,
                                               NSError *error) {
                               if (error == nil) {
                                   self->_fileList = fileList;
@@ -210,7 +207,7 @@
                           }];
 }
 
-- (void)streamFile:(GTLDriveFile *)file
+- (void)streamFile:(GTLRDrive_File *)file
 {
     NSString *token = [((GTMAppAuthFetcherAuthorization *)self.driveService.authorizer).authState.lastTokenResponse accessToken];
     NSString *urlString = [NSString stringWithFormat:@"https://www.googleapis.com/drive/v3/files/%@?alt=media&access_token=%@",
@@ -234,7 +231,7 @@
     }
 }
 
-- (void)_reallyDownloadFileToDocumentFolder:(GTLDriveFile *)file
+- (void)_reallyDownloadFileToDocumentFolder:(GTLRDrive_File *)file
 {
     NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     NSString *filePath = [searchPaths[0] stringByAppendingFormat:@"/%@", file.originalFilename];
@@ -259,7 +256,7 @@
 {
     NSMutableArray *listOfGoodFilesAndFolders = [[NSMutableArray alloc] init];
 
-    for (GTLDriveFile *iter in _fileList.files) {
+    for (GTLRDrive_File *iter in _fileList.files) {
         if (iter.trashed.boolValue) {
             continue;
         }
@@ -281,8 +278,8 @@
 
     //the files come in a chaotic order so we order alphabetically
      NSArray *sortedArray = [_currentFileList sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
-        NSString *first = [(GTLDriveFile *)a name];
-        NSString *second = [(GTLDriveFile *)b name];
+        NSString *first = [(GTLRDrive_File *)a name];
+        NSString *second = [(GTLRDrive_File *)b name];
         return [first compare:second];
     }];
     _currentFileList = sortedArray;
@@ -291,7 +288,7 @@
         [self.delegate mediaListUpdated];
 }
 
-- (void)loadFile:(GTLDriveFile*)file intoPath:(NSString*)destinationPath
+- (void)loadFile:(GTLRDrive_File*)file intoPath:(NSString*)destinationPath
 {
     NSString *exportURLStr =  [NSString stringWithFormat:@"https://www.googleapis.com/drive/v3/files/%@?alt=media",
                            file.identifier];

+ 2 - 2
Sources/VLCGoogleDriveTableViewController.m

@@ -26,7 +26,7 @@
 {
     VLCGoogleDriveController *_googleDriveController;
 
-    GTLDriveFile *_selectedFile;
+    GTLRDrive_File *_selectedFile;
 }
 
 @end
@@ -161,7 +161,7 @@
         OIDAuthorizationRequest *request = [[OIDAuthorizationRequest alloc] initWithConfiguration:[GTMAppAuthFetcherAuthorization configurationForGoogle]
                                                                                          clientId:kVLCGoogleDriveClientID
                                                                                      clientSecret:kVLCGoogleDriveClientSecret
-                                                                                           scopes:@[OIDScopeOpenID, kGTLAuthScopeDrive]
+                                                                                           scopes:@[OIDScopeOpenID, kGTLRAuthScopeDrive]
                                                                                       redirectURL:[NSURL URLWithString:kVLCGoogleRedirectURI]
                                                                                      responseType:OIDResponseTypeCode
                                                                              additionalParameters:nil];

+ 4 - 4
VLC.xcodeproj/project.pbxproj

@@ -2575,7 +2575,7 @@
 			files = (
 			);
 			inputPaths = (
-				"${SRCROOT}/Pods/Target Support Files/Pods-VLC-tvOS/Pods-VLC-tvOS-resources.sh",
+				"${PODS_ROOT}/Target Support Files/Pods-VLC-tvOS/Pods-VLC-tvOS-resources.sh",
 				"${PODS_ROOT}/VLC-LiveSDK/src/LiveSDK/Library/Internal/Resources/backArrow_black.png",
 				"${PODS_CONFIGURATION_BUILD_DIR}/XKKeychain-tvOS/XKKeychain.bundle",
 				"${PODS_CONFIGURATION_BUILD_DIR}/HockeySDK-tvOS/HockeySDKResources.bundle",
@@ -2588,7 +2588,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-VLC-tvOS/Pods-VLC-tvOS-resources.sh\"\n";
+			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-VLC-tvOS/Pods-VLC-tvOS-resources.sh\"\n";
 			showEnvVarsInLog = 0;
 		};
 		0A9D17D120C4A14700AA4A8C /* Run SwiftLint Script */ = {
@@ -2660,7 +2660,7 @@
 			files = (
 			);
 			inputPaths = (
-				"${SRCROOT}/Pods/Target Support Files/Pods-VLC-iOS/Pods-VLC-iOS-resources.sh",
+				"${PODS_ROOT}/Target Support Files/Pods-VLC-iOS/Pods-VLC-iOS-resources.sh",
 				"${PODS_CONFIGURATION_BUILD_DIR}/HockeySDK/HockeySDKResources.bundle",
 				"${PODS_ROOT}/InAppSettingsKit/InAppSettingsKit/Resources/Base.lproj",
 				"${PODS_ROOT}/InAppSettingsKit/InAppSettingsKit/Resources/de.lproj",
@@ -2711,7 +2711,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-VLC-iOS/Pods-VLC-iOS-resources.sh\"\n";
+			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-VLC-iOS/Pods-VLC-iOS-resources.sh\"\n";
 			showEnvVarsInLog = 0;
 		};
 		CEAC60B72FF5CB91256BC99B /* [CP] Check Pods Manifest.lock */ = {