From da718922f1886dc17098d9eca44d53285abb9b47 Mon Sep 17 00:00:00 2001 From: Ephraim Kigamba Date: Thu, 3 Nov 2022 17:02:13 +0300 Subject: [PATCH 1/5] Detect build config url changes and update preferences --- .gitignore | 1 + .../giz/application/GizMalawiApplication.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.gitignore b/.gitignore index 1d1522fef..0cdb2e6ef 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ target/ tmp/ opensrp-giz-malawi/debug/ opensrp-giz-malawi/preview/ +**/google-services.json diff --git a/opensrp-giz-malawi/src/main/java/org/smartregister/giz/application/GizMalawiApplication.java b/opensrp-giz-malawi/src/main/java/org/smartregister/giz/application/GizMalawiApplication.java index f14b0c0ae..33957a137 100644 --- a/opensrp-giz-malawi/src/main/java/org/smartregister/giz/application/GizMalawiApplication.java +++ b/opensrp-giz-malawi/src/main/java/org/smartregister/giz/application/GizMalawiApplication.java @@ -15,6 +15,9 @@ import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; +import org.json.JSONException; +import org.json.JSONObject; +import org.smartregister.AllConstants; import org.smartregister.Context; import org.smartregister.CoreLibrary; import org.smartregister.anc.library.AncLibrary; @@ -30,6 +33,7 @@ import org.smartregister.configurableviews.helper.JsonSpecHelper; import org.smartregister.domain.Obs; import org.smartregister.giz.BuildConfig; +import org.smartregister.giz.R; import org.smartregister.giz.activity.AllClientsRegisterActivity; import org.smartregister.giz.activity.AncRegisterActivity; import org.smartregister.giz.activity.ChildFormActivity; @@ -358,6 +362,18 @@ public void onCreate() { initMinimumDateForReportGeneration(); + updateBaseUrl(); + } + + private void updateBaseUrl() { + AllSharedPreferences allSharedPreferences = CoreLibrary.getInstance().context().allSharedPreferences(); + String currUrl = getString(R.string.opensrp_url); + + if (!currUrl.equals(allSharedPreferences.fetchBaseURL(""))) { + allSharedPreferences.savePreference(AllConstants.DRISHTI_BASE_URL, currUrl); + Timber.e("Changed URL to %s", currUrl); + allSharedPreferences.updateUrl(currUrl); + } } private void initMinimumDateForReportGeneration() { From f097527b545130db26f223c2a934557888dd5c43 Mon Sep 17 00:00:00 2001 From: Ephraim Kigamba Date: Thu, 3 Nov 2022 17:07:48 +0300 Subject: [PATCH 2/5] Update Malawi production URL - Bump to 0.3.1 and versionCode 38 --- opensrp-giz-malawi/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opensrp-giz-malawi/build.gradle b/opensrp-giz-malawi/build.gradle index c9980f34e..be25634e5 100644 --- a/opensrp-giz-malawi/build.gradle +++ b/opensrp-giz-malawi/build.gradle @@ -33,8 +33,8 @@ android { applicationId "org.smartregister.giz" minSdkVersion androidMinSdkVersion targetSdkVersion androidTargetSdkVersion - versionCode 37 - versionName "0.3.0" + versionCode 38 + versionName "0.3.1" multiDexEnabled true buildConfigField "long", "MAX_SERVER_TIME_DIFFERENCE", "1800000l" buildConfigField "boolean", "TIME_CHECK", "false" @@ -108,7 +108,7 @@ android { zipAlignEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rule.pro' - resValue "string", 'opensrp_url', '"https://his-mw.smartregister.org/opensrp/"' + resValue "string", 'opensrp_url', '"https://opensrp.health.gov.mw/opensrp/"' buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '250' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '100' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' From 3c38395b038fc0ff9aa7aa715ccfed4241b21514 Mon Sep 17 00:00:00 2001 From: Ephraim Kigamba Date: Thu, 3 Nov 2022 18:08:39 +0300 Subject: [PATCH 3/5] Fix hello-chart dependency --- opensrp-giz-malawi/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opensrp-giz-malawi/build.gradle b/opensrp-giz-malawi/build.gradle index be25634e5..bdaf8ba06 100644 --- a/opensrp-giz-malawi/build.gradle +++ b/opensrp-giz-malawi/build.gradle @@ -136,7 +136,7 @@ android { signingConfig signingConfigs.debug proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rule.pro' - resValue "string", 'opensrp_url', '"https://his-mw.smartregister.org/opensrp/"' + resValue "string", 'opensrp_url', '"https://opensrp.health.gov.mw/opensrp/"' buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' @@ -363,7 +363,7 @@ dependencies { // explicitly depend on RxJava's latest version for bug fixes and new features. implementation 'io.reactivex.rxjava2:rxjava:2.1.5' implementation 'com.evernote:android-job:1.2.6' - implementation 'com.github.lecho:hellocharts-android:v1.5.8' + implementation 'com.github.lecho:hellocharts-android:1.5.8@aar' implementation 'id.zelory:compressor:2.1.1' implementation('com.google.android.material:material:1.0.0') { exclude group: 'com.android.support', module: 'recyclerview-v7' From 3b697655d7a8d8b19ff64c60a8373f0847ded125 Mon Sep 17 00:00:00 2001 From: Ephraim Kigamba Date: Fri, 4 Nov 2022 11:34:06 +0300 Subject: [PATCH 4/5] Code cleanup --- .../org/smartregister/giz/application/GizMalawiApplication.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/opensrp-giz-malawi/src/main/java/org/smartregister/giz/application/GizMalawiApplication.java b/opensrp-giz-malawi/src/main/java/org/smartregister/giz/application/GizMalawiApplication.java index 33957a137..2812cb5d0 100644 --- a/opensrp-giz-malawi/src/main/java/org/smartregister/giz/application/GizMalawiApplication.java +++ b/opensrp-giz-malawi/src/main/java/org/smartregister/giz/application/GizMalawiApplication.java @@ -15,8 +15,6 @@ import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; -import org.json.JSONException; -import org.json.JSONObject; import org.smartregister.AllConstants; import org.smartregister.Context; import org.smartregister.CoreLibrary; From af661ebef344db22722a51e133871bee4bccb6eb Mon Sep 17 00:00:00 2001 From: Ephraim Kigamba Date: Thu, 10 Nov 2022 17:15:00 +0300 Subject: [PATCH 5/5] Update the preview URL --- opensrp-giz-malawi/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensrp-giz-malawi/build.gradle b/opensrp-giz-malawi/build.gradle index bdaf8ba06..d07d50540 100644 --- a/opensrp-giz-malawi/build.gradle +++ b/opensrp-giz-malawi/build.gradle @@ -163,7 +163,7 @@ android { signingConfig signingConfigs.debug proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rule.pro' - resValue "string", 'opensrp_url', '"https://jembi-staging.smartregister.org/opensrp/"' + resValue "string", 'opensrp_url', '"https://jembi-preview.smartregister.org/opensrp/"' buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '100' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2'