Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

click callbacks not always fired on IOS and ionic3 #232

Open
AleCat83 opened this issue Aug 10, 2020 · 5 comments
Open

click callbacks not always fired on IOS and ionic3 #232

AleCat83 opened this issue Aug 10, 2020 · 5 comments

Comments

@AleCat83
Copy link

Hello,

I m using the plugin along with Ionic 3 and @ionic-native/deeplinks. I listen for deep link clicks using the method route. In most of the cases it works fine but sometimes the callback are not called. When this happen I can see in the logs the string "No Match found" or "Match found /XXXXX" but the callbacks (both next or error) that I set using subscribe are not called.
Digging a bit more I discovered that the log messages comes from the "www/deeplinks.js" file, so the js bridge receive the callbacks from the native layer but it is not passed to the subscribe callbacks.

@ShadananaK
Copy link

Hi,

Even I am facing exactly same issue when it comes to IOS app using ionic 3. Some time it works fine and some time get "No Match found" string as log randomly. Is there any solution or work around to this problem ? Please help.

Regards,
Shadanana

@uxFeranmi
Copy link

@AleCat83, @ShadananaK, this issue has also been reported here: #77. I found a workaround in that thread and there's also more explanation on why it happens.

@uxFeranmi
Copy link

uxFeranmi commented Aug 12, 2020

This seems to work fine, using the plugin through the window object instead of the ionic-native wrapper. Better than re-subscribing to the observable after each nomatch occurence because the plugin's path matching function is called multiple times for each time you re-subscribe.

        window['IonicDeeplink'].route(this.Globals.Deeplinks,
            (match) => {
                console.log('Deeplink path found!');
                console.log(`Deeplink path found: ${JSON.stringify(match)}`);

                navigate(match);
            }, (nomatch) => {
                console.log('Deeplink path NOT found!');
                console.log(`Deeplink path NOT found: ${JSON.stringify(nomatch)}`);
                
                navigate(nomatch);
            }
        );

@AleCat83
Copy link
Author

AleCat83 commented Aug 13, 2020

This seems to work fine, using the plugin through the window object instead of the ionic-native wrapper. Better than re-subscribing cute to the observable after each nomatch occurence because the plugin's path matching function is called multiple times for each time you re-subscribe.

        window['IonicDeeplink'].route(this.Globals.Deeplinks,
            (match) => {
                console.log('Deeplink path found!');
                console.log(`Deeplink path found: ${JSON.stringify(match)}`);

                navigate(match);
            }, (nomatch) => {
                console.log('Deeplink path NOT found!');
                console.log(`Deeplink path NOT found: ${JSON.stringify(nomatch)}`);
                
                navigate(nomatch);
            }
        );

Thanks, this workaround works for me, and I agree that it's better than recreate the observable on error as it may lead to memory leaks.

@jpike88
Copy link

jpike88 commented Apr 19, 2021

observable method also isn't reliable (seems to only fire nomatch the first time, then subsequent tries fails)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants