Start the intro if the database file was not found

This commit is contained in:
Alexander Bakker 2017-11-26 19:27:03 +01:00
parent 41bafba596
commit f09d227378
2 changed files with 13 additions and 8 deletions

View file

@ -159,7 +159,6 @@ public class IntroActivity extends AppIntro {
setResult(RESULT_OK, result);
// skip the intro from now on
// TODO: show the intro if we can't find any database files
SharedPreferences prefs = this.getSharedPreferences("me.impy.aegis", Context.MODE_PRIVATE);
prefs.edit().putBoolean("passedIntro", true).apply();
finish();

View file

@ -26,6 +26,7 @@ import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.ArrayList;
@ -69,17 +70,22 @@ public class MainActivity extends AppCompatActivity {
} else {
try {
_db.load();
if (!_db.isDecrypted()) {
Intent intent = new Intent(this, AuthActivity.class);
intent.putExtra("slots", _db.getFile().getSlots());
startActivityForResult(intent, CODE_DECRYPT);
} else {
loadKeyProfiles();
}
} catch (FileNotFoundException e) {
// start the intro if the db file was not found
Toast.makeText(this, "Database file not found, starting over...", Toast.LENGTH_SHORT).show();
Intent intro = new Intent(this, IntroActivity.class);
startActivityForResult(intro, CODE_DO_INTRO);
} catch (Exception e) {
// TODO: feedback
throw new UndeclaredThrowableException(e);
}
if (!_db.isDecrypted()) {
Intent intent = new Intent(this, AuthActivity.class);
intent.putExtra("slots", _db.getFile().getSlots());
startActivityForResult(intent, CODE_DECRYPT);
} else {
loadKeyProfiles();
}
}
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);