Skip to content

Commit

Permalink
Merge pull request #1398 from OpenSRP/allow_save_on_submit
Browse files Browse the repository at this point in the history
Allow save on submit
  • Loading branch information
rkodev authored Oct 8, 2020
2 parents 9850f23 + 382b771 commit 7f89d44
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
6 changes: 3 additions & 3 deletions opensrp-chw/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ android {
dimension = 'baseDimension'
applicationIdSuffix ".lmh"
versionCode 1
versionName "0.0.4"
versionName "0.0.5-rc1"
buildConfigField "String", 'opensrp_url', '"https://lmh-liberia.smartregister.org/opensrp/"'
buildConfigField "String", 'guidebooks_url', '"https://opensrp.s3.amazonaws.com/media/lmh/"'
buildConfigField "String", 'opensrp_url_debug', '"https://lmh-stage.smartregister.org/opensrp/"'
Expand All @@ -266,7 +266,7 @@ android {
buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS_DEBUG", '{"Clinic" , "CHSS" , "CHA"}'
buildConfigField "String", 'DEFAULT_LOCATION', '"Village"'
buildConfigField "String", 'DEFAULT_LOCATION_DEBUG', '"CHA"'
buildConfigField "int", "DATABASE_VERSION", '4'
buildConfigField "int", "DATABASE_VERSION", '5'
}
}

Expand All @@ -276,7 +276,7 @@ android {
}

dependencies {
implementation('org.smartregister:opensrp-client-chw-core:1.5.5-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-chw-core:1.5.6-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'androidx.legacy', module: 'legacy-support-v4'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,9 @@ public boolean dueVaccinesFilterInChildRegister() {
public boolean showAllChildServicesDueIncludingCurrentChild(){
return false;
}

@Override
public boolean saveOnSubmission() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import net.sqlcipher.database.SQLiteDatabase;

import org.smartregister.chw.anc.repository.VisitRepository;
import org.smartregister.chw.util.RepositoryUtils;
import org.smartregister.domain.db.Column;
import org.smartregister.immunization.repository.RecurringServiceRecordRepository;
Expand Down Expand Up @@ -36,6 +37,9 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion,
case 4:
upgradeToVersion4(db);
break;
case 5:
upgradeToVersion5(db);
break;
default:
break;
}
Expand Down Expand Up @@ -106,7 +110,15 @@ private static void upgradeToVersion4(SQLiteDatabase db) {
EventClientRepository.createTable(db, EventClientRepository.Table.foreignEvent, EventClientRepository.event_column.values());
EventClientRepository.createTable(db, EventClientRepository.Table.foreignClient, EventClientRepository.client_column.values());
} catch (Exception e) {
Timber.e(e, "upgradeToVersion3");
Timber.e(e, "upgradeToVersion4");
}
}

private static void upgradeToVersion5(SQLiteDatabase db) {
try {
db.execSQL(VisitRepository.ADD_VISIT_GROUP_COLUMN);
} catch (Exception e) {
Timber.e(e, "upgradeToVersion5");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,13 @@ private void initializeLibraries() {

// init libraries
ImmunizationLibrary.init(context, getRepository(), null, BuildConfig.VERSION_CODE, BuildConfig.DATABASE_VERSION);
ImmunizationLibrary.getInstance().setAllowSyncImmediately(flavor.saveOnSubmission());

ConfigurableViewsLibrary.init(context);
FamilyLibrary.init(context, getMetadata(), BuildConfig.VERSION_CODE, BuildConfig.DATABASE_VERSION);
AncLibrary.init(context, getRepository(), BuildConfig.VERSION_CODE, BuildConfig.DATABASE_VERSION);
AncLibrary.getInstance().setSubmitOnSave(flavor.saveOnSubmission());

PncLibrary.init(context, getRepository(), BuildConfig.VERSION_CODE, BuildConfig.DATABASE_VERSION);
MalariaLibrary.init(context, getRepository(), BuildConfig.VERSION_CODE, BuildConfig.DATABASE_VERSION);
FpLibrary.init(context, getRepository(), BuildConfig.VERSION_CODE, BuildConfig.DATABASE_VERSION);
Expand Down Expand Up @@ -407,6 +411,8 @@ public interface Flavor {
boolean dueVaccinesFilterInChildRegister();

boolean showAllChildServicesDueIncludingCurrentChild();

boolean saveOnSubmission();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,9 @@ public boolean dueVaccinesFilterInChildRegister() {
public boolean showAllChildServicesDueIncludingCurrentChild(){
return true;
}

@Override
public boolean saveOnSubmission() {
return false;
}
}

0 comments on commit 7f89d44

Please sign in to comment.