@@ -77,6 +77,7 @@ var tab: struct {
7777 // elements visibile during lnd startup.
7878 startup : lvgl.FlexLayout ,
7979
80+ wallet_locked : lvgl.FlexLayout ,
8081 // TODO: support wallet manual unlock (LightningError.code.Locked)
8182
8283 // elements when lnd wallet is uninitialized.
@@ -115,7 +116,7 @@ var tab: struct {
115116 preserve_main_active_tab ();
116117 }
117118
118- fn setMode (self : * @This (), m : enum { setup , startup , operational }) void {
119+ fn setMode (self : * @This (), m : enum { setup , startup , wallet_locked , operational }) void {
119120 switch (m ) {
120121 .setup = > {
121122 self .nowallet .show ();
@@ -135,6 +136,16 @@ var tab: struct {
135136 self .pairing .hide ();
136137 self .reset .hide ();
137138 },
139+ .wallet_locked = > {
140+ self .wallet_locked .show ();
141+ self .nowallet .hide ();
142+ self .startup .hide ();
143+ self .info .card .hide ();
144+ self .balance .card .hide ();
145+ self .channels .card .hide ();
146+ self .pairing .hide ();
147+ self .reset .hide ();
148+ },
138149 .operational = > {
139150 self .info .card .show ();
140151 self .balance .card .show ();
@@ -174,6 +185,14 @@ pub fn initTabPanel(allocator: std.mem.Allocator, cont: lvgl.Container) !void {
174185 _ = btn .on (.click , nm_lnd_setup_click , null );
175186 }
176187
188+ // locked wallet state
189+ // TODO: handle this somehow, instead of just printing error
190+ {
191+ tab .wallet_locked = try lvgl .FlexLayout .new (parent , .row , .{ .all = .center });
192+ tab .wallet_locked .resizeToMax ();
193+ _ = try lvgl .Label .new (tab .wallet_locked , "ERROR: lightning wallet is locked." , .{});
194+ }
195+
177196 // regular operational mode
178197
179198 // info section
@@ -266,7 +285,7 @@ pub fn updateTabPanel(msg: comm.Message) !void {
266285 return switch (msg ) {
267286 .lightning_error = > | lnerr | switch (lnerr .code ) {
268287 .uninitialized = > tab .setMode (.setup ),
269- // TODO: handle "wallet locked" and other errors
288+ . locked = > tab . setMode ( .wallet_locked ),
270289 else = > tab .setMode (.startup ),
271290 },
272291 .lightning_report = > | rep | blk : {
0 commit comments