Tost shown when password is set now show when password is not set at end (cancel) or unset

This commit is contained in:
Dominik Dzienia 2020-03-25 14:47:28 +01:00
parent 39c08a5a2b
commit c58c62d4bc
2 changed files with 5 additions and 1 deletions

View file

@ -95,16 +95,19 @@ class PasswordCheck @Inject constructor(val sp: SP) {
val enteredPassword = userInput.text.toString()
if (enteredPassword.isNotEmpty()) {
sp.putString(preference, CryptoUtil.hashPassword(enteredPassword))
ToastUtils.showToastInUiThread(context, context.getString(R.string.password_set))
ok?.invoke(enteredPassword)
} else {
if (sp.contains(preference)) {
sp.remove(preference)
ToastUtils.showToastInUiThread(context, context.getString(R.string.password_cleared))
clear?.invoke()
} else {
ToastUtils.showToastInUiThread(context, context.getString(R.string.password_not_changed))
cancel?.invoke()
}
}
ToastUtils.showToastInUiThread(context, context.getString(R.string.password_set))
}
.setNegativeButton(context.getString(R.string.cancel)
) { dialog, _ ->

View file

@ -18,6 +18,7 @@
<string name="password_set">Password set!</string>
<string name="password_not_set">Password not set</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="key_master_password">master_password</string>