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

MobileRelayUI #904

Merged
merged 25 commits into from
Jun 29, 2023
Merged

MobileRelayUI #904

merged 25 commits into from
Jun 29, 2023

Conversation

bangtoven
Copy link
Contributor

Summary

How did you test your changes?

@@ -45,7 +46,7 @@ export interface CoinbaseWalletSDKOptions {
/** @optional whether or not to reload dapp automatically after disconnect, defaults to true */
reloadOnDisconnect?: boolean;
/** @optional whether to connect mobile web app via WalletLink, defaults to false */
useMobileWalletLink?: boolean;
enableMobileWalletLink?: boolean;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid confusion as react hook

packages/wallet-sdk/src/provider/MobileRelayUI.ts Outdated Show resolved Hide resolved
Comment on lines 98 to 104
showConnecting(_options: {
isUnlinkedErrorState?: boolean | undefined;
onCancel: ErrorHandler;
onResetConnection: () => void;
}): () => void {
return () => {}; // no-op
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: i might try this thing

onButtonClick: () => void;
};

export class RedirectDialog {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to show a button in case of redirection getting blocked by browser
image


setTimeout(() => {
this.redirectToCoinbaseWallet(walletLinkUrl);
}, 99);
Copy link
Contributor Author

@bangtoven bangtoven Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before redirecting to cb wallet, technically we should wait for message to be transmitted via websocket. but that's hidden very very deep under rxjs swamp.

tried listening to the rx observable, however i have encountered an issue where the browser seems to restrict calling window.open within the rxjs subscription block.
per some SO posts, it's known that browser blocks web apps to call window.open from rxjs handlers.

so, it just uses timeout here and show a dialog with force redirection just in case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the goal here to auto redirect if the user doesn't click the button?

location = window.location;
}

const location = getLocation();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to util

@@ -863,7 +863,7 @@ export class WalletLinkRelay extends WalletSDKRelayAbstract {
// WIP
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
private connectAndSignIn(_params: {
private connectAndSignIn(params: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressing #908 (comment)

@bangtoven bangtoven marked this pull request as ready for review June 29, 2023 03:05
vishnumad
vishnumad previously approved these changes Jun 29, 2023
@bangtoven bangtoven requested a review from vishnumad June 29, 2023 19:28
cb-jake
cb-jake previously approved these changes Jun 29, 2023
@bangtoven bangtoven merged commit 2adb337 into master Jun 29, 2023
10 checks passed
@bangtoven bangtoven deleted the jungho/mobile-redirect branch June 29, 2023 20:28
bangtoven added a commit that referenced this pull request Feb 29, 2024
* rename options.useMobileWalletLink to avoid confusion as react hook

* rename WalletSDKUI => WalletLinkRelayUI

* add MobileRelayUI

* implementing MobileRelayUI

* rename

* fix rename

* createWalletLinkUrl

* implement MobileRelayUI

* open the app after publishWeb3RequestEvent

* further simplify

* override publishEvent

* revert

* using timeout

* nits

* RedirectDialog

adding RedirectDialog

* for testing. needs to be reverted

* ughghghagh

* Revert "for testing. needs to be reverted"

This reverts commit ff0153d.

* this.redirectDialog.present called on openCoinbaseWalletDeeplink

* remove logging

* address comment

* linter …

* darkmode

* darkmode
bangtoven added a commit that referenced this pull request Aug 16, 2024
* rename options.useMobileWalletLink to avoid confusion as react hook

* rename WalletSDKUI => WalletLinkRelayUI

* add MobileRelayUI

* implementing MobileRelayUI

* rename

* fix rename

* createWalletLinkUrl

* implement MobileRelayUI

* open the app after publishWeb3RequestEvent

* further simplify

* override publishEvent

* revert

* using timeout

* nits

* RedirectDialog

adding RedirectDialog

* for testing. needs to be reverted

* ughghghagh

* Revert "for testing. needs to be reverted"

This reverts commit ff0153d.

* this.redirectDialog.present called on openCoinbaseWalletDeeplink

* remove logging

* address comment

* linter …

* darkmode

* darkmode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants