Skip to content

Commit 361585f

Browse files
authored
Merge pull request #87 from Iterable/feature/MOB-95-support-userId-in-updateEmail
[MOB-95] Don't switch to email as identifier after calling updateEmail with userId
2 parents 9bfec2e + 64a0338 commit 361585f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

iterableapi/src/main/java/com/iterable/iterableapi/IterableApi.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,9 @@ public void updateEmail(final String newEmail, final IterableHelper.SuccessHandl
753753
sendPostRequest(IterableConstants.ENDPOINT_UPDATE_EMAIL, requestJSON, new IterableHelper.SuccessHandler() {
754754
@Override
755755
public void onSuccess(JSONObject data) {
756-
_email = newEmail;
756+
if (_email != null) {
757+
_email = newEmail;
758+
}
757759
storeEmailAndUserId();
758760
if (successHandler != null) {
759761
successHandler.onSuccess(data);

iterableapi/src/test/java/com/iterable/iterableapi/IterableApiTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ public void testUpdateEmailWithUserId() throws Exception {
168168
JSONObject requestJson = new JSONObject(updateEmailRequest.getBody().readUtf8());
169169
assertEquals("testUserId", requestJson.getString(IterableConstants.KEY_CURRENT_USERID));
170170
assertEquals("[email protected]", requestJson.getString(IterableConstants.KEY_NEW_EMAIL));
171+
assertNull(IterableApi.getInstance().getEmail());
172+
assertEquals("testUserId", IterableApi.getInstance().getUserId());
171173
}
172174

173175
@Test

0 commit comments

Comments
 (0)