Merge pull request 'Fix wallet open timer' (#33) from iface into master
Reviewed-on: #33
This commit is contained in:
commit
2a52b593bb
@ -357,9 +357,7 @@ init(none) ->
|
|||||||
Window = gd_gui:start_link(GUI_Prefs),
|
Window = gd_gui:start_link(GUI_Prefs),
|
||||||
Wallets = get_prefs(wallets, Prefs, []),
|
Wallets = get_prefs(wallets, Prefs, []),
|
||||||
ok = hz:timeout(default_tic()),
|
ok = hz:timeout(default_tic()),
|
||||||
MS = default_tic(),
|
State = #s{window = Window, wallets = Wallets, prefs = Prefs},
|
||||||
T = erlang:send_after(MS, self(), tic),
|
|
||||||
State = #s{window = Window, timer = {T, MS}, wallets = Wallets, prefs = Prefs},
|
|
||||||
NewState = do_show_ui(gd_v_wallman, State),
|
NewState = do_show_ui(gd_v_wallman, State),
|
||||||
ok =
|
ok =
|
||||||
case FirstRun of
|
case FirstRun of
|
||||||
@ -1076,7 +1074,7 @@ do_drop_key(ID, State = #s{wallet = W, wallets = Wallets, pass = Pass}) ->
|
|||||||
State#s{wallet = NewWallet}.
|
State#s{wallet = NewWallet}.
|
||||||
|
|
||||||
|
|
||||||
do_open_wallet(Path, Phrase, State) ->
|
do_open_wallet(Path, Phrase, State = #s{timer = Timer}) ->
|
||||||
Pass = pass(Phrase),
|
Pass = pass(Phrase),
|
||||||
case read(Path, Pass) of
|
case read(Path, Pass) of
|
||||||
{ok, Recovered = #wallet{name = Name, poas = POAs, endpoint = _Node}} ->
|
{ok, Recovered = #wallet{name = Name, poas = POAs, endpoint = _Node}} ->
|
||||||
@ -1088,7 +1086,17 @@ do_open_wallet(Path, Phrase, State) ->
|
|||||||
% {ok, ChainID} -> gd_gui:chain(ChainID, Node);
|
% {ok, ChainID} -> gd_gui:chain(ChainID, Node);
|
||||||
% Error -> gd_gui:trouble(Error)
|
% Error -> gd_gui:trouble(Error)
|
||||||
% end,
|
% end,
|
||||||
{ok, State#s{pass = Pass, wallet = Recovered}};
|
ok =
|
||||||
|
case Timer of
|
||||||
|
none ->
|
||||||
|
ok;
|
||||||
|
{OldT, _} ->
|
||||||
|
_ = erlang:cancel_timer(OldT),
|
||||||
|
ok
|
||||||
|
end,
|
||||||
|
MS = default_tic(),
|
||||||
|
T = erlang:send_after(200, self(), tic),
|
||||||
|
{ok, State#s{pass = Pass, wallet = Recovered, timer = {T, MS}}};
|
||||||
Error ->
|
Error ->
|
||||||
{Error, State}
|
{Error, State}
|
||||||
end.
|
end.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user