use of org.eyeseetea.malariacare.domain.exception.PostMigrationException in project pictureapp by EyeSeeTea.
the class SplashScreenActivity method init.
private void init() {
LocationMemory.getInstance().init(getApplicationContext());
D2.init(this);
SdkQueries.createDBIndexes();
// Added to execute a query in DB, because DBFLow doesn't do any migration until a query
// is executed
PopulateDB.initDBQuery();
try {
PostMigration.launchPostMigration();
} catch (PostMigrationException e) {
new AlertDialog.Builder(this).setTitle(getApplicationContext().getString(R.string.error_message)).setCancelable(false).setMessage(getApplicationContext().getString(R.string.db_migration_error)).setNeutralButton(android.R.string.ok, null).create().show();
}
if (!BuildConfig.multiuser) {
Log.i(TAG, "Pull on SplashScreen ...");
PullController pullController = new PullController(getApplication().getApplicationContext());
IAsyncExecutor asyncExecutor = new AsyncExecutor();
IMainExecutor mainExecutor = new UIThreadExecutor();
PullUseCase pullUseCase = new PullUseCase(pullController, asyncExecutor, mainExecutor);
PullFilters pullFilters = new PullFilters();
pullFilters.setDemo(true);
pullUseCase.execute(pullFilters, new PullUseCase.Callback() {
@Override
public void onComplete() {
Log.d(this.getClass().getSimpleName(), "pull complete");
try {
NavigationBuilder.getInstance().buildController(Tab.getFirstTab());
} catch (LoadingNavigationControllerException ex) {
onError(ex.getMessage());
}
}
@Override
public void onStep(PullStep step) {
Log.d(this.getClass().getSimpleName(), step.toString());
}
@Override
public void onError(String message) {
Log.e(this.getClass().getSimpleName(), message);
}
@Override
public void onNetworkError() {
Log.e(this.getClass().getSimpleName(), "Network Error");
}
@Override
public void onPullConversionError() {
Log.e(this.getClass().getSimpleName(), "Pull Conversion Error");
}
@Override
public void onCancel() {
Log.e(this.getClass().getSimpleName(), "Pull oncancel");
}
});
}
}
use of org.eyeseetea.malariacare.domain.exception.PostMigrationException in project pictureapp by EyeSeeTea.
the class Migration2ChangeOptionPfPv method postMigrate.
public static void postMigrate() throws PostMigrationException {
// Migration NOT required -> done
Log.d(TAG, "Post migrate");
if (!instance.postMigrationRequired) {
return;
}
// Data? Add new default data
if (instance.hasData()) {
try {
UpdateDBStrategy.updateOptions(PreferencesState.getInstance().getContext());
} catch (IOException e) {
throw new PostMigrationException(e);
}
}
// This operation wont be done again
instance.postMigrationRequired = false;
}
use of org.eyeseetea.malariacare.domain.exception.PostMigrationException in project pictureapp by EyeSeeTea.
the class Migration2ChangeTravelQuestionIcon method postMigrate.
public static void postMigrate() throws PostMigrationException {
// Migration NOT required -> done
Log.d(TAG, "Post migrate");
if (instance == null || !instance.postMigrationRequired) {
return;
}
// Data? Add new default data
if (instance.hasData()) {
try {
UpdateDB.updateAndAddQuestions(PreferencesState.getInstance().getContext());
} catch (IOException e) {
throw new PostMigrationException(e);
}
}
// This operation wont be done again
instance.postMigrationRequired = false;
}
use of org.eyeseetea.malariacare.domain.exception.PostMigrationException in project pictureapp by EyeSeeTea.
the class Migration3RefactorHelptext method postMigrate.
public static void postMigrate() throws PostMigrationException {
// Migration NOT required -> done
Log.d(TAG, "Post migrate");
if (!instance.postMigrationRequired) {
return;
}
// Data? Add new default data
if (instance.hasData()) {
try {
UpdateDB.updateAndAddQuestions(PreferencesState.getInstance().getContext());
} catch (IOException e) {
throw new PostMigrationException(e);
}
}
// This operation wont be done again
instance.postMigrationRequired = false;
}
use of org.eyeseetea.malariacare.domain.exception.PostMigrationException in project pictureapp by EyeSeeTea.
the class Migration7UpdateOptionAttributeBackground method postMigrate.
public static void postMigrate() throws PostMigrationException {
// Migration NOT required -> done
Log.d(TAG, "Post migrate");
if (!instance.postMigrationRequired) {
return;
}
// Data? Add new default data
if (instance.hasData()) {
try {
UpdateDB.updateOptionAttributes(PreferencesState.getInstance().getContext());
} catch (IOException e) {
throw new PostMigrationException(e);
}
}
Log.d(TAG, "Post migrate finish");
// This operation wont be done again
instance.postMigrationRequired = false;
}
Aggregations