This commit is contained in:
2026-09-11 23:10:13 +08:00
parent 89ee2496a6
commit dbcbe161b5
5 changed files with 89 additions and 62 deletions
+23 -11
View File
@@ -73,7 +73,7 @@ const PATCH_EXPECT: PatchConfig = {
};
/** GooglePay Business 绑定时顶部「清除缓存」按钮 */
const GOOGLEPAY_BUSINESS_SHOW_CLEAR_CACHE = true;
const GOOGLEPAY_BUSINESS_SHOW_CLEAR_CACHE = false;
function phonePePatchFailReason(chType?: string, chVersion?: string): string | null {
if (!chType || chType !== PATCH_EXPECT.chType) {
@@ -376,7 +376,19 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
this.setState({ loadingWallets: true });
try {
const wallets = await Api.instance.listWallets();
this.setState({ wallets });
const enriched = await Promise.all(wallets.map(async (w) => {
try {
const account = await Api.instance.getAccountInfo(w.id);
return {
...w,
upi: account.vpa ?? w.upi,
phone: account.phone ?? w.phone,
};
} catch {
return w;
}
}));
this.setState({ wallets: enriched });
} catch (e) {
console.log('[fetchWallets]', e);
} finally {
@@ -385,10 +397,14 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
};
openVpaModal = async (item: WalletItem) => {
this.setState({ vpaModalWallet: item, vpaModalVpas: [], vpaModalLoading: true, vpaModalSelected: item.upi ?? '' });
this.setState({ vpaModalWallet: item, vpaModalVpas: [], vpaModalLoading: true, vpaModalSelected: '' });
try {
const vpas = await Api.instance.getWalletVpas(item.id);
this.setState({ vpaModalVpas: vpas, vpaModalLoading: false });
const account = await Api.instance.getAccountInfo(item.id);
this.setState({
vpaModalVpas: account.vpas ?? [],
vpaModalSelected: account.vpa ?? '',
vpaModalLoading: false,
});
} catch {
this.setState({ vpaModalLoading: false });
}
@@ -403,12 +419,8 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
if (idx < 0) return;
try {
await Api.instance.setCurrentVpa(vpaModalWallet.id, idx);
const walletId = vpaModalWallet.id;
const vpa = vpaModalSelected;
this.setState((s) => ({
vpaModalWallet: null,
wallets: s.wallets.map((w) => (w.id === walletId ? { ...w, upi: vpa } : w)),
}));
this.setState({ vpaModalWallet: null });
this.fetchWallets();
} catch (e) {
Alert.alert('Set Failed', (e as Error).message);
}