summaryrefslogtreecommitdiff
path: root/src/android
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-05 19:38:19 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-05 19:38:19 +0100
commitf67d7f54f9d0fed97446898942e3dfee67ee2985 (patch)
tree2b81738025e8f61250ede10908cbf81071e16975 /src/android
parent829acdd3d98f1014747f15ecb619b6fbaa06b640 (diff)
downloadwallet-core-f67d7f54f9d0fed97446898942e3dfee67ee2985.tar.gz
wallet-core-f67d7f54f9d0fed97446898942e3dfee67ee2985.tar.bz2
wallet-core-f67d7f54f9d0fed97446898942e3dfee67ee2985.zip
threads, retries and notifications WIP
Diffstat (limited to 'src/android')
-rw-r--r--src/android/index.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/android/index.ts b/src/android/index.ts
index 4d0136ecf..dcdb9d756 100644
--- a/src/android/index.ts
+++ b/src/android/index.ts
@@ -125,6 +125,7 @@ export function installAndroidWalletListener() {
return;
}
const id = msg.id;
+ console.log(`android listener: got request for ${operation} (${id})`);
let result;
switch (operation) {
case "init": {
@@ -137,7 +138,7 @@ export function installAndroidWalletListener() {
};
const w = await getDefaultNodeWallet(walletArgs);
maybeWallet = w;
- w.runLoopScheduledRetries().catch((e) => {
+ w.runRetryLoop().catch((e) => {
console.error("Error during wallet retry loop", e);
});
wp.resolve(w);
@@ -156,7 +157,11 @@ export function installAndroidWalletListener() {
}
case "withdrawTestkudos": {
const wallet = await wp.promise;
- await withdrawTestBalance(wallet);
+ try {
+ await withdrawTestBalance(wallet);
+ } catch (e) {
+ console.log("error during withdrawTestBalance", e);
+ }
result = {};
break;
}
@@ -221,7 +226,7 @@ export function installAndroidWalletListener() {
maybeWallet = undefined;
const w = await getDefaultNodeWallet(walletArgs);
maybeWallet = w;
- w.runLoopScheduledRetries().catch((e) => {
+ w.runRetryLoop().catch((e) => {
console.error("Error during wallet retry loop", e);
});
wp.resolve(w);
@@ -233,6 +238,8 @@ export function installAndroidWalletListener() {
return;
}
+ console.log(`android listener: sending response for ${operation} (${id})`);
+
const respMsg = { result, id, operation, type: "response" };
sendMessage(JSON.stringify(respMsg));
};