mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 11:45:10 +00:00
fix: Report sync status error
This commit is contained in:
parent
b5ba39eedd
commit
5983c83fcf
4 changed files with 66 additions and 52 deletions
|
@ -22,57 +22,60 @@ class SpacesBottomBar extends StatelessWidget {
|
||||||
return Material(
|
return Material(
|
||||||
color: Theme.of(context).appBarTheme.backgroundColor,
|
color: Theme.of(context).appBarTheme.backgroundColor,
|
||||||
elevation: 6,
|
elevation: 6,
|
||||||
child: StreamBuilder<Object>(
|
child: SafeArea(
|
||||||
stream: Matrix.of(context).client.onSync.stream.where((sync) =>
|
child: StreamBuilder<Object>(
|
||||||
(sync.rooms?.join?.values?.any((r) =>
|
stream: Matrix.of(context).client.onSync.stream.where((sync) =>
|
||||||
r.state?.any((s) => s.type.startsWith('m.space'))) ??
|
(sync.rooms?.join?.values?.any((r) =>
|
||||||
false) ||
|
r.state?.any((s) => s.type.startsWith('m.space'))) ??
|
||||||
(sync.rooms?.leave?.isNotEmpty ?? false)),
|
false) ||
|
||||||
builder: (context, snapshot) {
|
(sync.rooms?.leave?.isNotEmpty ?? false)),
|
||||||
return Container(
|
builder: (context, snapshot) {
|
||||||
height: 56,
|
return Container(
|
||||||
alignment: Alignment.center,
|
height: 56,
|
||||||
child: SingleChildScrollView(
|
alignment: Alignment.center,
|
||||||
scrollDirection: Axis.horizontal,
|
child: SingleChildScrollView(
|
||||||
child: SalomonBottomBar(
|
scrollDirection: Axis.horizontal,
|
||||||
itemPadding: const EdgeInsets.all(8),
|
child: SalomonBottomBar(
|
||||||
currentIndex: currentIndex,
|
itemPadding: const EdgeInsets.all(8),
|
||||||
onTap: (i) => controller.setActiveSpaceId(
|
currentIndex: currentIndex,
|
||||||
context,
|
onTap: (i) => controller.setActiveSpaceId(
|
||||||
i == 0 ? null : controller.spaces[i - 1].id,
|
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),
|
|
||||||
),
|
),
|
||||||
...controller.spaces
|
selectedItemColor: Theme.of(context).colorScheme.primary,
|
||||||
.map((space) => SalomonBottomBarItem(
|
items: [
|
||||||
icon: InkWell(
|
SalomonBottomBarItem(
|
||||||
borderRadius: BorderRadius.circular(28),
|
icon: const Icon(CupertinoIcons.chat_bubble_2),
|
||||||
onTap: () => controller.setActiveSpaceId(
|
activeIcon:
|
||||||
context,
|
const Icon(CupertinoIcons.chat_bubble_2_fill),
|
||||||
space.id,
|
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: () =>
|
title: Text(space.displayname),
|
||||||
controller.editSpace(context, space.id),
|
))
|
||||||
child: Avatar(
|
.toList(),
|
||||||
mxContent: space.avatar,
|
],
|
||||||
name: space.displayname,
|
),
|
||||||
size: 24,
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
title: Text(space.displayname),
|
|
||||||
))
|
|
||||||
.toList(),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
}),
|
||||||
}),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,11 +290,19 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
utf8.decode((await http.get(Uri.parse('config.json'))).bodyBytes);
|
utf8.decode((await http.get(Uri.parse('config.json'))).bodyBytes);
|
||||||
final configJson = json.decode(configJsonString);
|
final configJson = json.decode(configJsonString);
|
||||||
AppConfig.loadFromJson(configJson);
|
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);
|
Logs().v('[ConfigLoader] config.json not found', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _reportSyncError(SyncStatusUpdate update) =>
|
||||||
|
SentryController.captureException(
|
||||||
|
update.error.exception,
|
||||||
|
update.error.stackTrace,
|
||||||
|
);
|
||||||
|
|
||||||
void _registerSubs(String name) {
|
void _registerSubs(String name) {
|
||||||
final c = getClientByName(name);
|
final c = getClientByName(name);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
|
@ -302,6 +310,9 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
'Attempted to register subscriptions for non-existing client $name');
|
'Attempted to register subscriptions for non-existing client $name');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
c.onSyncStatus.stream
|
||||||
|
.where((s) => s.status == SyncStatus.error)
|
||||||
|
.listen(_reportSyncError);
|
||||||
onKeyVerificationRequestSub[name] ??= c.onKeyVerificationRequest.stream
|
onKeyVerificationRequestSub[name] ??= c.onKeyVerificationRequest.stream
|
||||||
.listen((KeyVerification request) async {
|
.listen((KeyVerification request) async {
|
||||||
var hidPopup = false;
|
var hidPopup = false;
|
||||||
|
|
|
@ -364,7 +364,7 @@ packages:
|
||||||
name: fluffybox
|
name: fluffybox
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.1"
|
version: "0.3.2"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -782,7 +782,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "krille/idb"
|
ref: "krille/idb"
|
||||||
resolved-ref: "3045005bfb7d60d7bc9d1e5b30f42e072a60a682"
|
resolved-ref: "1714f0a35f2558a6fb56bdf6940cf2a13cdcd5dd"
|
||||||
url: "https://gitlab.com/famedly/company/frontend/famedlysdk.git"
|
url: "https://gitlab.com/famedly/company/frontend/famedlysdk.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.7.0-nullsafety.6"
|
version: "0.7.0-nullsafety.6"
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
flutter config --enable-web
|
flutter config --enable-web
|
||||||
flutter clean
|
flutter clean
|
||||||
flutter pub get
|
flutter pub get
|
||||||
flutter build web --release --verbose
|
flutter build web --release --verbose --source-maps
|
||||||
|
|
Loading…
Reference in a new issue