🗝️ Preferences & DataStore Editor
Flocon provides full visibility into your app's key-value storage (SharedPreferences and Jetpack DataStore), allowing you to view and edit values live from the desktop UI.
Overview
Features:
- Auto-Discovery: Automatically finds and lists default SharedPreferences files on Android.
- DataStore Support: Seamlessly browse and mutate PreferencesDataStore keys.
- Live Mutation: Edit booleans, numbers, strings, and JSON objects in real-time.
Setup & Registration
Install the plugin:
Standard SharedPreferences (Android)
All the SharedPreferences files of the app are automatically detected on Android. To register one with a custom display name:
val userPrefs = context.getSharedPreferences("user_pref", Context.MODE_PRIVATE)
Flocon.preferencesPlugin.register(FloconSharedPreference(name = "User Settings", userPrefs))
Jetpack DataStore
Register your DataStore instance (Android, JVM and iOS):
val Context.dataStore by preferencesDataStore(name = "settings")
Flocon.preferencesPlugin.register(FloconDatastorePreference(name = "App Settings", context.dataStore))
If the values are encrypted, pass a FloconDatastoreMapper to decode / encode them:
FloconDatastorePreference(name = "Secure Settings", context.secureDataStore, mapper = myCipherMapper)
Custom Key-Value Storage
You can expose any proprietary storage system (such as EncryptedSharedPreferences or custom key-value stores, on every platform) by implementing FloconPreference:
class MyCustomPreference : FloconPreference {
override val name: String = "Encrypted Vault"
override suspend fun columns(): List<String> = listOf("token", "is_authenticated")
override suspend fun get(columnName: String): FloconPreferenceValue? {
return FloconPreferenceValue(stringValue = readSecureKey(columnName))
}
override suspend fun set(columnName: String, value: FloconPreferenceValue) {
writeSecureKey(columnName, value.stringValue)
}
}
Flocon.preferencesPlugin.register(MyCustomPreference())