@@ -519,6 +519,10 @@ public void registerDeviceToken(String applicationName, String token) {
519
519
*/
520
520
@ Deprecated
521
521
public void registerDeviceToken (final String applicationName , final String token , final String pushServicePlatform ) {
522
+ registerDeviceToken (_email , _userId , applicationName , token , pushServicePlatform );
523
+ }
524
+
525
+ protected void registerDeviceToken (final String email , final String userId , final String applicationName , final String token , final String pushServicePlatform ) {
522
526
if (!IterableConstants .MESSAGING_PLATFORM_FIREBASE .equals (pushServicePlatform )) {
523
527
IterableLogger .e (TAG , "registerDeviceToken: only MESSAGING_PLATFORM_FIREBASE is supported." );
524
528
return ;
@@ -527,7 +531,7 @@ public void registerDeviceToken(final String applicationName, final String token
527
531
if (token != null ) {
528
532
final Thread registrationThread = new Thread (new Runnable () {
529
533
public void run () {
530
- registerDeviceToken (applicationName , token , IterableConstants .MESSAGING_PLATFORM_FIREBASE , null );
534
+ registerDeviceToken (email , userId , applicationName , token , IterableConstants .MESSAGING_PLATFORM_FIREBASE , null );
531
535
}
532
536
});
533
537
@@ -770,7 +774,7 @@ public void registerForPush() {
770
774
return ;
771
775
}
772
776
773
- IterablePushRegistrationData data = new IterablePushRegistrationData (config .pushIntegrationName , IterablePushRegistrationData .PushRegistrationAction .ENABLE );
777
+ IterablePushRegistrationData data = new IterablePushRegistrationData (_email , _userId , config .pushIntegrationName , IterablePushRegistrationData .PushRegistrationAction .ENABLE );
774
778
new IterablePushRegistration ().execute (data );
775
779
}
776
780
@@ -801,7 +805,7 @@ public void registerForPush(String pushIntegrationName, String projectNumber, St
801
805
return ;
802
806
}
803
807
804
- IterablePushRegistrationData data = new IterablePushRegistrationData (pushIntegrationName , projectNumber , pushServicePlatform , IterablePushRegistrationData .PushRegistrationAction .ENABLE );
808
+ IterablePushRegistrationData data = new IterablePushRegistrationData (_email , _userId , pushIntegrationName , projectNumber , pushServicePlatform , IterablePushRegistrationData .PushRegistrationAction .ENABLE );
805
809
new IterablePushRegistration ().execute (data );
806
810
}
807
811
@@ -813,7 +817,7 @@ public void registerForPush(String pushIntegrationName, String projectNumber, St
813
817
*/
814
818
@ Deprecated
815
819
public void registerForPush (String pushIntegrationName ) {
816
- IterablePushRegistrationData data = new IterablePushRegistrationData (pushIntegrationName , IterablePushRegistrationData .PushRegistrationAction .ENABLE );
820
+ IterablePushRegistrationData data = new IterablePushRegistrationData (_email , _userId , pushIntegrationName , IterablePushRegistrationData .PushRegistrationAction .ENABLE );
817
821
new IterablePushRegistration ().execute (data );
818
822
}
819
823
@@ -826,7 +830,7 @@ public void disablePush() {
826
830
return ;
827
831
}
828
832
829
- IterablePushRegistrationData data = new IterablePushRegistrationData (config .pushIntegrationName , IterablePushRegistrationData .PushRegistrationAction .DISABLE );
833
+ IterablePushRegistrationData data = new IterablePushRegistrationData (_email , _userId , config .pushIntegrationName , IterablePushRegistrationData .PushRegistrationAction .DISABLE );
830
834
new IterablePushRegistration ().execute (data );
831
835
}
832
836
@@ -857,7 +861,7 @@ public void disablePush(String iterableAppId, String projectNumber, String pushS
857
861
return ;
858
862
}
859
863
860
- IterablePushRegistrationData data = new IterablePushRegistrationData (iterableAppId , projectNumber , pushServicePlatform , IterablePushRegistrationData .PushRegistrationAction .DISABLE );
864
+ IterablePushRegistrationData data = new IterablePushRegistrationData (_email , _userId , iterableAppId , projectNumber , pushServicePlatform , IterablePushRegistrationData .PushRegistrationAction .DISABLE );
861
865
new IterablePushRegistration ().execute (data );
862
866
}
863
867
@@ -1111,19 +1115,23 @@ protected void trackPushOpen(int campaignId, int templateId, String messageId, J
1111
1115
}
1112
1116
}
1113
1117
1114
- protected void disableToken (String token ) {
1115
- disableToken (token , null , null );
1118
+ protected void disableToken (String email , String userId , String token ) {
1119
+ disableToken (email , userId , token , null , null );
1116
1120
}
1117
1121
1118
1122
/**
1119
1123
* Internal api call made from IterablePushRegistration after a registrationToken is obtained.
1120
1124
* @param token
1121
1125
*/
1122
- protected void disableToken (String token , IterableHelper .SuccessHandler onSuccess , IterableHelper .FailureHandler onFailure ) {
1126
+ protected void disableToken (String email , String userId , String token , IterableHelper .SuccessHandler onSuccess , IterableHelper .FailureHandler onFailure ) {
1123
1127
JSONObject requestJSON = new JSONObject ();
1124
1128
try {
1125
1129
requestJSON .put (IterableConstants .KEY_TOKEN , token );
1126
- addEmailOrUserIdToJson (requestJSON );
1130
+ if (email != null ) {
1131
+ requestJSON .put (IterableConstants .KEY_EMAIL , email );
1132
+ } else {
1133
+ requestJSON .put (IterableConstants .KEY_USER_ID , userId );
1134
+ }
1127
1135
1128
1136
sendPostRequest (IterableConstants .ENDPOINT_DISABLE_DEVICE , requestJSON , onSuccess , onFailure );
1129
1137
}
@@ -1139,7 +1147,7 @@ protected void disableToken(String token, IterableHelper.SuccessHandler onSucces
1139
1147
* @param pushServicePlatform
1140
1148
* @param dataFields
1141
1149
*/
1142
- protected void registerDeviceToken (String applicationName , String token , String pushServicePlatform , JSONObject dataFields ) {
1150
+ protected void registerDeviceToken (String email , String userId , String applicationName , String token , String pushServicePlatform , JSONObject dataFields ) {
1143
1151
if (!checkSDKInitialization ()) {
1144
1152
return ;
1145
1153
}
0 commit comments