Skip to content

Commit

Permalink
Added page to allow user to change PIN during registration if they al…
Browse files Browse the repository at this point in the history
…ready forgot their PIN by that point.

Swapped Sync and Connect buttons on app home page (better visual alignment on UI).
  • Loading branch information
OrangeAndGreen committed May 17, 2024
1 parent a5d3061 commit 9e79495
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
8 changes: 4 additions & 4 deletions app/src/org/commcare/activities/HomeButtons.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class HomeButtons {

private final static String[] buttonNames =
new String[]{"start", "training", "saved", "incomplete", "sync", "connect", "report", "logout"};
new String[]{"start", "training", "saved", "incomplete", "connect", "sync", "report", "logout"};

/**
* Note: The order in which home cards are returned by this method should be consistent with
Expand Down Expand Up @@ -68,6 +68,9 @@ public static HomeCardDisplayData[] buildButtonData(StandardHomeActivity activit
getIncompleteButtonListener(activity),
null,
getIncompleteButtonTextSetter(activity)),
HomeCardDisplayData.homeCardDataWithStaticText(Localization.get("home.connect"), R.color.white,
R.drawable.home_saved, R.color.orange_500,
getConnectButtonListener(activity)),
HomeCardDisplayData.homeCardDataWithNotification(Localization.get(syncKey), R.color.white,
R.color.white,
R.drawable.home_sync,
Expand All @@ -76,9 +79,6 @@ public static HomeCardDisplayData[] buildButtonData(StandardHomeActivity activit
getSyncButtonListener(activity),
getSyncButtonSubTextListener(activity),
getSyncButtonTextSetter(activity)),
HomeCardDisplayData.homeCardDataWithStaticText(Localization.get("home.connect"), R.color.white,
R.drawable.home_saved, R.color.orange_500,
getConnectButtonListener(activity)),
HomeCardDisplayData.homeCardDataWithStaticText(Localization.get("home.report"), R.color.white,
R.drawable.home_report, R.color.cc_attention_negative_color,
getReportButtonListener(activity)),
Expand Down
16 changes: 13 additions & 3 deletions app/src/org/commcare/activities/connect/ConnectIdWorkflows.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ private static void continueWorkflow() {
case CONNECT_REGISTRATION_CHANGE_PRIMARY_PHONE -> {
params.put(ConnectConstants.METHOD, ConnectConstants.METHOD_CHANGE_PRIMARY);
}
case CONNECT_REGISTRATION_CONFIGURE_PIN -> {
case CONNECT_REGISTRATION_CONFIGURE_PIN,
CONNECT_REGISTRATION_CHANGE_PIN -> {
params.put(ConnectConstants.PHONE, user.getPrimaryPhone());
params.put(ConnectConstants.SECRET, "");
params.put(ConnectConstants.RECOVER, false);
Expand Down Expand Up @@ -357,8 +358,17 @@ public static boolean handleFinishedActivity(int requestCode, int resultCode, In
}
case CONNECT_REGISTRATION_CONFIRM_PIN -> {
rememberPhase = success;
nextRequestCode = success ? ConnectTask.CONNECT_REGISTRATION_SUCCESS :
ConnectTask.CONNECT_REGISTRATION_ALTERNATE_PHONE;
nextRequestCode = ConnectTask.CONNECT_REGISTRATION_ALTERNATE_PHONE;
if(success) {
forgotPin = intent.getBooleanExtra(ConnectConstants.FORGOT, false);
nextRequestCode = forgotPin ? ConnectTask.CONNECT_REGISTRATION_CHANGE_PIN :
ConnectTask.CONNECT_REGISTRATION_SUCCESS;
}
}
case CONNECT_REGISTRATION_CHANGE_PIN -> {
rememberPhase = success;
nextRequestCode = ConnectTask.CONNECT_REGISTRATION_CONFIRM_PIN;
forgotPin = false;
}
case CONNECT_RECOVERY_PRIMARY_PHONE -> {
if (success) {
Expand Down
2 changes: 2 additions & 0 deletions app/src/org/commcare/activities/connect/ConnectTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public enum ConnectTask {
ConnectIdPhoneVerificationActivity.class),
CONNECT_JOB_INFO(ConnectConstants.ConnectIdTaskIdOffset + 34,
ConnectActivity.class),
CONNECT_REGISTRATION_CHANGE_PIN(ConnectConstants.ConnectIdTaskIdOffset + 35,
ConnectIdPinActivity.class),
;

private final int requestCode;
Expand Down

0 comments on commit 9e79495

Please sign in to comment.