give payload notification to Android
This commit is contained in:
parent
4e76edf129
commit
c5c308661e
@ -33,6 +33,7 @@ import {
|
|||||||
} from "../util/http";
|
} from "../util/http";
|
||||||
import { NodeHttpLib } from "../headless/NodeHttpLib";
|
import { NodeHttpLib } from "../headless/NodeHttpLib";
|
||||||
import { OperationFailedAndReportedError } from "../operations/errors";
|
import { OperationFailedAndReportedError } from "../operations/errors";
|
||||||
|
import { WalletNotification } from "../types/notifications";
|
||||||
|
|
||||||
// @ts-ignore: special built-in module
|
// @ts-ignore: special built-in module
|
||||||
//import akono = require("akono");
|
//import akono = require("akono");
|
||||||
@ -140,8 +141,10 @@ class AndroidWalletMessageHandler {
|
|||||||
switch (operation) {
|
switch (operation) {
|
||||||
case "init": {
|
case "init": {
|
||||||
this.walletArgs = {
|
this.walletArgs = {
|
||||||
notifyHandler: async () => {
|
notifyHandler: async (notification: WalletNotification) => {
|
||||||
sendAkonoMessage(JSON.stringify({ type: "notification" }));
|
sendAkonoMessage(
|
||||||
|
JSON.stringify({ type: "notification", payload: notification }),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
persistentStoragePath: args.persistentStoragePath,
|
persistentStoragePath: args.persistentStoragePath,
|
||||||
httpLib: this.httpLib,
|
httpLib: this.httpLib,
|
||||||
@ -290,7 +293,13 @@ export function installAndroidWalletListener() {
|
|||||||
console.log(
|
console.log(
|
||||||
`android listener: sending success response for ${operation} (${id})`,
|
`android listener: sending success response for ${operation} (${id})`,
|
||||||
);
|
);
|
||||||
const respMsg = { type: "response", id, operation, isError: false, result };
|
const respMsg = {
|
||||||
|
type: "response",
|
||||||
|
id,
|
||||||
|
operation,
|
||||||
|
isError: false,
|
||||||
|
result,
|
||||||
|
};
|
||||||
sendMessage(JSON.stringify(respMsg));
|
sendMessage(JSON.stringify(respMsg));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const respMsg = {
|
const respMsg = {
|
||||||
|
Loading…
Reference in New Issue
Block a user