Present full room error differently
This commit is contained in:
parent
71e710c777
commit
d8dc864616
2 changed files with 10 additions and 17 deletions
|
|
@ -13,6 +13,7 @@ import 'package:fluffychat/pangea/utils/error_handler.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import '../../widgets/matrix.dart';
|
||||
|
|
@ -149,11 +150,15 @@ class ClassController extends BaseController {
|
|||
if (room == null) {
|
||||
return;
|
||||
}
|
||||
if ((await room.leaveIfFull())) {
|
||||
ClassCodeUtil.messageSnack(
|
||||
context,
|
||||
L10n.of(context)!.roomFull,
|
||||
);
|
||||
final joinResult = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () async {
|
||||
if (await room.leaveIfFull()) {
|
||||
throw L10n.of(context)!.roomFull;
|
||||
}
|
||||
},
|
||||
);
|
||||
if (joinResult.error != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,9 @@ import 'dart:async';
|
|||
|
||||
import 'package:fluffychat/pangea/enum/construct_type_enum.dart';
|
||||
import 'package:fluffychat/pangea/extensions/client_extension/client_extension.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/base_analytics_view.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/student_analytics/student_analytics.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
|
|
@ -121,16 +119,6 @@ class BaseAnalyticsController extends State<BaseAnalyticsPage> {
|
|||
);
|
||||
await Matrix.of(context).client.joinRoom(selectedParam.id);
|
||||
await waitForRoom;
|
||||
final room = Matrix.of(context).client.getRoomById(selectedParam.id);
|
||||
if (room != null && (await room.leaveIfFull())) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
duration: const Duration(seconds: 10),
|
||||
content: Text(L10n.of(context)!.roomFull),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue