Tost shown when password is set now show when password is not set at end (cancel) or unset
This commit is contained in:
parent
39c08a5a2b
commit
c58c62d4bc
2 changed files with 5 additions and 1 deletions
|
@ -95,16 +95,19 @@ class PasswordCheck @Inject constructor(val sp: SP) {
|
||||||
val enteredPassword = userInput.text.toString()
|
val enteredPassword = userInput.text.toString()
|
||||||
if (enteredPassword.isNotEmpty()) {
|
if (enteredPassword.isNotEmpty()) {
|
||||||
sp.putString(preference, CryptoUtil.hashPassword(enteredPassword))
|
sp.putString(preference, CryptoUtil.hashPassword(enteredPassword))
|
||||||
|
ToastUtils.showToastInUiThread(context, context.getString(R.string.password_set))
|
||||||
ok?.invoke(enteredPassword)
|
ok?.invoke(enteredPassword)
|
||||||
} else {
|
} else {
|
||||||
if (sp.contains(preference)) {
|
if (sp.contains(preference)) {
|
||||||
sp.remove(preference)
|
sp.remove(preference)
|
||||||
|
ToastUtils.showToastInUiThread(context, context.getString(R.string.password_cleared))
|
||||||
clear?.invoke()
|
clear?.invoke()
|
||||||
} else {
|
} else {
|
||||||
|
ToastUtils.showToastInUiThread(context, context.getString(R.string.password_not_changed))
|
||||||
cancel?.invoke()
|
cancel?.invoke()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ToastUtils.showToastInUiThread(context, context.getString(R.string.password_set))
|
|
||||||
}
|
}
|
||||||
.setNegativeButton(context.getString(R.string.cancel)
|
.setNegativeButton(context.getString(R.string.cancel)
|
||||||
) { dialog, _ ->
|
) { dialog, _ ->
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
<string name="password_set">Password set!</string>
|
<string name="password_set">Password set!</string>
|
||||||
<string name="password_not_set">Password not set</string>
|
<string name="password_not_set">Password not set</string>
|
||||||
<string name="password_not_changed">Password not changed</string>
|
<string name="password_not_changed">Password not changed</string>
|
||||||
|
<string name="password_cleared">Password cleared!</string>
|
||||||
<string name="password_hint">Enter password here</string>
|
<string name="password_hint">Enter password here</string>
|
||||||
|
|
||||||
<string name="key_master_password">master_password</string>
|
<string name="key_master_password">master_password</string>
|
||||||
|
|
Loading…
Reference in a new issue