use a builder for PassphraseInput
This commit is contained in:
1 parent
39b3f74068
commit
c1186ad55e
4 files changed
+69
-37
No files matched your search
@@ -54,8 +54,7 @@ impl CredentialsScreen {
|
||||
fn add_aws(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
let name = cx.new(|cx| InputState::new(window, cx));
|
||||
let access_key_id = cx.new(|cx| InputState::new(window, cx));
|
||||
let show = cx.new(|_| false);
|
||||
let secret_access_key = cx.new(|cx| PassphraseInput::new("aws-secret", show, window, cx));
|
||||
let secret_access_key = PassphraseInput::builder("aws-secret").build(window, cx);
|
||||
name.update(cx, |name, cx| name.focus(window, cx));
|
||||
|
||||
let mut _subscriptions = Vec::new();
|
||||
|
||||
@@ -22,9 +22,9 @@ pub struct UnlockScreen {
|
||||
|
||||
impl UnlockScreen {
|
||||
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
|
||||
// nothing else shares the show/hide flag, so it's private to this input
|
||||
let show = cx.new(|_| false);
|
||||
let passphrase = cx.new(|cx| PassphraseInput::new("passphrase", show, window, cx));
|
||||
let passphrase = PassphraseInput::builder("passphrase")
|
||||
.placeholder("correct horse battery staple")
|
||||
.build(window, cx);
|
||||
passphrase.update(cx, |input, cx| input.focus(window, cx));
|
||||
|
||||
let submit = cx.subscribe_in(&passphrase, window, |this, _, event, window, cx| {
|
||||
|
||||
@@ -26,8 +26,14 @@ pub struct WelcomeScreen {
|
||||
impl WelcomeScreen {
|
||||
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
|
||||
let show = cx.new(|_| false);
|
||||
let passphrase = cx.new(|cx| PassphraseInput::new("passphrase", show.clone(), window, cx));
|
||||
let confirm = cx.new(|cx| PassphraseInput::new("confirm", show, window, cx));
|
||||
let passphrase = PassphraseInput::builder("passphrase")
|
||||
.show(show.clone())
|
||||
.placeholder("correct horse battery staple")
|
||||
.build(window, cx);
|
||||
let confirm = PassphraseInput::builder("confirm")
|
||||
.show(show)
|
||||
.placeholder("correct horse battery staple")
|
||||
.build(window, cx);
|
||||
passphrase.update(cx, |input, cx| input.focus(window, cx));
|
||||
|
||||
let mut _subscriptions = Vec::new();
|
||||
|
||||
Reference in new issue
Block a user