chore: added timeout to room creation (#1971)
This commit is contained in:
parent
60fe4d122d
commit
e9bfcbe88a
2 changed files with 25 additions and 2 deletions
|
|
@ -61,6 +61,7 @@ abstract class AppConfig {
|
|||
static const Color goldLight = Color.fromARGB(255, 254, 223, 73);
|
||||
static const Color error = Colors.red;
|
||||
static const int overlayAnimationDuration = 250;
|
||||
static const int roomCreationTimeoutSeconds = 15;
|
||||
// static String _privacyUrl =
|
||||
// 'https://gitlab.com/famedly/fluffychat/-/blob/main/PRIVACY.md';
|
||||
static String _privacyUrl = "https://www.pangeachat.com/privacy";
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:go_router/go_router.dart';
|
|||
import 'package:matrix/matrix.dart' as sdk;
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pages/new_group/new_group_view.dart';
|
||||
import 'package:fluffychat/pangea/bot/utils/bot_name.dart';
|
||||
import 'package:fluffychat/pangea/common/constants/model_keys.dart';
|
||||
|
|
@ -101,6 +102,10 @@ class NewGroupController extends State<NewGroup> {
|
|||
// Pangea#
|
||||
);
|
||||
if (!mounted) return;
|
||||
// #Pangea
|
||||
// if a timeout happened, don't redirect to the chat
|
||||
if (error != null) return;
|
||||
// Pangea#
|
||||
context.go('/rooms/$roomId/invite');
|
||||
}
|
||||
|
||||
|
|
@ -155,6 +160,9 @@ class NewGroupController extends State<NewGroup> {
|
|||
data: {"spaceId": spaceId, "error": err},
|
||||
);
|
||||
}
|
||||
|
||||
// if a timeout happened, don't redirect to the space
|
||||
if (error != null) return;
|
||||
MatrixState.pangeaController.classController
|
||||
.setActiveSpaceIdInChatListController(spaceId);
|
||||
// Pangea#
|
||||
|
|
@ -206,9 +214,23 @@ class NewGroupController extends State<NewGroup> {
|
|||
|
||||
switch (createGroupType) {
|
||||
case CreateGroupType.group:
|
||||
await _createGroup();
|
||||
// #Pangea
|
||||
// await _createGroup();
|
||||
await _createGroup().timeout(
|
||||
const Duration(
|
||||
seconds: AppConfig.roomCreationTimeoutSeconds,
|
||||
),
|
||||
);
|
||||
// Pangea#
|
||||
case CreateGroupType.space:
|
||||
await _createSpace();
|
||||
// #Pangea
|
||||
// await _createSpace();
|
||||
await _createSpace().timeout(
|
||||
const Duration(
|
||||
seconds: AppConfig.roomCreationTimeoutSeconds,
|
||||
),
|
||||
);
|
||||
// Pangea#
|
||||
}
|
||||
} catch (e, s) {
|
||||
sdk.Logs().d('Unable to create group', e, s);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue