private void updateSetting(String attribute, String value) { showWaitDialog("Changing SMS MFA setting..."); newSettings = new CognitoUserSettings(); newSettings.setSettings(attribute, value); AppHelper.getPool() .getUser(AppHelper.getCurrUser()) .setUserSettingsInBackground(newSettings, updateSettingHandler); }
public void run() { boolean flag; if (AppHelper.access$000().getLastLob() == 0) { flag = true; } else { flag = false; } AppHelper.access$000().switchProducts(flag); }
@Override public void onSuccess(CognitoUserDetails cognitoUserDetails) { closeWaitDialog(); // Store details in the AppHandler AppHelper.setUserDetails(cognitoUserDetails); // showDialogMessage("MFA setting successfully changed","",false); Toast.makeText(getApplicationContext(), "MFA settings changed", Toast.LENGTH_LONG); }
@Override public void onFailure(Exception exception) { // Failed closeWaitDialog(); smsSwitch.toggle(); toggleSwitch(); showDialogMessage( "Could not change MFA settings", AppHelper.formatException(exception), false); }
private void init() { newSettings = new CognitoUserSettings(); settingsChanged = false; smsSwitch = (Switch) findViewById(R.id.switchSettingsPhone); if (smsSwitch != null) { smsSwitch.setClickable(true); smsSwitch.setChecked(false); } settings = AppHelper.getUserDetails().getSettings().getSettings(); if (settings != null) { if (settings.containsKey("phone_number")) { smsSwitch.setClickable(true); if (settings.get("phone_number").contains("sms") || settings.get("phone_number").contains("SMS")) { smsSwitch.setChecked(true); smsSwitch.setText("Enable"); smsSwitch.setTextColor(Color.parseColor("#37A51C")); } else { smsSwitch.setChecked(false); smsSwitch.setText("Disabled"); smsSwitch.setTextColor(Color.parseColor("#E94700")); } } } smsSwitch.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { toggleSwitch(); if (smsSwitch.isChecked()) { updateSetting("phone_number", "SMS"); } else { updateSetting("phone_number", null); } } }); }
private void getDetails() { settingsChanged = true; AppHelper.getPool().getUser(AppHelper.getCurrUser()).getDetailsInBackground(detailsHandler); }