ionic-team / ionic-plugin-deeplinks

Handle deeplinks into your Ionic/Cordova apps from Universal Links, App Links, and Custom URL schemes. For those using Ionic 2, there are some nice goodies that make life easier.
Other
332 stars 218 forks source link

Plugin stops custom url schemes out of its control from being handled #124

Open pougin opened 7 years ago

pougin commented 7 years ago

I am using ionic 1 and encountered one problem. This plugin cannot handle custom url schemes to other plugins.

In the log below, the plugin stops my Wechat SSO login callback method which relies on custom url scheme wxb00cac42c59bb5b3.

2017-08-08 19:07:33.059066+0800 pangmaomao[3196:694632] IonicDeepLinkPlugin: Handle link (internal) wxb00cac42c59bb5b3://oauth?code=021XiQ7z1TWsDd0ZEk5z1yxZ7z1XiQ7v&state=_1502190448416 2017-08-08 19:07:34.063903+0800 pangmaomao[3196:694632] retryHandleOpenURL

The process is:

  1. I click Wechat login, jumps to Wechat and login
  2. After Wechat login succeeds, jumps back to my APP and nothing hanppends with the log above

Command the plugin was installed: ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=ivynote --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=ivynote.cn --variable ANDROID_PATH_PREFIX=/

My system:

cli packages: (/usr/local/var/www/com.pangmaomao.app/node_modules)

@ionic/cli-plugin-cordova : 1.6.2
@ionic/cli-plugin-gulp    : 1.1.1
@ionic/cli-plugin-ionic1  : 2.1.1
@ionic/cli-utils          : 1.7.0
ionic (Ionic CLI)         : 3.7.0

global packages:

Cordova CLI : 7.0.1 
Gulp CLI    : CLI version 3.9.0 Local version 3.9.1

local packages:

Cordova Platforms : android 6.0.0 ios 4.4.0
Ionic Framework   : unknown

System:

Android SDK Tools : 25.2.5
Node              : v6.11.1
OS                : macOS Sierra
Xcode             : Xcode 8.3.3 Build version 8E3004b 
ios-deploy        : 1.9.0 
ios-sim           : 5.0.6 
npm               : 5.3.0 
pougin commented 7 years ago

Solved for iOS. Modify file /src/ios/IonicDeeplinkPlugin.m, limit the scheme that deeplink deals with.

Edit method handleLink, add codes below line 39,

if (![[url scheme] isEqualToString:@"https"]) { NSLog(@"IonicDeepLinkPlugin: Scheme not for deeplink: %@", [url scheme]);

return NO; }

mlynch commented 7 years ago

Thanks for the note, keeping this open until it gets in the code

Remco75 commented 7 years ago

is there a eta for this arriving in the code? im running into the as well. this would fix it. (also a redirect from another plugin)

Remco75 commented 7 years ago

Btw, I could make a PR for this, but bear in mind that this will break < ios8 as it breaks custom url schemes . So you prob want to add something to the readme

mlynch commented 7 years ago

@Remco75 that would be much appreciated! We don't support iOS < 8 so that seems totally fine to me

Remco75 commented 7 years ago

@mlynch cool, I will do that. I'm away for the rest of the week, I will submit pr somewhere next week

Remco75 commented 7 years ago

And I see I made a mistake. It will break support <9 !