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

View File

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

View File

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

View File

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