fix(deeplinking): After braking it with the dropbox implementation.
This commit is contained in:
parent
af37141e3d
commit
467452d110
|
@ -125,7 +125,23 @@ continueUserActivity:(NSUserActivity *)userActivity
|
|||
continueUserActivity:userActivity
|
||||
restorationHandler:restorationHandler];
|
||||
}
|
||||
```
|
||||
|
||||
And also one of the following:
|
||||
|
||||
```objc
|
||||
// See https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623073-application?language=objc
|
||||
- (BOOL)application:(UIApplication *)app
|
||||
openURL:(NSURL *)url
|
||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
||||
return [JitsiMeetView application:app
|
||||
openURL:url
|
||||
options: options];
|
||||
}
|
||||
```
|
||||
or
|
||||
```objc
|
||||
// See https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623112-application?language=objc
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
openURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
|
@ -215,31 +231,33 @@ user to request entering Picture-in-Picture.
|
|||
|
||||
## Dropbox integration
|
||||
|
||||
To setup the dropbox integration you need to do the following steps:
|
||||
To setup the Dropbox integration, follow these steps:
|
||||
|
||||
1. Add the following lines in your Info.plist file and replace `<APP_KEY>` with your dropbox app key:
|
||||
1. Add the following to the app's Info.plist and change `<APP_KEY>` to your
|
||||
Dropbox app key:
|
||||
```
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>db-<APP_KEY></string>
|
||||
</array>
|
||||
<key>CFBundleURLName</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string></string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>db-<APP_KEY></string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
<array>
|
||||
<string>dbapi-8-emm</string>
|
||||
<string>dbapi-2</string>
|
||||
<string>dbapi-2</string>
|
||||
<string>dbapi-8-emm</string>
|
||||
</array>
|
||||
```
|
||||
|
||||
2. Add the following method to `AppDelegate`:
|
||||
2. Add the following to the app's `AppDelegate`:
|
||||
```objc
|
||||
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url
|
||||
- (BOOL)application:(UIApplication *)app
|
||||
openURL:(NSURL *)url
|
||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
||||
return [JitsiMeetView application:app
|
||||
openURL:url
|
||||
|
|
|
@ -36,22 +36,13 @@
|
|||
restorationHandler:restorationHandler];
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
|
||||
- (BOOL)application:(UIApplication *)app
|
||||
openURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
annotation:(id)annotation {
|
||||
return [JitsiMeetView application:application
|
||||
openURL:url
|
||||
sourceApplication:sourceApplication
|
||||
annotation:annotation];
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url
|
||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
||||
return [JitsiMeetView application:app
|
||||
openURL:url
|
||||
options: options];
|
||||
return [JitsiMeetView application:app
|
||||
openURL:url
|
||||
options:options];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -195,6 +195,14 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
|
|||
restorationHandler:restorationHandler];
|
||||
}
|
||||
|
||||
+ (BOOL)application:(UIApplication *)app
|
||||
openURL:(NSURL *)url
|
||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
||||
return
|
||||
[Dropbox application:app openURL:url options:options]
|
||||
|| [RCTLinkingManager application:app openURL:url options:options];
|
||||
}
|
||||
|
||||
+ (BOOL)application:(UIApplication *)application
|
||||
openURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
|
@ -214,13 +222,6 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
|
|||
annotation:annotation];
|
||||
}
|
||||
|
||||
+ (BOOL)application:(UIApplication *)app openURL:(NSURL *)url
|
||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
||||
return [Dropbox application:app
|
||||
openURL:url
|
||||
options: options];
|
||||
}
|
||||
|
||||
#pragma mark Initializers
|
||||
|
||||
- (instancetype)init {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#import <React/RCTBridgeModule.h>
|
||||
#import <ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.h>
|
||||
|
||||
#import "Dropbox.h"
|
||||
|
||||
RCTPromiseResolveBlock currentResolve = nil;
|
||||
|
@ -24,19 +25,19 @@ RCTPromiseRejectBlock currentReject = nil;
|
|||
@implementation Dropbox
|
||||
|
||||
+ (NSString *)getAppKey{
|
||||
NSArray *urlTypes = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleURLTypes"];
|
||||
for(NSDictionary<NSString *, NSArray *> *urlType in urlTypes) {
|
||||
NSArray *urlTypes
|
||||
= [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleURLTypes"];
|
||||
|
||||
for (NSDictionary<NSString *, NSArray *> *urlType in urlTypes) {
|
||||
NSArray *urlSchemes = urlType[@"CFBundleURLSchemes"];
|
||||
if(urlSchemes != nil) {
|
||||
for(NSString *urlScheme in urlSchemes) {
|
||||
if(urlScheme != nil) {
|
||||
if ([urlScheme hasPrefix:@"db-"]) {
|
||||
return [urlScheme substringFromIndex:3];
|
||||
}
|
||||
|
||||
if (urlSchemes) {
|
||||
for (NSString *urlScheme in urlSchemes) {
|
||||
if (urlScheme && [urlScheme hasPrefix:@"db-"]) {
|
||||
return [urlScheme substringFromIndex:3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
@ -52,7 +53,7 @@ RCT_EXPORT_MODULE();
|
|||
};
|
||||
};
|
||||
|
||||
RCT_EXPORT_METHOD(authorize: (RCTPromiseResolveBlock)resolve
|
||||
RCT_EXPORT_METHOD(authorize:(RCTPromiseResolveBlock)resolve
|
||||
reject:(__unused RCTPromiseRejectBlock)reject) {
|
||||
currentResolve = resolve;
|
||||
currentReject = reject;
|
||||
|
@ -75,7 +76,7 @@ RCT_EXPORT_METHOD(getDisplayName: (NSString *)token
|
|||
resolve(result.name.displayName);
|
||||
} else {
|
||||
NSString *msg = @"Failed!";
|
||||
if (networkError != nil) {
|
||||
if (networkError) {
|
||||
msg = [NSString stringWithFormat:@"Failed! Error: %@", networkError];
|
||||
}
|
||||
reject(@"getDisplayName", @"Failed", nil);
|
||||
|
@ -93,7 +94,7 @@ RCT_EXPORT_METHOD(getSpaceUsage: (NSString *)token
|
|||
DBUSERSSpaceAllocation *allocation = result.allocation;
|
||||
NSNumber *allocated = 0;
|
||||
NSNumber *used = 0;
|
||||
if([allocation isIndividual]) {
|
||||
if ([allocation isIndividual]) {
|
||||
allocated = allocation.individual.allocated;
|
||||
used = result.used;
|
||||
} else if ([allocation isTeam]) {
|
||||
|
@ -108,7 +109,7 @@ RCT_EXPORT_METHOD(getSpaceUsage: (NSString *)token
|
|||
resolve(dictionary);
|
||||
} else {
|
||||
NSString *msg = @"Failed!";
|
||||
if (networkError != nil) {
|
||||
if (networkError) {
|
||||
msg = [NSString stringWithFormat:@"Failed! Error: %@", networkError];
|
||||
}
|
||||
reject(@"getSpaceUsage", msg, nil);
|
||||
|
@ -117,15 +118,18 @@ RCT_EXPORT_METHOD(getSpaceUsage: (NSString *)token
|
|||
|
||||
}
|
||||
|
||||
+ (BOOL)application:(UIApplication *)app openURL:(NSURL *)url
|
||||
+ (BOOL)application:(UIApplication *)app
|
||||
openURL:(NSURL *)url
|
||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
||||
if (currentReject == nil || currentResolve == nil) {
|
||||
return NO;
|
||||
}
|
||||
DBOAuthResult *authResult = [DBClientsManager handleRedirectURL:url];
|
||||
if (authResult != nil) {
|
||||
if (authResult) {
|
||||
if ([authResult isSuccess]) {
|
||||
currentResolve(authResult.accessToken.accessToken);
|
||||
currentResolve = nil;
|
||||
currentReject = nil;
|
||||
return YES;
|
||||
} else {
|
||||
NSString *msg;
|
||||
if ([authResult isError]) {
|
||||
|
@ -137,13 +141,15 @@ RCT_EXPORT_METHOD(getSpaceUsage: (NSString *)token
|
|||
currentResolve = nil;
|
||||
currentReject = nil;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (UIViewController*)topMostController
|
||||
+ (UIViewController *)topMostController
|
||||
{
|
||||
UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
UIViewController *topController
|
||||
= [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
|
||||
while (topController.presentedViewController) {
|
||||
topController = topController.presentedViewController;
|
||||
|
@ -154,10 +160,10 @@ RCT_EXPORT_METHOD(getSpaceUsage: (NSString *)token
|
|||
|
||||
+ (void)setAppKey {
|
||||
NSString *appKey = [self getAppKey];
|
||||
if (appKey != nil) {
|
||||
|
||||
if (appKey) {
|
||||
[DBClientsManager setupWithAppKey:appKey];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue