Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setDeepLinkingEnabled has no effect #15

Open
KestasVenslauskas opened this issue Sep 21, 2022 · 14 comments
Open

setDeepLinkingEnabled has no effect #15

KestasVenslauskas opened this issue Sep 21, 2022 · 14 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@KestasVenslauskas
Copy link

As I was testing on Android & iOS I think I didnt find a purpose for 'setDeepLinkingEnabled' method.
Yes it sets this flag in code package and also calls native method to set the flat on native SDK itself, but what is the usecase for this?

I can actually set auth & payment redirect urls as https://www.google.com and the flow will still ignore this. Looking on android code it makes sense because it does not even look at redirect url since it uses activity result from AccountSessionActivity. Maybe 'deepLinkingEnabled' flag is used somewhere internally on Kevin native SDK's but is this even required here to be exposed in flutter package?

It's great that we do not need to setup deepLinking manually but is this intended not to have option for any other redirect url?

@edgar-zigis
Copy link
Member

Hey @KestasVenslauskas , deep linking will only work after the proper deep link registering within your application.
Registration ways on the native applications can be found in our docs here.

@KestasVenslauskas
Copy link
Author

@edgar-zigis I had the proper deepLink setup from previous examples it was "kevin://" I tought it works because I left it there and callback urls matched the schema but after removing intent-filters from androids manifest and changing callback url it was still working the same.
Before this I had no "kevin://.." deepLink implementation on iOS, but iOS works the same - it just does a simple callback to flutter code.

What would be the use case or advantage to have a proper deepLink setup right now?

@KestasVenslauskas
Copy link
Author

@edgar-zigis Just tried with my own deepLinking setup. Changing this flag tries to open a deepLink even if 'deepLinkingEnabled' is false.

Also I think deepLinking is not working as expected because another instance of my app is opened from deep link instead going back to the same app instance and passing intent result.

@antons-zubkovs antons-zubkovs self-assigned this Sep 21, 2022
@antons-zubkovs
Copy link
Contributor

antons-zubkovs commented Sep 21, 2022

@KestasVenslauskas hi! Since our current example does not support account linking yet (we are working on a new refactored example app), I tested deep linking with in app payments.

In flutter's app main() method I added:

  await Kevin.setDeepLinkingEnabled(true);
  await KevinPayments.setPaymentsConfiguration(
    const KevinPaymentsConfiguration(
      callbackUrl: 'kevin://redirect.payment',
    ),
  );

In flutter's app android manifest file:

 <activity
           android:name="eu.kevin.inapppayments.paymentsession.PaymentSessionActivity"
           android:exported="true">
           <intent-filter>
               <action android:name="android.intent.action.VIEW" />
               <category android:name="android.intent.category.DEFAULT" />
               <category android:name="android.intent.category.BROWSABLE" />
               <data
                   android:host="redirect.payment"
                   android:scheme="kevin" />
           </intent-filter>
 </activity>

Then I proceeded to make a payment using Revolut bank. After the payment, redirect link was opened and example app existing instance was opened as well.

Could you share some code snippets with your deep linking setup, so I could investigate it later?

@KestasVenslauskas
Copy link
Author

KestasVenslauskas commented Sep 21, 2022

@antons-zubkovs Since I did not used an example app, but just double checked the code I tested both accountLinking & in-app-payments. Both works fine.

About the deep linking... I tested few links and behaviour is still strange.

  1. Lets say we initialise accoutLinking with callbackUrl A and set calbackUrl in AccountsConfiguration as B.
    Then after account linking is successfull I will see a webview with url A. Why B is ignored?
  2. Lets say we initialise accoutLinking with callbackUrl A and set calbackUrl in AccountsConfiguration as A.
    Then after account linking is successfull I will get a simple callback to flutter code without deepLinking just using this method channel.
    I don't see any code touching deep linking feature inside your flutter packages.
  3. Lets say my deep link scheme is myApp:/... with a single / but I can't set a callbackUrl with a single / during auth init api call it gives me an error it has to be myApp://.... So I tried sending myApp://... to auth init and set myApp:/... inside AccountsConfiguration. This way Kevin tries to redirect me to my deepLinking by opening new instance of my app...
  4. In all of the cases mentioned before setting deepLinkingEnabled either to true or false does not impact any behaviour...

I cannot fully test deep linking because of the points mentioned above but the other question is what is the expected flow here? Is it actually needed?

I wonder what happens when deepLinkingEnabled is set to false but I will pass callbackUrl as my deepLink url?

@antons-zubkovs
Copy link
Contributor

@KestasVenslauskas

  1. callbackUrl must be the same for your accountLinking initialisation and AccountsConfiguration object
  2. When you set Kevin.setDeepLinkingEnabled(true), provide callbackUrl in configuration and set that url in intent filter, you should not worry about handling deep linking yourself, as it is handled by the SDK, all you get - is a response from the flutter plugin (using method channel mentioned above). What happens in details:
  • when the deep linking is disabled, SDK does not try to open third-party app and proceeds to open url in the browser. From that moment, authorisation depends on a bank, which you chose. You may get a push notification, click on it and open bank app, authorise there, but afterwards you must go back to your app manually, since no deep linking is envolved here. Once you open your app, and finish your flow, you will receive result from flutter plugin.
  • when the deep linking is enabled, SDK tries to open corresponding third-party app (if present). App will be opened, you will authorise there, afterwards your callbackUrl link is opened in browser. Since you have that url scheme in the intent filter for Payments/Accounts activities, they will be called/opened and you will receive your result through the flutter plugin.
  1. To have a proper scheme, you have to use double slash (you check that doc). Your intent filter's scheme and host and concatenated like scheme://host.

@KestasVenslauskas
Copy link
Author

@antons-zubkovs As I understand Kevin.setDeepLinkingEnabled(true) is just for auth/payment app redirection vs brower and has nothing to do with the apps deepLink which is initializing the auth/payment? Maybe it's worth mentioning this in the docs or just as comment in the code?

What I'm trying to achieve here is simply callback to our backend for a successfull payment, which does not actually require deepLinking here since this SDK automatically goes back to the app if links match, so then I can send a request to the backend from a client app after the callback from Kevin SDK is received in flutter code.
But anyway links get ignored if they are equal so I'm trying to understand the correct flow here. I tought the callback url should be to our backend endpoint and after that our backend should redirect to our app via deep link.

@antons-zubkovs
Copy link
Contributor

@KestasVenslauskas regarding Kevin.setDeepLinkingEnabled(true), probably we will have to improve our docs on that point.

The way to achieve your desired behaviour - you can have some endpoint on your BE to confirm that the payment was finished, when you get the result from the flutter plugin.

@KestasVenslauskas
Copy link
Author

@antons-zubkovs Just tried Kevin.setDeepLinkingEnabled(true) on a real device that has "SwedBank" app. But it did not tried to open "SwedBank" app during auth/payment. Maybe it's because project is still in sandbox mode?

@antons-zubkovs
Copy link
Contributor

@KestasVenslauskas it tried to open SwedBank app, though it does not support it, that's why flow was continued in a web view. You can try to check it with Revolut bank with/without setDeepLinkingEnabled and you will see the difference.

@KestasVenslauskas
Copy link
Author

KestasVenslauskas commented Sep 22, 2022

@antons-zubkovs I do have a Revolut on my device. Just tried with setDeepLinkingEnabled either true or false I just see few flashes of webview like "waiting for payment..." and then it goes back with a success callback. Revolut app was not opened.

@antons-zubkovs
Copy link
Contributor

@KestasVenslauskas did you set isSandbox as true? That could be the reason of that behaviour. Banks behave differently in a sandbox mode, so it could be Revolut's behaviour.

@KestasVenslauskas
Copy link
Author

@antons-zubkovs No if I set isSandbox to true I see only webview with "page not found" after starting auth/payment.
But our project is still in sandbox mode. Maybe this is also a reason?

@antons-zubkovs
Copy link
Contributor

@KestasVenslauskas that also could be the reason, yes.

@edgar-zigis edgar-zigis added the help wanted Extra attention is needed label Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants