diff --git a/lib/pages/chat_list/spaces_bottom_bar.dart b/lib/pages/chat_list/spaces_bottom_bar.dart index 9cef8027..81196972 100644 --- a/lib/pages/chat_list/spaces_bottom_bar.dart +++ b/lib/pages/chat_list/spaces_bottom_bar.dart @@ -22,57 +22,60 @@ class SpacesBottomBar extends StatelessWidget { return Material( color: Theme.of(context).appBarTheme.backgroundColor, elevation: 6, - child: StreamBuilder( - stream: Matrix.of(context).client.onSync.stream.where((sync) => - (sync.rooms?.join?.values?.any((r) => - r.state?.any((s) => s.type.startsWith('m.space'))) ?? - false) || - (sync.rooms?.leave?.isNotEmpty ?? false)), - builder: (context, snapshot) { - return Container( - height: 56, - alignment: Alignment.center, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: SalomonBottomBar( - itemPadding: const EdgeInsets.all(8), - currentIndex: currentIndex, - onTap: (i) => controller.setActiveSpaceId( - context, - i == 0 ? null : controller.spaces[i - 1].id, - ), - selectedItemColor: Theme.of(context).colorScheme.primary, - items: [ - SalomonBottomBarItem( - icon: const Icon(CupertinoIcons.chat_bubble_2), - activeIcon: const Icon(CupertinoIcons.chat_bubble_2_fill), - title: Text(L10n.of(context).allChats), + child: SafeArea( + child: StreamBuilder( + stream: Matrix.of(context).client.onSync.stream.where((sync) => + (sync.rooms?.join?.values?.any((r) => + r.state?.any((s) => s.type.startsWith('m.space'))) ?? + false) || + (sync.rooms?.leave?.isNotEmpty ?? false)), + builder: (context, snapshot) { + return Container( + height: 56, + alignment: Alignment.center, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: SalomonBottomBar( + itemPadding: const EdgeInsets.all(8), + currentIndex: currentIndex, + onTap: (i) => controller.setActiveSpaceId( + context, + i == 0 ? null : controller.spaces[i - 1].id, ), - ...controller.spaces - .map((space) => SalomonBottomBarItem( - icon: InkWell( - borderRadius: BorderRadius.circular(28), - onTap: () => controller.setActiveSpaceId( - context, - space.id, + selectedItemColor: Theme.of(context).colorScheme.primary, + items: [ + SalomonBottomBarItem( + icon: const Icon(CupertinoIcons.chat_bubble_2), + activeIcon: + const Icon(CupertinoIcons.chat_bubble_2_fill), + title: Text(L10n.of(context).allChats), + ), + ...controller.spaces + .map((space) => SalomonBottomBarItem( + icon: InkWell( + borderRadius: BorderRadius.circular(28), + onTap: () => controller.setActiveSpaceId( + context, + space.id, + ), + onLongPress: () => + controller.editSpace(context, space.id), + child: Avatar( + mxContent: space.avatar, + name: space.displayname, + size: 24, + fontSize: 12, + ), ), - onLongPress: () => - controller.editSpace(context, space.id), - child: Avatar( - mxContent: space.avatar, - name: space.displayname, - size: 24, - fontSize: 12, - ), - ), - title: Text(space.displayname), - )) - .toList(), - ], + title: Text(space.displayname), + )) + .toList(), + ], + ), ), - ), - ); - }), + ); + }), + ), ); } } diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index 002e421f..fe5da578 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -290,11 +290,19 @@ class MatrixState extends State with WidgetsBindingObserver { utf8.decode((await http.get(Uri.parse('config.json'))).bodyBytes); final configJson = json.decode(configJsonString); AppConfig.loadFromJson(configJson); - } catch (e, _) { + } on FormatException catch (_) { + Logs().v('[ConfigLoader] config.json not found'); + } catch (e) { Logs().v('[ConfigLoader] config.json not found', e); } } + void _reportSyncError(SyncStatusUpdate update) => + SentryController.captureException( + update.error.exception, + update.error.stackTrace, + ); + void _registerSubs(String name) { final c = getClientByName(name); if (c == null) { @@ -302,6 +310,9 @@ class MatrixState extends State with WidgetsBindingObserver { 'Attempted to register subscriptions for non-existing client $name'); return; } + c.onSyncStatus.stream + .where((s) => s.status == SyncStatus.error) + .listen(_reportSyncError); onKeyVerificationRequestSub[name] ??= c.onKeyVerificationRequest.stream .listen((KeyVerification request) async { var hidPopup = false; diff --git a/pubspec.lock b/pubspec.lock index c0506f02..2c8907e6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -364,7 +364,7 @@ packages: name: fluffybox url: "https://pub.dartlang.org" source: hosted - version: "0.3.1" + version: "0.3.2" flutter: dependency: "direct main" description: flutter @@ -782,7 +782,7 @@ packages: description: path: "." ref: "krille/idb" - resolved-ref: "3045005bfb7d60d7bc9d1e5b30f42e072a60a682" + resolved-ref: "1714f0a35f2558a6fb56bdf6940cf2a13cdcd5dd" url: "https://gitlab.com/famedly/company/frontend/famedlysdk.git" source: git version: "0.7.0-nullsafety.6" diff --git a/scripts/build-web.sh b/scripts/build-web.sh index 0eb50297..a136aeea 100755 --- a/scripts/build-web.sh +++ b/scripts/build-web.sh @@ -2,4 +2,4 @@ flutter config --enable-web flutter clean flutter pub get -flutter build web --release --verbose +flutter build web --release --verbose --source-maps