-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commcare 2.59.2 back-merge #3335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
771a9c9
6e51e97
9fd08f7
6557de6
1372a65
0835f55
04a759c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
|
|
||
| import android.Manifest; | ||
| import android.app.Activity; | ||
| import android.app.Dialog; | ||
| import android.content.DialogInterface; | ||
| import android.location.Location; | ||
| import android.os.Bundle; | ||
|
|
@@ -268,8 +267,10 @@ public void onTokenReceived(@NotNull String requestHash, | |
|
|
||
| @Override | ||
| public void onTokenFailure(@NotNull Exception exception) { | ||
| onConfigurationFailure(AnalyticsParamValue.START_CONFIGURATION_INTEGRITY_DEVICE_FAILURE, | ||
| integrityTokenApiRequestHelper.getErrorForException(requireActivity(), exception)); | ||
| String errorCode = IntegrityTokenApiRequestHelper.Companion.getCodeForException(exception); | ||
| FirebaseAnalyticsUtil.reportPersonalIdConfigurationIntegritySubmission(errorCode); | ||
|
|
||
| makeStartConfigurationCall(null, body, null); | ||
| } | ||
|
Comment on lines
+270
to
274
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possible NPE path: handleIntegritySubError can receive null tokenResponse After onTokenFailure you call makeStartConfigurationCall(null, body, null). If the API then returns INTEGRITY_ERROR, the subsequent handleIntegritySubError(integrityTokenResponse, …) dereferences a null tokenResponse in showIntegrityCheckDialog(...). Add a null guard and avoid fall-through. - case INTEGRITY_ERROR:
- handleIntegritySubError(integrityTokenResponse,
- personalIdSessionDataViewModel.getPersonalIdSessionData().getSessionFailureSubcode());
- default:
- navigateFailure(failureCode, t);
- break;
+ case INTEGRITY_ERROR:
+ if (integrityTokenResponse != null) {
+ handleIntegritySubError(
+ integrityTokenResponse,
+ personalIdSessionDataViewModel.getPersonalIdSessionData().getSessionFailureSubcode());
+ break;
+ } else {
+ onConfigurationFailure(
+ AnalyticsParamValue.START_CONFIGURATION_INTEGRITY_CHECK_FAILURE,
+ getString(R.string.personalid_configuration_process_failed_subtitle));
+ break;
+ }
+ default:
+ navigateFailure(failureCode, t);
+ break;Also applies to: 389-394 🤖 Prompt for AI Agents |
||
| }); | ||
| } | ||
|
|
@@ -385,7 +386,12 @@ private void registerLauncher() { | |
|
|
||
| private void makeStartConfigurationCall(String requestHash, | ||
| HashMap<String, String> body, | ||
| StandardIntegrityManager.@NotNull StandardIntegrityToken integrityTokenResponse) { | ||
| StandardIntegrityManager.StandardIntegrityToken integrityTokenResponse) { | ||
| String token = integrityTokenResponse != null ? integrityTokenResponse.token() : ""; | ||
| if(requestHash == null) { | ||
| requestHash = ""; | ||
| } | ||
|
|
||
| new PersonalIdApiHandler<PersonalIdSessionData>() { | ||
| @Override | ||
| public void onSuccess(PersonalIdSessionData sessionData) { | ||
|
|
@@ -425,7 +431,7 @@ public void onFailure(@androidx.annotation.NonNull PersonalIdOrConnectApiErrorCo | |
| break; | ||
| } | ||
| } | ||
| }.makeStartConfigurationCall(requireActivity(), body, integrityTokenResponse.token(), requestHash); | ||
| }.makeStartConfigurationCall(requireActivity(), body, token, requestHash); | ||
| } | ||
|
|
||
| private void handleIntegritySubError(StandardIntegrityManager.StandardIntegrityToken tokenResponse, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid sending raw exception messages to analytics
Using exception.message risks leaking details; prefer a sanitized, stable code.
📝 Committable suggestion
🤖 Prompt for AI Agents