Skip to content

Commit

Permalink
[firebase_dynamic_links] sometimes got error NSPOSIXErrorDomain Code=53
Browse files Browse the repository at this point in the history
As in link there is a case of nil at completion of handleUniversalLink.
firebase/firebase-ios-sdk#2303

Also, even if make this correction,  cause an error, so fixed it to tell
it to the dart side.
  • Loading branch information
ko2ic committed Mar 25, 2019
1 parent 0403387 commit 0db4f75
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

@interface FLTFirebaseDynamicLinksPlugin ()
@property(nonatomic, retain) FIRDynamicLink *dynamicLink;
@property(nonatomic, retain) FlutterError *flutterError;
@end

@implementation FLTFirebaseDynamicLinksPlugin
Expand Down Expand Up @@ -48,7 +49,13 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
options:options
completion:[self createShortLinkCompletion:result]];
} else if ([@"FirebaseDynamicLinks#retrieveDynamicLink" isEqualToString:call.method]) {
result([self retrieveDynamicLink]);
NSMutableDictionary *dict = [self retrieveDynamicLink];
if (dict == nil && self.flutterError) {
result(self.flutterError);
self.flutterError = nil;
} else {
result(dict);
}
} else {
result(FlutterMethodNotImplemented);
}
Expand Down Expand Up @@ -96,9 +103,13 @@ - (BOOL)checkForDynamicLink:(NSURL *)url {
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray *))restorationHandler {
usleep(50000);
BOOL handled = [[FIRDynamicLinks dynamicLinks]
handleUniversalLink:userActivity.webpageURL
completion:^(FIRDynamicLink *_Nullable dynamicLink, NSError *_Nullable error) {
if (error) {
self.flutterError = getFlutterError(error);
}
self.dynamicLink = dynamicLink;
}];
return handled;
Expand Down

0 comments on commit 0db4f75

Please sign in to comment.