Tuesday, January 29, 2019

Widget Mapping

var gridArr2 = [];
var gridArr3 = [];
function PusSD(){
  try{
    var SName = frmwMdata.txtName.text;
    var Smark = frmwMdata.txtMark.text;
    var SPercent = frmwMdata.txtpercenntage.text;
    var SPass = frmwMdata.rdoResult.selectedKeyValue[1];
    if(frmwMdata.txtName.text ==="" || frmwMdata.txtName.text === null || frmwMdata.txtName.text ===" " ||frmwMdata.txtName.text === undefined){
    frmwMdata.txtName.setFocus(true);
    return false;
  }
    if(frmwMdata.txtMark.text ==="" || frmwMdata.txtMark.text === null || frmwMdata.txtMark.text ===" " ||frmwMdata.txtMark.text === undefined){
    frmwMdata.txtMark.setFocus(true);
    return false;
  }
      if(frmwMdata.txtpercenntage.text ==="" || frmwMdata.txtpercenntage.text === null || frmwMdata.txtpercenntage.text ===" " ||frmwMdata.txtpercenntage.text === undefined){
    frmwMdata.txtpercenntage.setFocus(true);
    return false;
  }
      if(SPass ==="" || SPass === null || SPass ===" " ||SPass === undefined){
    frmwMdata.rdoResult.setFocus(true);
    return false;
  }
    var OBJ = {"SName":frmwMdata.txtName.text,"Smark":frmwMdata.txtMark.text,
               "SPercent": frmwMdata.txtpercenntage.text,"SPass":frmwMdata.rdoResult.selectedKeyValue[1]};
 
    if(OBJ.SPass === "PASS"){
       frmWM.segwm.widgetDataMap = {"lblName":"SName","lblMark":"Smark","lblPercentage":"SPercent"};
      frmWM.segwm.rowTemplate = flxmainPS;
    //  frmWM.segwm.setData(gridArr2);
    }else if(OBJ.SPass === "FAIL"){
      frmWM.segwm.widgetDataMap = {"lblNameF":"SName","lblMarkf":"Smark","lblPercentagef":"SPercent"};
      frmWM.segwm.rowTemplate = flxmainFS;
      //frmWM.segwm.data ="";
    }
    gridArr2.push(OBJ);
    //gridArr3.push(gridArr2);
    frmWM.segwm.setData(gridArr2);
    //gridArr2=[];
    frmwMdata.destroy();
    frmWM.show();

  }catch(err){
    alert("Error "+ err);
  }
}

Sunday, January 27, 2019

How to do touch ID



function isAuthUsingTouchSupported()
{
  var status = kony.localAuthentication.getStatusForAuthenticationMode(constants.LOCAL_AUTHENTICATION_MODE_TOUCH_ID);
  alert("satatofisAuthUsingTouchSupported"+status);
  if(status == 5000)
   {
     kony.ui.Alert({message: "AUTHENTICATION BY TOUCHID SUPPORTED", alertType: constants.ALERT_TYPE_INFO, yesLabel:"Close"}, {});
   }
  else
   {
     var msg = "TOUCHID AUTHENTICATION RETURNED THE STATUS ::"+status;
     kony.ui.Alert({message: status, alertType: constants.ALERT_TYPE_INFO, yesLabel:"Close"}, {});
   }
}

function statusCB(status,message)
{
  if(status == 5000)
   {
     kony.ui.Alert({message: "AUTHENTICATION SUCCESSFULL", alertType: constants.ALERT_TYPE_INFO, yesLabel:"Close"}, {});
   }
  else
   {
     var messg = status+message;
     kony.ui.Alert({message: messg, alertType: constants.ALERT_TYPE_INFO, yesLabel:"Close"}, {});
   }
}
function authUsingTouchID()
{
  var config = {"promptMessage" : "PLEASE AUTHENTICATE USING YOUR TOUCH ID","fallbackTitle" :  "Please Enter your Password"};
  kony.localAuthentication.authenticate(constants.LOCAL_AUTHENTICATION_MODE_TOUCH_ID,statusCB,config);


}

In this only support IOS device:

function getBiometryTypeOfDevice(){
  var promptMessage = "Sign in with ";
  alert("typeofkonybio"+ kony.localAuthentication.getBiometryType());
  var Typof = kony.localAuthentication.getBiometryType();
  switch(Typof){
    case constants.BIOMETRY_TYPE_NONE:
      // Handle the case if the device doesn't support any biometryType
      break;        
    case constants.BIOMETRY_TYPE_TOUCHID:
      promptMessage += "TouchID";
      break;
    case constants.BIOMETRY_TYPE_FACEID:
      promptMessage += "FaceID";
      break;
    case constants.BIOMETRY_TYPE_UNDEFINED:
    
      // Handle the case if the device is not a iOS11 device (or) above
      break;
      
  }
   
}