Commit 927b3dd9 authored by Wilko Manger's avatar Wilko Manger

Don't start sync in the chat overview page

Fixes PATTLE-G7.
parent bbf08095
......@@ -21,6 +21,7 @@ import 'package:meta/meta.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/sentry.dart';
import 'package:pattle/src/ui/main/sync_bloc.dart';
import 'package:respect_24_hour/respect_24_hour.dart';
import 'package:rxdart/rxdart.dart';
import 'package:pattle/src/di.dart' as di;
......@@ -69,8 +70,8 @@ class AppBloc {
final loggedIn = localUser != null;
_loggedInSubj.add(loggedIn);
if (loggedIn && await getMayReportCrashes()) {
sentry = await Sentry.create();
if (loggedIn) {
await notifyLogin();
}
}
......@@ -78,6 +79,8 @@ class AppBloc {
if (await getMayReportCrashes() && sentry == null) {
sentry = await Sentry.create();
}
await syncBloc.start();
}
void wrap(Function run) => runZoned<Future<void>>(
......
......@@ -110,12 +110,9 @@ class ChatOverviewBloc {
_chatsSubj.add(List.of(chats.reversed));
}
Future<void> startSync() async {
// Load from store before sync
Future<void> loadAndListen() async {
await loadChats();
await syncBloc.start();
syncBloc.stream.listen((state) async => await loadChats());
}
}
......@@ -40,7 +40,7 @@ class ChatOverviewPageState extends State<ChatOverviewPage> {
void initState() {
super.initState();
bloc.startSync();
bloc.loadAndListen();
}
@override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment