fix bugs
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,3 +16,4 @@ android/.gradle/8.0.1/checksums/sha1-checksums.bin
|
|||||||
android/.idea/caches
|
android/.idea/caches
|
||||||
ios/build
|
ios/build
|
||||||
ios/Pods
|
ios/Pods
|
||||||
|
android/app/release
|
||||||
|
|||||||
36
App.tsx
36
App.tsx
@@ -1,5 +1,5 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { Alert, AppState, AppStateStatus, Modal, Switch, Text, TextInput, TouchableOpacity, View } from "react-native";
|
import { Alert, AppState, AppStateStatus, Modal, Text, TextInput, TouchableOpacity, View } from "react-native";
|
||||||
import DeviceInfo from 'react-native-device-info';
|
import DeviceInfo from 'react-native-device-info';
|
||||||
import {
|
import {
|
||||||
PhonePeBusinessBind,
|
PhonePeBusinessBind,
|
||||||
@@ -65,7 +65,6 @@ export default class App extends Component<AppProps, WalletmanAppState> {
|
|||||||
showServerSettings: false,
|
showServerSettings: false,
|
||||||
settingsHost: '',
|
settingsHost: '',
|
||||||
settingsPort: '',
|
settingsPort: '',
|
||||||
settingsHttps: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deviceId = DeviceInfo.getUniqueIdSync();
|
this.deviceId = DeviceInfo.getUniqueIdSync();
|
||||||
@@ -640,24 +639,41 @@ export default class App extends Component<AppProps, WalletmanAppState> {
|
|||||||
const colonIdx = domain.lastIndexOf(':');
|
const colonIdx = domain.lastIndexOf(':');
|
||||||
const host = colonIdx > 0 ? domain.substring(0, colonIdx) : domain;
|
const host = colonIdx > 0 ? domain.substring(0, colonIdx) : domain;
|
||||||
const port = colonIdx > 0 ? domain.substring(colonIdx + 1) : '';
|
const port = colonIdx > 0 ? domain.substring(colonIdx + 1) : '';
|
||||||
this.setState({ showServerSettings: true, settingsHost: host, settingsPort: port, settingsHttps: getUseHttps() });
|
this.setState({ showServerSettings: true, settingsHost: host, settingsPort: port });
|
||||||
};
|
};
|
||||||
|
|
||||||
saveDomain = async () => {
|
saveDomain = async () => {
|
||||||
const { settingsHost, settingsPort, settingsHttps } = this.state;
|
const { settingsHost, settingsPort } = this.state;
|
||||||
const domain = settingsPort ? `${settingsHost}:${settingsPort}` : settingsHost;
|
const domain = settingsPort ? `${settingsHost}:${settingsPort}` : settingsHost;
|
||||||
await saveServerDomain(domain, settingsHttps);
|
const useHttps = settingsPort === '443';
|
||||||
|
await saveServerDomain(domain, useHttps);
|
||||||
this.setState({ showServerSettings: false });
|
this.setState({ showServerSettings: false });
|
||||||
Alert.alert('已保存', '重启 App 后生效');
|
Alert.alert('已保存', '重启 App 后生效');
|
||||||
};
|
};
|
||||||
|
|
||||||
renderServerSettingsModal() {
|
renderServerSettingsModal() {
|
||||||
const { showServerSettings, settingsHost, settingsPort, settingsHttps } = this.state;
|
const { showServerSettings, settingsHost, settingsPort } = this.state;
|
||||||
|
const presets = [
|
||||||
|
{ label: 'aa.pfgame.org', host: 'aa.pfgame.org', port: '443' },
|
||||||
|
{ label: 'game.ainavx.com:16000', host: 'game.ainavx.com', port: '16000' },
|
||||||
|
{ label: '192.168.1.117:16000', host: '192.168.1.117', port: '16000' },
|
||||||
|
];
|
||||||
return (
|
return (
|
||||||
<Modal visible={showServerSettings} transparent animationType="fade">
|
<Modal visible={showServerSettings} transparent animationType="fade">
|
||||||
<View style={{ flex: 1, backgroundColor: 'rgba(0,0,0,0.5)', justifyContent: 'center', alignItems: 'center' }}>
|
<View style={{ flex: 1, backgroundColor: 'rgba(0,0,0,0.5)', justifyContent: 'center', alignItems: 'center' }}>
|
||||||
<View style={{ backgroundColor: '#fff', borderRadius: 10, padding: 20, width: '85%' }}>
|
<View style={{ backgroundColor: '#fff', borderRadius: 10, padding: 20, width: '85%' }}>
|
||||||
<Text style={{ fontSize: 16, fontWeight: 'bold', marginBottom: 16 }}>服务器设置</Text>
|
<Text style={{ fontSize: 16, fontWeight: 'bold', marginBottom: 12 }}>服务器设置</Text>
|
||||||
|
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 6, marginBottom: 14 }}>
|
||||||
|
{presets.map(p => (
|
||||||
|
<TouchableOpacity
|
||||||
|
key={p.label}
|
||||||
|
onPress={() => this.setState({ settingsHost: p.host, settingsPort: p.port })}
|
||||||
|
style={{ paddingHorizontal: 10, paddingVertical: 5, borderRadius: 6, backgroundColor: settingsHost === p.host && settingsPort === p.port ? '#3498db' : '#f0f0f0' }}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 12, color: settingsHost === p.host && settingsPort === p.port ? '#fff' : '#333' }}>{p.label}</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
<Text style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>Host</Text>
|
<Text style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>Host</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
style={{ borderWidth: 1, borderColor: '#ddd', borderRadius: 6, paddingHorizontal: 10, paddingVertical: 8, marginBottom: 12, fontSize: 14 }}
|
style={{ borderWidth: 1, borderColor: '#ddd', borderRadius: 6, paddingHorizontal: 10, paddingVertical: 8, marginBottom: 12, fontSize: 14 }}
|
||||||
@@ -669,16 +685,12 @@ export default class App extends Component<AppProps, WalletmanAppState> {
|
|||||||
/>
|
/>
|
||||||
<Text style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>Port</Text>
|
<Text style={{ fontSize: 13, color: '#666', marginBottom: 4 }}>Port</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
style={{ borderWidth: 1, borderColor: '#ddd', borderRadius: 6, paddingHorizontal: 10, paddingVertical: 8, marginBottom: 12, fontSize: 14 }}
|
style={{ borderWidth: 1, borderColor: '#ddd', borderRadius: 6, paddingHorizontal: 10, paddingVertical: 8, marginBottom: 20, fontSize: 14 }}
|
||||||
value={settingsPort}
|
value={settingsPort}
|
||||||
onChangeText={t => this.setState({ settingsPort: t })}
|
onChangeText={t => this.setState({ settingsPort: t })}
|
||||||
placeholder="16000"
|
placeholder="16000"
|
||||||
keyboardType="number-pad"
|
keyboardType="number-pad"
|
||||||
/>
|
/>
|
||||||
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 20 }}>
|
|
||||||
<Text style={{ fontSize: 13, color: '#666' }}>使用 HTTPS / WSS</Text>
|
|
||||||
<Switch value={settingsHttps} onValueChange={v => this.setState({ settingsHttps: v })} />
|
|
||||||
</View>
|
|
||||||
<View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
|
<View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
|
||||||
<TouchableOpacity onPress={() => this.setState({ showServerSettings: false })} style={{ paddingHorizontal: 16, paddingVertical: 8, marginRight: 10 }}>
|
<TouchableOpacity onPress={() => this.setState({ showServerSettings: false })} style={{ paddingHorizontal: 16, paddingVertical: 8, marginRight: 10 }}>
|
||||||
<Text style={{ color: '#666' }}>取消</Text>
|
<Text style={{ color: '#666' }}>取消</Text>
|
||||||
|
|||||||
BIN
android/keys/rnpay_release.jks
Normal file
BIN
android/keys/rnpay_release.jks
Normal file
Binary file not shown.
Submodule servers/walletman updated: cfd46bb59c...8b3e2b2785
Reference in New Issue
Block a user