feat(app): phone onboarding (server, then password) kept across launches; a known server opens straight into the app; a refused session asks for the password
This commit is contained in:
@@ -18,9 +18,16 @@ enum RunSubscriptionState { pending, live, refused }
|
||||
/// `subscribe` on every connected transition because a new socket has no
|
||||
/// watch, and drops it deliberately with `unsubscribe` when the app stops.
|
||||
class AppSession extends ChangeNotifier {
|
||||
AppSession({required Uri? endpoint, PipelinesClient? client})
|
||||
: _initialEndpoint = endpoint,
|
||||
_client = client ?? PipelinesClient() {
|
||||
/// [knownServer]: this device has signed in to [endpoint] before, so the
|
||||
/// app opens straight away and reconnects behind a banner instead of the
|
||||
/// full connection screen.
|
||||
AppSession({
|
||||
required Uri? endpoint,
|
||||
PipelinesClient? client,
|
||||
bool knownServer = false,
|
||||
}) : _initialEndpoint = endpoint,
|
||||
_client = client ?? PipelinesClient(),
|
||||
_everConnected = knownServer {
|
||||
_states = _client.states.listen(_onState);
|
||||
_frames = _client.frames.listen(_onFrame);
|
||||
}
|
||||
@@ -30,7 +37,8 @@ class AppSession extends ChangeNotifier {
|
||||
late final StreamSubscription<ConnectionState> _states;
|
||||
late final StreamSubscription<JsonMap> _frames;
|
||||
ConnectionState _connection = const ConnectionState(ConnectionKind.idle);
|
||||
bool _subscribed = false, _disposed = false, _everConnected = false;
|
||||
bool _subscribed = false, _disposed = false;
|
||||
bool _everConnected;
|
||||
int _connectionEpoch = 0;
|
||||
RunSubscriptionState _subscription = RunSubscriptionState.pending;
|
||||
String _subscriptionError = '';
|
||||
|
||||
Reference in New Issue
Block a user