Skip to content

Commit 1c41357

Browse files
committed
fix exception while trying to access a SharedPreferences key with the format |T|<project_number>|*
1 parent 34b5fcf commit 1c41357

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/main/java/android/content/Context.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,13 @@ open class Context {
5656
}
5757

5858
override fun getString(key: String, defaultValue: String?): String? {
59-
when (key) {
60-
"|T|app.teamhub.core|*" -> return null
61-
"|T|dev.teamhub.core|*" -> return null
62-
"last-used-date" -> return FirebasePlatform.firebasePlatform.retrieve(key) ?: defaultValue
63-
else -> if(key.startsWith("com.google.firebase.auth.FIREBASE_USER")) {
64-
return FirebasePlatform.firebasePlatform.retrieve(key) ?: defaultValue
65-
}
59+
return when {
60+
key == "last-used-date" -> FirebasePlatform.firebasePlatform.retrieve(key) ?: defaultValue
61+
key.startsWith("|T|") -> null
62+
key.startsWith("com.google.firebase.auth.FIREBASE_USER") ->
63+
FirebasePlatform.firebasePlatform.retrieve(key) ?: defaultValue
64+
else -> throw IllegalArgumentException(key)
6665
}
67-
throw IllegalArgumentException(key)
6866
}
6967

7068
override fun getLong(key: String?, defaultValue: Long): Long {

0 commit comments

Comments
 (0)