fix for freezing after joining space
This commit is contained in:
parent
70e085e4f0
commit
e4ceb91757
2 changed files with 46 additions and 40 deletions
|
|
@ -64,13 +64,17 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
void _refresh() {
|
||||
// #Pangea
|
||||
// _lastResponse.remove(widget.controller.activseSpaceId);
|
||||
if (mounted) {
|
||||
// Pangea#
|
||||
loadHierarchy();
|
||||
// #Pangea
|
||||
}
|
||||
// Pangea#
|
||||
loadHierarchy();
|
||||
}
|
||||
|
||||
Future<GetSpaceHierarchyResponse> 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<SpaceView> {
|
|||
});
|
||||
rethrow;
|
||||
} finally {
|
||||
// #Pangea
|
||||
if (mounted) {
|
||||
// Pangea#
|
||||
setState(() {
|
||||
loading = false;
|
||||
});
|
||||
// #Pangea
|
||||
}
|
||||
// Pangea#
|
||||
setState(() {
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -378,6 +376,31 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
_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<SpaceView> {
|
|||
}
|
||||
|
||||
// #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<SpaceView> {
|
|||
),
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -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?
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue