only launch onboarding after device is initialized and write device to database if not in yet.
parent
49b8b9ebca
commit
063d00cc51
|
@ -131,16 +131,6 @@ public class ControlCenter extends GBActivity {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GBApplication.deviceService().connect(gbDevice);
|
GBApplication.deviceService().connect(gbDevice);
|
||||||
try (DBHandler dbHandler = GBApplication.acquireDB()) {
|
|
||||||
DaoSession session = dbHandler.getDaoSession();
|
|
||||||
|
|
||||||
if (DBHelper.findDevice(gbDevice, session) == null) {
|
|
||||||
Intent startIntent = new Intent(ControlCenter.this, OnboardingActivity.class);
|
|
||||||
startIntent.putExtra(GBDevice.EXTRA_DEVICE, gbDevice);
|
|
||||||
startActivity(startIntent);
|
|
||||||
}
|
|
||||||
} catch (Exception _ignore) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -348,6 +338,20 @@ public class ControlCenter extends GBActivity {
|
||||||
for (GBDevice device : deviceList) {
|
for (GBDevice device : deviceList) {
|
||||||
if (device.isConnected() || device.isConnecting()) {
|
if (device.isConnected() || device.isConnecting()) {
|
||||||
connectedDevice = device;
|
connectedDevice = device;
|
||||||
|
if (device.isInitialized()) {
|
||||||
|
LOG.info("will try");
|
||||||
|
try (DBHandler dbHandler = GBApplication.acquireDB()) {
|
||||||
|
DaoSession session = dbHandler.getDaoSession();
|
||||||
|
|
||||||
|
if (DBHelper.findDevice(device, session) == null) {
|
||||||
|
DBHelper.getDevice(device, session); // implicitly creates it :P
|
||||||
|
Intent startIntent = new Intent(ControlCenter.this, OnboardingActivity.class);
|
||||||
|
startIntent.putExtra(GBDevice.EXTRA_DEVICE, device);
|
||||||
|
startActivity(startIntent);
|
||||||
|
}
|
||||||
|
} catch (Exception _ignore) {
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue