This allows the user to add different slots (sets) to an exercise, like
10 x 10kg, 8 x 12kg, 6 x 15kg. Also note that this is purely a UI change,
as it was already possible to simply add the same exercise again.
Call requestHealthDataHistoryAuthorization() on Android after initial
permission grant. Without this runtime request, Health Connect limits
data access to the last 30 days regardless of the manifest permission.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the 30-day lookback limit on initial sync. Pull all available
weight data from Health Connect on first enable. Add
READ_HEALTH_DATA_HISTORY permission to AndroidManifest to allow
reading data older than 30 days.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add healthSync, healthSyncDescription, healthSyncSuccess, and health
keys to app_en.arb and use AppLocalizations instead of hardcoded
English strings in the settings tile and settings page.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use existing isSameDayAs() extension in findByDate() instead of
manual year/month/day comparison
- Build a Set of existing timestamps for O(1) dedup lookups instead
of O(n*m) .any() scan per data point
- Simplify nullable bool check (_isAvailable != true)
- Remove comments that restate the code
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Pass isMetric to enableSync() so the initial sync from the settings
toggle converts kg to lb when the user's profile is set to lb
- Refresh BodyWeightProvider after sync from settings tile so the
dashboard and weight screen update immediately
- Fix DashboardWeightWidget to compute sensibleRange() inside the
Consumer builder so it rebuilds when weight data changes
- Add permission check in syncOnAppOpen() for app restart scenarios
- Add unit tests for weight conversion logic and HealthSyncState
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
sqlite3_flutter_libs 0.6.0+eol no longer bundles the native SQLite
library correctly on newer Android toolchains, causing a
DriftRemoteException on startup (dlopen failed: libsqlite3.so not found).
Replace it with drift_flutter which is the current recommended package
for providing native SQLite to drift databases. Also suppress the
StackFrame assertion error from the stack_trace package that was masking
the real error.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Show "Weight (kg)" or "Weight (lb)" on the weight entry form based on
the user's profile preference
- Convert health sync values from kg to lb before POSTing when the user's
profile is set to lb
- Check/request health permissions on sync to handle app restart
- Fix weight form tests to provide UserProvider mock
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Import body weight data from Apple Health (iOS) and Google Health Connect
(Android) into wger when the app is opened. Uses the Flutter `health` package
for cross-platform access. Feature is opt-in via a settings toggle.
Key changes:
- Add HealthSyncNotifier (Riverpod) for sync orchestration
- Add HealthSyncSettingsTile in settings page
- Add health package dependency and platform permissions
- Fix WeightEntry.copyWith parameter type (int? -> num?)
- Fix BodyWeightProvider.findByDate() to use calendar-date comparison
- Raise Android minSdkVersion to 26 (Health Connect requirement)
- Change MainActivity to extend FlutterFragmentActivity
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>