Skip to content

Conversation

devcsomnicg
Copy link
Contributor

@devcsomnicg devcsomnicg commented Apr 26, 2023

🔹 Jira Ticket(s) if any

✏️ Description

Add callbacks for setEmail/setUserId, and it returns success/failure based on device token is registered successfully or not. It will always return success if autoPushRegistration is false.

@devcsomnicg
Copy link
Contributor Author

@roninopf Could you please start review for this ?

Copy link
Member

@Ayyanchira Ayyanchira left a comment

Choose a reason for hiding this comment

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

Added some comments. Looking great!

}

sendPostRequest(IterableConstants.ENDPOINT_REGISTER_DEVICE_TOKEN, requestJSON, authToken);
sendPostRequest(IterableConstants.ENDPOINT_REGISTER_DEVICE_TOKEN, requestJSON, authToken, new IterableHelper.SuccessHandler() {
Copy link
Member

Choose a reason for hiding this comment

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

public void updateEmail(final @NonNull String newEmail, final @Nullable String authToken, final @Nullable IterableHelper.SuccessHandler successHandler, @Nullable IterableHelper.FailureHandler failureHandler) {
if (!checkSDKInitialization()) {
IterableLogger.e(TAG, "The Iterable SDK must be initialized with email or userId before " +
"calling updateEmail");
if (failureHandler != null) {
failureHandler.onFailure("The Iterable SDK must be initialized with email or " +
"userId before calling updateEmail", null);
}
return;
}
apiClient.updateEmail(newEmail, new IterableHelper.SuccessHandler() {
@Override
public void onSuccess(@NonNull JSONObject data) {
if (_email != null) {
_email = newEmail;
_authToken = authToken;
}
storeAuthData();
getAuthManager().requestNewAuthToken(false);
if (successHandler != null) {
successHandler.onSuccess(data);
}
}
}, failureHandler);
}

Reference to how it can be

/**
* Handler to pass result of success/failure for setemail/setuserid
*/
public interface ResultCallbackHandler {
Copy link
Member

Choose a reason for hiding this comment

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

Use the Iterable callbacks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Ayyanchira Thanks for the feedback. I have updated the code with the suggested changes. Please review and let me know if anything else, thanks.

@codecov
Copy link

codecov bot commented May 17, 2023

Codecov Report

Patch coverage: 80.00% and project coverage change: +0.05 🎉

Comparison is base (f10606b) 61.99% compared to head (f81670f) 62.05%.

❗ Current head f81670f differs from pull request most recent head 0513dc5. Consider uploading reports for the commit 0513dc5 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #555      +/-   ##
==========================================
+ Coverage   61.99%   62.05%   +0.05%     
==========================================
  Files          68       68              
  Lines        3984     3990       +6     
  Branches      465      466       +1     
==========================================
+ Hits         2470     2476       +6     
+ Misses       1265     1264       -1     
- Partials      249      250       +1     
Impacted Files Coverage Δ
...ain/java/com/iterable/iterableapi/IterableApi.java 60.42% <77.77%> (+0.08%) ⬆️
...va/com/iterable/iterableapi/IterableApiClient.java 75.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Ayyanchira Ayyanchira changed the base branch from master to omni-cg-pr May 17, 2023 19:11
@Ayyanchira Ayyanchira merged commit a829515 into Iterable:omni-cg-pr May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants