Skip to content

Create SafeBox Playground in :app module with Dispatcher Toggle and Text Persistence #43

@harrytmthy

Description

@harrytmthy

Background

This playground serves both contributors and users:

  • Helps newcomers understand SafeBox's threading behavior.
  • Verifies lifecycle correctness and OnSharedPreferenceChangeListener support.
  • Aids in debugging performance, concurrency, and cryptographic internals.
  • Lays the groundwork for future observability features.

Goal

Introduce a minimal Jetpack Compose-based :app module that serves as an interactive SafeBox Playground:

UI Features

  • Key input field

  • Value input field

  • Switch: Toggles between Apply/Commit Mode.

  • Buttons:

    • Validate Key: Calls safeBox.contains(key) and shows a snackbar with the result.
    • Get: Calls safeBox.getString(...) then updates Value field with result (default: null).
    • Put: Starts safeBox.edit() (if needed) then calls editor.putString(key, value).
    • Clear: Starts safeBox.edit() (if needed) then calls editor.clear().
    • Apply / Commit: Triggers apply/commit towards the staged changes. Shows a snackbar if no edits are staged.
  • Dispatcher Toggle:
    Choose coroutine context for safeBox.getString(...) between Main, IO, or Default.

  • Staged Changes View:
    Displays all pending (uncommitted) key-value pairs.

  • Committed Entries View:
    Displays current key-value pairs from safeBox.getAll(), auto-updated via OnSharedPreferenceChangeListener.


MVP Scope

  • Built with Jetpack Compose (preferred for future UI benchmarking).
  • Clean, unidirectional architecture with MVVM/MVI.
  • No Gradle script changes unless necessary.
  • No metrics/benchmarking tools for now.
  • No DI or Hilt/Koin setup required.

Future Ideas (Not part of MVP)

  • Add Choreographer-based frame skip detection.
  • Visualize read/write durations.
  • Monitor CipherPool size and idle lifespan.
  • Simulate race conditions for educational purposes.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions