This commit is contained in:
2026-03-05 22:54:17 +08:00
parent b61cb00fe8
commit 6e48882bb0
2 changed files with 7 additions and 8 deletions

13
App.tsx
View File

@@ -67,6 +67,12 @@ export default class App extends Component<AppProps, WalletmanAppState> {
async componentDidMount() {
await this.setupPermissions();
this.echoSub = onProxyMessage((msg) => {
if (msg.type === 'echo') {
Alert.alert('Echo 回来了', JSON.stringify(msg.data));
}
});
// Login with auto-retry every 3s until success (setTimeout, non-blocking)
const doLogin = () => {
Api.instance.login('test123', '123456')
@@ -93,13 +99,6 @@ export default class App extends Component<AppProps, WalletmanAppState> {
sendEcho = () => {
const text = `hello_${Date.now()}`;
this.echoSub?.remove();
this.echoSub = onProxyMessage((msg) => {
if (msg.type === 'echo') {
Alert.alert('Echo 回来了', JSON.stringify(msg.data));
this.echoSub?.remove();
}
});
proxySendMessage({ type: 'echo', messageId: `echo_${Date.now()}`, data: { text } });
};