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 generates very long links when adding custom params #280

Closed mtalha101 closed 10 months ago

mtalha101 commented 10 months ago

Describe the bug When I add custom parameters to link properties while generating a short link, I receive a very large link like: https://app.evershop.ai/a/key_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?%24randomized_bundle_token=1253323032068742588&tags=influencer&alias=u/testuser7140&channel=influencer&feature=influencer&source=ios&data=eyIkbG9jYWxseV9pbmRleGFibGUiOnRydWUsIiRvZ190aXRsZSI6IkV2ZXJTaG9wIEluZmx1ZW5jZXIiLCIka2V5d29yZHMiOlsiaW5mbHVlbmNlciJdLCIkcHVibGljbHlfaW5kZXhhYmxlIjp0cnVlLCIkY2Fub25pY2FsX3VybCI6Imh0dHBzOi8vd2ViLmV2ZXJzaG9wLmFpL3UvdGVzdHVzZXI3MTQwIiwiJGNhbm9uaWNhbF9pZGVudGlmaWVyIjoiZXZlcnNob3AvaW5mbHVlbmNlciJ9. This started happening when I added custom params i.e. $android_url and $ios_url, to redirect the user to webpage if the app is not installed

To Reproduce This is my link generating code:

return await FlutterBranchSdk.getShortUrl(
        buo: BranchUniversalObject(
          canonicalIdentifier: 'evershop/post',
          canonicalUrl: 'https://web.evershop.ai/p/$id',
          title: 'EverShop Post',
          keywords: ['post'],
        ),
        linkProperties: BranchLinkProperties(
          tags: ['post'],
          campaign: 'post',
          feature: 'post',
          channel: 'post',
          alias: 'p/$id',
        )
          ..addControlParam('\$uri_redirect_mode', '1')
          ..addControlParam('\$ios_url', 'https://web.evershop.ai/p/$id')
          ..addControlParam('\$android_url', 'https://web.evershop.ai/p/$id'),
      );

Expected behavior The sdk should generate a link like https://app.evershop.ai/u/testuser7140 which should be redirected to webapge https://web.evershop.ai/u/testuser7140 if the app is not installed.

Smartphone:

Web:

RodrigoSMarques commented 10 months ago

Based on the tests I carried out (including in a native Swift project to ensure that the problem was not in the Flutter plugin), the problem does not occur when using the $android_url and $ios_url parameters, but when combining the alias parameter.

If you remove the alias, a short link is generated.

This package calls Branch Native SDK functions on each platform.

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

Please open an issue in the platform repository:

Captura de Tela 2024-01-11 às 10 08 27 Captura de Tela 2024-01-11 às 10 11 03 Captura de Tela 2024-01-11 às 10 29 13 Captura de Tela 2024-01-11 às 10 30 31
mtalha101 commented 10 months ago

Thank you so much Sir! I will open an issue for iOS Native SDK