log notification from wallet

This commit is contained in:
Sebastian 2023-06-20 11:18:37 -03:00
parent e5a8ae7d60
commit 773712419e
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
4 changed files with 5 additions and 24 deletions

View File

@ -18,6 +18,7 @@ import {
CoreApiResponse,
NotificationType,
TalerUri,
WalletNotification,
} from "@gnu-taler/taler-util";
import {
WalletConfig,
@ -60,9 +61,7 @@ export interface CrossBrowserPermissionsApi {
): void;
}
export type MessageFromBackend = {
type: NotificationType;
};
export type MessageFromBackend = WalletNotification;
export type MessageFromFrontend<
Op extends BackgroundOperations | WalletOperations | ExtensionOperations,

View File

@ -75,7 +75,6 @@ export namespace State {
goToBank: ButtonHandler;
goToWallet: ButtonHandler;
amountHandler: AmountFieldHandler;
mode: ToggleHandler;
}
}

View File

@ -47,8 +47,6 @@ export function useComponentState(props: Props): RecursiveState<State> {
const [amount, setAmount] = useState(
!parsedInitialAmount ? undefined : parsedInitialAmount,
);
const [rawMode, setRawMode] = useState(false);
//FIXME: get this information from wallet
// eslint-disable-next-line no-constant-condition
const previous: Contact[] = true
@ -119,14 +117,6 @@ export function useComponentState(props: Props): RecursiveState<State> {
return {
status: "ready",
error: undefined,
mode: {
button: {
onClick: pushAlertOnError(async () => {
setRawMode(!rawMode);
}),
},
value: rawMode,
},
previous,
selectCurrency: {
onClick: pushAlertOnError(async () => {
@ -166,14 +156,6 @@ export function useComponentState(props: Props): RecursiveState<State> {
status: "ready",
error: undefined,
previous,
mode: {
button: {
onClick: pushAlertOnError(async () => {
setRawMode(!rawMode);
}),
},
value: rawMode,
},
selectCurrency: {
onClick: pushAlertOnError(async () => {
setAmount(undefined);

View File

@ -28,6 +28,7 @@ import {
Logger,
TalerErrorCode,
WalletDiagnostics,
WalletNotification,
getErrorDetailFromException,
makeErrorDetail,
setGlobalLogLevelFromString,
@ -342,8 +343,8 @@ async function reinitWallet(): Promise<void> {
walletInit.reject(e);
return;
}
wallet.addNotificationListener((x) => {
const message: MessageFromBackend = { type: x.type };
wallet.addNotificationListener((message) => {
logger.info("wallet -> ui", message);
platform.sendMessageToAllChannels(message);
});