RodrigoSMarques / flutter_branch_sdk

Flutter Plugin for create deep link using Branch Metrics SDK. This plugin provides a cross-platform (iOS, Android, Web).
https://branch.io
MIT License
101 stars 91 forks source link

Branch SDK asks for paste permission everytime the app is opened. #345

Closed korzonkiee closed 4 months ago

korzonkiee commented 5 months ago

Describe the bug Branch SDK asks for paste permission everytime the app is opened.

To Reproduce Steps to reproduce the behavior:

  1. Copy link.
  2. Open the Flutter example app, see that it requests paste permission popup.
  3. Kill the app.
  4. Copy link.
  5. Open the Flutter example app, see that it requests paste permission popup again.

Expected behavior Branch SDK should only ask for paste permission after app was installed.

Current behavior Branch SDK asks for paste permission everytime the app is opened.

Screenshots

Step 1: Copy link Step 2: Open app (permission request) Step 3: Kill app Step 4: Copy link Step 5: Open app (permission request)
CleanShot 2024-07-01 at 16 14 22@2x CleanShot 2024-07-01 at 16 14 22@2x CleanShot 2024-07-01 at 16 14 41@2x CleanShot 2024-07-01 at 16 13 57@2x CleanShot 2024-07-01 at 16 14 22@2x
RodrigoSMarques commented 4 months ago

Please do not remove the additional information that is requested when opening the issue, otherwise your issue will be closed due to lack of detailed information.

Which package version? Which operating system version? Which Flutter version?

RodrigoSMarques commented 4 months ago

I ran the test with the sample application and I can't reproduce the problem. Clipboard authorization is only requested during installation.

The print below is the code instruction that requests authorization only during installation

image
korzonkiee commented 4 months ago

Please do not remove the additional information that is requested when opening the issue, otherwise your issue will be closed due to lack of detailed information.

Which package version? Which operating system version? Which Flutter version?

Hey @RodrigoSMarques, thank you so much for your reply. Sorry for not providing all the details right away.

Smartphone (Please complete the following information. remove session if not platform):

korzonkiee commented 4 months ago

I ran the test with the sample application and I can't reproduce the problem. Clipboard authorization is only requested during installation.

The print below is the code instruction that requests authorization only during installation

image

Thanks for spending time to investigate this.

I skimmed through the code that you highlighted and it looks to me that this checkPasteboardOnInstall function gets called every time the app is opened because the application(_:didFinishLaunchingWithOptions:) callback fires upon each app launch. I also verified that by setting a breakpoint in Xcode and launching the app a bunch of times.

Moreover, I checked what does the checkPasteboardOnInstall function do and it just sets the checkOnInstall flag to YES.

So if I understand correctly, every time the app is opened, the Flutter SDK tells the iOS Branch SDK to check the pasteboard.


Regarding your tests — are you sure you copy the link again before opening the app as described in my steps to reproduce section?

When I do the following steps (I do not copy link before opening the app):

  1. Copy link.
  2. Install app.
  3. Get pasteboard permission prompt.
  4. Tap "Allow paste".
  5. Close app (swipe up to kill it).
  6. Open app.

Then I am not getting the paste permission popup upon opening the app. See video below:

RodrigoSMarques commented 4 months ago

This plugin follows the implementation guidelines of the Branch SDK for checkPasteboardOnInstall, which can be found here

This package calls Branch Native SDK functions on each platform.

The problem reported is not in the Flutter plugin, but in the Native SDK.

I suggest you open issue in the platform repository:

Or open a support ticket for Branch at the link

korzonkiee commented 4 months ago

I just created an issue in the Branch iOS SDK repository: https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/issues/1412.

I will close this one.

Thanks @RodrigoSMarques!