-
Notifications
You must be signed in to change notification settings - Fork 32
[MOB-6055] callback on setEmail/setUserId #555
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
Conversation
@roninopf Could you please start review for this ? |
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.
Added some comments. Looking great!
} | ||
|
||
sendPostRequest(IterableConstants.ENDPOINT_REGISTER_DEVICE_TOKEN, requestJSON, authToken); | ||
sendPostRequest(IterableConstants.ENDPOINT_REGISTER_DEVICE_TOKEN, requestJSON, authToken, new IterableHelper.SuccessHandler() { |
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.
iterable-android-sdk/iterableapi/src/main/java/com/iterable/iterableapi/IterableApi.java
Lines 918 to 946 in bf261d1
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 { |
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.
Use the Iterable callbacks
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.
@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 ReportPatch coverage:
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
☔ View full report in Codecov by Sentry. |
🔹 Jira Ticket(s) if any
✏️ Description