소스 검색

feat(ios) update dropbox authentication to PKCE flow

master
Alex Bumbu 4 년 전
부모
커밋
5bd329acb9
No account linked to committer's email address
4개의 변경된 파일56개의 추가작업 그리고 54개의 파일을 삭제
  1. 1
    1
      ios/Podfile
  2. 4
    4
      ios/Podfile.lock
  3. 21
    28
      ios/app/app.xcodeproj/project.pbxproj
  4. 30
    21
      ios/sdk/src/dropbox/Dropbox.m

+ 1
- 1
ios/Podfile 파일 보기

@@ -76,7 +76,7 @@ target 'JitsiMeetSDK' do
76 76
   #
77 77
 
78 78
   pod 'CocoaLumberjack', '~>3.5.3'
79
-  pod 'ObjectiveDropboxOfficial', '~> 3.9.4'
79
+  pod 'ObjectiveDropboxOfficial', '~>6.1.0'
80 80
 
81 81
   use_native_modules!
82 82
 end

+ 4
- 4
ios/Podfile.lock 파일 보기

@@ -115,7 +115,7 @@ PODS:
115 115
     - nanopb/encode (= 1.30906.0)
116 116
   - nanopb/decode (1.30906.0)
117 117
   - nanopb/encode (1.30906.0)
118
-  - ObjectiveDropboxOfficial (3.9.4)
118
+  - ObjectiveDropboxOfficial (6.1.0)
119 119
   - PromisesObjC (1.2.12)
120 120
   - RCTRequired (0.61.5-jitsi.2)
121 121
   - RCTTypeSafety (0.61.5-jitsi.2):
@@ -386,7 +386,7 @@ DEPENDENCIES:
386 386
   - Firebase/DynamicLinks (~> 6.33.0)
387 387
   - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
388 388
   - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
389
-  - ObjectiveDropboxOfficial (~> 3.9.4)
389
+  - ObjectiveDropboxOfficial (~> 6.1.0)
390 390
   - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired/`)
391 391
   - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety/`)
392 392
   - React (from `../node_modules/react-native/`)
@@ -560,7 +560,7 @@ SPEC CHECKSUMS:
560 560
   GTMAppAuth: ad5c2b70b9a8689e1a04033c9369c4915bfcbe89
561 561
   GTMSessionFetcher: 36689134877faeb055b27dfa4ccc9ceaa42e029e
562 562
   nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc
563
-  ObjectiveDropboxOfficial: a5afefc83f6467c42c45f2253f583f2ad1ffc701
563
+  ObjectiveDropboxOfficial: b4765572e334d6fc6214b43a7595510324bbbbaa
564 564
   PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
565 565
   RCTRequired: a686731276578c125dff205f08b6ec9cee6ede32
566 566
   RCTTypeSafety: 88e5500e801c00d16a3d1895e3470d13beed6584
@@ -599,6 +599,6 @@ SPEC CHECKSUMS:
599 599
   RNWatch: a5320c959c75e72845c07985f3e935e58998f1d3
600 600
   Yoga: 96b469c5e81ff51b917b92e8c3390642d4ded30c
601 601
 
602
-PODFILE CHECKSUM: 1ae1a9823f3eab0b6e735b9637ba7588e0890d08
602
+PODFILE CHECKSUM: 6f4485ed41286517917d47d2170b0de97d32bbfb
603 603
 
604 604
 COCOAPODS: 1.10.1

+ 21
- 28
ios/app/app.xcodeproj/project.pbxproj 파일 보기

@@ -23,6 +23,7 @@
23 23
 		13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
24 24
 		13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
25 25
 		13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
26
+		2681BB562C7A0B42CFBA6719 /* libPods-JitsiMeet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D6152FF9E9F7B0E86F70A21D /* libPods-JitsiMeet.a */; };
26 27
 		4E90F9402632D1AB001102D4 /* Atomic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E90F93F2632D1AB001102D4 /* Atomic.swift */; };
27 28
 		4EB06024260E026600F524C5 /* ReplayKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EC49B8625BED71300E76218 /* ReplayKit.framework */; };
28 29
 		4EB06027260E026600F524C5 /* SampleHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EB06026260E026600F524C5 /* SampleHandler.swift */; };
@@ -30,7 +31,6 @@
30 31
 		4EB0603C260E09D000F524C5 /* SocketConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EB06039260E09D000F524C5 /* SocketConnection.swift */; };
31 32
 		4EB0603D260E09D000F524C5 /* DarwinNotificationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EB0603A260E09D000F524C5 /* DarwinNotificationCenter.swift */; };
32 33
 		4EB0603E260E09D000F524C5 /* SampleUploader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EB0603B260E09D000F524C5 /* SampleUploader.swift */; };
33
-		55BEDABDA92D47D399A70A5E /* libPods-JitsiMeet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D878B07B3FBD6E305EAA6B27 /* libPods-JitsiMeet.a */; };
34 34
 		DE050389256E904600DEE3A5 /* WebRTC.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE050388256E904600DEE3A5 /* WebRTC.xcframework */; };
35 35
 		DE05038A256E904600DEE3A5 /* WebRTC.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DE050388256E904600DEE3A5 /* WebRTC.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
36 36
 		DE4C456121DE1E4E00EA0709 /* FIRUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = DE4C455F21DE1E4E00EA0709 /* FIRUtilities.m */; };
@@ -113,7 +113,6 @@
113 113
 /* End PBXCopyFilesBuildPhase section */
114 114
 
115 115
 /* Begin PBXFileReference section */
116
-		09AA3B93E4CC62D84B424690 /* Pods-jitsi-meet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-jitsi-meet.release.xcconfig"; path = "../Pods/Target Support Files/Pods-jitsi-meet/Pods-jitsi-meet.release.xcconfig"; sourceTree = "<group>"; };
117 116
 		0B26BE6D1EC5BC3C00EEFB41 /* JitsiMeet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = JitsiMeet.framework; sourceTree = BUILT_PRODUCTS_DIR; };
118 117
 		0B412F1D1EDEE6E800B1A0A6 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
119 118
 		0B412F1E1EDEE6E800B1A0A6 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
@@ -139,7 +138,7 @@
139 138
 		13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
140 139
 		13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
141 140
 		13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
142
-		4670A512A688E2DC34528282 /* Pods-jitsi-meet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-jitsi-meet.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-jitsi-meet/Pods-jitsi-meet.debug.xcconfig"; sourceTree = "<group>"; };
141
+		3E0F4ED943C0B12BE77F6B45 /* Pods-JitsiMeet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.release.xcconfig"; path = "Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.release.xcconfig"; sourceTree = "<group>"; };
143 142
 		4E90F93F2632D1AB001102D4 /* Atomic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Atomic.swift; sourceTree = "<group>"; };
144 143
 		4EB06023260E026600F524C5 /* JitsiMeetBroadcastExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = JitsiMeetBroadcastExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
145 144
 		4EB06026260E026600F524C5 /* SampleHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleHandler.swift; sourceTree = "<group>"; };
@@ -149,11 +148,9 @@
149 148
 		4EB0603A260E09D000F524C5 /* DarwinNotificationCenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DarwinNotificationCenter.swift; sourceTree = "<group>"; };
150 149
 		4EB0603B260E09D000F524C5 /* SampleUploader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SampleUploader.swift; sourceTree = "<group>"; };
151 150
 		4EC49B8625BED71300E76218 /* ReplayKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReplayKit.framework; path = System/Library/Frameworks/ReplayKit.framework; sourceTree = SDKROOT; };
152
-		5FEF9D87A4D2A38AD7193308 /* Pods-JitsiMeet-JitsiMeetBroadcastExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet-JitsiMeetBroadcastExtension.release.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet-JitsiMeetBroadcastExtension/Pods-JitsiMeet-JitsiMeetBroadcastExtension.release.xcconfig"; sourceTree = "<group>"; };
153
-		609CB2080B75F75A89923F3D /* Pods-JitsiMeet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.debug.xcconfig"; sourceTree = "<group>"; };
154
-		A7B2827E068A0E05260054AC /* Pods-JitsiMeet-JitsiMeetBroadcastExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet-JitsiMeetBroadcastExtension.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet-JitsiMeetBroadcastExtension/Pods-JitsiMeet-JitsiMeetBroadcastExtension.debug.xcconfig"; sourceTree = "<group>"; };
151
+		756FCE06C08D9B947653C98A /* Pods-JitsiMeet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.debug.xcconfig"; path = "Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.debug.xcconfig"; sourceTree = "<group>"; };
155 152
 		B3B083EB1D4955FF0069CEE7 /* app.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = app.entitlements; sourceTree = "<group>"; };
156
-		D878B07B3FBD6E305EAA6B27 /* libPods-JitsiMeet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-JitsiMeet.a"; sourceTree = BUILT_PRODUCTS_DIR; };
153
+		D6152FF9E9F7B0E86F70A21D /* libPods-JitsiMeet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-JitsiMeet.a"; sourceTree = BUILT_PRODUCTS_DIR; };
157 154
 		DE050388256E904600DEE3A5 /* WebRTC.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = WebRTC.xcframework; path = "../../node_modules/react-native-webrtc/apple/WebRTC.xcframework"; sourceTree = "<group>"; };
158 155
 		DE4C455F21DE1E4E00EA0709 /* FIRUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FIRUtilities.m; sourceTree = "<group>"; };
159 156
 		DE4C456021DE1E4E00EA0709 /* FIRUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FIRUtilities.h; sourceTree = "<group>"; };
@@ -161,7 +158,6 @@
161 158
 		DEFDBBDB25656E3B00344B23 /* WebRTC.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = WebRTC.xcframework; path = "../../node_modules/react-native-webrtc/ios/WebRTC.xcframework"; sourceTree = "<group>"; };
162 159
 		E58801132278944E008B0561 /* JitsiMeetContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JitsiMeetContext.swift; sourceTree = "<group>"; };
163 160
 		E5C97B62227A1EB400199214 /* JitsiMeetCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JitsiMeetCommands.swift; sourceTree = "<group>"; };
164
-		FC040BBED70876444D89E91C /* Pods-JitsiMeet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.release.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.release.xcconfig"; sourceTree = "<group>"; };
165 161
 /* End PBXFileReference section */
166 162
 
167 163
 /* Begin PBXFrameworksBuildPhase section */
@@ -178,7 +174,7 @@
178 174
 			files = (
179 175
 				DE050389256E904600DEE3A5 /* WebRTC.xcframework in Frameworks */,
180 176
 				DEA9F289258A6EA800D4CD74 /* JitsiMeetSDK.framework in Frameworks */,
181
-				55BEDABDA92D47D399A70A5E /* libPods-JitsiMeet.a in Frameworks */,
177
+				2681BB562C7A0B42CFBA6719 /* libPods-JitsiMeet.a in Frameworks */,
182 178
 			);
183 179
 			runOnlyForDeploymentPostprocessing = 0;
184 180
 		};
@@ -208,8 +204,8 @@
208 204
 				0B26BE6D1EC5BC3C00EEFB41 /* JitsiMeet.framework */,
209 205
 				DEFDBBDB25656E3B00344B23 /* WebRTC.xcframework */,
210 206
 				0BD6B4361EF82A6B00D1F4CD /* WebRTC.framework */,
211
-				D878B07B3FBD6E305EAA6B27 /* libPods-JitsiMeet.a */,
212 207
 				4EC49B8625BED71300E76218 /* ReplayKit.framework */,
208
+				D6152FF9E9F7B0E86F70A21D /* libPods-JitsiMeet.a */,
213 209
 			);
214 210
 			name = Frameworks;
215 211
 			sourceTree = "<group>";
@@ -278,19 +274,6 @@
278 274
 			sourceTree = "<group>";
279 275
 			tabWidth = 4;
280 276
 		};
