simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -67,7 +67,12 @@ class ShareChatPicker extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final talkSettings = context.watch<SettingsCubit>().val().talkSettings;
|
||||
final (favoritesToTop, unreadToTop) = context.select(
|
||||
(SettingsCubit c) => (
|
||||
c.state.talkSettings.sortFavoritesToTop,
|
||||
c.state.talkSettings.sortUnreadToTop,
|
||||
),
|
||||
);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Talk-Chat auswählen'),
|
||||
@@ -100,8 +105,8 @@ class ShareChatPicker extends StatelessWidget {
|
||||
if (rooms == null) return const SizedBox.shrink();
|
||||
final sorted = rooms
|
||||
.sortBy(
|
||||
favoritesToTop: talkSettings.sortFavoritesToTop,
|
||||
unreadToTop: talkSettings.sortUnreadToTop,
|
||||
favoritesToTop: favoritesToTop,
|
||||
unreadToTop: unreadToTop,
|
||||
)
|
||||
// Hide chats the user can't write to (announcement channels,
|
||||
// archived rooms, …) — uploading there would only fail at the
|
||||
@@ -195,8 +200,8 @@ Future<void> _runShareFlow(
|
||||
try {
|
||||
await action();
|
||||
} catch (e) {
|
||||
if (context.mounted) Navigator.of(context).pop();
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
InfoDialog.show(
|
||||
context,
|
||||
errorToUserMessage(e),
|
||||
|
||||
Reference in New Issue
Block a user