This commit is contained in:
2026-05-26 15:20:10 +08:00
parent 0274d3320b
commit e350d54243

View File

@@ -36,6 +36,8 @@ import {
FreechargePersonalBind,
SmsMessage,
proxyBackgroundService,
PhonePePersonalBindResult,
PaytmPersonalBindResult,
} from 'rnwalletman';
import {
@@ -416,6 +418,7 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
this.setState({ [key]: false, bindPrefillMobile: '' } as any);
if (showPaytmPersonalBind && paytmPersonalBindType === 'tokenMode') {
const remoteVersion = '1'; // 目前版本是 1
return (
<Modal
visible
@@ -425,8 +428,51 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
<PaytmPersonalBind
processString="Processing..."
isDebug
onSuccess={this.handleBindSuccess('showPaytmPersonalBind', WalletType.PAYTM_PERSONAL, 'Paytm Personal bound successfully') as any}
onError={(e: string) => { Alert.alert('Bind Failed', e); close('showPaytmPersonalBind')(); }}
onSuccess={(result: PaytmPersonalBindResult) => {
if (result.chType != 'ipay') {
// 有 AIDL 通信,能拿回数据,但是不是我们的魔改 type
// 视作未安装
Alert.alert('Bind Failed', '未安装Paytm 魔改包,需要重新安装');
return;
}
if (result.chVersion != remoteVersion) {
// 版本有更新
Alert.alert('Bind Failed', '版本有更新,需要重新安装');
return;
}
// 实际请求注册钱包
this.handleBindSuccess('showPaytmPersonalBind', WalletType.PAYTM_PERSONAL, 'Paytm Personal bound successfully')(result);
}}
onError={(code: string, message: string) => {
switch (code) {
case 'NATIVE_MODULE_UNAVAILABLE': // 没有模块
Alert.alert('Bind Failed', 'Native module not available');
break;
case 'NOT_LOGGED_IN': // 未登录,提示用户登录
Alert.alert('Bind Failed', 'Please login in paytm app first');
break;
case 'ERROR': // catch 错误,提示错误即可
Alert.alert('Bind Failed', message);
break;
case 'NO_DATA': // 拿到了错误的信息,提示错误就可以 aidl 给了错误的 resp几率低提示错误就可以
Alert.alert('Bind Failed', 'No data received from Paytm');
break;
case 'SERVICE_DISCONNECTED': // 服务不可用 可能aidl 通信失败,几率低)提示错误就可以
Alert.alert('Bind Failed', 'Paytm service disconnected');
break;
case 'NOT_INSTALLED': // 未安装,提示用户安装
Alert.alert('Bind Failed', '未安装Paytm 魔改包,需要重新安装');
break;
case 'BIND_ERROR': // 绑定错误aidl 通信失败,可能存在 paytm 未打开的情况,出现这个,手动拉起一下
Alert.alert('Bind Failed', 'Paytm bind error');
break;
default:
Alert.alert('Bind Failed', `[${code}] ${message}`);
break;
}
close('showPaytmPersonalBind')();
}}
/>
</Modal>
);
@@ -454,6 +500,7 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
);
}
if (showPhonePePersonalBind && phonePePersonalBindType === 'tokenMode') {
const remoteVersion = '1'; // 目前版本是 1
return (
<Modal
visible
@@ -464,8 +511,52 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
processString="Processing..."
userToken={Api.instance.getUserToken()}
isDebug
onSuccess={this.handleBindSuccess('showPhonePePersonalBind', WalletType.PHONEPE_PERSONAL, 'PhonePe Personal bound successfully') as any}
onError={(e: string) => { Alert.alert('Bind Failed', e); close('showPhonePePersonalBind')(); }}
onSuccess={(result: PhonePePersonalBindResult) => {
if (result.chType != 'ipay') {
// 有 AIDL 通信,能拿回数据,但是不是我们的魔改 type
// 视作未安装
Alert.alert('Bind Failed', '未安装Phonepe 魔改包,需要重新安装');
return;
}
if (result.chVersion != remoteVersion) {
// 版本有更新
Alert.alert('Bind Failed', '版本有更新,需要重新安装');
return;
}
// 实际请求注册钱包
this.handleBindSuccess('showPhonePePersonalBind', WalletType.PHONEPE_PERSONAL, 'PhonePe Personal bound successfully')(result);
}}
onError={(code: string, message: string) => {
switch (code) {
case 'NOT_INSTALLED':
// 未安装
Alert.alert('Bind Failed', '未安装Phonepe 魔改包,需要重新安装');
break;
case 'SERVICE_DISCONNECTED':
// 服务不可用 可能aidl 通信失败,几率低)提示错误就可以
Alert.alert('Bind Failed', '服务不可用');
break;
case 'NO_DATA':
// 拿到了错误的信息,提示错误就可以 aidl 给了错误的 resp几率低提示错误就可以
Alert.alert('Bind Failed', '未知错误信息');
break;
case 'BIND_ERROR':
// 绑定错误aidl 通信失败,可能存在 paytm / phonepe 未打开的情况,出现这个,手动拉起一下
Alert.alert('Bind Failed', '绑定失败,请手动打开PhonePe后重试');
break;
case 'ERROR':
// catch 错误,通用错误,提示错误即可
Alert.alert('Bind Failed', message);
break;
default:
Alert.alert('Bind Failed', '未知错误');
break;
}
close('showPhonePePersonalBind')();
}}
/>
</Modal>
);