281
-		5E96ADD5E49F3B3822EF9A52 /* Pods */ = {
282
-			isa = PBXGroup;
283
-			children = (
284
-				4670A512A688E2DC34528282 /* Pods-jitsi-meet.debug.xcconfig */,
285
-				09AA3B93E4CC62D84B424690 /* Pods-jitsi-meet.release.xcconfig */,
286
-				609CB2080B75F75A89923F3D /* Pods-JitsiMeet.debug.xcconfig */,
287
-				FC040BBED70876444D89E91C /* Pods-JitsiMeet.release.xcconfig */,
288
-				A7B2827E068A0E05260054AC /* Pods-JitsiMeet-JitsiMeetBroadcastExtension.debug.xcconfig */,
289
-				5FEF9D87A4D2A38AD7193308 /* Pods-JitsiMeet-JitsiMeetBroadcastExtension.release.xcconfig */,
290
-			);
291
-			name = Pods;
292
-			sourceTree = "<group>";
293
-		};
294 277
 		83CBB9F61A601CBA00E9B192 = {
295 278
 			isa = PBXGroup;
296 279
 			children = (
@@ -298,10 +281,10 @@
298 281
 				0B26BE711EC5BC4D00EEFB41 /* Frameworks */,
299 282
 				83CBBA001A601CBA00E9B192 /* Products */,
300 283
 				13B07FAE1A68108700A75B9A /* src */,
301
-				5E96ADD5E49F3B3822EF9A52 /* Pods */,
302 284
 				0BEA5C261F7B8F73000D0AB4 /* Watch app */,
303 285
 				0BEA5C351F7B8F73000D0AB4 /* WatchKit extension */,
304 286
 				4EB06025260E026600F524C5 /* JitsiMeetBroadcast Extension */,
287
+				CDD71F5E1157E9F283DF92A8 /* Pods */,
305 288
 			);
306 289
 			indentWidth = 2;
307 290
 			sourceTree = "<group>";
@@ -318,6 +301,16 @@
318 301
 			name = Products;
319 302
 			sourceTree = "<group>";
320 303
 		};
304
+		CDD71F5E1157E9F283DF92A8 /* Pods */ = {
305
+			isa = PBXGroup;
306
+			children = (
307
+				756FCE06C08D9B947653C98A /* Pods-JitsiMeet.debug.xcconfig */,
308
+				3E0F4ED943C0B12BE77F6B45 /* Pods-JitsiMeet.release.xcconfig */,
309
+			);
310
+			name = Pods;
311
+			path = ../Pods;
312
+			sourceTree = "<group>";
313
+		};
321 314
 /* End PBXGroup section */
322 315
 
323 316
 /* Begin PBXNativeTarget section */
@@ -360,7 +353,7 @@
360 353
 			isa = PBXNativeTarget;
361 354
 			buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "JitsiMeet" */;
362 355
 			buildPhases = (
363
-				B6607F42A5CF0C76E98929E2 /* [CP] Check Pods Manifest.lock */,
356
+				69BC5020DBE393B56BD76636 /* [CP] Check Pods Manifest.lock */,
364 357
 				0BBA83C41EC9F7600075A103 /* Run React packager */,
365 358
 				13B07F871A680F5B00A75B9A /* Sources */,
366 359
 				13B07F8C1A680F5B00A75B9A /* Frameworks */,
@@ -523,7 +516,7 @@
523 516
 			shellPath = /bin/sh;
524 517
 			shellScript = "../scripts/run-packager.sh\n";
525 518
 		};
