diff --git a/.gitignore b/.gitignore index c1c8dc2b..8cccb68e 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,10 @@ local.properties opensrp-unicef-tunisia/fabric.properties opensrp-unicef-tunisia/jacoco.exec opensrp-unicef-tunisia/reports/ +opensrp-unicef-tunisia/debug/ +opensrp-unicef-tunisia/debug/output-metadata.json +opensrp-unicef-tunisia/preview/ +opensrp-unicef-tunisia/release/ out/ project.properties target/ diff --git a/build.gradle b/build.gradle index 765b9fd7..e7a590ed 100644 --- a/build.gradle +++ b/build.gradle @@ -43,8 +43,8 @@ subprojects { ext.androidToolsBuildGradle = '4.0.1' ext.androidBuildToolsVersion = '29.0.3' ext.androidMinSdkVersion = 19 - ext.androidCompileSdkVersion = 30 - ext.androidTargetSdkVersion = 30 + ext.androidCompileSdkVersion = 31 + ext.androidTargetSdkVersion = 31 ext.androidAnnotationsVersion = '3.0.1' ext.androidAnnotationsAPIVersion = '3.0.1' diff --git a/opensrp-unicef-tunisia/build.gradle b/opensrp-unicef-tunisia/build.gradle index e0dd3be0..4c5393aa 100644 --- a/opensrp-unicef-tunisia/build.gradle +++ b/opensrp-unicef-tunisia/build.gradle @@ -83,20 +83,30 @@ android { applicationVariants.all { variant -> if (variant.name == "debug") { variant.outputs.each { output -> - output.versionCodeOverride = 9 - output.versionNameOverride = "0.2.5-debug" + output.versionCodeOverride = 12 + output.versionNameOverride = "0.2.8-debug" } } else if (variant.name == "preview") { variant.outputs.each { output -> - output.versionCodeOverride = 9 - output.versionNameOverride = "0.2.5-preview" + output.versionCodeOverride = 11 + output.versionNameOverride = "0.2.7-preview" } } else if (variant.name == "release") { variant.outputs.each { output -> - output.versionCodeOverride = 10 - output.versionNameOverride = "1.0.0" + output.versionCodeOverride = 12 + output.versionNameOverride = "1.0.2" } } + + configurations.all { + exclude group: 'com.evernote', module: 'android-job' + } + + // https://stackoverflow.com/a/27119543/152938 + variant.outputs.all { output -> + outputFileName = new File(outputFileName.replace(".apk", "-${output.versionNameOverride}.apk")) + println "Name of the APK is using versionNameOverride $outputFileName" + } } dexOptions { @@ -132,7 +142,7 @@ android { buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '100' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '11' buildConfigField "int", "VACCINE_SYNC_TIME", '0' - buildConfigField "int", "DATABASE_VERSION", '15' + buildConfigField "int", "DATABASE_VERSION", '16' buildConfigField "long", "MAX_SERVER_TIME_DIFFERENCE", "1800000l" buildConfigField "boolean", "TIME_CHECK", "true" buildConfigField "int", "DATA_SYNC_DURATION_MINUTES", '15' @@ -158,7 +168,7 @@ android { buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '100' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '12' buildConfigField "int", "VACCINE_SYNC_TIME", '0' - buildConfigField "int", "DATABASE_VERSION", '15' + buildConfigField "int", "DATABASE_VERSION", '16' buildConfigField "long", "MAX_SERVER_TIME_DIFFERENCE", "1800000l" buildConfigField "boolean", "TIME_CHECK", "true" buildConfigField "int", "DATA_SYNC_DURATION_MINUTES", '15' @@ -190,7 +200,7 @@ android { buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '100' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '13' buildConfigField "int", "VACCINE_SYNC_TIME", '0' - buildConfigField "int", "DATABASE_VERSION", '15' + buildConfigField "int", "DATABASE_VERSION", '16' buildConfigField "long", "MAX_SERVER_TIME_DIFFERENCE", "1800000l" buildConfigField "boolean", "TIME_CHECK", "true" buildConfigField "int", "DATA_SYNC_DURATION_MINUTES", '15' @@ -269,7 +279,7 @@ dependencies { implementation "androidx.cardview:cardview:1.0.0" // implementation(project(':opensrp-child')) { - implementation('org.smartregister:opensrp-client-child:0.7.1-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-child:0.10.1-SNAPSHOT@aar') { transitive = true exclude group: 'id.zelory', module: 'compressor' exclude group: 'org.smartregister', module: 'opensrp-client-growth-monitoring' @@ -286,7 +296,7 @@ dependencies { exclude group: 'com.github.lecho', module: 'hellocharts-library' } - implementation('org.smartregister:opensrp-client-immunization:4.0.3-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-immunization:4.0.6-SNAPSHOT@aar') { transitive = true exclude group: 'org.smartregister', module: 'opensrp-client-core' exclude group: 'com.android.support', module: 'design' @@ -298,7 +308,7 @@ dependencies { exclude group: 'com.ibm.fhir', module: 'fhir-path' } - implementation('org.smartregister:opensrp-client-core:4.3.24-BETA-2-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-core:5.0.15-UNICEFTUNISIA-SNAPSHOT@aar') { transitive = true exclude group: 'id.zelory', module: 'compressor' exclude group: 'com.android.support', module: 'appcompat-v7' @@ -371,7 +381,9 @@ dependencies { // Because RxAndroid releases are few and far between, it is recommended you also // explicitly depend on RxJava's latest version for bug fixes and new features. implementation 'io.reactivex.rxjava2:rxjava:2.2.19' - implementation 'com.evernote:android-job:1.2.6' + implementation('com.github.devv911:android-job:1.4.5') { + exclude group: 'com.google.android', module: 'android' + } implementation 'com.github.lecho:hellocharts-android:1.5.8' implementation 'id.zelory:compressor:2.1.1' implementation 'androidx.recyclerview:recyclerview:1.1.0' diff --git a/opensrp-unicef-tunisia/src/main/AndroidManifest.xml b/opensrp-unicef-tunisia/src/main/AndroidManifest.xml index e672b1a9..0cdb3961 100644 --- a/opensrp-unicef-tunisia/src/main/AndroidManifest.xml +++ b/opensrp-unicef-tunisia/src/main/AndroidManifest.xml @@ -50,6 +50,7 @@ android:name=".activity.LoginActivity" android:screenOrientation="portrait" android:theme="@style/AppTheme.Login" + android:exported="true" android:windowSoftInputMode="stateAlwaysHidden|adjustPan"> @@ -110,19 +111,19 @@ android:resource="@xml/captured_images_path" /> - + - - - + + + - - - - + + + + - - + + processRegistration(@NonNull String jsonString, FormTag formTag) { - List childEventClients = super.processRegistration(jsonString, formTag); + public List processRegistration(@NonNull String jsonString, FormTag formTag, boolean isEditMode) { + List childEventClients = super.processRegistration(jsonString, formTag, isEditMode); //Add location name as part of child attributes to avoid fetching name from events for (ChildEventClient childEventClient : childEventClients) { Client client = childEventClient.getClient(); diff --git a/opensrp-unicef-tunisia/src/main/java/org/smartregister/uniceftunisia/repository/UnicefTunisiaRepository.java b/opensrp-unicef-tunisia/src/main/java/org/smartregister/uniceftunisia/repository/UnicefTunisiaRepository.java index c074b6e7..094ab520 100644 --- a/opensrp-unicef-tunisia/src/main/java/org/smartregister/uniceftunisia/repository/UnicefTunisiaRepository.java +++ b/opensrp-unicef-tunisia/src/main/java/org/smartregister/uniceftunisia/repository/UnicefTunisiaRepository.java @@ -9,6 +9,7 @@ import org.smartregister.AllConstants; import org.smartregister.child.util.ChildDbMigrations; import org.smartregister.child.util.Utils; +import org.smartregister.child.util.VaccineOverdueCountRepositoryHelper; import org.smartregister.configurableviews.repository.ConfigurableViewsRepository; import org.smartregister.domain.db.Column; import org.smartregister.growthmonitoring.repository.HeightRepository; @@ -16,6 +17,7 @@ import org.smartregister.growthmonitoring.repository.WeightForHeightRepository; import org.smartregister.growthmonitoring.repository.WeightRepository; import org.smartregister.growthmonitoring.repository.WeightZScoreRepository; +import org.smartregister.immunization.repository.VaccineOverdueCountRepository; import org.smartregister.immunization.repository.VaccineRepository; import org.smartregister.reporting.ReportingLibrary; import org.smartregister.reporting.repository.DailyIndicatorCountRepository; @@ -134,6 +136,8 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { upgradeToVersion14(db); case 15: upgradeToVersion15(db); + case 16: + upgradeToVersion16(db); default: break; } @@ -361,4 +365,43 @@ private void upgradeToVersion15(SQLiteDatabase db) { Timber.e(e, "upgradeToVersion15"); } } + + private void upgradeToVersion16(SQLiteDatabase db) { + try { + // Add vaccine overdue table and migration vaccines + db.execSQL(VaccineOverdueCountRepository.CREATE_TABLE_SQL); + db.execSQL(VaccineOverdueCountRepositoryHelper.MIGRATE_VACCINES_QUERY); + + addOutreachColumn(db); + addDateRemovedColumnChildDetailsTable(db); + } catch (Exception e) { + Timber.e(e); + } + } + + private void addOutreachColumn(SQLiteDatabase db) { + try { + String UPDATE_VACCINES_TABLE_ADD_OUTREACH = "ALTER TABLE " + VaccineRepository.VACCINE_TABLE_NAME + " ADD COLUMN outreach INTEGER;"; + db.execSQL(UPDATE_VACCINES_TABLE_ADD_OUTREACH); + db.execSQL(HeightRepository.UPDATE_TABLE_ADD_CHILD_LOCATION_ID_COL); + db.execSQL(HeightRepository.UPDATE_TABLE_ADD_TEAM_COL); + db.execSQL(HeightRepository.UPDATE_TABLE_ADD_TEAM_ID_COL); + db.execSQL(HeightRepository.UPDATE_TABLE_ADD_EVENT_ID_COL); + db.execSQL(HeightRepository.UPDATE_TABLE_ADD_FORMSUBMISSION_ID_COL); + db.execSQL(HeightRepository.ALTER_ADD_Z_SCORE_COLUMN); + db.execSQL(HeightRepository.UPDATE_TABLE_ADD_OUT_OF_AREA_COL); + db.execSQL(HeightRepository.ALTER_ADD_CREATED_AT_COLUMN); + } catch (Exception e) { + Timber.e(e); + } + } + + private void addDateRemovedColumnChildDetailsTable(SQLiteDatabase database) { + try { + String UPDATE_CHILD_DETAILS_TABLE_ADD_DATE_REMOVED = "ALTER TABLE ec_child_details ADD COLUMN date_removed VARCHAR;"; + database.execSQL(UPDATE_CHILD_DETAILS_TABLE_ADD_DATE_REMOVED); + } catch (Exception e) { + Timber.e(e); + } + } }