Fix a recent regression that caused the database migration dialog to never pop up
This commit is contained in:
parent
109a032f1e
commit
2677dad873
|
@ -173,9 +173,13 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
||||||
if (device.isInitialized()) {
|
if (device.isInitialized()) {
|
||||||
try (DBHandler dbHandler = GBApplication.acquireDB()) {
|
try (DBHandler dbHandler = GBApplication.acquireDB()) {
|
||||||
DaoSession session = dbHandler.getDaoSession();
|
DaoSession session = dbHandler.getDaoSession();
|
||||||
|
boolean askForDBMigration = false;
|
||||||
|
if (DBHelper.findDevice(device, session) == null && device.getType() != DeviceType.VIBRATISSIMO) {
|
||||||
|
askForDBMigration = true;
|
||||||
|
}
|
||||||
|
DBHelper.getDevice(device, session); // implicitly creates the device in database if not present, and updates device attributes
|
||||||
|
if (askForDBMigration) {
|
||||||
DBHelper dbHelper = new DBHelper(context);
|
DBHelper dbHelper = new DBHelper(context);
|
||||||
DBHelper.getDevice(device, session); // implicitly creates it :P
|
|
||||||
if (DBHelper.findDevice(device, session) == null && (device.getType() != DeviceType.VIBRATISSIMO)) {
|
|
||||||
if (dbHelper.getOldActivityDatabaseHandler() != null) {
|
if (dbHelper.getOldActivityDatabaseHandler() != null) {
|
||||||
Intent startIntent = new Intent(context, OnboardingActivity.class);
|
Intent startIntent = new Intent(context, OnboardingActivity.class);
|
||||||
startIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
startIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
Loading…
Reference in New Issue