From 20882925d864ee80192b0113d4241131270bc176 Mon Sep 17 00:00:00 2001 From: gosso22 Date: Mon, 9 Dec 2019 13:16:31 +0300 Subject: [PATCH 01/10] Confirm Identification. --- gradle.properties | 2 +- .../smartregister/simprint/SimPrintsIdentifyActivity.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f46d7a2..18ba4d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=1.0.2-DEMO-6-SNAPSHOT +VERSION_NAME=1.0.2-DEMO-8-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Simprints Library diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java index 1032111..9eb9685 100644 --- a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java @@ -36,6 +36,12 @@ public static void StartSimprintsIdentifyActivity(Activity context, String modul context.startActivityForResult(intent, requestCode); } + public static void ConfirmIdentification(Activity context, String sessionid, String selectedGuid) { + SimPrintsHelper simPrintsHelper = new SimPrintsHelper(SimPrintsLibrary.getInstance().getProjectId(), + SimPrintsLibrary.getInstance().getUserId()); + simPrintsHelper.confirmIdentity(context, sessionid, selectedGuid); + } + @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -89,6 +95,7 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten Intent returnIntent = new Intent(); returnIntent.putExtra(SimPrintsConstantHelper.INTENT_DATA, simPrintsIdentifications); + returnIntent.putExtra(Constants.SIMPRINTS_SESSION_ID, data.getStringExtra(Constants.SIMPRINTS_SESSION_ID)); setResult(RESULT_OK,returnIntent); finish(); From 2b0bb4cbcef15fb8e8f64b2bb1f21a18566716a6 Mon Sep 17 00:00:00 2001 From: gosso22 Date: Fri, 14 Feb 2020 15:06:49 +0300 Subject: [PATCH 02/10] Initial integration with Riddler. --- .gitignore | 1 + gradle.properties | 2 +- .../simprint/SimPrintsHelperResearch.java | 28 +++++++++++++++++++ .../simprint/SimPrintsRegisterActivity.java | 15 +++++++--- 4 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsHelperResearch.java diff --git a/.gitignore b/.gitignore index 549d5ba..45e16da 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ project.properties .settings build/ jacoco.exec +github.properties diff --git a/gradle.properties b/gradle.properties index 18ba4d4..3c3cecc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=1.0.2-DEMO-8-SNAPSHOT +VERSION_NAME=1.0.2-DEMO-14-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Simprints Library diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsHelperResearch.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsHelperResearch.java new file mode 100644 index 0000000..fdac4b2 --- /dev/null +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsHelperResearch.java @@ -0,0 +1,28 @@ +package org.smartregister.simprint; + +import android.content.Intent; +import android.provider.SyncStateContract; + +import com.simprints.libsimprints.Constants; + +public class SimPrintsHelperResearch { + + final private String projectId; + final private String userId; + private String age; + + public SimPrintsHelperResearch(String projectId, String userId, String age) { + this.projectId = projectId; + this.userId = userId; + this.age = age; + } + + public Intent register(String moduleId) { + Intent intent = new Intent("com.simprints.afyatek.REGISTER"); + intent.putExtra("projectId", projectId); + intent.putExtra(Constants.SIMPRINTS_MODULE_ID, moduleId); + intent.putExtra("userId", userId); + intent.putExtra("age", age); + return intent; + } +} diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsRegisterActivity.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsRegisterActivity.java index 3b1bbbc..90b1657 100644 --- a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsRegisterActivity.java +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsRegisterActivity.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.SharedPreferences; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; @@ -47,11 +48,17 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { } private void startRegister(){ + SharedPreferences preferences = getApplication().getSharedPreferences("AllSharedPreferences", MODE_PRIVATE); + Boolean is_research_enabled = preferences.getBoolean("IS_SIMPRINTS_RESEARCH_ENABLED", false); try{ - SimPrintsHelper simprintsHelper = new SimPrintsHelper(SimPrintsLibrary.getInstance().getProjectId(), - SimPrintsLibrary.getInstance().getUserId()); - Intent intent = simprintsHelper.enroll(moduleId); - startActivityForResult(intent,REQUEST_CODE); +// SimPrintsHelper simprintsHelper = new SimPrintsHelper(SimPrintsLibrary.getInstance().getProjectId(), +// SimPrintsLibrary.getInstance().getUserId()); +// Intent intent = simprintsHelper.enroll(moduleId); +// startActivityForResult(intent,REQUEST_CODE); + SimPrintsHelperResearch simPrintsHelperResearch = new SimPrintsHelperResearch(SimPrintsLibrary.getInstance().getProjectId(), + SimPrintsLibrary.getInstance().getUserId(), "13"); + Intent intent = simPrintsHelperResearch.register(moduleId); + startActivityForResult(intent, REQUEST_CODE); }catch (IllegalStateException e){ Toast.makeText(this,e.getMessage(),Toast.LENGTH_LONG).show(); finish(); From 58e364548fb846812aa69e4c0c8ad7b24d24274f Mon Sep 17 00:00:00 2001 From: gosso22 Date: Mon, 17 Feb 2020 17:35:52 +0300 Subject: [PATCH 03/10] SimPrintsHelper confirmIdentity returns an Intent. --- .../main/java/org/smartregister/simprint/SimPrintsHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsHelper.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsHelper.java index 3debf7b..2de1af3 100644 --- a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsHelper.java +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsHelper.java @@ -24,8 +24,8 @@ public Intent identify(String moduleId){ return simHelper.identify(moduleId); } - public void confirmIdentity(Context context, String sessionId, String selectedGuid){ - simHelper.confirmIdentity(context, sessionId, selectedGuid); + public Intent confirmIdentity(Context context, String sessionId, String selectedGuid){ + return simHelper.confirmIdentity(context, sessionId, selectedGuid); } } From 050c496d0586701b1ffeef3a7bcc1b7cd583f3a3 Mon Sep 17 00:00:00 2001 From: gosso22 Date: Mon, 17 Feb 2020 17:40:35 +0300 Subject: [PATCH 04/10] KS | Fix; SimPrints Confirmatio call with Biometric Complete check. --- ...mprintsIdentificationRegisterActivity.java | 81 +++++++++++++++++++ ...mprintsIdentificationRegisterFragment.java | 64 ++++----------- 2 files changed, 96 insertions(+), 49 deletions(-) diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/activity/SimprintsIdentificationRegisterActivity.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/activity/SimprintsIdentificationRegisterActivity.java index 7a77cc3..f56936c 100644 --- a/opensrp-simprints/src/main/java/org/smartregister/simprint/activity/SimprintsIdentificationRegisterActivity.java +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/activity/SimprintsIdentificationRegisterActivity.java @@ -1,8 +1,13 @@ package org.smartregister.simprint.activity; +import android.content.Context; import android.content.Intent; +import android.os.AsyncTask; import android.os.Bundle; import com.google.android.material.bottomnavigation.BottomNavigationView; +import com.simprints.libsimprints.Constants; +import com.simprints.libsimprints.SimHelper; + import androidx.fragment.app.Fragment; import android.util.Pair; @@ -10,7 +15,10 @@ import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; +import org.smartregister.commonregistry.CommonPersonObject; +import org.smartregister.family.util.Utils; import org.smartregister.simprint.R; +import org.smartregister.simprint.SimPrintsLibrary; import org.smartregister.simprint.contract.SimprintsIdentificationRegisterContract; import org.smartregister.simprint.fragment.EmptyResultFragment; import org.smartregister.simprint.fragment.SimprintsIdentificationRegisterFragment; @@ -35,6 +43,8 @@ public class SimprintsIdentificationRegisterActivity extends BaseRegisterActivit public String sessionId = ""; private ArrayList resultsList = new ArrayList<>(); + public static final int REQUEST_CODE = 3322; + private CommonPersonObject selectedClient; public SimprintsIdentificationRegisterActivity(){ @@ -112,4 +122,75 @@ public List getViewIdentifiers() { public void startRegistration() { } + + @Override + protected void onDestroy() { + super.onDestroy(); + } + + public void startSimPrintsConfirmation(String sessionId, String selectedGuid, CommonPersonObject selectedClient) { + this.selectedClient = selectedClient; + Utils.startAsyncTask(new ConfirmIdentificationTask(this, sessionId, selectedGuid), null); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (data != null && requestCode == REQUEST_CODE) { + Boolean check = data.getBooleanExtra(Constants.SIMPRINTS_BIOMETRICS_COMPLETE_CHECK, false); + if (check) { + goTotheFamilyProfileOfSelected(); + } + } + } + + private void goTotheFamilyProfileOfSelected() { + + if (selectedClient != null) { + Intent intent = new Intent(this, org.smartregister.family.util.Utils.metadata().profileActivity); + intent.putExtra("family_base_entity_id", selectedClient.getCaseId()); + intent.putExtra("family_head", + org.smartregister.family.util.Utils.getValue(selectedClient.getColumnmaps(), "family_head", false)); + intent.putExtra("primary_caregiver", + org.smartregister.family.util.Utils.getValue(selectedClient.getColumnmaps(), "primary_caregiver", false)); + intent.putExtra("village_town", + org.smartregister.family.util.Utils.getValue(selectedClient.getColumnmaps(), "village_town", false)); + intent.putExtra("family_name", + org.smartregister.family.util.Utils.getValue(selectedClient.getColumnmaps(), "first_name", false)); + intent.putExtra("go_to_due_page", false); + startActivity(intent); + finish(); + } else { + finish(); + } + + } + + + + //////////////////////////////////////////////////////////////////// + // Inner Class | SimPrints Identification Confirmation + /////////////////////////////////////////////////////////////////// + + private class ConfirmIdentificationTask extends AsyncTask { + + private String sessiodId; + private String selectedGuid; + private Context context; + + private ConfirmIdentificationTask(Context context, String sessiodId, String selectedGuid) { + this.sessiodId = sessiodId; + this.selectedGuid = selectedGuid; + this.context = context; + } + + @Override + protected Void doInBackground(Void... voids) { + SimHelper simPrintsHelper = new SimHelper(SimPrintsLibrary.getInstance().getProjectId(), + SimPrintsLibrary.getInstance().getUserId()); + Intent intent = simPrintsHelper.confirmIdentity(context, sessiodId, selectedGuid); + startActivityForResult(intent, REQUEST_CODE); + return null; + } + } + } diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/fragment/SimprintsIdentificationRegisterFragment.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/fragment/SimprintsIdentificationRegisterFragment.java index dd4d3fb..a1516e0 100644 --- a/opensrp-simprints/src/main/java/org/smartregister/simprint/fragment/SimprintsIdentificationRegisterFragment.java +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/fragment/SimprintsIdentificationRegisterFragment.java @@ -10,12 +10,15 @@ import android.view.View; import android.widget.LinearLayout; +import com.simprints.libsimprints.SimHelper; + import org.smartregister.commonregistry.CommonPersonObject; import org.smartregister.commonregistry.CommonPersonObjectClient; import org.smartregister.cursoradapter.RecyclerViewPaginatedAdapter; import org.smartregister.simprint.R; import org.smartregister.simprint.SimPrintsHelper; import org.smartregister.simprint.SimPrintsLibrary; +import org.smartregister.simprint.activity.SimprintsIdentificationRegisterActivity; import org.smartregister.simprint.contract.SimprintsIdentificationRegisterFragmentContract; import org.smartregister.simprint.model.SimprintsIdentificationRegisterFragmentModel; import org.smartregister.simprint.presenter.SimprintIdentificationRegisterFragmentPresenter; @@ -23,10 +26,12 @@ import org.smartregister.view.customcontrols.CustomFontTextView; import org.smartregister.view.fragment.BaseRegisterFragment; +import java.net.PasswordAuthentication; import java.util.ArrayList; import java.util.HashMap; import java.util.Set; +import static org.smartregister.simprint.activity.SimprintsIdentificationRegisterActivity.REQUEST_CODE; import static org.smartregister.simprint.util.Utils.convertDpToPixel; public class SimprintsIdentificationRegisterFragment extends @@ -34,6 +39,7 @@ public class SimprintsIdentificationRegisterFragment extends private static String sessionID = ""; private static ArrayList> simprintsIdBaseEntityIdPair = new ArrayList<>(); + private CommonPersonObject patient; private static ArrayList clientIds = new ArrayList<>(); @@ -143,13 +149,13 @@ protected void onViewClicked(View view) { if (view.getId() == R.id.patient_column){ if (view.getTag() != null && view.getTag(R.id.VIEW_ID) == "click_view_normal") { - goToFamilyProfileActivity(view); + confirmSelectedClient(view); } } if (view.getId() == R.id.next_arrow){ if (view.getTag() != null && view.getTag(R.id.VIEW_ID) == "click_next_arrow") { - goToFamilyProfileActivity(view); + confirmSelectedClient(view); } } @@ -162,13 +168,12 @@ protected void onViewClicked(View view) { private void handleNoneSelected(android.view.View view) { String sessionid = sessionID; // A call back to SimPrint to notify that none of the item on the list was selected - org.smartregister.family.util.Utils.startAsyncTask(new ConfirmIdentificationTask(sessionid, "none_selected"), null); - - this.getActivity().finish(); + SimprintsIdentificationRegisterActivity activity = (SimprintsIdentificationRegisterActivity) this.getActivity(); + activity.startSimPrintsConfirmation(sessionid, "none_selected", null); } - private void goToFamilyProfileActivity(android.view.View view) { + private void confirmSelectedClient(android.view.View view) { if (view.getTag() instanceof CommonPersonObjectClient) { CommonPersonObjectClient pc = (CommonPersonObjectClient) view.getTag(); @@ -176,25 +181,12 @@ private void goToFamilyProfileActivity(android.view.View view) { String baseEntityId = pc.entityId(); String simPrintsGuid = getSimPrintGuid(baseEntityId); String sessionid = sessionID; - org.smartregister.family.util.Utils.startAsyncTask(new ConfirmIdentificationTask(sessionid, simPrintsGuid), null); - - // Get values to start the family profile + SimprintsIdentificationRegisterActivity activity = (SimprintsIdentificationRegisterActivity) this.getActivity(); String relational_id = org.smartregister.family.util.Utils.getValue(pc.getColumnmaps(), "relationalid", false); - CommonPersonObject patient = org.smartregister.family.util.Utils.context().commonrepository(org.smartregister.family.util.Utils.metadata().familyRegister.tableName) + patient = org.smartregister.family.util.Utils.context().commonrepository(org.smartregister.family.util.Utils.metadata().familyRegister.tableName) .findByCaseID(relational_id); - Intent intent = new Intent(this.getActivity(), org.smartregister.family.util.Utils.metadata().profileActivity); - intent.putExtra("family_base_entity_id", patient.getCaseId()); - intent.putExtra("family_head", - org.smartregister.family.util.Utils.getValue(patient.getColumnmaps(), "family_head", false)); - intent.putExtra("primary_caregiver", - org.smartregister.family.util.Utils.getValue(patient.getColumnmaps(), "primary_caregiver", false)); - intent.putExtra("village_town", - org.smartregister.family.util.Utils.getValue(patient.getColumnmaps(), "village_town", false)); - intent.putExtra("family_name", - org.smartregister.family.util.Utils.getValue(patient.getColumnmaps(), "first_name", false)); - intent.putExtra("go_to_due_page", false); - this.startActivity(intent); - this.getActivity().finish(); + activity.startSimPrintsConfirmation(sessionid, simPrintsGuid, patient); + } } @@ -214,30 +206,4 @@ private String getSimPrintGuid(String baseEntityId) { } - //////////////////////////////////////////////////////////////////// - // Inner Class | SimPrints Identification Confirmation - /////////////////////////////////////////////////////////////////// - - private class ConfirmIdentificationTask extends AsyncTask { - - private String sessiodId; - private String selectedGuid; - - private ConfirmIdentificationTask(String sessiodId, String selectedGuid) { - this.sessiodId = sessiodId; - this.selectedGuid = selectedGuid; - } - - @Override - protected Void doInBackground(Void... voids) { - confirmSelectedGuid(sessiodId, selectedGuid); - return null; - } - } - - private void confirmSelectedGuid(String sessionid, String simPrintsGuid) { - SimPrintsHelper simPrintsHelper = new SimPrintsHelper(SimPrintsLibrary.getInstance().getProjectId(), SimPrintsLibrary.getInstance().getUserId()); - simPrintsHelper.confirmIdentity(this.getActivity(), sessionid, simPrintsGuid); - } - } From 643993993a4d032f9e6aab99336954d79f14e940 Mon Sep 17 00:00:00 2001 From: gosso22 Date: Tue, 18 Feb 2020 16:11:51 +0300 Subject: [PATCH 05/10] Fix; Remove SimPrints Confirmation callout from Async task. --- .../activity/SimprintsIdentificationRegisterActivity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/activity/SimprintsIdentificationRegisterActivity.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/activity/SimprintsIdentificationRegisterActivity.java index f56936c..a533da9 100644 --- a/opensrp-simprints/src/main/java/org/smartregister/simprint/activity/SimprintsIdentificationRegisterActivity.java +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/activity/SimprintsIdentificationRegisterActivity.java @@ -130,7 +130,10 @@ protected void onDestroy() { public void startSimPrintsConfirmation(String sessionId, String selectedGuid, CommonPersonObject selectedClient) { this.selectedClient = selectedClient; - Utils.startAsyncTask(new ConfirmIdentificationTask(this, sessionId, selectedGuid), null); + SimHelper simPrintsHelper = new SimHelper(SimPrintsLibrary.getInstance().getProjectId(), + SimPrintsLibrary.getInstance().getUserId()); + Intent intent = simPrintsHelper.confirmIdentity(this, sessionId, selectedGuid); + startActivityForResult(intent, REQUEST_CODE); } @Override From 4be51197eded8c714c7a71b070b2ca4b58348c75 Mon Sep 17 00:00:00 2001 From: gosso22 Date: Wed, 19 Feb 2020 17:26:19 +0300 Subject: [PATCH 06/10] Fix; SimPrints Identification refusal. --- opensrp-simprints/build.gradle | 2 +- .../simprint/SimPrintsIdentifyActivity.java | 35 ++++++++++--------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/opensrp-simprints/build.gradle b/opensrp-simprints/build.gradle index 76a004a..e916b0b 100644 --- a/opensrp-simprints/build.gradle +++ b/opensrp-simprints/build.gradle @@ -79,7 +79,7 @@ def githubProperties = new Properties() githubProperties.load(new FileInputStream(rootProject.file("github.properties"))) def getVersionName = { -> - return "1.1.40-SNAPSHOT" // Library version + return "1.1.42-SNAPSHOT" // Library version } def getArtificatId = { -> diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java index eb1dd99..7e0617a 100644 --- a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java @@ -70,27 +70,30 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten if (data != null && resultCode == RESULT_OK && requestCode == REQUEST_CODE){ Boolean check = data.getBooleanExtra(Constants.SIMPRINTS_BIOMETRICS_COMPLETE_CHECK, false); - ArrayList identifications = data - .getParcelableArrayListExtra(Constants.SIMPRINTS_IDENTIFICATIONS); + if (check) { - ArrayList resultsGuids = new ArrayList<>(); - String sessionId = ""; - sessionId = data.getStringExtra("sessionId"); + ArrayList identifications = data + .getParcelableArrayListExtra(Constants.SIMPRINTS_IDENTIFICATIONS); - if (check && identifications != null && identifications.size() > 0){ - ArrayList topResults = getTopResults(identifications); - for (Identification identification : topResults){ - resultsGuids.add(identification.getGuid()); + ArrayList resultsGuids = new ArrayList<>(); + String sessionId = ""; + sessionId = data.getStringExtra("sessionId"); + + if (check && identifications != null && identifications.size() > 0){ + ArrayList topResults = getTopResults(identifications); + for (Identification identification : topResults){ + resultsGuids.add(identification.getGuid()); + } } - } - Intent intent = new Intent(this, SimprintsIdentificationRegisterActivity.class); - intent.putExtra(SimprintsIdentificationRegisterActivity.CURRENT_SESSION_EXTRA, sessionId); - intent.putExtra(SimprintsIdentificationRegisterActivity.RESULTS_LIST_EXTRA, resultsGuids); - startActivity(intent); - finish(); + Intent intent = new Intent(this, SimprintsIdentificationRegisterActivity.class); + intent.putExtra(SimprintsIdentificationRegisterActivity.CURRENT_SESSION_EXTRA, sessionId); + intent.putExtra(SimprintsIdentificationRegisterActivity.RESULTS_LIST_EXTRA, resultsGuids); + startActivity(intent); + finish(); + } else { finish(); } - }else { + } else { showFingerPrintFail(this, new OnDialogButtonClick() { @Override public void onOkButtonClick() { From 190f5e3237b0c4be4c4767c6bcc01546aaaeed1e Mon Sep 17 00:00:00 2001 From: gosso22 Date: Thu, 20 Feb 2020 14:42:12 +0300 Subject: [PATCH 07/10] Update library version. --- opensrp-simprints/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensrp-simprints/build.gradle b/opensrp-simprints/build.gradle index e916b0b..f69cd5d 100644 --- a/opensrp-simprints/build.gradle +++ b/opensrp-simprints/build.gradle @@ -79,7 +79,7 @@ def githubProperties = new Properties() githubProperties.load(new FileInputStream(rootProject.file("github.properties"))) def getVersionName = { -> - return "1.1.42-SNAPSHOT" // Library version + return "1.1.43-SNAPSHOT" // Library version } def getArtificatId = { -> From 45373cad2e682712c1bd053cba023d9bd857e109 Mon Sep 17 00:00:00 2001 From: gosso22 Date: Thu, 20 Feb 2020 14:43:51 +0300 Subject: [PATCH 08/10] Fix, Identification results when user has refused to get their finger prints scan for SimPrints Verification and Identification. --- .../org/smartregister/simprint/SimPrintsIdentifyActivity.java | 3 ++- .../org/smartregister/simprint/SimPrintsVerifyActivity.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java index 7e0617a..81c3e5b 100644 --- a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import static com.simprints.libsimprints.Constants.SIMPRINTS_PACKAGE_NAME; +import static com.simprints.libsimprints.Constants.SIMPRINTS_REFUSAL_FORM; /** * Author : Isaya Mollel on 2019-10-30. @@ -70,7 +71,7 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten if (data != null && resultCode == RESULT_OK && requestCode == REQUEST_CODE){ Boolean check = data.getBooleanExtra(Constants.SIMPRINTS_BIOMETRICS_COMPLETE_CHECK, false); - if (check) { + if (check && (data.getParcelableExtra(SIMPRINTS_REFUSAL_FORM) == null)) { ArrayList identifications = data .getParcelableArrayListExtra(Constants.SIMPRINTS_IDENTIFICATIONS); diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsVerifyActivity.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsVerifyActivity.java index 051bc61..1755de4 100644 --- a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsVerifyActivity.java +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsVerifyActivity.java @@ -12,6 +12,7 @@ import com.simprints.libsimprints.Verification; import static com.simprints.libsimprints.Constants.SIMPRINTS_PACKAGE_NAME; +import static com.simprints.libsimprints.Constants.SIMPRINTS_REFUSAL_FORM; public class SimPrintsVerifyActivity extends AppCompatActivity { @@ -57,7 +58,7 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten super.onActivityResult(requestCode, resultCode, data); if( data!=null && resultCode == RESULT_OK && requestCode == REQUEST_CODE){ Boolean check = data.getBooleanExtra(Constants.SIMPRINTS_BIOMETRICS_COMPLETE_CHECK,false); - if(check){ + if(check && (data.getParcelableExtra(SIMPRINTS_REFUSAL_FORM) == null)){ SimPrintsVerification simprintsVerification; Verification verification = data.getParcelableExtra(Constants.SIMPRINTS_VERIFICATION); if(verification == null || TextUtils.isEmpty(verification.getGuid())){ From ad1ed40346249b67b618322ea8a90103816d9fee Mon Sep 17 00:00:00 2001 From: gosso22 Date: Tue, 3 Mar 2020 20:53:57 +0300 Subject: [PATCH 09/10] Fix, include a message biometric denied when the user refused to scan their fingerprints. --- opensrp-simprints/build.gradle | 4 +- .../simprint/SimPrintsIdentifyActivity.java | 39 ++++++++++++------- .../simprint/SimPrintsVerifyActivity.java | 39 ++++++++++--------- .../src/main/res/values/strings.xml | 1 + 4 files changed, 48 insertions(+), 35 deletions(-) diff --git a/opensrp-simprints/build.gradle b/opensrp-simprints/build.gradle index f69cd5d..fa06a94 100644 --- a/opensrp-simprints/build.gradle +++ b/opensrp-simprints/build.gradle @@ -79,7 +79,7 @@ def githubProperties = new Properties() githubProperties.load(new FileInputStream(rootProject.file("github.properties"))) def getVersionName = { -> - return "1.1.43-SNAPSHOT" // Library version + return "1.1.44-STANDARD-SNAPSHOT" // Library version } def getArtificatId = { -> @@ -166,7 +166,7 @@ dependencies { transitive = true } - implementation('org.smartregister:opensrp-client-family:1.2.26-SNAPSHOT') { + implementation('org.smartregister:opensrp-client-family:1.2.26-SNAPSHOT@aar') { transitive = true exclude group: 'org.smartregister', module: 'opensrp-client-core' exclude group: 'com.android.support', module: 'appcompat-v7' diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java index 81c3e5b..1fadfe3 100644 --- a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsIdentifyActivity.java @@ -71,27 +71,36 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten if (data != null && resultCode == RESULT_OK && requestCode == REQUEST_CODE){ Boolean check = data.getBooleanExtra(Constants.SIMPRINTS_BIOMETRICS_COMPLETE_CHECK, false); - if (check && (data.getParcelableExtra(SIMPRINTS_REFUSAL_FORM) == null)) { - ArrayList identifications = data - .getParcelableArrayListExtra(Constants.SIMPRINTS_IDENTIFICATIONS); + if (check) { - ArrayList resultsGuids = new ArrayList<>(); - String sessionId = ""; - sessionId = data.getStringExtra("sessionId"); + if (data.getParcelableExtra(SIMPRINTS_REFUSAL_FORM) == null) { - if (check && identifications != null && identifications.size() > 0){ - ArrayList topResults = getTopResults(identifications); - for (Identification identification : topResults){ - resultsGuids.add(identification.getGuid()); + ArrayList identifications = data + .getParcelableArrayListExtra(Constants.SIMPRINTS_IDENTIFICATIONS); + + ArrayList resultsGuids = new ArrayList<>(); + String sessionId = ""; + sessionId = data.getStringExtra("sessionId"); + + if (check && identifications != null && identifications.size() > 0){ + ArrayList topResults = getTopResults(identifications); + for (Identification identification : topResults){ + resultsGuids.add(identification.getGuid()); + } } + + Intent intent = new Intent(this, SimprintsIdentificationRegisterActivity.class); + intent.putExtra(SimprintsIdentificationRegisterActivity.CURRENT_SESSION_EXTRA, sessionId); + intent.putExtra(SimprintsIdentificationRegisterActivity.RESULTS_LIST_EXTRA, resultsGuids); + startActivity(intent); + finish(); + + } else { + Toast.makeText(this, R.string.biometric_declined_message, Toast.LENGTH_SHORT).show(); + finish(); } - Intent intent = new Intent(this, SimprintsIdentificationRegisterActivity.class); - intent.putExtra(SimprintsIdentificationRegisterActivity.CURRENT_SESSION_EXTRA, sessionId); - intent.putExtra(SimprintsIdentificationRegisterActivity.RESULTS_LIST_EXTRA, resultsGuids); - startActivity(intent); - finish(); } else { finish(); } } else { diff --git a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsVerifyActivity.java b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsVerifyActivity.java index 1755de4..8bffce1 100644 --- a/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsVerifyActivity.java +++ b/opensrp-simprints/src/main/java/org/smartregister/simprint/SimPrintsVerifyActivity.java @@ -58,30 +58,33 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten super.onActivityResult(requestCode, resultCode, data); if( data!=null && resultCode == RESULT_OK && requestCode == REQUEST_CODE){ Boolean check = data.getBooleanExtra(Constants.SIMPRINTS_BIOMETRICS_COMPLETE_CHECK,false); - if(check && (data.getParcelableExtra(SIMPRINTS_REFUSAL_FORM) == null)){ - SimPrintsVerification simprintsVerification; - Verification verification = data.getParcelableExtra(Constants.SIMPRINTS_VERIFICATION); - if(verification == null || TextUtils.isEmpty(verification.getGuid())){ - simprintsVerification = new SimPrintsVerification(null); - simprintsVerification.setCheckStatus(false); - simprintsVerification.setTier(null); - }else{ - simprintsVerification = new SimPrintsVerification(verification.getGuid()); - simprintsVerification.setCheckStatus(true); - simprintsVerification.setTier(verification.getTier()); + if(check){ + if (data.getParcelableExtra(SIMPRINTS_REFUSAL_FORM) == null) { + SimPrintsVerification simprintsVerification; + Verification verification = data.getParcelableExtra(Constants.SIMPRINTS_VERIFICATION); + if(verification == null || TextUtils.isEmpty(verification.getGuid())){ + simprintsVerification = new SimPrintsVerification(null); + simprintsVerification.setCheckStatus(false); + simprintsVerification.setTier(null); + }else{ + simprintsVerification = new SimPrintsVerification(verification.getGuid()); + simprintsVerification.setCheckStatus(true); + simprintsVerification.setTier(verification.getTier()); + } + Intent returnIntent = new Intent(); + returnIntent.putExtra(SimPrintsConstantHelper.INTENT_DATA,simprintsVerification); + setResult(RESULT_OK,returnIntent); + finish(); + } else { + Toast.makeText(this, R.string.biometric_declined_message, Toast.LENGTH_SHORT).show(); + finish(); } - Intent returnIntent = new Intent(); - returnIntent.putExtra(SimPrintsConstantHelper.INTENT_DATA,simprintsVerification); - setResult(RESULT_OK,returnIntent); - finish(); - }else{ + } else{ Intent returnIntent = new Intent(); setResult(RESULT_CANCELED,returnIntent); finish(); } - - } } } diff --git a/opensrp-simprints/src/main/res/values/strings.xml b/opensrp-simprints/src/main/res/values/strings.xml index 7d7914a..522d3b3 100644 --- a/opensrp-simprints/src/main/res/values/strings.xml +++ b/opensrp-simprints/src/main/res/values/strings.xml @@ -8,5 +8,6 @@ Fingerprint Identification None of above + Biometric Declined From efa561ae3d9b8dd422d36c0c96323496bcb7abd0 Mon Sep 17 00:00:00 2001 From: gosso22 Date: Tue, 3 Mar 2020 20:57:02 +0300 Subject: [PATCH 10/10] Updated library version. --- opensrp-simprints/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensrp-simprints/build.gradle b/opensrp-simprints/build.gradle index fa06a94..8837ee5 100644 --- a/opensrp-simprints/build.gradle +++ b/opensrp-simprints/build.gradle @@ -79,7 +79,7 @@ def githubProperties = new Properties() githubProperties.load(new FileInputStream(rootProject.file("github.properties"))) def getVersionName = { -> - return "1.1.44-STANDARD-SNAPSHOT" // Library version + return "1.1.45-STANDARD-SNAPSHOT" // Library version } def getArtificatId = { ->