44 Commits

Author SHA1 Message Date
Roland Geider
9333afd38e Keep the session while the iOS keychain is locked
Closes #1417
2026-11-12 20:30:22 +01:00
Roland Geider
64c3c46e53 Merge branch 'pr-1280'
# Conflicts:
#	lib/features/routines/providers/gym_state_notifier.g.dart
2026-10-29 19:48:08 +01:00
Roland Geider
d7498bc18f Regenerate code after the json_serializable and mockito bumps 2026-10-26 22:48:24 +01:00
Roland Geider
999ac4b546 Drop the stored workout progress with the local data 2026-10-26 22:39:19 +01:00
Roland Geider
bdf4fa7174 Treat raw OSErrors as network errors
On iOS, dart:io fails setting TCP_NODELAY on a connection that was
already reset and throws a plain OSError instead of a SocketException.
The reachability probe rethrew it and the app showed an error dialog.

Closes #1397
2026-10-21 09:24:17 +02:00
Roland Geider
104b4ee71b Treat a pre-release server as below its release 2026-09-27 01:06:32 +02:00
Roland Geider
233a3c8312 Regenerate code for freezed 4 and drop field @override 2026-09-26 23:18:36 +02:00
Roland Geider
1b121ff22c Merge branch 'pr-1332-probe' into feat/upgrade-flutter-1316 2026-09-26 22:08:32 +02:00
Roland Geider
31783745f2 Ask the probe for a body before treating a 403 as a rejection 2026-09-06 16:00:57 +02:00
Roland Geider
25e3e6485e Anchor the access token lifetime to the local clock 2026-09-06 15:51:18 +02:00
Roland Geider
c46763ffd0 Renew an expired access token before the first-time probe 2026-09-06 15:51:18 +02:00
Roland Geider
e701519d8f Keep the session through a failed or transient token refresh 2026-09-06 15:48:13 +02:00
Roland Geider
48dc290224 Renew an expired token instead of dropping the upload 2026-09-06 15:48:13 +02:00
Roland Geider
5c52b3481b Improve semver checks for min server version 2026-09-06 15:26:10 +02:00
pankaj-basnet
5ab92f73cb test: align test imports for material_ui package usage 2026-09-01 21:30:57 +05:45
Roland Geider
9e9f2b1fbf Time out hanging token fetches instead of freezing the sync 2026-08-28 10:48:22 +02:00
Roland Geider
6096eadb37 Split up auth provider 2026-08-25 14:51:08 +02:00
Roland Geider
f6ff275526 Replace the revalidation listeners instead of stacking them 2026-08-25 14:04:01 +02:00
Roland Geider
6f23e492bb Pass the 401 through when a refresh could not deliver a new token 2026-08-25 13:32:51 +02:00
Roland Geider
ed65a0e42c Discard a token refresh that outlives its session 2026-08-24 22:56:29 +02:00
Roland Geider
185e5341ba Merge remote-tracking branch 'origin/master' into feature/release-2.7 2026-08-21 22:37:02 +02:00
Roland Geider
de758b5dfa Final fixes 2026-08-21 17:42:28 +02:00
Roland Geider
2a596349df Report reachability from the bottom of the client stack 2026-08-21 16:04:52 +02:00
Roland Geider
a0fd3ad0e2 Make one provider the single Connectivity consumer 2026-08-21 15:29:52 +02:00
Roland Geider
9cb25ad538 Guard the probe pass against a mid-flight invalidation 2026-08-21 15:10:01 +02:00
Roland Geider
74fbb9db95 Coalesce overlapping reachability probes 2026-08-21 14:51:09 +02:00
Roland Geider
9a97202dd4 Cleanup 2026-08-14 17:37:47 +02:00
Roland Geider
6e5555fe2f Mark the probe as in flight before the connectivity lookup 2026-08-14 16:09:32 +02:00
Roland Geider
a986091ab8 Make the network status follow real traffic instead of a 1s probe 2026-08-14 15:20:45 +02:00
Roland Geider
5e332e18aa Connect PowerSync on the adapter state, not on the reachability probe 2026-08-14 14:52:49 +02:00
Roland Geider
4fd83ce202 Merge PR #1309 (remove old API token exchange) for 2.7 integration testing
# Conflicts:
#	lib/core/network/network_provider.g.dart
#	lib/database/powersync/powersync.g.dart
2026-08-13 14:10:24 +02:00
Ben Tucker
57fe12677c fix(auth): do not await PowerSync disconnect during session clear
A rejected refresh token runs clearSessionOnly inside the single-flight
refresh future. PowerSync's disconnect can block on an in-flight sync
fetch that is itself awaiting that same refresh future through
AuthHttpClient's pre-emptive refresh, closing a three-party cycle
(refresh -> disconnect -> sync fetch -> refresh) that permanently wedges
every authenticated request behind the never-completing refresh. The
session-expired message never appears because it is sequenced after the
hanging call, and an app restart re-triggers the same rejected refresh
during startup revalidation, so the deadlock re-forms immediately.

On the keep-data path the DB is not wiped, so there is no re-attach race
to guard against; the disconnect is only a courtesy stop of the sync
loop and is now fire-and-forget. The wipe path (explicit logout) keeps
its ordering. The disconnect hook is injectable for tests because
PowerSyncDatabase is a base class that cannot be faked.
2026-08-12 19:08:24 -05:00
Roland Geider
024d6f246c Consolidate the test helpers in test/helpers/ 2026-08-10 12:40:16 +02:00
Roland Geider
bb5eb344b0 Repair tests that could not fail 2026-08-10 11:43:23 +02:00
Roland Geider
15fd579d15 Repair tests that could not fail 2026-08-10 11:04:23 +02:00
Roland Geider
3a05492528 Pin the watchdog replay case and the 403 auth semantics 2026-08-10 09:58:53 +02:00
Roland Geider
fb05d1e872 Log network state changes and the sync connection 2026-08-09 22:43:40 +02:00
Roland Geider
7b6306703b Remove old API token exchange 2026-08-09 21:04:49 +02:00
Roland Geider
914e9ac575 Surface involuntary logouts and revalidate the session on app resume
This makes it obvious why users are redirected to the auth screen, since the
snackbar could be easily missed.

See #1265
2026-07-30 15:47:04 +02:00
Roland Geider
3ee512fd6c More intelligent powersync service URL handling
When the server-provided powersync URL is not reachable, try using $server-url/ps/.
This should help with self-hosted instances where SITE_URL points to localhost
or other similar misconfigurations

See https://github.com/wger-project/wger/issues/2432
2026-07-28 15:06:34 +02:00
Roland Geider
ed623f9108 Improve PowerSync sync diagnostics and token expiry handling 2026-07-23 13:58:06 +02:00
Roland Geider
938001b152 Optimistically set the online status
This avoids having the app register as "offline" after bringing it back from
the background
2026-07-17 21:31:29 +02:00
Roland Geider
2158075e12 Merge base_provider_extra_test into base_provider_test
Both were testing the same thing
2026-07-01 22:51:01 +02:00
Roland Geider
60c9f67282 Move shared infra to lib/core/ 2026-07-01 20:28:06 +02:00