Skip to content

fix: deeplink url format#111

Merged
quetool merged 3 commits intoWalletConnect:masterfrom
MuckT:tomm/wc-url-fix
Apr 19, 2024
Merged

fix: deeplink url format#111
quetool merged 3 commits intoWalletConnect:masterfrom
MuckT:tomm/wc-url-fix

Conversation

@MuckT
Copy link
Copy Markdown
Contributor

@MuckT MuckT commented Apr 17, 2024

Description

We've received several reports of users unable to link to Valora using Web3ModalFlutter in our discord.

After investigation it appears the URL format is missing an / character and parsing incorrectly. This should fix that integration and match the deeplinks created by other WalletConnect Web3Modal implementations.

Before: celo://walletwc?uri=wc...
After: celo://wallet/wc?uri=wc...

@quetool
Copy link
Copy Markdown
Contributor

quetool commented Apr 18, 2024

Hello @MuckT! Thanks for bringing this to my attention and I apologize for any inconvenience this may have caused! Indeed I was making some changes on core_utils lately in regards of this. However the fix should be done on createSafeUrl() function as follow:

  @override
  String createSafeUrl(String url) {
    if (url.isEmpty) return url;

    String safeUrl = url;
    if (!safeUrl.contains('://')) {
      safeUrl = url.replaceAll('/', '').replaceAll(':', '');
      safeUrl = '$safeUrl://';
    } else {
      final parts = safeUrl.split('://');
      if (parts.last.isNotEmpty && parts.last != 'wc') {
        if (!safeUrl.endsWith('/')) {
          return '$safeUrl/';
        }
        return safeUrl;
      } else {
        safeUrl = url.replaceFirst('://wc', '://');
      }
    }
    return safeUrl;
  }

If you are willing to change your code into this one I will totally merge it and deploy it in following version.
That being said, it may take some time for every dapp to adopt the new version so wouldn't be fair that you pass celo://wallet/ instead of celo://wallet in your metadata's redirect object? You can leverage CodePush and will be much faster.

@MuckT
Copy link
Copy Markdown
Contributor Author

MuckT commented Apr 18, 2024

@quetool adjusted the PR in 3467433.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@quetool quetool merged commit 74f2192 into WalletConnect:master Apr 19, 2024
@MuckT MuckT deleted the tomm/wc-url-fix branch September 20, 2024 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants