diff --git a/.gitignore b/.gitignore index 1d1522fe..0cdb2e6e 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/build.gradle b/opensrp-giz-malawi/build.gradle index c9980f34..d07d5054 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' @@ -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' @@ -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' @@ -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' 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 f14b0c0a..2812cb5d 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,7 @@ import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; +import org.smartregister.AllConstants; import org.smartregister.Context; import org.smartregister.CoreLibrary; import org.smartregister.anc.library.AncLibrary; @@ -30,6 +31,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 +360,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() {