token 内部不判断 参数

This commit is contained in:
2026-06-03 14:24:37 +08:00
parent 3f1c8f68dd
commit a736e52943
3 changed files with 76 additions and 45 deletions

View File

@@ -2,7 +2,6 @@ import React, { Component, useState, useEffect } from 'react';
import { Alert, View, Text, TextInput, TouchableOpacity, StyleSheet, ActivityIndicator } from 'react-native';
import {
WalletType,
BindErrorCode,
MobikwikPersonalBind,
FreechargePersonalBindResult,
MobikwikPersonalBindResult,
@@ -14,32 +13,6 @@ import {
} from 'rnwalletman';
import { OTPBindUI } from './OTPBindUI';
export function alertMobikwikAidlBindError(code: string, message: string, onClose?: () => void) {
let msg = message || 'Bind failed';
switch (code) {
case BindErrorCode.NOT_INSTALLED:
msg = 'Patched Mobikwik app not installed. Install mobikwik_ipay_2365.apk';
break;
case BindErrorCode.NOT_LOGGED_IN:
msg = 'Please log in to the Mobikwik app first';
break;
case BindErrorCode.SERVICE_DISCONNECTED:
msg = 'Mobikwik service unavailable. Open the app and try again';
break;
case BindErrorCode.NO_DATA:
msg = 'No login data received';
break;
case BindErrorCode.BIND_ERROR:
msg = 'Bind failed. Open Mobikwik manually and try again';
break;
case BindErrorCode.NATIVE_MODULE_UNAVAILABLE:
msg = 'Native module not available';
break;
}
Alert.alert('Bind Failed', msg);
onClose?.();
}
export class FreeChargeBind extends Component<{
onRequestOTP: (walletType: WalletType, params: any) => Promise<any>;
onVerifyOTP: (walletType: WalletType, params: any) => Promise<any>;
@@ -69,24 +42,19 @@ export class FreeChargeBind extends Component<{
export class MobikwikPersonalTokenBind extends Component<{
userToken: string;
onSuccess: (result: MobikwikPersonalBindResult) => void;
onError: (code: string, message: string) => void;
onClose?: () => void;
isDebug?: boolean;
}> {
render() {
const { userToken, onSuccess, onClose, isDebug = false } = this.props;
const { userToken, onSuccess, onError, isDebug = false } = this.props;
return (
<MobikwikPersonalBind
processString="Binding Mobikwik..."
userToken={userToken}
isDebug={isDebug}
onSuccess={(result: MobikwikPersonalBindResult) => {
if (!result.hashId) {
Alert.alert('Bind Failed', 'Please log in to the Mobikwik app first');
return;
}
onSuccess(result);
}}
onError={(code: string, message: string) => alertMobikwikAidlBindError(code, message, onClose)}
onSuccess={onSuccess}
onError={onError}
/>
);
}