Skip to content

Commit

Permalink
removed not supported type
Browse files Browse the repository at this point in the history
Signed-off-by: Basler182 <[email protected]>
  • Loading branch information
Basler182 committed Jun 23, 2024
1 parent cf52b3e commit 08bbd29
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class EncryptedSharedPreferencesKeyValueStorage @Inject constructor(
is Long -> putLong(key.key.name, data)
is Double -> putString(key.key.name, data.toString())
is ByteArray -> putString(key.key.name, data.toHexString())
else -> throw IllegalArgumentException("Unsupported type")
}
}
}
Expand All @@ -56,10 +55,6 @@ class EncryptedSharedPreferencesKeyValueStorage @Inject constructor(

is PreferenceKey.ByteArrayKey -> sharedPreferences.getString(key.key.name, null)
?.hexToByteArray()

else -> {
throw IllegalArgumentException("Unsupported type")
}
} as T?
)
}
Expand All @@ -77,10 +72,6 @@ class EncryptedSharedPreferencesKeyValueStorage @Inject constructor(

is PreferenceKey.ByteArrayKey -> sharedPreferences.getString(key.key.name, null)
?.hexToByteArray()

else -> {
throw IllegalArgumentException("Unsupported type")
}
} as T?
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.datastore.preferences.core.floatPreferencesKey
import androidx.datastore.preferences.core.intPreferencesKey
import androidx.datastore.preferences.core.longPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.core.stringSetPreferencesKey

sealed class PreferenceKey<T>(val key: Preferences.Key<T>) {
class IntKey(name: String) : PreferenceKey<Int>(intPreferencesKey(name))
Expand All @@ -17,6 +16,5 @@ sealed class PreferenceKey<T>(val key: Preferences.Key<T>) {
class BooleanKey(name: String) : PreferenceKey<Boolean>(booleanPreferencesKey(name))
class FloatKey(name: String) : PreferenceKey<Float>(floatPreferencesKey(name))
class LongKey(name: String) : PreferenceKey<Long>(longPreferencesKey(name))
class StringSetKey(name: String) : PreferenceKey<Set<String>>(stringSetPreferencesKey(name))
class ByteArrayKey(name: String) : PreferenceKey<ByteArray>(byteArrayPreferencesKey(name))
}

0 comments on commit 08bbd29

Please sign in to comment.