diff --git a/lib/pages/chat/chat_view.dart b/lib/pages/chat/chat_view.dart index a72f45890..e5f566dcb 100644 --- a/lib/pages/chat/chat_view.dart +++ b/lib/pages/chat/chat_view.dart @@ -237,34 +237,31 @@ class ChatView extends StatelessWidget { // #Pangea : controller.widget.backButton != null ? controller.widget.backButton! + // : FluffyThemes.isColumnMode(context) + // ? null // Pangea# - : FluffyThemes.isColumnMode(context) - ? null - : StreamBuilder( - stream: Matrix.of(context) - .client - .onSync - .stream - .where( + : StreamBuilder( + stream: + Matrix.of(context).client.onSync.stream.where( (syncUpdate) => syncUpdate.hasRoomUpdate, ), - // #Pangea - // builder: (context, _) => UnreadRoomsBadge( - builder: (context, _) => Center( - child: SizedBox( - height: kToolbarHeight, - child: UnreadRoomsBadge( - // Pangea# - filter: (r) => r.id != controller.roomId, - badgePosition: BadgePosition.topEnd( - end: 8, - top: 4, - ), - child: const Center(child: BackButton()), - ), + // #Pangea + // builder: (context, _) => UnreadRoomsBadge( + builder: (context, _) => Center( + child: SizedBox( + height: kToolbarHeight, + child: UnreadRoomsBadge( + // Pangea# + filter: (r) => r.id != controller.roomId, + badgePosition: BadgePosition.topEnd( + end: 8, + top: 4, ), + child: const Center(child: BackButton()), ), ), + ), + ), titleSpacing: FluffyThemes.isColumnMode(context) ? 24 : 0, title: ChatAppBarTitle(controller), actions: _appBarActions(context), diff --git a/lib/pangea/chat_settings/pages/pangea_invitation_selection.dart b/lib/pangea/chat_settings/pages/pangea_invitation_selection.dart index f36406701..abcbf06c4 100644 --- a/lib/pangea/chat_settings/pages/pangea_invitation_selection.dart +++ b/lib/pangea/chat_settings/pages/pangea_invitation_selection.dart @@ -194,6 +194,10 @@ class PangeaInvitationSelectionController if (a.id == client.userID) return -1; if (b.id == client.userID) return 1; + // sort the bot to the top + if (a.id == BotName.byEnvironment) return -1; + if (b.id == BotName.byEnvironment) return 1; + if (participants != null) { final participantA = participants!.firstWhereOrNull((u) => u.id == a.id); final participantB = participants!.firstWhereOrNull((u) => u.id == b.id); @@ -264,25 +268,27 @@ class PangeaInvitationSelectionController ) .toList(); - contacts.removeWhere((u) => u.id == BotName.byEnvironment); + if (_room?.isSpace ?? false) { + contacts.removeWhere((u) => u.id == BotName.byEnvironment); + } contacts.sort(_sortUsers); return contacts; } List getContacts(BuildContext context) { final client = Matrix.of(context).client; - participants!.removeWhere( - (u) => ![Membership.join, Membership.invite].contains(u.membership), - ); final contacts = client.rooms .where((r) => r.isDirectChat) .map((r) => r.unsafeGetUserFromMemoryOrFallback(r.directChatMatrixID!)) .toList(); - contacts.sort( - (a, b) => a.calcDisplayname().toLowerCase().compareTo( - b.calcDisplayname().toLowerCase(), - ), - ); + + if (_room?.isSpace == false && + !contacts.any((u) => u.id == BotName.byEnvironment)) { + final bot = _room?.unsafeGetUserFromMemoryOrFallback( + BotName.byEnvironment, + ); + if (bot != null) contacts.add(bot); + } return contacts; } @@ -341,7 +347,9 @@ class PangeaInvitationSelectionController } final results = response.results; - results.removeWhere((profile) => profile.userId == BotName.byEnvironment); + if (_room?.isSpace ?? false) { + results.removeWhere((profile) => profile.userId == BotName.byEnvironment); + } setState(() { foundProfiles = List.from(results); @@ -364,8 +372,7 @@ class PangeaInvitationSelectionController foundProfiles.removeWhere( (profile) => - participants?.indexWhere((u) => u.id == profile.userId) != -1 || - BotName.byEnvironment == profile.userId, + participants?.indexWhere((u) => u.id == profile.userId) != -1, ); }); } diff --git a/pubspec.yaml b/pubspec.yaml index e64febf56..9c3f86aa9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ description: Learn a language while texting your friends. # Pangea# publish_to: none # On version bump also increase the build number for F-Droid -version: 4.1.15+5 +version: 4.1.15+6 environment: sdk: ">=3.0.0 <4.0.0"