Advertisement
Guest User

Untitled

a guest
Mar 16th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (void)handleDeepUrlLink:(NSURL *)url {
  2.    
  3.     self.deepLinkUlr = nil;
  4.     NSString *defURLScheme = nil;
  5.    
  6. #ifdef DEBUG
  7.     defURLScheme = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"kURLSchemeDebug"];
  8. #else
  9.     defURLScheme = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"kUrl_scheme"];
  10. #endif
  11.    
  12.     if ([[url scheme] isEqualToString:defURLScheme]) {
  13.        
  14.         NSMutableArray *parameters = [[[[url path] stringByReplacingOccurrencesOfString:@"/" withString:@""] componentsSeparatedByString:@"="] mutableCopy];
  15.        
  16.         if ([parameters containsObject:@"reset"]) {
  17.             if (![AOCredentialStore isLogged]) {
  18.                 [self handleResetPasswordDeepLinkWithParameters:parameters];
  19.             } else {
  20.                 __weak typeof(self) weakSelf = self;
  21.                 [AOCredentialStore logoutActionWithCompletion:^{
  22.                     [weakSelf handleResetPasswordDeepLinkWithParameters:parameters];
  23.                 }];
  24.             }
  25.            
  26.         } else {
  27.             if (parameters.count >= 2) {
  28.                
  29.                 //access code should be second parameter
  30.                 [AOCredentialStore loginWithAccessCode:parameters[1] andComplitionBlock:^{
  31.                    
  32.                     [[NSNotificationCenter defaultCenter] postNotificationName:kAOCredentialStoreDidLoginAccessCodeNotification object:nil userInfo:@{@"SetNewPinFlag" : @"Y"}];
  33.                 }];
  34.             }
  35.         }
  36.     }
  37.     else if ([url isFileURL]) {
  38.        
  39.         [[NSNotificationCenter defaultCenter] postNotificationName:kNotificationDidReceiveOpenInFile
  40.                                                             object:nil
  41.                                                           userInfo:@{kNotificationDidReceiveOpenInFileUrlKey:url}];
  42.     }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement