fix: restore mobile wallet login feedback
Some checks failed
Deploy Staging (terry-wallet-login) / deploy (push) Failing after 37s

This commit is contained in:
TerryM
2026-06-04 15:19:50 +08:00
parent 863a448ec9
commit 53dc35e7dc
4 changed files with 36 additions and 12 deletions

View File

@@ -137,6 +137,11 @@ export function getInjectedEthereum(): EthereumProvider | null {
return maybeWindow.ethereum ?? null;
}
export function isTokenPocketBrowser(): boolean {
if (typeof navigator === "undefined") return false;
return /tokenpocket|tpwallet/i.test(navigator.userAgent || "");
}
export function isImTokenBrowser(): boolean {
if (typeof navigator === "undefined") return false;
return /imtoken/i.test(navigator.userAgent || "");
@@ -156,6 +161,10 @@ export function getInjectedWallet(kind?: WalletKind): EthereumProvider | null {
});
if (match) return match;
if (kind === "tokenPocket" && isTokenPocketBrowser()) {
return providers[0] ?? ethereum;
}
if (kind === "imToken" && isImTokenBrowser()) return providers[0] ?? ethereum;
return null;