|
|
@ -174,6 +174,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|
|
|
_loginClientCandidate = null;
|
|
|
|
_loginClientCandidate = null;
|
|
|
|
FluffyChatApp.router.go('/rooms');
|
|
|
|
FluffyChatApp.router.go('/rooms');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
if (widget.clients.isEmpty) widget.clients.add(candidate);
|
|
|
|
return candidate;
|
|
|
|
return candidate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -282,12 +283,12 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|
|
|
onLoginStateChanged[name] ??= c.onLoginStateChanged.stream.listen((state) {
|
|
|
|
onLoginStateChanged[name] ??= c.onLoginStateChanged.stream.listen((state) {
|
|
|
|
final loggedInWithMultipleClients = widget.clients.length > 1;
|
|
|
|
final loggedInWithMultipleClients = widget.clients.length > 1;
|
|
|
|
if (state == LoginState.loggedOut) {
|
|
|
|
if (state == LoginState.loggedOut) {
|
|
|
|
InitWithRestoreExtension.deleteSessionBackup(name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (loggedInWithMultipleClients && state != LoginState.loggedIn) {
|
|
|
|
|
|
|
|
_cancelSubs(c.clientName);
|
|
|
|
_cancelSubs(c.clientName);
|
|
|
|
widget.clients.remove(c);
|
|
|
|
widget.clients.remove(c);
|
|
|
|
ClientManager.removeClientNameFromStore(c.clientName, store);
|
|
|
|
ClientManager.removeClientNameFromStore(c.clientName, store);
|
|
|
|
|
|
|
|
InitWithRestoreExtension.deleteSessionBackup(name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (loggedInWithMultipleClients && state != LoginState.loggedIn) {
|
|
|
|
ScaffoldMessenger.of(
|
|
|
|
ScaffoldMessenger.of(
|
|
|
|
FluffyChatApp.router.routerDelegate.navigatorKey.currentContext ??
|
|
|
|
FluffyChatApp.router.routerDelegate.navigatorKey.currentContext ??
|
|
|
|
context,
|
|
|
|
context,
|
|
|
@ -379,12 +380,14 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|
|
|
Logs().v('AppLifecycleState = $state');
|
|
|
|
Logs().v('AppLifecycleState = $state');
|
|
|
|
final foreground = state != AppLifecycleState.inactive &&
|
|
|
|
final foreground = state != AppLifecycleState.inactive &&
|
|
|
|
state != AppLifecycleState.paused;
|
|
|
|
state != AppLifecycleState.paused;
|
|
|
|
client.syncPresence =
|
|
|
|
for (final client in widget.clients) {
|
|
|
|
state == AppLifecycleState.resumed ? null : PresenceType.unavailable;
|
|
|
|
client.syncPresence =
|
|
|
|
if (PlatformInfos.isMobile) {
|
|
|
|
state == AppLifecycleState.resumed ? null : PresenceType.unavailable;
|
|
|
|
client.backgroundSync = foreground;
|
|
|
|
if (PlatformInfos.isMobile) {
|
|
|
|
client.requestHistoryOnLimitedTimeline = !foreground;
|
|
|
|
client.backgroundSync = foreground;
|
|
|
|
Logs().v('Set background sync to', foreground);
|
|
|
|
client.requestHistoryOnLimitedTimeline = !foreground;
|
|
|
|
|
|
|
|
Logs().v('Set background sync to', foreground);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|