Public Access
Desktop: put the keyboard in the closed vault's card on launch, and let Enter sign in and enrol
This commit is contained in:
1 parent
a4b81da597
commit
372a7cbdc7
3 files changed
+175
-3
No files matched your search
@@ -33,6 +33,9 @@ internal sealed partial class MainWindow : Window
|
||||
|
||||
private bool wasUnlocked;
|
||||
|
||||
/// <summary>Which closed-vault card the keyboard was last sent to, so it is sent once per card.</summary>
|
||||
private ShellState? closedState;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -184,6 +187,7 @@ internal sealed partial class MainWindow : Window
|
||||
{
|
||||
ShellState.Locked => UnlockPane.PassphraseBox,
|
||||
ShellState.NeedsServer => ServerUrlBox,
|
||||
ShellState.NeedsEnrollment => NewPassphraseBox,
|
||||
_ => this,
|
||||
};
|
||||
|
||||
@@ -307,6 +311,14 @@ internal sealed partial class MainWindow : Window
|
||||
Terminal.Source = viewModel.TerminalPageUrl;
|
||||
|
||||
wasUnlocked = viewModel.IsUnlocked;
|
||||
closedState = null;
|
||||
|
||||
// The shell may have reached its card before this window was given it, and then no change would
|
||||
// ever say so.
|
||||
if (!viewModel.IsUnlocked)
|
||||
{
|
||||
FocusClosedVaultCard(viewModel);
|
||||
}
|
||||
|
||||
viewModel.TerminalSessionOpened += OnTerminalSessionOpened;
|
||||
viewModel.TerminalFocusRequested += OnTerminalFocusRequested;
|
||||
@@ -380,10 +392,32 @@ internal sealed partial class MainWindow : Window
|
||||
{
|
||||
ReleaseKeyboardTo(ClosedVaultKeyboardHome);
|
||||
}
|
||||
else if (!unlocked && viewModel.State != closedState)
|
||||
{
|
||||
FocusClosedVaultCard(viewModel);
|
||||
}
|
||||
|
||||
closedState = unlocked ? null : viewModel.State;
|
||||
wasUnlocked = unlocked;
|
||||
}
|
||||
|
||||
/// <summary>Hands the keyboard to the box on whichever card a closed vault is showing.</summary>
|
||||
/// <remarks>
|
||||
/// For arriving at a card other than by locking — launch landing on the unlock card, a sign-in finishing
|
||||
/// on the enrolment one — which used to leave the passphrase somebody started typing going nowhere. Once
|
||||
/// per card, which is what keeps it from moving the keyboard while somebody is mid-sign-in: IsUnlocked is
|
||||
/// raised for every state change, and the state does not change while they type. Posted, because the card
|
||||
/// is revealed by a binding the same change has not reached yet.
|
||||
/// </remarks>
|
||||
private void FocusClosedVaultCard(MainWindowViewModel viewModel)
|
||||
{
|
||||
closedState = viewModel.State;
|
||||
|
||||
var home = ClosedVaultKeyboardHome;
|
||||
|
||||
Dispatcher.UIThread.Post(() => home.Focus(), DispatcherPriority.Loaded);
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// Closing only. Opening also has to move the keyboard — the palette is a text box somebody is expected
|
||||
/// to start typing into immediately — but the palette does that for itself when it becomes visible,
|
||||
|
||||
Reference in new issue
Block a user