2
0

Fix a bug with storing the default algorithm version.

This commit is contained in:
Maarten Billemont 2016-02-20 22:26:50 -05:00
parent 64829c99d8
commit 7eb10cb5a6
2 changed files with 4 additions and 3 deletions

View File

@ -272,7 +272,7 @@ public class EmergencyActivity extends Activity {
try {
return MasterKey.create( version, fullName, masterPassword );
}
catch (RuntimeException e) {
catch (Exception e) {
sitePasswordField.setText( "" );
progressView.setVisibility( View.INVISIBLE );
logger.err( e, "While generating master key." );

View File

@ -21,6 +21,7 @@ public class Preferences {
private static final String PREF_MASK_PASSWORD = "maskPassword";
private static final String PREF_FULL_NAME = "fullName";
private static final String PREF_SITE_TYPE = "siteType";
private static final String PREF_ALGORITHM_VERSION = "algorithmVersion";
private static Preferences instance;
private Context context;
@ -136,12 +137,12 @@ public class Preferences {
if (getDefaultVersion().equals( value ))
return false;
prefs().edit().putInt( PREF_SITE_TYPE, value.ordinal() ).apply();
prefs().edit().putInt( PREF_ALGORITHM_VERSION, value.ordinal() ).apply();
return true;
}
@Nonnull
public MasterKey.Version getDefaultVersion() {
return MasterKey.Version.values()[prefs().getInt( PREF_SITE_TYPE, MasterKey.Version.CURRENT.ordinal() )];
return MasterKey.Version.values()[prefs().getInt( PREF_ALGORITHM_VERSION, MasterKey.Version.CURRENT.ordinal() )];
}
}