From c4bb8a41957b28baf4cab0b02e81eaba984bed4c Mon Sep 17 00:00:00 2001 From: Hamza Ahmed Khan Date: Fri, 27 Nov 2020 11:45:27 +0500 Subject: [PATCH 1/3] - "Family" translation fix --- .../family/presenter/BaseFamilyProfilePresenter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opensrp-family/src/main/java/org/smartregister/family/presenter/BaseFamilyProfilePresenter.java b/opensrp-family/src/main/java/org/smartregister/family/presenter/BaseFamilyProfilePresenter.java index 3b2cc121..9cfbb370 100644 --- a/opensrp-family/src/main/java/org/smartregister/family/presenter/BaseFamilyProfilePresenter.java +++ b/opensrp-family/src/main/java/org/smartregister/family/presenter/BaseFamilyProfilePresenter.java @@ -8,6 +8,7 @@ import org.smartregister.commonregistry.CommonPersonObjectClient; import org.smartregister.domain.FetchStatus; import org.smartregister.family.R; +import org.smartregister.family.activity.BaseFamilyProfileActivity; import org.smartregister.family.contract.FamilyProfileContract; import org.smartregister.family.domain.FamilyEventClient; import org.smartregister.family.interactor.FamilyProfileInteractor; @@ -119,11 +120,11 @@ public void refreshProfileTopSection(CommonPersonObjectClient client) { if (Utils.getBooleanProperty(Constants.Properties.FAMILY_HEAD_FIRSTNAME_ENABLED)) { String familyHeadFirstName = Utils.getValue(client.getColumnmaps(), Constants.KEY.FAMILY_HEAD_NAME, true); - famName = getView().getApplicationContext().getString(R.string.family_profile_title_with_firstname, familyHeadFirstName, firstName); + famName = ((BaseFamilyProfileActivity) getView()).getString(R.string.family_profile_title_with_firstname, familyHeadFirstName, firstName); } else { - famName = getView().getApplicationContext().getString(R.string.family_profile_title, firstName); + famName = ((BaseFamilyProfileActivity) getView()).getString(R.string.family_profile_title, firstName); } getView().setProfileName(famName); From d7e253260501b91e5d4c890015772cd324e93b26 Mon Sep 17 00:00:00 2001 From: Hamza Ahmed Khan Date: Fri, 27 Nov 2020 11:47:59 +0500 Subject: [PATCH 2/3] - Bumped up library version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6c340c68..33f0c0a4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=1.3.1-SNAPSHOT +VERSION_NAME=1.3.2-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Family Library From 0002be557bc3296f480619de61b7b88dda177ace Mon Sep 17 00:00:00 2001 From: Hamza Ahmed Khan Date: Fri, 27 Nov 2020 12:23:56 +0500 Subject: [PATCH 3/3] - Fixed failing test --- .../presenter/BaseFamilyProfilePresenterTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/opensrp-family/src/test/java/org/smartregister/family/presenter/BaseFamilyProfilePresenterTest.java b/opensrp-family/src/test/java/org/smartregister/family/presenter/BaseFamilyProfilePresenterTest.java index 694dd396..82d3258f 100644 --- a/opensrp-family/src/test/java/org/smartregister/family/presenter/BaseFamilyProfilePresenterTest.java +++ b/opensrp-family/src/test/java/org/smartregister/family/presenter/BaseFamilyProfilePresenterTest.java @@ -17,6 +17,7 @@ import org.smartregister.domain.FetchStatus; import org.smartregister.family.BaseUnitTest; import org.smartregister.family.R; +import org.smartregister.family.activity.BaseFamilyProfileActivity; import org.smartregister.family.contract.FamilyProfileContract; import org.smartregister.family.domain.FamilyEventClient; @@ -36,6 +37,9 @@ public class BaseFamilyProfilePresenterTest extends BaseUnitTest { @Mock private FamilyProfileContract.Interactor interactor; + @Mock + private BaseFamilyProfileActivity familyProfileActivity; + private Context context = RuntimeEnvironment.application; private String familyBaseEntityId = "familyBaseEntityId"; @@ -69,13 +73,14 @@ public void testRefreshProfileView() { @Test public void testRefreshProfileTopSection() { + BaseFamilyProfilePresenter mockPresenter = Mockito.spy(presenter); CommonPersonObjectClient client = Mockito.mock(CommonPersonObjectClient.class); Mockito.doReturn("12345").when(client).getCaseId(); - Mockito.doReturn(context).when(view).getApplicationContext(); + Mockito.doReturn(familyProfileActivity).when(mockPresenter).getView(); - presenter.refreshProfileTopSection(client); + mockPresenter.refreshProfileTopSection(client); - Mockito.verify(view).setProfileImage(client.getCaseId()); + Mockito.verify(familyProfileActivity).setProfileImage(client.getCaseId()); } @Test