Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmud6390 committed Dec 18, 2020
1 parent cc7519a commit 15e1928
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 62 deletions.
6 changes: 3 additions & 3 deletions opensrp-brac-hnpp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ android {
buildConfigField "String", 'opensrp_url_live', '"http://mhealthtest.brac.net:8080/opensrp/"'
}
normal{
versionCode 28
versionName "1.3.2"
versionCode 29
versionName "1.3.3"
dimension = 'baseDimension'
buildConfigField "boolean", 'IS_TRAINING', 'false'
// buildConfigField "String", 'opensrp_url_training', '"http://mhealth.brac.net:8080/opensrp/"'
Expand All @@ -140,7 +140,7 @@ dependencies {
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
api('org.smartregister:opensrp-client-simprints:2.0.9-SNAPSHOT@aar') {
api('org.smartregister:opensrp-client-simprints:2.1.0-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'org.smartregister', module: 'opensrp-client-native-form'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
import org.smartregister.brac.hnpp.location.SSModel;
import org.smartregister.brac.hnpp.model.ReferralFollowUpModel;
import org.smartregister.brac.hnpp.repository.HnppVisitLogRepository;
import org.smartregister.brac.hnpp.task.ConfirmIdentificationTask;
import org.smartregister.brac.hnpp.utils.ANCRegister;
import org.smartregister.brac.hnpp.utils.FormApplicability;
import org.smartregister.brac.hnpp.utils.HnppDBUtils;
import org.smartregister.brac.hnpp.utils.HnppConstants;
Expand Down Expand Up @@ -94,8 +92,8 @@ public class HnppFamilyOtherMemberProfileActivity extends CoreFamilyOtherMemberP
public static final int REQUEST_HOME_VISIT = 5555;
public static final int REQUEST_SIMPRINTS_VERIFY = 1222;
public static final String IS_COMES_IDENTITY = "is_comes";
public static final String SESSION_ID = "session_id";
public static final String SELECTED_GU_ID = "selected_gu_id";
// public static final String SESSION_ID = "session_id";
//public static final String SELECTED_GU_ID = "selected_gu_id";
private static final int REQUEST_CODE_PREGNANCY_OUTCOME = 5556;

private CustomFontTextView textViewDetails3;
Expand Down Expand Up @@ -145,9 +143,9 @@ private void updateFingerPrintIcon(){
if(isComesFromIdentity){
isVerified = true;
verificationNeeded = true;
String sessionId = getIntent().getStringExtra(SESSION_ID);
String selectedGuId = getIntent().getStringExtra(SELECTED_GU_ID);
sendSessionIdToSimprints(sessionId,selectedGuId);
// String sessionId = getIntent().getStringExtra(SESSION_ID);
// String selectedGuId = getIntent().getStringExtra(SELECTED_GU_ID);
// sendSessionIdToSimprints(sessionId,selectedGuId);
}
moduleId = HnppDBUtils.getModuleId(familyHead);
guId = HnppDBUtils.getGuid(baseEntityId);
Expand Down Expand Up @@ -874,10 +872,10 @@ public void updateAncRegisterVisible(String eventType){
menu.findItem(R.id.action_anc_registration).setVisible(false);
}
}
private void sendSessionIdToSimprints(String sessionId, String guId){
Utils.startAsyncTask(new ConfirmIdentificationTask(sessionId,guId),null);

}
// private void sendSessionIdToSimprints(String sessionId, String guId){
// Utils.startAsyncTask(new ConfirmIdentificationTask(sessionId,guId),null);
//
// }


}
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
import com.simprints.libsimprints.Tier;

import org.smartregister.CoreLibrary;
import org.smartregister.brac.hnpp.HnppApplication;
import org.smartregister.brac.hnpp.R;
import org.smartregister.brac.hnpp.adapter.IdentityAdapter;
import org.smartregister.brac.hnpp.fragment.HnppDashBoardFragment;
import org.smartregister.brac.hnpp.location.SSLocationHelper;
import org.smartregister.brac.hnpp.location.SSLocations;
import org.smartregister.brac.hnpp.location.SSModel;
import org.smartregister.brac.hnpp.task.ConfirmIdentificationTask;
import org.smartregister.brac.hnpp.utils.HnppConstants;
import org.smartregister.brac.hnpp.utils.HnppDBUtils;
import org.smartregister.brac.hnpp.utils.IdentityModel;
Expand All @@ -55,6 +55,7 @@
import org.smartregister.family.util.DBConstants;
import org.smartregister.family.util.Utils;
import org.smartregister.simprint.SimPrintsConstantHelper;
import org.smartregister.simprint.SimPrintsHelper;
import org.smartregister.simprint.SimPrintsIdentification;
import org.smartregister.simprint.SimPrintsIdentifyActivity;
import org.smartregister.simprint.SimPrintsRegistration;
Expand All @@ -71,6 +72,7 @@
public class SimprintsIdentityActivity extends SecuredActivity implements View.OnClickListener {

private static final int REQUEST_CODE_IDENTIFY = 1445;
private static final int REQUEST_CODE = 213;
private LinearLayout selectionBar,notFoundPanel;
private String moduleId = "";
private RecyclerView recyclerView;
Expand Down Expand Up @@ -123,8 +125,7 @@ public void onClick(View v) {
case R.id.not_found_btn:
showNotFoundDialog();
if(!sessionId.isEmpty()){
org.smartregister.chw.core.utils.Utils.startAsyncTask(new ConfirmIdentificationTask(sessionId,""),null);

startSimPrintsConfirmation(sessionId,"","");
}
break;
}
Expand Down Expand Up @@ -240,7 +241,25 @@ public void onClick(View v) {
dialog.show();

}
private void openProfile(String baseEntityId, String selectedGuId){
String baseEntityId;
public void startSimPrintsConfirmation(String sessiodId, String simPrintsGuid,String baseEntityId) {
this.baseEntityId = baseEntityId;

//Log.v("SIMPRINTS_IDENTITY","projectId:"+HnppConstants.getSimPrintsProjectId()+":userId:"+CoreLibrary.getInstance().context().allSharedPreferences().fetchRegisteredANM());
SimPrintsHelper simPrintsHelper = new SimPrintsHelper(HnppConstants.getSimPrintsProjectId(), CoreLibrary.getInstance().context().allSharedPreferences().fetchRegisteredANM());
Intent intent;
if (TextUtils.isEmpty(simPrintsGuid)) {
//Log.v("SIMPRINTS_IDENTITY","confirmSelectedGuid non selected>>"+sessiodId);
intent = simPrintsHelper.confirmIdentity(HnppApplication.getHNPPInstance().getApplicationContext(), sessiodId, "none_selected");

} else {
//Log.v("SIMPRINTS_IDENTITY","sessionId:"+sessiodId+":guId"+simPrintsGuid+":appcontext:"+HnppApplication.getHNPPInstance().getApplicationContext());
intent = simPrintsHelper.confirmIdentity(HnppApplication.getHNPPInstance().getApplicationContext(), sessiodId, simPrintsGuid);
}
startActivityForResult(intent, REQUEST_CODE);
}

private void openProfile(String baseEntityId){

CommonPersonObjectClient patient = HnppDBUtils.createFromBaseEntity(baseEntityId);
String familyId = org.smartregister.util.Utils.getValue(patient.getColumnmaps(), ChildDBConstants.KEY.RELATIONAL_ID, false);
Expand All @@ -260,8 +279,8 @@ private void openProfile(String baseEntityId, String selectedGuId){
intent.putExtra(HnppConstants.KEY.HOUSE_HOLD_ID,moduleId);
intent.putExtra(org.smartregister.family.util.Constants.INTENT_KEY.FAMILY_NAME, houseHoldHead);
intent.putExtra(HnppFamilyOtherMemberProfileActivity.IS_COMES_IDENTITY,true);
intent.putExtra(HnppFamilyOtherMemberProfileActivity.SESSION_ID,sessionId);
intent.putExtra(HnppFamilyOtherMemberProfileActivity.SELECTED_GU_ID,selectedGuId);
// intent.putExtra(HnppFamilyOtherMemberProfileActivity.SESSION_ID,sessionId);
// intent.putExtra(HnppFamilyOtherMemberProfileActivity.SELECTED_GU_ID,selectedGuId);
startActivity(intent);
finish();

Expand Down Expand Up @@ -383,6 +402,15 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten
if(resultCode == RESULT_OK && data !=null){

switch (requestCode){
case REQUEST_CODE: {
Boolean check = data.getBooleanExtra(Constants.SIMPRINTS_BIOMETRICS_COMPLETE_CHECK, false);
//Log.v("SIMPRINTS_IDENTITY","onActivityREsult>check"+check);
if (check && !TextUtils.isEmpty(baseEntityId)) {
openProfile(baseEntityId);
}
}

break;
case REQUEST_CODE_IDENTIFY:
Boolean check = data.getBooleanExtra(Constants.SIMPRINTS_BIOMETRICS_COMPLETE_CHECK,true);
if(check){
Expand Down Expand Up @@ -458,7 +486,8 @@ private void updateAdapter() {
@Override
public void onClick(int position, IdentityModel content) {
if(!content.getBaseEntityId().isEmpty()){
openProfile(content.getBaseEntityId(),content.getOriginalGuId());
startSimPrintsConfirmation(sessionId,content.getOriginalGuId(),content.getBaseEntityId());

}else {
Toast.makeText(SimprintsIdentityActivity.this,getString(R.string.not_match),Toast.LENGTH_SHORT).show();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
package org.smartregister.brac.hnpp.task;

import android.os.AsyncTask;
import android.text.TextUtils;
import android.util.Log;

import org.smartregister.CoreLibrary;
import org.smartregister.brac.hnpp.HnppApplication;
import org.smartregister.brac.hnpp.utils.HnppConstants;
import org.smartregister.simprint.SimPrintsHelper;

public class ConfirmIdentificationTask extends AsyncTask<Void, Void, Void> {

private String sessiodId;
private String selectedGuid;

public 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) {
Log.v("SIMPRINTS_IDENTITY","projectId:"+HnppConstants.getSimPrintsProjectId()+":userId:"+CoreLibrary.getInstance().context().allSharedPreferences().fetchRegisteredANM());
SimPrintsHelper simPrintsHelper = new SimPrintsHelper(HnppConstants.getSimPrintsProjectId(), CoreLibrary.getInstance().context().allSharedPreferences().fetchRegisteredANM());
if (TextUtils.isEmpty(simPrintsGuid)) {
Log.v("SIMPRINTS_IDENTITY","confirmSelectedGuid>>"+sessiodId);
simPrintsHelper.confirmIdentity(HnppApplication.getHNPPInstance().getApplicationContext(), sessionid, "none_selected");

} else {
Log.v("SIMPRINTS_IDENTITY","sessionId:"+sessiodId+":guId"+simPrintsGuid+":appcontext:"+HnppApplication.getHNPPInstance().getApplicationContext());
simPrintsHelper.confirmIdentity(HnppApplication.getHNPPInstance().getApplicationContext(), sessionid, simPrintsGuid);
}
}
}
//package org.smartregister.brac.hnpp.task;
//
//import android.os.AsyncTask;
//import android.text.TextUtils;
//import android.util.Log;
//
//import org.smartregister.CoreLibrary;
//import org.smartregister.brac.hnpp.HnppApplication;
//import org.smartregister.brac.hnpp.utils.HnppConstants;
//import org.smartregister.simprint.SimPrintsHelper;
//
//public class ConfirmIdentificationTask extends AsyncTask<Void, Void, Void> {
//
// private String sessiodId;
// private String selectedGuid;
//
// public 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) {
// Log.v("SIMPRINTS_IDENTITY","projectId:"+HnppConstants.getSimPrintsProjectId()+":userId:"+CoreLibrary.getInstance().context().allSharedPreferences().fetchRegisteredANM());
// SimPrintsHelper simPrintsHelper = new SimPrintsHelper(HnppConstants.getSimPrintsProjectId(), CoreLibrary.getInstance().context().allSharedPreferences().fetchRegisteredANM());
// if (TextUtils.isEmpty(simPrintsGuid)) {
// Log.v("SIMPRINTS_IDENTITY","confirmSelectedGuid>>"+sessiodId);
// simPrintsHelper.confirmIdentity(HnppApplication.getHNPPInstance().getApplicationContext(), sessionid, "none_selected");
//
// } else {
// Log.v("SIMPRINTS_IDENTITY","sessionId:"+sessiodId+":guId"+simPrintsGuid+":appcontext:"+HnppApplication.getHNPPInstance().getApplicationContext());
// simPrintsHelper.confirmIdentity(HnppApplication.getHNPPInstance().getApplicationContext(), sessionid, simPrintsGuid);
// }
// }
//}

0 comments on commit 15e1928

Please sign in to comment.