Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public static ConnectJobRecord fromJson(JSONObject json) throws JSONException, P

job.claimed = json.has(META_CLAIM) && !json.isNull(META_CLAIM);

job.isActive = !json.optBoolean(META_IS_ACTIVE, true);
job.isActive = json.optBoolean(META_IS_ACTIVE, true);

job.isUserSuspended = json.optBoolean(META_USER_SUSPENDED, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void setSecondaryPhoneVerified(boolean verified) {
}

public Date getSecondaryPhoneVerifyByDate() {
return secondaryPhoneVerified ? verifySecondaryPhoneByDate : null;
return verifySecondaryPhoneByDate;
}

public void setSecondaryPhoneVerifyByDate(Date date) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@

public class ConnectAppDatabaseUtil {
public static ConnectLinkedAppRecord getAppData(Context context, String appId, String username) {

Vector<ConnectLinkedAppRecord> records = ConnectDatabaseHelper.getConnectStorage(context, ConnectLinkedAppRecord.class)
.getRecordsForValues(
new String[]{ConnectLinkedAppRecord.META_APP_ID, ConnectLinkedAppRecord.META_USER_ID},
new Object[]{appId, username});
return records.isEmpty() ? null : records.firstElement();
if (ConnectManager.isConnectIdConfigured()) {
Vector<ConnectLinkedAppRecord> records = ConnectDatabaseHelper.getConnectStorage(context, ConnectLinkedAppRecord.class)
.getRecordsForValues(
new String[]{ConnectLinkedAppRecord.META_APP_ID, ConnectLinkedAppRecord.META_USER_ID},
new Object[]{appId, username});
return records.isEmpty() ? null : records.firstElement();
}
return null;
}

public static void deleteAppData(Context context, ConnectLinkedAppRecord record) {
Expand Down
12 changes: 8 additions & 4 deletions app/src/org/commcare/connect/database/ConnectJobUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,13 @@ public static void storeLearningRecords(Context context, List<ConnectJobLearning
}

public static ConnectAppRecord getAppRecord(Context context, String appId) {
Vector<ConnectAppRecord> records = ConnectDatabaseHelper.getConnectStorage(context, ConnectAppRecord.class).getRecordsForValues(
new String[]{ConnectAppRecord.META_APP_ID},
new Object[]{appId});
return records.isEmpty() ? null : records.firstElement();
if (ConnectManager.isConnectIdConfigured()) {
Vector<ConnectAppRecord> records = ConnectDatabaseHelper.getConnectStorage(context, ConnectAppRecord.class).getRecordsForValues(
new String[]{ConnectAppRecord.META_APP_ID},
new Object[]{appId});
return records.isEmpty() ? null : records.firstElement();
}
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -265,21 +265,14 @@ public void checkPhoneNumber() {
String finalPhone = phone;
switch (callingClass) {
case ConnectConstants.CONNECT_REGISTRATION_PRIMARY_PHONE,
ConnectConstants.CONNECT_REGISTRATION_CHANGE_PRIMARY_PHONE,
ConnectConstants.CONNECT_RECOVERY_PRIMARY_PHONE -> {
if (existingPrimary != null && existingPrimary.equals(phone)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are we trying to solve here ? And why is primary check not required any more ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it was a issue we are getting existing no when we are changing the method from signup to recover we pass the no entered there so this condition willl never allow user to check phone no

binding.errorTextView.setVisibility(View.GONE);
binding.errorTextView.setText("");
} else if (existingAlternate != null && existingAlternate.equals(phone)) {
binding.errorTextView.setVisibility(View.VISIBLE);
ConnectConstants.CONNECT_REGISTRATION_CHANGE_PRIMARY_PHONE,
ConnectConstants.CONNECT_RECOVERY_PRIMARY_PHONE -> {
binding.errorTextView.setVisibility(View.VISIBLE);
if (existingAlternate != null && existingAlternate.equals(phone)) {
binding.errorTextView.setText(getString(R.string.connect_phone_not_alt));
} else {
//Make sure the number isn't already in use
// phone = phone.replaceAll("\\+", "%2b");
binding.errorTextView.setVisibility(View.VISIBLE);
binding.errorTextView.setText(getString(R.string.connect_phone_checking));

ApiConnectId.checkPhoneAvailable(getContext(), phone,
ApiConnectId.checkPhoneAvailable(getContext(), phone,
new IApiCallback() {
@Override
public void processSuccess(int responseCode, InputStream responseData) {
Expand All @@ -297,7 +290,7 @@ public void processSuccess(int responseCode, InputStream responseData) {
@Override
public void processFailure(int responseCode, IOException e) {
skipPhoneNumberCheck = false;
if(responseCode==406){
if (responseCode == 406) {
skipPhoneNumberCheck = false;
updateButtonEnabled();
binding.errorTextView.setVisibility(View.VISIBLE);
Expand Down Expand Up @@ -336,8 +329,8 @@ public void processOldApiError() {
binding.errorTextView.setText(getString(R.string.recovery_network_outdated));
}
});

}

}
case ConnectConstants.CONNECT_UNLOCK_ALT_PHONE_CHANGE -> {
if (existingPrimary != null && existingPrimary.equals(phone)) {
Expand Down