diff --git a/lib/pages/chat_list/space_view.dart b/lib/pages/chat_list/space_view.dart index 70f7ddfed..bc92ab4ef 100644 --- a/lib/pages/chat_list/space_view.dart +++ b/lib/pages/chat_list/space_view.dart @@ -64,13 +64,17 @@ class _SpaceViewState extends State { void _refresh() { // #Pangea // _lastResponse.remove(widget.controller.activseSpaceId); + if (mounted) { + // Pangea# + loadHierarchy(); + // #Pangea + } // Pangea# - loadHierarchy(); } Future loadHierarchy([String? prevBatch]) async { // #Pangea - if (widget.controller.activeSpaceId == null) { + if (widget.controller.activeSpaceId == null || loading) { return GetSpaceHierarchyResponse( rooms: [], nextBatch: null, @@ -108,15 +112,9 @@ class _SpaceViewState extends State { }); rethrow; } finally { - // #Pangea - if (mounted) { - // Pangea# - setState(() { - loading = false; - }); - // #Pangea - } - // Pangea# + setState(() { + loading = false; + }); } } @@ -378,6 +376,31 @@ class _SpaceViewState extends State { _refresh(); } + // #Pangea + void refreshOnUpdate(SyncUpdate event) { + /* refresh on leave, invite, and space child update + not join events, because there's already a listener on + onTapSpaceChild, and they interfere with each other */ + if (widget.controller.activeSpaceId == null || !mounted) { + return; + } + final client = Matrix.of(context).client; + if (event.isMembershipUpdateByType( + Membership.leave, + client.userID!, + ) || + event.isMembershipUpdateByType( + Membership.invite, + client.userID!, + ) || + event.isSpaceChildUpdate( + widget.controller.activeSpaceId!, + )) { + _refresh(); + } + } + // Pangea# + @override Widget build(BuildContext context) { final client = Matrix.of(context).client; @@ -482,23 +505,6 @@ class _SpaceViewState extends State { } // #Pangea - void refreshOnUpdate(SyncUpdate event) { - /* refresh on leave, invite, and space child update - not join events, because there's already a listener on - onTapSpaceChild, and they interfere with each other */ - if (event.isMembershipUpdateByType( - Membership.leave, - client.userID!, - ) || - event.isMembershipUpdateByType( - Membership.invite, - client.userID!, - ) || - event.isSpaceChildUpdate(activeSpaceId)) { - _refresh(); - } - } - _roomSubscription ??= client.onSync.stream .where((event) => event.hasRoomUpdate) .listen(refreshOnUpdate); @@ -750,15 +756,20 @@ class _SpaceViewState extends State { ), title: Row( children: [ - Expanded( - child: Text( - name, - maxLines: 1, - style: const TextStyle( - fontWeight: FontWeight.bold, - ), + // #Pangea + // Expanded( + // child: + // Pangea# + Text( + name, + maxLines: 1, + style: const TextStyle( + fontWeight: FontWeight.bold, ), ), + // #Pangea + // ), + // Pangea# if (!isSpace) ...[ const Icon( Icons.people_outline, diff --git a/lib/pangea/controllers/class_controller.dart b/lib/pangea/controllers/class_controller.dart index 7b1693ec0..a767036f7 100644 --- a/lib/pangea/controllers/class_controller.dart +++ b/lib/pangea/controllers/class_controller.dart @@ -132,11 +132,6 @@ class ClassController extends BaseController { setActiveSpaceIdInChatListController(classChunk.roomId); GoogleAnalytics.joinClass(classCode); - - ClassCodeUtil.messageSnack( - context, - L10n.of(context)!.welcomeToYourNewClass, - ); return; // P-EPIC // prereq - server needs ability to invite to private room. how?