Skip to content

Commit

Permalink
Merge branch 'optibp_main' into optibp-master-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
SebaMutuku authored Mar 7, 2023
2 parents 689fbe9 + 0d5e5e3 commit fd8e380
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 19 deletions.
6 changes: 4 additions & 2 deletions opensrp-anc/src/main/assets/json.form/anc_physical_exam.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@
"read_only": false,
"optibp_data": {
"clientId": "",
"clientOpenSRPId": ""
"clientOpenSRPId": "",
"calibration": ""
},
"fields_to_use_value": [
"bp_systolic",
Expand Down Expand Up @@ -900,7 +901,8 @@
"read_only": false,
"optibp_data": {
"clientId": "",
"clientOpenSRPId": ""
"clientOpenSRPId": "",
"calibration": ""
},
"fields_to_use_value": [
"bp_systolic_repeat",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ private void updateDefaultValues(JSONArray stepArray, int i, JSONObject fieldObj

if (fieldObject.has(JsonFormConstants.OPTIONS_FIELD_NAME)) {
boolean addDefaults = true;

for (int m = 0; m < fieldObject.getJSONArray(JsonFormConstants.OPTIONS_FIELD_NAME).length(); m++) {
String optionValue;
if (fieldObject.getJSONArray(JsonFormConstants.OPTIONS_FIELD_NAME).getJSONObject(m)
Expand Down Expand Up @@ -661,16 +660,16 @@ private void updateDefaultValues(JSONArray stepArray, int i, JSONObject fieldObj
}
}
}

if (fieldObject.getString(JsonFormConstants.KEY).equals(ANCJsonFormConstants.KeyConstants.OPTIBP_BUTTON)
|| fieldObject.getString(JsonFormConstants.KEY).equals(ANCJsonFormConstants.KeyConstants.OPTIBP_BUTTON_SECOND)) {
if (fieldObject.has(JsonFormConstants.OptibpConstants.OPTIBP_KEY_DATA)) {
fieldObject.remove(JsonFormConstants.OptibpConstants.OPTIBP_KEY_DATA);
}
JSONObject optiBPData = FormUtils.createOptiBPDataObject(baseEntityId, womanOpenSRPId);
String optibpButtonKey = fieldObject.getString(JsonFormConstants.KEY).equals(ANCJsonFormConstants.KeyConstants.OPTIBP_BUTTON) ? ANCJsonFormConstants.KeyConstants.OPTIBP_BUTTON : ANCJsonFormConstants.KeyConstants.OPTIBP_BUTTON_SECOND;
String previousContactBpValue = getMapValue(optibpButtonKey) == null ? "" : getMapValue(optibpButtonKey);
JSONObject optiBPData = FormUtils.createOptiBPDataObject(baseEntityId, womanOpenSRPId, previousContactBpValue);
fieldObject.put(JsonFormConstants.OptibpConstants.OPTIBP_KEY_DATA, optiBPData);
}

}

private void getValueMap(JSONObject object) throws JSONException {
Expand Down Expand Up @@ -810,6 +809,7 @@ protected void onPause() {

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && data != null) {
formInvalidFields = data.getStringExtra("formInvalidFields");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected void onViewClicked(View view) {
if (view.getTag() != null && view.getTag(R.id.VIEW_ID) == CLICK_VIEW_NORMAL) {
Utils.navigateToProfile(getActivity(), (HashMap<String, String>) pc.getColumnmaps());
} else if (view.getTag() != null && view.getTag(R.id.VIEW_ID) == CLICK_VIEW_ALERT_STATUS) {
if (Integer.valueOf(view.getTag(R.id.GESTATION_AGE).toString()) >= ConstantsUtils.DELIVERY_DATE_WEEKS) {
if (Integer.parseInt(view.getTag(R.id.GESTATION_AGE).toString()) >= ConstantsUtils.DELIVERY_DATE_WEEKS) {
baseHomeRegisterActivity.showRecordBirthPopUp((CommonPersonObjectClient) view.getTag());
} else {
String baseEntityId = Utils.getValue(pc.getColumnmaps(), DBConstantsUtils.KeyUtils.BASE_ENTITY_ID, false);
Expand All @@ -180,7 +180,7 @@ public void onSyncInProgress(FetchStatus fetchStatus) {
@Override
public void showNotFoundPopup(String whoAncId) {
NoMatchDialogFragment
.launchDialog((BaseRegisterActivity) Objects.requireNonNull(getActivity()), SecuredNativeSmartRegisterFragment.DIALOG_TAG, whoAncId);
.launchDialog((BaseRegisterActivity) requireActivity(), SecuredNativeSmartRegisterFragment.DIALOG_TAG, whoAncId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public Facts getPreviousContactTestsFacts(String baseEntityId) {
if (mCursor != null) {
while (mCursor.moveToNext()) {
String jsonValue = mCursor.getString(mCursor.getColumnIndex(VALUE));
if (StringUtils.isNotBlank(jsonValue) && jsonValue.trim().charAt(0) == '{') {
if (StringUtils.isNotBlank(jsonValue) && jsonValue.trim().startsWith("{")) {
JSONObject valueObject = new JSONObject(jsonValue);
String text, translated_text;
text = valueObject.optString(JsonFormConstants.TEXT).trim();
Expand Down Expand Up @@ -335,7 +335,7 @@ public Facts getPreviousContactFacts(String baseEntityId, String contactNo, bool
if (mCursor != null && mCursor.getCount() > 0) {
while (mCursor.moveToNext()) {
String previousContactValue = mCursor.getString(mCursor.getColumnIndex(VALUE));
if (StringUtils.isNotBlank(previousContactValue) && previousContactValue.trim().charAt(0) == '{') {
if (StringUtils.isNotBlank(previousContactValue) && previousContactValue.trim().startsWith("{")) {
JSONObject previousContactObject = new JSONObject(previousContactValue);
if (previousContactObject.has(JsonFormConstants.KEY) && previousContactObject.has(JsonFormConstants.TEXT)) {
String translated_text, text;
Expand Down Expand Up @@ -424,4 +424,5 @@ public Facts getImmediatePreviousSchedule(String baseEntityId, String contactNo)

return schedule;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected void addAttentionFlagsService() {
}
}
} catch (Exception e) {
Timber.e(e, " --> ");
Timber.e(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,8 @@ public static boolean checkJsonArrayString(String input) {
return jsonArray.optJSONObject(0) != null || jsonArray.optJSONObject(0).length() > 0;
}
return false;

} catch (Exception e) {
Timber.e(e);
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ public void testInitializeFacts() {
Assert.assertTrue(facts.asMap().containsKey("global_pallor"));
Assert.assertEquals("yes", facts.asMap().get("global_pallor"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ public void getCurrentContactStateTest() {
long id = 7346;
String value = "{\"value\":\"first_contact\",\"text\":\"First contact\"}";
String contactNo = "1";
PreviousContact previousContact = new PreviousContact(baseEntityId, key, value, contactNo);
Mockito.when(ancLibrary.getPreviousContactRepository()).thenReturn(previousContactRepository);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public void setUp() {
// The fix might to add an actual OpenSRP application but again UserService testing should be in the
// opensrp-client-core library which provides this data

//This test is already covered in Login Interactor
@Ignore
@Test
@Ignore
public void testIsUserLoggedOutShouldReturnTrue() {
Expand Down
7 changes: 3 additions & 4 deletions reference-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jacoco {
// This variables are used by the version code & name generators
ext.versionMajor = 1
ext.versionMinor = 6
ext.versionPatch = 16
ext.versionPatch = 15
ext.versionClassifier = null
ext.isSnapshot = false
ext.minimumSdkVersion = androidMinSdkVersion
Expand Down Expand Up @@ -146,10 +146,10 @@ android {
minifyEnabled false
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rule.pro'
resValue "string", 'opensrp_url', '"https://who-anc.preview.smartregister.org/opensrp/"'
resValue "string", 'opensrp_url', '"https://anc.labs.smartregister.org/opensrp/"'
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 "int", "DATABASE_VERSION", '3'
buildConfigField "long", "MAX_SERVER_TIME_DIFFERENCE", "1800000l"
buildConfigField "boolean", "TIME_CHECK", "false"
Expand Down Expand Up @@ -244,7 +244,6 @@ dependencies {
exclude group: 'org.yaml', module: 'snakeyaml'
exclude group: 'io.ona.rdt-capture', module: 'lib'
}

implementation('org.smartregister:opensrp-client-core:6.0.0-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.github.bmelnychuk', module: 'atv'
Expand Down
3 changes: 2 additions & 1 deletion reference-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@

<application
android:name=".application.AncApplication"
android:allowBackup="true"
android:fullBackupContent="@xml/backup_config"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:exported="true"
android:theme="@style/AncAppTheme"
tools:replace="android:theme">

<activity
android:name=".activity.LoginActivity"
android:allowBackup="true"
android:screenOrientation="portrait"
android:theme="@style/AncAppTheme.Login"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public static synchronized AncApplication getInstance() {
@Override
public void onCreate() {
super.onCreate();

mInstance = this;
context = Context.getInstance();
context.updateApplicationContext(getApplicationContext());
Expand Down

0 comments on commit fd8e380

Please sign in to comment.