Skip to content

Commit 6c8906f

Browse files
committed
Call Editor to remove the key if its value is null
- This was a problem for `logoutEmail` and `logoutSMSNumber` - The above methods end up calling `OneSignalPrefs.saveString` to save their channel IDs with the value of `null` - However, when we `flushBufferToDisk`, the value of null falls through the "if-else if" checks and nothing happens, when it should be removed.
1 parent 5604baf commit 6c8906f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ else if (value instanceof Long)
204204
editor.putLong(key, (Long)value);
205205
else if (value instanceof Set)
206206
editor.putStringSet(key, (Set<String>)value);
207+
else if (value == null)
208+
editor.remove(key);
207209
}
208210
prefHash.clear();
209211
}

0 commit comments

Comments
 (0)