526
-		B6607F42A5CF0C76E98929E2 /* [CP] Check Pods Manifest.lock */ = {
519
+		69BC5020DBE393B56BD76636 /* [CP] Check Pods Manifest.lock */ = {
527 520
 			isa = PBXShellScriptBuildPhase;
528 521
 			buildActionMask = 2147483647;
529 522
 			files = (
@@ -825,7 +818,7 @@
825 818
 		};
826 819
 		13B07F941A680F5B00A75B9A /* Debug */ = {
827 820
 			isa = XCBuildConfiguration;
828
-			baseConfigurationReference = 609CB2080B75F75A89923F3D /* Pods-JitsiMeet.debug.xcconfig */;
821
+			baseConfigurationReference = 756FCE06C08D9B947653C98A /* Pods-JitsiMeet.debug.xcconfig */;
829 822
 			buildSettings = {
830 823
 				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
831 824
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIconDebug;
@@ -855,7 +848,7 @@
855 848
 		};
856 849
 		13B07F951A680F5B00A75B9A /* Release */ = {
857 850
 			isa = XCBuildConfiguration;
858
-			baseConfigurationReference = FC040BBED70876444D89E91C /* Pods-JitsiMeet.release.xcconfig */;
851
+			baseConfigurationReference = 3E0F4ED943C0B12BE77F6B45 /* Pods-JitsiMeet.release.xcconfig */;
859 852
 			buildSettings = {
860 853
 				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
861 854
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIconRelease;

+ 30
- 21
ios/sdk/src/dropbox/Dropbox.m 파일 보기

@@ -63,11 +63,14 @@ RCT_EXPORT_METHOD(authorize:(RCTPromiseResolveBlock)resolve
63 63
     currentReject = reject;
64 64
     
65 65
     dispatch_async(dispatch_get_main_queue(), ^{
66
-        [DBClientsManager authorizeFromController:[UIApplication sharedApplication]
67
-                                       controller:[[self class] topMostController]
68
-                                          openURL:^(NSURL *url) {
69
-                                              [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
70
-                                          }];
66
+        DBScopeRequest *scopeRequest = [[DBScopeRequest alloc] initWithScopeType:DBScopeTypeUser
67
+                                                                          scopes:@[]
68
+                                                            includeGrantedScopes:NO];
69
+        [DBClientsManager authorizeFromControllerV2:[UIApplication sharedApplication]
70
+                                         controller:[[self class] topMostController]
71
+                              loadingStatusDelegate:nil
72
+                                            openURL:^(NSURL *url) { [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; }
73
+                                       scopeRequest:scopeRequest];
71 74
     });
72 75
 }
73 76
 
@@ -128,25 +131,31 @@ RCT_EXPORT_METHOD(getSpaceUsage: (NSString *)token
128 131
     if (currentReject == nil || currentResolve == nil) {
129 132
         return NO;
130 133
     }
131
-    DBOAuthResult *authResult = [DBClientsManager handleRedirectURL:url];
132
-    if (authResult) {
133
-        if ([authResult isSuccess]) {
134
-            currentResolve(authResult.accessToken.accessToken);
135
-        } else {
136
-            NSString *msg;
137
-            if ([authResult isError]) {
138
-                msg = [NSString stringWithFormat:@"%@, error type: %zd",[authResult errorDescription], [authResult errorType]];
134
+    
135
+    BOOL canHandle = [DBClientsManager handleRedirectURL:url completion:^(DBOAuthResult *authResult) {
136
+        if (authResult) {
137
+            if ([authResult isSuccess]) {
138
+                NSInteger msTimestamp = authResult.accessToken.tokenExpirationTimestamp * 1000;
139
+                NSDictionary *authInfo = @{@"token": authResult.accessToken.accessToken,
140
+                                           @"rToken": authResult.accessToken.refreshToken,
141
+                                           @"expireDate": @(msTimestamp)
142
+                };
143
+                currentResolve(authInfo);
139 144
             } else {
140
-                msg = @"OAuth canceled!";
145
+                NSString *msg;
146
+                if ([authResult isError]) {
147
+                    msg = [NSString stringWithFormat:@"%@, error type: %zd", [authResult errorDescription], [authResult errorType]];
148
+                } else {
149
+                    msg = @"OAuth canceled!";
150
+                }
151
+                currentReject(@"authorize", msg, nil);
141 152
             }
142
-            currentReject(@"authorize", msg, nil);
153
+            currentResolve = nil;
154
+            currentReject = nil;
143 155
         }
144
-        currentResolve = nil;
145
-        currentReject = nil;
146
-
147
-        return YES;
148
-    }
149
-    return NO;
156
+    }];
157
+    
158
+    return canHandle;
150 159
 }
151 160
 
152 161
 + (UIViewController *)topMostController {

Loading…
취소
저장