Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions DeepLinkKit/Router/DPLDeepLinkRouter.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
@interface DPLDeepLinkRouter ()

@property (nonatomic, copy) DPLApplicationCanHandleDeepLinksBlock applicationCanHandleDeepLinksBlock;
@property (nonatomic, copy) DPLRouteCompletionBlock routeCompletionHandler;

@property (nonatomic, strong) NSMutableOrderedSet *routes;
@property (nonatomic, strong) NSMutableDictionary *classesByRoute;
Expand Down Expand Up @@ -106,13 +105,12 @@ - (void)setObject:(id)obj forKeyedSubscript:(NSString *)key {
#pragma mark - Routing Deep Links

- (BOOL)handleURL:(NSURL *)url withCompletion:(DPLRouteCompletionBlock)completionHandler {
self.routeCompletionHandler = completionHandler;
if (!url) {
return NO;
}

if (![self applicationCanHandleDeepLinks]) {
[self completeRouteWithSuccess:NO error:nil];
[self completeRouteWithSuccess:NO error:nil completionHandler:completionHandler];
return NO;
}

Expand All @@ -133,7 +131,7 @@ - (BOOL)handleURL:(NSURL *)url withCompletion:(DPLRouteCompletionBlock)completio
error = [NSError errorWithDomain:DPLErrorDomain code:DPLRouteNotFoundError userInfo:userInfo];
}

[self completeRouteWithSuccess:isHandled error:error];
[self completeRouteWithSuccess:isHandled error:error completionHandler:completionHandler];

return isHandled;
}
Expand Down Expand Up @@ -186,13 +184,12 @@ - (BOOL)handleRoute:(NSString *)route withDeepLink:(DPLDeepLink *)deepLink error
}


- (void)completeRouteWithSuccess:(BOOL)handled error:(NSError *)error {

dispatch_async(dispatch_get_main_queue(), ^{
if (self.routeCompletionHandler) {
self.routeCompletionHandler(handled, error);
}
});
- (void)completeRouteWithSuccess:(BOOL)handled error:(NSError *)error completionHandler:(DPLRouteCompletionBlock)completionHandler {
if (completionHandler) {
dispatch_async(dispatch_get_main_queue(), ^{
completionHandler(handled, error);
});
}
}

@end