gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-wallet-webex] branch master updated: adhere better t


From: gnunet
Subject: [GNUnet-SVN] [taler-wallet-webex] branch master updated: adhere better to GNU guidlines
Date: Mon, 19 Aug 2019 14:08:19 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-webex.

The following commit(s) were added to refs/heads/master by this push:
     new 10df6913 adhere better to GNU guidlines
10df6913 is described below

commit 10df69131f70c63a94247edf38f40ba5a31ae54e
Author: Florian Dold <address@hidden>
AuthorDate: Mon Aug 19 14:08:14 2019 +0200

    adhere better to GNU guidlines
---
 .gitignore           |  2 ++
 Makefile             | 16 ++++++++++++++-
 configure            | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/android/index.ts | 26 +++++++++++++++---------
 4 files changed, 91 insertions(+), 10 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7f18bfd7..99ac470f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@ node_modules
 yarn-error.log
 
 npm-packages-offline-cache/
+
+config.mk
diff --git a/Makefile b/Makefile
index 06241581..efb3e7cb 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,7 @@ ava = node_modules/ava/cli.js
 nyc = node_modules/nyc/bin/nyc.js
 tslint = node_modules/tslint/bin/tslint
 
+-include config.mk
 
 .PHONY: package-stable
 package-stable: i18n
@@ -40,7 +41,6 @@ typedoc:
 
 .PHONY: clean
 clean:
-       rm -rf build/
        rm -rf dist/
 
 .PHONY: check
@@ -70,3 +70,17 @@ i18n: yarn-install
        done;
        # generate .ts file containing all translations
        $(gulp) po2js
+
+
+ifndef prefix
+.PHONY: install
+install:
+       @echo "no prefix configured, did you run ./configure?"
+else
+.PHONY: install
+install:
+       @echo "installing to" $(prefix)
+       npm install -g --prefix $(prefix) .     
+endif
+
+
diff --git a/configure b/configure
index 3ec6d4d1..ede3a916 100755
--- a/configure
+++ b/configure
@@ -2,6 +2,63 @@
 
 set -eu
 
+prefix=/usr/local
+
+usage() {
+  echo "Usage: ./configure [OPTION]"
+  echo
+  echo "Configuration:"
+  echo "  -h, --help              display this help and exit"
+  echo
+  echo "Installation directories:"
+  echo "  --prefix=PREFIX         install architecture-independent files in 
PREFIX [$prefix]"
+}
+
+
+# -allow a command to fail with !’s side effect on errexit
+# -use return value from ${PIPESTATUS[0]}, because ! hosed $?
+! getopt --test > /dev/null
+if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
+    echo 'getopt not available'
+    exit 1
+fi
+
+LONGOPTS=prefix:,help
+OPTIONS=h
+
+! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- 
"$@")
+if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
+    # e.g. return value is 1
+    #  then getopt has complained about wrong arguments to stdout
+    exit 2
+fi
+
+# read getopt’s output this way to handle the quoting right:
+eval set -- "$PARSED"
+
+while true; do
+    case "$1" in
+      --prefix)
+        prefix="$2"
+        shift 2
+        ;;
+      -h|--help)
+        usage
+        exit 1
+        ;;
+      --)
+        shift
+        break
+        ;;
+      *)
+        echo "Programming error"
+        exit 3
+        ;;
+    esac
+done
+
+echo "prefix=$prefix" >config.mk
+
 node_version=$(node --version)
 if [ ! "$?" -eq 0 ]; then
   echo 'Error: node executable not found.'
diff --git a/src/android/index.ts b/src/android/index.ts
index 3e7eeb64..abf065a8 100644
--- a/src/android/index.ts
+++ b/src/android/index.ts
@@ -20,14 +20,12 @@
 import { Wallet } from "../wallet";
 import { getDefaultNodeWallet } from "../headless/helpers";
 
-
 class AndroidWalletHelper {
-  wallet: Wallet | undefined;
-  constructor (private sendMessage: (m: any) => void) {
-  }
+  walletPromise: Promise<Wallet> | undefined;
+  constructor() {}
 
   async init() {
-    this.wallet = await getDefaultNodeWallet();
+    this.walletPromise = getDefaultNodeWallet();
   }
 }
 
@@ -35,19 +33,25 @@ export function installAndroidWalletListener() {
   // @ts-ignore
   const sendMessage: (m: any) => void = global.__akono_sendMessage;
   if (typeof sendMessage !== "function") {
-    const errMsg = "FATAL: cannot install android wallet listener: akono 
functions missing";
+    const errMsg =
+      "FATAL: cannot install android wallet listener: akono functions missing";
     console.error(errMsg);
     throw new Error(errMsg);
   }
-  const walletHelper = new AndroidWalletHelper(sendMessage);
+  const walletHelper = new AndroidWalletHelper();
   const onMessage = (msg: any) => {
     const operation = msg.operation;
     if (typeof operation !== "string") {
-      console.error("message to android wallet helper must contain operation 
of type string");
+      console.error(
+        "message to android wallet helper must contain operation of type 
string",
+      );
       return;
     }
+    const id = msg.id;
+    let result;
     switch (operation) {
       case "init":
+        result = walletHelper.init();
         break;
       case "getBalances":
         break;
@@ -57,7 +61,11 @@ export function installAndroidWalletListener() {
         console.error(`operation "${operation}" not understood`);
         return;
     }
+
+    const respMsg = { result, id };
+    console.log("sending message back", respMsg);
+    sendMessage(respMsg);
   };
   // @ts-ignore
   globalThis.__akono_onMessage = onMessage;
-}
\ No newline at end of file
+}

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]