-
Notifications
You must be signed in to change notification settings - Fork 520
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
MobileRelay #903
MobileRelay #903
Conversation
this._relay = isMobileWeb() | ||
? new MobileRelay(relayOption) | ||
: new WalletLinkRelay(relayOption); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
branching here for dedicated relay logic
// override | ||
public requestEthereumAccounts(): CancelablePromise<RequestEthereumAccountsResponse> { | ||
if (this._useMobileWalletLink) { | ||
return super.requestEthereumAccounts(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: deeplink navigation
promise: new Promise(() => { | ||
let location: Location; | ||
try { | ||
if (isInIFrame() && window.top) { | ||
location = window.top.location; | ||
} else { | ||
location = window.location; | ||
} | ||
} catch (e) { | ||
location = window.location; | ||
} | ||
|
||
location.href = `https://www.coinbase.com/connect-dapp?uri=${encodeURIComponent( | ||
location.href, | ||
)}`; | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { RequestEthereumAccountsResponse } from "./Web3Response"; | ||
|
||
export class MobileRelay extends WalletLinkRelay { | ||
private _useMobileWalletLink: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of typescript privates we can start using javascript private methods
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields
#useMobileWalletLink: boolean;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for flagging that.
will address that during overall refactor.
* rename to clarify how the relay connects * introduce MobileRelay * comment
Summary
separate relay for mobile connection.
currently it subclasses existing relay, but will be updated later.
How did you test your changes?