Skip to content

Commit 07547fb

Browse files
committed
Replace all currentUserState accesses with a getter
* In the previous commit, we already replaced all access to `currentUserState` where it could possibly be `null`, with the getter `getCurrentUserState()`. * In this commit, replace all other access to `currentUserState` with the getter `getCurrentUserState()` for consistency purposes.
1 parent 0c4e905 commit 07547fb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/UserStateSynchronizer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,11 @@ private void internalSyncUserState(boolean fromSyncService) {
268268
synchronized (LOCK) {
269269
jsonBody = getCurrentUserState().generateJsonDiff(getToSyncUserState(), isSessionCall);
270270
UserState toSyncState = getToSyncUserState();
271-
dependDiff = currentUserState.generateJsonDiffFromDependValues(toSyncState, null);;
271+
dependDiff = getCurrentUserState().generateJsonDiffFromDependValues(toSyncState, null);;
272272
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "UserStateSynchronizer internalSyncUserState from session call: "+ isSessionCall + " jsonBody: " + jsonBody);
273273
// Updates did not result in a server side change, skipping network call
274274
if (jsonBody == null) {
275-
currentUserState.persistStateAfterSync(dependDiff, null);
275+
getCurrentUserState().persistStateAfterSync(dependDiff, null);
276276
sendTagsHandlersPerformOnSuccess();
277277
externalUserIdUpdateHandlersPerformOnSuccess();
278278
return;
@@ -294,7 +294,7 @@ private void doEmailLogout(String userId) {
294294
if (dependValues.has(EMAIL_AUTH_HASH_KEY))
295295
jsonBody.put(EMAIL_AUTH_HASH_KEY, dependValues.optString(EMAIL_AUTH_HASH_KEY));
296296

297-
ImmutableJSONObject syncValues = currentUserState.getSyncValues();
297+
ImmutableJSONObject syncValues = getCurrentUserState().getSyncValues();
298298
if (syncValues.has(PARENT_PLAYER_ID))
299299
jsonBody.put(PARENT_PLAYER_ID, syncValues.optString(PARENT_PLAYER_ID));
300300

@@ -334,9 +334,9 @@ private void logoutEmailSyncSuccess() {
334334
toSyncUserState.persistState();
335335

336336
getCurrentUserState().removeFromDependValues(EMAIL_AUTH_HASH_KEY);
337-
currentUserState.removeFromSyncValues(PARENT_PLAYER_ID);
338-
String emailLoggedOut = currentUserState.getSyncValues().optString(EMAIL_KEY);
339-
currentUserState.removeFromSyncValues(EMAIL_KEY);
337+
getCurrentUserState().removeFromSyncValues(PARENT_PLAYER_ID);
338+
String emailLoggedOut = getCurrentUserState().getSyncValues().optString(EMAIL_KEY);
339+
getCurrentUserState().removeFromSyncValues(EMAIL_KEY);
340340

341341
OneSignalStateSynchronizer.setNewSessionForEmail();
342342

@@ -571,7 +571,7 @@ private void handlePlayerDeletedFromServer() {
571571

572572
void resetCurrentState() {
573573
getCurrentUserState().setSyncValues(new JSONObject());
574-
currentUserState.persistState();
574+
getCurrentUserState().persistState();
575575
}
576576

577577
public abstract boolean getUserSubscribePreference();

0 commit comments

Comments
 (0)