mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 23:07:15 +01:00
Five apps had copied google_sign_in_backend.dart; home_inventory's copy was byte-identical to todo's. lyricanki was about to become the sixth, which is the mistake this package exists to prevent. So the plugin call moves here. Desktop is the new half. google_sign_in ships android, ios and web implementations only -- there is no google_sign_in_linux -- so lyricanki's real GTK build could never have used the plugin, and "one tap" would have meant "one tap on the phone, type a password on the PC". The OAuth loopback flow covers it: bind a socket, open the system browser, catch the redirect, exchange the code with PKCE. Both halves return a Google ID token of the same shape, so signInWithGoogle cannot tell them apart. googleSignInSupported takes the client id rather than reading a const. In todo the emptiness check was a second conjunct at the call site, and moving the fetcher here without it would have let a forgetful app ship a button that always reports "cancelled" -- todo's own file documents that failure. Taking the value as an argument makes the check impossible to drop. The decision (which flow, or none) is pure and covered; the two one-line delegations that reach a platform channel and a real browser are the only suppressions. 83 tests, 100% coverage. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CFSGeWxHPY5rHUGrPqhcmG
22 lines
834 B
Dart
22 lines
834 B
Dart
/// The Flutter half of `crdt_sync`.
|
|
///
|
|
/// `crdt_sync` is pure Dart so it can run from CLI tools and headless
|
|
/// systemd jobs. That leaves every Flutter app to write the same glue:
|
|
/// a `flutter_secure_storage` adapter, a persisted device id, an account
|
|
/// store, and a client-opening function. Four apps had copied it, and the
|
|
/// copies had drifted -- `todo` carried an opt-out flag and a seeded-session
|
|
/// path the others never received.
|
|
///
|
|
/// This package owns that glue. A new app needs a [SyncApp] and one call to
|
|
/// [openSync]; see the README.
|
|
library;
|
|
|
|
export 'src/account_store.dart';
|
|
export 'src/bootstrap.dart';
|
|
export 'src/device_id.dart';
|
|
export 'src/google_any_sign_in.dart';
|
|
export 'src/google_desktop_sign_in.dart';
|
|
export 'src/google_pkce.dart';
|
|
export 'src/google_sign_in.dart';
|
|
export 'src/keystore.dart';
|