Skip to content

feat: [PREFERENCES] Send the preference type and show it in the selector - #728

Merged
florent37 merged 7 commits into
mainfrom
feat/preferences-type
Oct 30, 2026
Merged

florent37 merged 7 commits into
mainfrom
feat/preferences-type

Conversation

@florent37

@florent37 florent37 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Each preference store now tells the desktop which storage it comes from, and the desktop shows it in the preference selector.

SDK

  • FloconPreference gets a type: String property (free value), defaulting to "Custom", so existing Kotlin implementations keep compiling.
  • FloconPreferenceType holds suggested values per OS: SharedPreferences (Android), DataStore (Android / iOS / JVM), UserDefaults and Keychain (iOS), Java Preferences (JVM), LocalStorage (Wasm), Custom.
  • Built-in stores set it: FloconSharedPreference → SharedPreferences, FloconDatastorePreference → DataStore, iOS UserDefaults → UserDefaults. The multiplatform sample uses a free value ("In memory").
  • get_shared_preferences sends type next to name. The field is optional, so old SDK / new desktop and the reverse both keep working. Protocol.kt is unchanged (no new method).

Desktop

  • type goes through the wire / domain / UI models. It is null for older SDKs.
  • Selector: the anchor shows [icon type name] and each dropdown item shows the icon, the name and the type. The filter also matches the type.
  • Icons by type: a line glyph tinted with a category color, on a tile of the same color (new design system component FloconTintedIcon, plus an optional leadingContent slot on FloconPageSelector and the dropdown items). The type string is mapped to PreferenceTypeUiModel in Mapper.kt (case insensitive):
    • SharedPreferences → key/value list (catTable)
    • DataStore → database (catDatabase)
    • UserDefaults → sliders (catNetwork)
    • Keychain → key (accent)
    • Java Preferences → coffee cup (catAccessibility)
    • LocalStorage → browser window (catAnalytics)
    • Custom, unknown types and older SDKs (no type) → shapes (catAdb)
  • The local datasource now dedupes preferences by id, so a store sent again replaces the previous one.

MCP: list_shared_preferences returns type, and the test checks it.

Docs: protocol/shared-preferences.md, docs2/sharedpref.md (new "Preference type" section; docs/ is left as on main), docs2/mcp.md, docs2/migration.md, flocon-debug skill.

The same change for the Swift SDK is in a separate PR on openflocon/FloconSwift.

Checks run locally: :sharedprefs:jvmTest, the no-op / datastore / iOS compiles, :sample:android:assembleDebug / assembleRelease, :mcp:allTests, :data:core:allTests, :composeApp:compileKotlinDesktop, ktlintCheck. Checked in the running desktop with the Android sample (SharedPreferences, DataStore and a custom "In memory" store). Not run: mkdocs build --strict (mkdocs-material is not installed here), iOS.

/gemini review

Comment thread docs/sharedpref.md Resolved
@florent37 florent37 self-assigned this Oct 30, 2026
@florent37
florent37 marked this pull request as ready for review October 30, 2026 09:13
@florent37
florent37 merged commit cdf5cc6 into main Oct 30, 2026
3 checks passed
@florent37
florent37 deleted the feat/preferences-type branch October 30, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant