Skip to content

Cache ExerciseDB for offline use and add 4-week refresh prompt#40

Merged
Appp-maker merged 1 commit intomainfrom
codex/rework-exercise-fetching-to-use-local-database
Jan 3, 2026
Merged

Cache ExerciseDB for offline use and add 4-week refresh prompt#40
Appp-maker merged 1 commit intomainfrom
codex/rework-exercise-fetching-to-use-local-database

Conversation

@Appp-maker
Copy link
Copy Markdown
Owner

Motivation

  • Ensure ExerciseDB content is always available offline by downloading and storing the full dataset locally.
  • Avoid live network queries for every search and body-part fetch by switching to a cached local dataset.
  • Give users a chance to refresh the local dataset periodically by prompting about refreshes every ~4 weeks.
  • Preload the cached dataset on app startup so data is ready when the workout UI is opened.

Description

  • Reworked ExerciseDbRepository to download the full exercises dataset, save it to a cache file (exercisedb_cache.json), and serve queries from the cached list using thread-safe Mutex locking.
  • Added refresh APIs on the repository: preloadExerciseDatabase(), refreshExerciseDatabase(), and prompt helpers shouldPromptForRefresh() / recordRefreshPromptShown() / recordRefreshPromptDismissed().
  • Persisted refresh & prompt timestamps in SettingsRepository via new keys and methods (EXERCISE_DB_LAST_REFRESH, EXERCISE_DB_LAST_PROMPT, saveExerciseDbLastRefresh(), getExerciseDbLastRefresh(), saveExerciseDbLastPrompt(), getExerciseDbLastPrompt()).
  • Updated DI to provide OkHttpClient and Gson via new ExerciseDbModule, preloaded the cache from RoutineReminderApp startup, and updated WorkoutViewModel/WorkoutScreen to show a refresh AlertDialog, call refreshExerciseDatabase(), and track prompt state.

Testing

  • No automated tests were executed for this change.
  • No unit or instrumentation test runs were performed in this rollout.

Codex Task

@Appp-maker Appp-maker merged commit bd45072 into main Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant