新后台
This commit is contained in:
@@ -5,6 +5,8 @@ import {
|
||||
AppStateStatus,
|
||||
Image,
|
||||
Modal,
|
||||
NativeModules,
|
||||
Platform,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
Switch,
|
||||
@@ -145,8 +147,7 @@ interface HomeScreenState {
|
||||
export default class HomeScreen extends Component<any, HomeScreenState> {
|
||||
private deviceId: string;
|
||||
private androidId: string;
|
||||
|
||||
private tuneUserId: string;
|
||||
private adid: string = '';
|
||||
|
||||
private clientId: string = '';
|
||||
|
||||
@@ -185,12 +186,39 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
||||
expandedBoundWalletGroups: {},
|
||||
};
|
||||
this.deviceId = DeviceInfo.getUniqueIdSync();
|
||||
this.tuneUserId = "yz8mxybytus";//Math.random().toString(36).substring(2, 15);
|
||||
this.androidId = DeviceInfo.getAndroidIdSync();
|
||||
}
|
||||
|
||||
private loadAdid = async (): Promise<string> => {
|
||||
if (Platform.OS !== 'android' || !NativeModules.AdId?.getAdvertisingId) {
|
||||
this.adid = '';
|
||||
return '';
|
||||
}
|
||||
try {
|
||||
const id = await NativeModules.AdId.getAdvertisingId();
|
||||
this.adid = (id || '').trim();
|
||||
} catch (e) {
|
||||
console.log('[ADID] getAdvertisingId failed:', e);
|
||||
this.adid = '';
|
||||
}
|
||||
return this.adid;
|
||||
};
|
||||
|
||||
private ensureMobikwikOtpParams = async () => {
|
||||
const adid = this.adid || await this.loadAdid();
|
||||
if (!adid) {
|
||||
throw new Error('无法获取 GAID (广告 ID),请确认已安装 Google Play 服务且未关闭广告 ID');
|
||||
}
|
||||
return {
|
||||
androidId: this.androidId,
|
||||
adid,
|
||||
tuneUserId: adid,
|
||||
};
|
||||
};
|
||||
|
||||
async componentDidMount() {
|
||||
await loadServerDomain();
|
||||
await this.loadAdid();
|
||||
const tokenAutoRebind = getTokenAutoRebindEnabled();
|
||||
this.setState({ tokenAutoRebind });
|
||||
proxyBackgroundService.setTokenAutoRebindEnabled(tokenAutoRebind);
|
||||
@@ -705,12 +733,14 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
||||
<MobikwikPersonalOTPBind
|
||||
isDebug
|
||||
initialMobile={bindPrefillMobile}
|
||||
onRequestOTP={async (wt, p) =>
|
||||
this.wrapOtpCall(() => Api.instance.requestOTP(wt, p.mobile, {
|
||||
androidId: this.androidId,
|
||||
tuneUserId: this.tuneUserId,
|
||||
}))
|
||||
}
|
||||
onRequestOTP={async (wt, p) => {
|
||||
try {
|
||||
const otpParams = await this.ensureMobikwikOtpParams();
|
||||
return this.wrapOtpCall(() => Api.instance.requestOTP(wt, p.mobile, otpParams));
|
||||
} catch (e) {
|
||||
return { success: false, message: (e as Error).message };
|
||||
}
|
||||
}}
|
||||
onVerifyOTP={async (wt, p) =>
|
||||
this.wrapOtpCall(() => Api.instance.verifyOTP(wt, p.mobile, p.otp, p))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user