mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-20 02:59:26 +01:00
fix: Setup push on chat list init
This commit is contained in:
parent
d6d0325e85
commit
4bddd4a77f
@ -360,6 +360,7 @@ class ChatListController extends State<ChatList>
|
|||||||
});
|
});
|
||||||
|
|
||||||
_checkTorBrowser();
|
_checkTorBrowser();
|
||||||
|
Matrix.of(context).backgroundPush?.setupPush();
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,6 @@ class BackgroundPush {
|
|||||||
bool upAction = false;
|
bool upAction = false;
|
||||||
|
|
||||||
BackgroundPush._(this.client) {
|
BackgroundPush._(this.client) {
|
||||||
onLogin ??=
|
|
||||||
client.onLoginStateChanged.stream.listen(handleLoginStateChanged);
|
|
||||||
onRoomSync ??= client.onSync.stream
|
onRoomSync ??= client.onSync.stream
|
||||||
.where((s) => s.hasRoomUpdate)
|
.where((s) => s.hasRoomUpdate)
|
||||||
.listen((s) => _onClearingPush(getFromServer: false));
|
.listen((s) => _onClearingPush(getFromServer: false));
|
||||||
@ -123,7 +121,6 @@ class BackgroundPush {
|
|||||||
|
|
||||||
void handleLoginStateChanged(_) => setupPush();
|
void handleLoginStateChanged(_) => setupPush();
|
||||||
|
|
||||||
StreamSubscription<LoginState>? onLogin;
|
|
||||||
StreamSubscription<SyncUpdate>? onRoomSync;
|
StreamSubscription<SyncUpdate>? onRoomSync;
|
||||||
|
|
||||||
void _newFcmToken(String token) {
|
void _newFcmToken(String token) {
|
||||||
|
@ -78,7 +78,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||||||
String? loginUsername;
|
String? loginUsername;
|
||||||
bool? loginRegistrationSupported;
|
bool? loginRegistrationSupported;
|
||||||
|
|
||||||
BackgroundPush? _backgroundPush;
|
BackgroundPush? backgroundPush;
|
||||||
|
|
||||||
Client get client {
|
Client get client {
|
||||||
if (widget.clients.isEmpty) {
|
if (widget.clients.isEmpty) {
|
||||||
@ -397,7 +397,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PlatformInfos.isMobile) {
|
if (PlatformInfos.isMobile) {
|
||||||
_backgroundPush = BackgroundPush(
|
backgroundPush = BackgroundPush(
|
||||||
client,
|
client,
|
||||||
context,
|
context,
|
||||||
widget.router,
|
widget.router,
|
||||||
@ -444,7 +444,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||||||
client.requestHistoryOnLimitedTimeline = !foreground;
|
client.requestHistoryOnLimitedTimeline = !foreground;
|
||||||
if (_firstStartup) {
|
if (_firstStartup) {
|
||||||
_firstStartup = false;
|
_firstStartup = false;
|
||||||
_backgroundPush?.setupPush();
|
backgroundPush?.setupPush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,7 +514,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||||||
client.httpClient.close();
|
client.httpClient.close();
|
||||||
onFocusSub?.cancel();
|
onFocusSub?.cancel();
|
||||||
onBlurSub?.cancel();
|
onBlurSub?.cancel();
|
||||||
_backgroundPush?.onLogin?.cancel();
|
backgroundPush?.onRoomSync?.cancel();
|
||||||
|
|
||||||
linuxNotifications?.close();
|
linuxNotifications?.close();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user