From 2c36bfe17bf2c8c18609a06746ed3bf69e67c607 Mon Sep 17 00:00:00 2001 From: rkodev <43806892+rkodev@users.noreply.github.com> Date: Tue, 23 Mar 2021 13:38:23 +0300 Subject: [PATCH] Fix P2P authentication and offline login --- gradle.properties | 2 +- opensrp-chw-core/build.gradle | 2 +- .../chw/core/service/CoreAuthorizationService.java | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index f178e3c1cf..f7cee4dcec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=2.0.24-SNAPSHOT +VERSION_NAME=2.0.25-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Chw Core Library diff --git a/opensrp-chw-core/build.gradle b/opensrp-chw-core/build.gradle index 38df5e5e94..fd50cd68e4 100644 --- a/opensrp-chw-core/build.gradle +++ b/opensrp-chw-core/build.gradle @@ -141,7 +141,7 @@ dependencies { compileOnly 'com.ibm.fhir:fhir-model:4.2.3' - api('org.smartregister:opensrp-client-core:4.2.5-SNAPSHOT@aar') { + api('org.smartregister:opensrp-client-core:4.2.16-SNAPSHOT@aar') { transitive = true exclude group: 'com.github.bmelnychuk', module: 'atv' exclude group: 'com.google.guava', module: 'guava' diff --git a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/service/CoreAuthorizationService.java b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/service/CoreAuthorizationService.java index 78c736284c..bea4363810 100644 --- a/opensrp-chw-core/src/main/java/org/smartregister/chw/core/service/CoreAuthorizationService.java +++ b/opensrp-chw-core/src/main/java/org/smartregister/chw/core/service/CoreAuthorizationService.java @@ -3,6 +3,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import org.apache.commons.lang3.StringUtils; import org.smartregister.AllConstants; import org.smartregister.CoreLibrary; import org.smartregister.chw.core.utils.CoreConstants; @@ -135,7 +136,9 @@ public void getAuthorizationDetails(@NonNull OnAuthorizationDetailsProvidedCallb AllSharedPreferences allSharedPreferences = CoreLibrary.getInstance().context().allSharedPreferences(); authorizationDetails.put(AllConstants.PeerToPeer.KEY_TEAM_ID, allSharedPreferences.fetchDefaultTeamId(allSharedPreferences.fetchRegisteredANM())); - authorizationDetails.put(CoreConstants.PEER_TO_PEER.LOCATION_ID, allSharedPreferences.fetchUserLocalityId(allSharedPreferences.fetchRegisteredANM())); + String locationId = allSharedPreferences.fetchDefaultLocalityId(allSharedPreferences.fetchRegisteredANM()); + if(StringUtils.isBlank(locationId)) locationId = allSharedPreferences.fetchUserLocalityId(allSharedPreferences.fetchRegisteredANM()); + authorizationDetails.put(CoreConstants.PEER_TO_PEER.LOCATION_ID, locationId); onAuthorizationDetailsProvidedCallback.onAuthorizationDetailsProvided(authorizationDetails); }