Skip to content

Commit

Permalink
Merge branch 'master' into togo_release
Browse files Browse the repository at this point in the history
  • Loading branch information
rkodev authored Sep 17, 2019
2 parents a4170d1 + d601b22 commit 5245bf1
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@
import org.smartregister.view.activity.DrishtiApplication;
import org.smartregister.view.activity.LoginActivity;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import timber.log.Timber;

public class CoreChwApplication extends DrishtiApplication implements CoreApplication {
public abstract class CoreChwApplication extends DrishtiApplication implements CoreApplication {

private static ClientProcessorForJava clientProcessor;

Expand Down Expand Up @@ -263,4 +264,7 @@ public FamilyMetadata getMetadata() {
metadata.updateFamilyOtherMemberRegister(CoreConstants.TABLE_NAME.FAMILY_MEMBER, Integer.MAX_VALUE, false);
return metadata;
}

@Override
public abstract ArrayList<String> getAllowedLocationLevels();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.smartregister.family.domain.FamilyMetadata;
import org.smartregister.sync.helper.ECSyncHelper;

import java.util.ArrayList;

public interface CoreApplication {
void saveLanguage(String language);

Expand All @@ -17,4 +19,6 @@ public interface CoreApplication {
RulesEngineHelper getRulesEngineHelper();

FamilyMetadata getMetadata();

ArrayList<String> getAllowedLocationLevels();
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ public static class CONFIGURATION {
public static final String FAMILY_MEMBER_REGISTER = "family_member_register";
public static final String ANC_REGISTER = "anc_register";
public static final String MALARIA_REGISTER = "anc_malaria_confirmation";
public static final String HEALTH_FACILITY_TAG = "MOH Jhpiego Facility Name";

}

public static final class EventType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ private static void createReferralTask(String baseEntityId, AllSharedPreferences
}*/
task.setPlanIdentifier(CoreConstants.REFERRAL_PLAN_ID);
LocationHelper locationHelper = LocationHelper.getInstance();
ArrayList<String> allowedLevels = new ArrayList<>();
allowedLevels.add(CoreConstants.CONFIGURATION.HEALTH_FACILITY_TAG);
task.setGroupIdentifier(locationHelper.getOpenMrsLocationId(locationHelper.generateDefaultLocationHierarchy(allowedLevels).get(0)));
task.setGroupIdentifier(locationHelper.getOpenMrsLocationId(locationHelper.generateDefaultLocationHierarchy(CoreChwApplication.getInstance().getAllowedLocationLevels()).get(0)));
task.setStatus(Task.TaskStatus.READY);
task.setBusinessStatus(CoreConstants.BUSINESS_STATUS.REFERRED);
task.setPriority(3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;

import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
Expand All @@ -28,8 +27,6 @@
import java.util.List;
import java.util.Map;

import timber.log.Timber;

public class VaccineScheduleUtil {

private VaccineScheduleUtil() {
Expand Down
8 changes: 5 additions & 3 deletions opensrp-chw-hf/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ android {
multiDexEnabled true
buildConfigField "String", 'opensrp_url', '"https://boresha-afya.smartregister.org/opensrp/"'
buildConfigField "String", 'opensrp_url_debug', '"https://boresha-afya-stage.smartregister.org/opensrp/"'
buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS", '{"MOH Jhpiego Facility Name" , "Village"}'
buildConfigField "String", 'DEFAULT_LOCATION', '"Village"'
buildConfigField "boolean", 'SUPPORT_QR', 'true'
buildConfigField "int", "DATABASE_VERSION", '5'
buildConfigField "int", "DATA_SYNC_DURATION_MINUTES", '15'
Expand All @@ -56,7 +54,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '250'
buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '100'
buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '1'
buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2'
buildConfigField "boolean", "TIME_CHECK", "true"
buildConfigField "int", "DATA_SYNC_DURATION_MINUTES", '15'
buildConfigField "int", "VACCINE_SYNC_PROCESSING_MINUTES", '30'
Expand All @@ -65,6 +63,8 @@ android {
buildConfigField "int", "REPORT_INDICATOR_GENERATION_MINUTES", '15'
buildConfigField "int", "HOME_VISIT_MINUTES", '60'
buildConfigField "boolean", 'SUPPORT_REPORT', 'false'
buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS", '{"Ward" , "Health Facility"}'
buildConfigField "String", 'DEFAULT_LOCATION', '"Health Facility"'
}

debug {
Expand All @@ -79,6 +79,8 @@ android {
buildConfigField "int", "REPORT_INDICATOR_GENERATION_MINUTES", '15'
buildConfigField "int", "HOME_VISIT_MINUTES", '60'
buildConfigField "boolean", 'SUPPORT_REPORT', 'false'
buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS", '{"MOH Jhpiego Facility Name" , "Village"}'
buildConfigField "String", 'DEFAULT_LOCATION', '"Village"'
testCoverageEnabled true
}
}
Expand Down
2 changes: 1 addition & 1 deletion opensrp-chw-hf/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in 'org.robolectric:robolectric:4.0.1'dle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
1 change: 0 additions & 1 deletion opensrp-chw-hf/release/output.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ public FamilyMetadata getMetadata() {
return metadata;
}

@Override
public ArrayList<String> getAllowedLocationLevels() {
return new ArrayList<>(Arrays.asList(BuildConfig.ALLOWED_LOCATION_LEVELS));
}

public @NotNull Map<String, Class> getRegisteredActivities() {
Map<String, Class> registeredActivities = new HashMap<>();
registeredActivities.put(CoreConstants.REGISTERED_ACTIVITIES.ANC_REGISTER_ACTIVITY, AncRegisterActivity.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.smartregister.CoreLibrary;
import org.smartregister.chw.core.utils.CoreConstants;
import org.smartregister.chw.hf.HealthFacilityApplication;
import org.smartregister.location.helper.LocationHelper;
import org.smartregister.repository.TaskRepository;
import org.smartregister.sync.helper.TaskServiceHelper;
Expand All @@ -28,8 +29,7 @@ public static HfTaskServiceHelper getInstance() {
@Override
protected List<String> getLocationIds() {
LocationHelper locationHelper = LocationHelper.getInstance();
ArrayList<String> allowedLevels = new ArrayList<>();
allowedLevels.add(CoreConstants.CONFIGURATION.HEALTH_FACILITY_TAG);
ArrayList<String> allowedLevels = HealthFacilityApplication.getInstance().getAllowedLocationLevels();
List<String> locations = new ArrayList<>();
locations.add(locationHelper.getOpenMrsLocationId(locationHelper.generateDefaultLocationHierarchy(allowedLevels).get(0)));
return locations;
Expand Down
4 changes: 2 additions & 2 deletions opensrp-chw/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ android {
versionName "1.0.0"
buildConfigField "String", 'opensrp_url', '"https://boresha-afya.smartregister.org/opensrp/"'
buildConfigField "String", 'opensrp_url_debug', '"https://boresha-afya-stage.smartregister.org/opensrp/"'
buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS", '{"MOH Jhpiego Facility Name" , "Village"}'
buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS", '{"Ward" , "Health Facility"}'
buildConfigField "String[]", "ALLOWED_LOCATION_LEVELS_DEBUG", '{"MOH Jhpiego Facility Name" , "Village"}'
buildConfigField "String", 'DEFAULT_LOCATION', '"Village"'
buildConfigField "String", 'DEFAULT_LOCATION', '"Health Facility"'
buildConfigField "String", 'DEFAULT_LOCATION_DEBUG', '"Village"'
buildConfigField "boolean", 'SUPPORT_QR', 'true'
buildConfigField "boolean", 'SUPPORT_REPORT', 'false'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.smartregister.chw.activity;

import android.app.Activity;

import org.smartregister.chw.core.activity.CoreChildMedicalHistoryActivity;

public class ChildMedicalHistoryActivity extends CoreChildMedicalHistoryActivity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void onCreate() {

SyncStatusBroadcastReceiver.init(this);

LocationHelper.init(new ArrayList<>(Arrays.asList(BuildConfig.DEBUG ? BuildConfig.ALLOWED_LOCATION_LEVELS_DEBUG : BuildConfig.ALLOWED_LOCATION_LEVELS)), BuildConfig.DEBUG ? BuildConfig.DEFAULT_LOCATION_DEBUG: BuildConfig.DEFAULT_LOCATION);
LocationHelper.init(new ArrayList<>(Arrays.asList(BuildConfig.DEBUG ? BuildConfig.ALLOWED_LOCATION_LEVELS_DEBUG : BuildConfig.ALLOWED_LOCATION_LEVELS)), BuildConfig.DEBUG ? BuildConfig.DEFAULT_LOCATION_DEBUG : BuildConfig.DEFAULT_LOCATION);

// set up processor
FamilyLibrary.getInstance().setClientProcessorForJava(ChwClientProcessor.getInstance(getApplicationContext()));
Expand Down Expand Up @@ -158,6 +158,11 @@ public FamilyMetadata getMetadata() {
return metadata;
}

@Override
public ArrayList<String> getAllowedLocationLevels() {
return new ArrayList<>(Arrays.asList(BuildConfig.ALLOWED_LOCATION_LEVELS));
}

@NotNull
public Map<String, Class> getRegisteredActivities() {
Map<String, Class> registeredActivities = new HashMap<>();
Expand Down

0 comments on commit 5245bf1

Please sign in to comment.