@@ -266,13 +266,13 @@ private void internalSyncUserState(boolean fromSyncService) {
266
266
final boolean isSessionCall = !fromSyncService && isSessionCall ();
267
267
JSONObject jsonBody , dependDiff ;
268
268
synchronized (LOCK ) {
269
- jsonBody = currentUserState .generateJsonDiff (getToSyncUserState (), isSessionCall );
269
+ jsonBody = getCurrentUserState () .generateJsonDiff (getToSyncUserState (), isSessionCall );
270
270
UserState toSyncState = getToSyncUserState ();
271
- dependDiff = currentUserState .generateJsonDiffFromDependValues (toSyncState , null );;
271
+ dependDiff = getCurrentUserState () .generateJsonDiffFromDependValues (toSyncState , null );;
272
272
OneSignal .onesignalLog (OneSignal .LOG_LEVEL .DEBUG , "UserStateSynchronizer internalSyncUserState from session call: " + isSessionCall + " jsonBody: " + jsonBody );
273
273
// Updates did not result in a server side change, skipping network call
274
274
if (jsonBody == null ) {
275
- currentUserState .persistStateAfterSync (dependDiff , null );
275
+ getCurrentUserState () .persistStateAfterSync (dependDiff , null );
276
276
sendTagsHandlersPerformOnSuccess ();
277
277
externalUserIdUpdateHandlersPerformOnSuccess ();
278
278
return ;
@@ -290,11 +290,11 @@ private void doEmailLogout(String userId) {
290
290
String urlStr = "players/" + userId + "/email_logout" ;
291
291
JSONObject jsonBody = new JSONObject ();
292
292
try {
293
- ImmutableJSONObject dependValues = currentUserState .getDependValues ();
293
+ ImmutableJSONObject dependValues = getCurrentUserState () .getDependValues ();
294
294
if (dependValues .has (EMAIL_AUTH_HASH_KEY ))
295
295
jsonBody .put (EMAIL_AUTH_HASH_KEY , dependValues .optString (EMAIL_AUTH_HASH_KEY ));
296
296
297
- ImmutableJSONObject syncValues = currentUserState .getSyncValues ();
297
+ ImmutableJSONObject syncValues = getCurrentUserState () .getSyncValues ();
298
298
if (syncValues .has (PARENT_PLAYER_ID ))
299
299
jsonBody .put (PARENT_PLAYER_ID , syncValues .optString (PARENT_PLAYER_ID ));
300
300
@@ -333,10 +333,10 @@ private void logoutEmailSyncSuccess() {
333
333
toSyncUserState .removeFromSyncValues (EMAIL_KEY );
334
334
toSyncUserState .persistState ();
335
335
336
- currentUserState .removeFromDependValues (EMAIL_AUTH_HASH_KEY );
337
- currentUserState .removeFromSyncValues (PARENT_PLAYER_ID );
338
- String emailLoggedOut = currentUserState .getSyncValues ().optString (EMAIL_KEY );
339
- currentUserState .removeFromSyncValues (EMAIL_KEY );
336
+ getCurrentUserState () .removeFromDependValues (EMAIL_AUTH_HASH_KEY );
337
+ getCurrentUserState () .removeFromSyncValues (PARENT_PLAYER_ID );
338
+ String emailLoggedOut = getCurrentUserState () .getSyncValues ().optString (EMAIL_KEY );
339
+ getCurrentUserState () .removeFromSyncValues (EMAIL_KEY );
340
340
341
341
OneSignalStateSynchronizer .setNewSessionForEmail ();
342
342
@@ -379,7 +379,7 @@ void onFailure(int statusCode, String response, Throwable throwable) {
379
379
@ Override
380
380
void onSuccess (String response ) {
381
381
synchronized (LOCK ) {
382
- currentUserState .persistStateAfterSync (dependDiff , jsonBody );
382
+ getCurrentUserState () .persistStateAfterSync (dependDiff , jsonBody );
383
383
onSuccessfulSync (jsonBody );
384
384
}
385
385
@@ -422,7 +422,7 @@ void onFailure(int statusCode, String response, Throwable throwable) {
422
422
void onSuccess (String response ) {
423
423
synchronized (LOCK ) {
424
424
waitingForSessionResponse = false ;
425
- currentUserState .persistStateAfterSync (dependDiff , jsonBody );
425
+ getCurrentUserState () .persistStateAfterSync (dependDiff , jsonBody );
426
426
427
427
try {
428
428
OneSignal .onesignalLog (OneSignal .LOG_LEVEL .DEBUG , "doCreateOrNewSession:response: " + response );
@@ -468,7 +468,7 @@ private void handleNetworkFailure(int statusCode) {
468
468
}
469
469
470
470
private void fireNetworkFailureEvents () {
471
- final JSONObject jsonBody = currentUserState .generateJsonDiff (toSyncUserState , false );
471
+ final JSONObject jsonBody = getCurrentUserState () .generateJsonDiff (toSyncUserState , false );
472
472
if (jsonBody != null )
473
473
fireEventsForUpdateFailure (jsonBody );
474
474
@@ -570,8 +570,8 @@ private void handlePlayerDeletedFromServer() {
570
570
}
571
571
572
572
void resetCurrentState () {
573
- currentUserState .setSyncValues (new JSONObject ());
574
- currentUserState .persistState ();
573
+ getCurrentUserState () .setSyncValues (new JSONObject ());
574
+ getCurrentUserState () .persistState ();
575
575
}
576
576
577
577
public abstract boolean getUserSubscribePreference ();
0 commit comments