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:
@@ -148,8 +148,8 @@ public final class Constants {
|
|||||||
|
|
||||||
public static final class Theme {
|
public static final class Theme {
|
||||||
public static final String AUTO = "auto";
|
public static final String AUTO = "auto";
|
||||||
public static final String LIGHT = "light";
|
|
||||||
public static final String DARK = "dark";
|
public static final String DARK = "dark";
|
||||||
|
public static final String LIGHT = "light";
|
||||||
public static final String DEFAULT = Constants.Pref.Theme.AUTO;
|
public static final String DEFAULT = Constants.Pref.Theme.AUTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,20 @@ public class RequiredInputParcel implements Parcelable {
|
|||||||
return new String(mInputData[0]);
|
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 {
|
public enum RequiredInputType {
|
||||||
PASSPHRASE, PASSPHRASE_SYMMETRIC, PASSPHRASE_AUTH,
|
PASSPHRASE, PASSPHRASE_SYMMETRIC, PASSPHRASE_AUTH,
|
||||||
BACKUP_CODE, NUMERIC_9X4, NUMERIC_9X4_AUTOCRYPT,
|
BACKUP_CODE, NUMERIC_9X4, NUMERIC_9X4_AUTOCRYPT,
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
|||||||
|
|
||||||
// this activity itself has no content view (see manifest)
|
// this activity itself has no content view (see manifest)
|
||||||
RequiredInputParcel requiredInput = getIntent().getParcelableExtra(EXTRA_REQUIRED_INPUT);
|
RequiredInputParcel requiredInput = getIntent().getParcelableExtra(EXTRA_REQUIRED_INPUT);
|
||||||
if (requiredInput.mType != RequiredInputType.PASSPHRASE) {
|
if (!requiredInput.isTextInput()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,9 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
|||||||
try {
|
try {
|
||||||
KeyRepository keyRepository = KeyRepository.create(this);
|
KeyRepository keyRepository = KeyRepository.create(this);
|
||||||
// use empty passphrase for empty passphrase
|
// 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
|
// also return passphrase back to activity
|
||||||
Intent returnIntent = new Intent();
|
Intent returnIntent = new Intent();
|
||||||
cryptoInputParcel = cryptoInputParcel.withPassphrase(new Passphrase(""), requiredInput.getSubKeyId());
|
cryptoInputParcel = cryptoInputParcel.withPassphrase(new Passphrase(""), requiredInput.getSubKeyId());
|
||||||
|
|||||||
@@ -33,8 +33,8 @@
|
|||||||
|
|
||||||
<string-array name="theme_entries" translatable="false">
|
<string-array name="theme_entries" translatable="false">
|
||||||
<item>@string/theme_auto</item>
|
<item>@string/theme_auto</item>
|
||||||
<item>@string/theme_light</item>
|
|
||||||
<item>@string/theme_dark</item>
|
<item>@string/theme_dark</item>
|
||||||
|
<item>@string/theme_light</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="theme_values" translatable="false">
|
<string-array name="theme_values" translatable="false">
|
||||||
<item>"auto"</item>
|
<item>"auto"</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user