@@ -44,55 +44,59 @@ const waitForNUILoaded = (checkInterval = 250): Promise<void> => {
44
44
} ) ;
45
45
} ;
46
46
47
- const SendBankUIMessage = ( data : object ) => {
48
- SendNUIMessage ( data ) ;
47
+ const SendBankUIMessage = ( app : string , method : string , data : unknown ) => {
48
+ SendNUIMessage ( {
49
+ app,
50
+ method,
51
+ data,
52
+ } ) ;
49
53
50
54
if ( GetResourceState ( 'npwd' ) === 'started' ) {
51
- npwdExports . sendUIMessage ( data ) ;
55
+ npwdExports . sendNPWDMessage ( app , method , data ) ;
52
56
}
53
57
} ;
54
58
55
59
onNet ( Broadcasts . NewAccount , ( payload : Account ) => {
56
- SendBankUIMessage ( { type : Broadcasts . NewAccount , payload } ) ;
60
+ SendBankUIMessage ( 'PEFCL' , Broadcasts . NewAccount , payload ) ;
57
61
} ) ;
58
62
59
63
onNet ( Broadcasts . NewAccountBalance , ( balance : number ) => {
60
- SendBankUIMessage ( { type : Broadcasts . NewAccountBalance , payload : balance } ) ;
64
+ SendBankUIMessage ( 'PEFCL' , Broadcasts . NewAccountBalance , balance ) ;
61
65
} ) ;
62
66
63
67
onNet ( Broadcasts . NewTransaction , ( payload : Transaction ) => {
64
- SendBankUIMessage ( { type : Broadcasts . NewTransaction , payload } ) ;
68
+ SendBankUIMessage ( 'PEFCL' , Broadcasts . NewTransaction , payload ) ;
65
69
} ) ;
66
70
67
71
onNet ( Broadcasts . UpdatedAccount , ( payload : Account ) => {
68
- SendBankUIMessage ( { type : Broadcasts . UpdatedAccount , payload } ) ;
72
+ SendBankUIMessage ( 'PEFCL' , Broadcasts . UpdatedAccount , payload ) ;
69
73
} ) ;
70
74
71
75
onNet ( Broadcasts . NewInvoice , ( payload : Invoice ) => {
72
- SendBankUIMessage ( { type : Broadcasts . NewInvoice , payload } ) ;
76
+ SendBankUIMessage ( 'PEFCL' , Broadcasts . NewInvoice , payload ) ;
73
77
} ) ;
74
78
75
79
onNet ( Broadcasts . NewSharedUser , ( ) => {
76
- SendBankUIMessage ( { type : Broadcasts . NewSharedUser } ) ;
80
+ SendBankUIMessage ( 'PEFCL' , Broadcasts . NewSharedUser , { } ) ;
77
81
} ) ;
78
82
79
83
onNet ( Broadcasts . RemovedSharedUser , ( ) => {
80
- SendBankUIMessage ( { type : Broadcasts . RemovedSharedUser } ) ;
84
+ SendBankUIMessage ( 'PEFCL' , Broadcasts . RemovedSharedUser , { } ) ;
81
85
} ) ;
82
86
83
87
onNet ( UserEvents . Loaded , async ( ) => {
84
88
console . debug ( 'Waiting for NUI to load ..' ) ;
85
89
await waitForNUILoaded ( ) ;
86
90
console . debug ( 'Loaded. Emitting data to NUI.' ) ;
87
- SendBankUIMessage ( { type : UserEvents . Loaded , payload : true } ) ;
91
+ SendBankUIMessage ( 'PEFCL' , UserEvents . Loaded , true ) ;
88
92
89
93
if ( ! useFrameworkIntegration ) {
90
94
StatSetInt ( CASH_BAL_STAT , ( await API . getMyCash ( ) ) ?? 0 , true ) ;
91
95
}
92
96
} ) ;
93
97
94
98
onNet ( UserEvents . Unloaded , ( ) => {
95
- SendBankUIMessage ( { type : UserEvents . Unloaded } ) ;
99
+ SendBankUIMessage ( 'PEFCL' , UserEvents . Unloaded , { } ) ;
96
100
} ) ;
97
101
98
102
const CASH_BAL_STAT = GetHashKey ( 'MP0_WALLET_BALANCE' ) ;
@@ -130,7 +134,7 @@ RegisterCommand(
130
134
console . debug ( 'Waiting for NUI to load ..' ) ;
131
135
await waitForNUILoaded ( ) ;
132
136
console . debug ( 'Loaded. Emitting data to NUI.' ) ;
133
- SendBankUIMessage ( { type : UserEvents . Loaded , payload : true } ) ;
137
+ SendBankUIMessage ( 'PEFCL' , UserEvents . Loaded , true ) ;
134
138
} ,
135
139
false ,
136
140
) ;
0 commit comments