Merge pull request #2883 from basilgello/passphrase-auth-fix-v6.0.0

Fix passphrase dialog and dark/light mode reversal
This commit is contained in:
Vincent Breitmoser
2024-02-16 10:42:25 +01:00
committed by GitHub
4 changed files with 20 additions and 4 deletions

View File

@@ -148,8 +148,8 @@ public final class Constants {
public static final class Theme {
public static final String AUTO = "auto";
public static final String LIGHT = "light";
public static final String DARK = "dark";
public static final String LIGHT = "light";
public static final String DEFAULT = Constants.Pref.Theme.AUTO;
}

View File

@@ -39,6 +39,20 @@ public class RequiredInputParcel implements Parcelable {
return new String(mInputData[0]);
}
public boolean isTextInput() {
switch (mType) {
case BACKUP_CODE:
case NUMERIC_9X4:
case NUMERIC_9X4_AUTOCRYPT:
case PASSPHRASE:
case PASSPHRASE_AUTH:
case PASSPHRASE_SYMMETRIC:
return true;
default:
return false;
}
}
public enum RequiredInputType {
PASSPHRASE, PASSPHRASE_SYMMETRIC, PASSPHRASE_AUTH,
BACKUP_CODE, NUMERIC_9X4, NUMERIC_9X4_AUTOCRYPT,

View File

@@ -107,7 +107,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
// this activity itself has no content view (see manifest)
RequiredInputParcel requiredInput = getIntent().getParcelableExtra(EXTRA_REQUIRED_INPUT);
if (requiredInput.mType != RequiredInputType.PASSPHRASE) {
if (!requiredInput.isTextInput()) {
return;
}
@@ -115,7 +115,9 @@ public class PassphraseDialogActivity extends FragmentActivity {
try {
KeyRepository keyRepository = KeyRepository.create(this);
// use empty passphrase for empty passphrase
if (keyRepository.getSecretKeyType(requiredInput.getSubKeyId()) == SecretKeyType.PASSPHRASE_EMPTY) {
Long subKeyId = requiredInput.getSubKeyId();
if (subKeyId != null &&
keyRepository.getSecretKeyType(subKeyId) == SecretKeyType.PASSPHRASE_EMPTY) {
// also return passphrase back to activity
Intent returnIntent = new Intent();
cryptoInputParcel = cryptoInputParcel.withPassphrase(new Passphrase(""), requiredInput.getSubKeyId());

View File

@@ -33,8 +33,8 @@
<string-array name="theme_entries" translatable="false">
<item>@string/theme_auto</item>
<item>@string/theme_light</item>
<item>@string/theme_dark</item>
<item>@string/theme_light</item>
</string-array>
<string-array name="theme_values" translatable="false">
<item>"auto"</item>