Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.3.1 GIZ Malawi: URL change to new servers #500

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ target/
tmp/
opensrp-giz-malawi/debug/
opensrp-giz-malawi/preview/
**/google-services.json
12 changes: 6 additions & 6 deletions opensrp-giz-malawi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down