diff --git a/screens/HomeScreen.tsx b/screens/HomeScreen.tsx index 092cf3d..87f392d 100644 --- a/screens/HomeScreen.tsx +++ b/screens/HomeScreen.tsx @@ -97,14 +97,10 @@ function groupBoundWallets(wallets: WalletItem[]) { })); } -function getBindKeyForWalletType(walletType: string): string | null { - switch (walletType) { - case 'paytm': return 'paytm_personal_token'; - case 'phonepe': return 'phonepe_personal_token'; - case 'mobikwik': return 'mobikwik_personal_token'; - case 'freecharge': return 'freecharge_personal_token'; - default: return null; - } +function parseWalletId(walletId: string): { walletType: string; phone: string } | null { + const i = walletId.lastIndexOf('_'); + if (i <= 0) return null; + return { walletType: walletId.slice(0, i), phone: walletId.slice(i + 1) }; } function getBindKeyForWallet(item: WalletItem): string | null { @@ -276,9 +272,12 @@ export default class HomeScreen extends Component { this.handleRebind(item); return; } - if (walletType) { - const key = getBindKeyForWalletType(walletType); - if (key) this.openWalletBind(key, phone); + const parsed = walletId ? parseWalletId(walletId) : null; + const wt = walletType || parsed?.walletType; + const mobile = phone || parsed?.phone; + if (wt) { + const key = getBindKeyForWallet({ id: walletId ?? '', walletType: wt, otpMode: false }); + if (key) this.openWalletBind(key, mobile); } };