implemented a comprehensive client-side demo mode triggered by a "demo@" username prefix, serving curated fixture data for all app modules
This commit is contained in:
@@ -9,6 +9,7 @@ import '../../../../share_intent/remote_file_ref.dart';
|
||||
import '../../../../state/app/modules/chat/bloc/chat_bloc.dart';
|
||||
import '../../../../utils/downloads/download_job.dart';
|
||||
import '../../../../utils/haptics.dart';
|
||||
import '../../../../widget/demo_restricted.dart';
|
||||
import '../../../../widget/downloads/download_trigger.dart';
|
||||
import '../data/chat_bubble_styles.dart';
|
||||
import '../data/chat_message.dart';
|
||||
@@ -177,6 +178,7 @@ class _ChatBubbleState extends State<ChatBubble>
|
||||
return;
|
||||
}
|
||||
if (message.file == null) return;
|
||||
if (guardDemoAction(context)) return;
|
||||
if (isDownloading) {
|
||||
confirmCancelDownload();
|
||||
} else {
|
||||
|
||||
@@ -7,6 +7,7 @@ import '../../../../api/marianumcloud/talk/react_message/react_message.dart';
|
||||
import '../../../../api/marianumcloud/talk/react_message/react_message_params.dart';
|
||||
import '../../../../api/marianumcloud/talk/room/get_room_response.dart';
|
||||
import '../../../../widget/async_action_button.dart';
|
||||
import '../../../../widget/demo_restricted.dart';
|
||||
import '../../../../widget/emoji_text.dart';
|
||||
|
||||
/// Reactions wrap shown beneath a chat bubble. Tapping a reaction toggles
|
||||
@@ -60,6 +61,7 @@ class ChatBubbleReactions extends StatelessWidget {
|
||||
? Theme.of(context).primaryColor
|
||||
: null,
|
||||
onPressed: () {
|
||||
if (guardDemoAction(context)) return;
|
||||
runWithErrorDialog(context, () async {
|
||||
if (hasSelfReacted) {
|
||||
await DeleteReactMessage(
|
||||
|
||||
@@ -14,6 +14,7 @@ import '../../../../widget/app_progress_indicator.dart';
|
||||
import '../../../../widget/async_action_button.dart';
|
||||
import '../../../../widget/confirm_dialog.dart';
|
||||
import '../../../../widget/debug/debug_tile.dart';
|
||||
import '../../../../widget/demo_restricted.dart';
|
||||
import '../../../../widget/details_bottom_sheet.dart';
|
||||
import '../../../../widget/emoji_picker_dialog.dart';
|
||||
import '../../../../widget/emoji_text.dart';
|
||||
@@ -64,6 +65,7 @@ void showChatMessageOptionsDialog(
|
||||
leading: const Icon(Icons.reply_outlined),
|
||||
title: const Text('Antworten'),
|
||||
onTap: () {
|
||||
if (guardDemoAction(sheetCtx)) return;
|
||||
sheetCtx.read<ChatBloc>().setReferenceMessageId(bubbleData.id);
|
||||
Navigator.of(sheetCtx).pop();
|
||||
},
|
||||
@@ -96,6 +98,7 @@ void showChatMessageOptionsDialog(
|
||||
leading: const Icon(Icons.cloud_outlined),
|
||||
title: const Text('In Cloud speichern'),
|
||||
onTap: () {
|
||||
if (guardDemoAction(sheetCtx)) return;
|
||||
Navigator.of(sheetCtx).pop();
|
||||
if (!parentContext.mounted) return;
|
||||
AppRoutes.openInternalSaveToFolder(
|
||||
@@ -109,6 +112,7 @@ void showChatMessageOptionsDialog(
|
||||
leading: const Icon(Icons.shortcut_outlined),
|
||||
title: const Text('Weiterleiten'),
|
||||
onTap: () {
|
||||
if (guardDemoAction(sheetCtx)) return;
|
||||
Navigator.of(sheetCtx).pop();
|
||||
if (!parentContext.mounted) return;
|
||||
AppRoutes.openForwardMessageToChat(
|
||||
@@ -143,6 +147,7 @@ void showChatMessageOptionsDialog(
|
||||
leading: const Icon(Icons.delete_outline),
|
||||
title: const Text('Nachricht löschen'),
|
||||
onTap: () {
|
||||
if (guardDemoAction(sheetCtx)) return;
|
||||
ConfirmDialog(
|
||||
title: 'Nachricht löschen?',
|
||||
content: 'Die Nachricht wird für alle Teilnehmer gelöscht.',
|
||||
@@ -189,6 +194,7 @@ class _ReactionsRowState extends State<_ReactionsRow> {
|
||||
}
|
||||
|
||||
Future<void> _react(String emoji) async {
|
||||
if (guardDemoAction(context)) return;
|
||||
final ok = await _controller.run(() async {
|
||||
await ReactMessage(
|
||||
chatToken: widget.chatToken,
|
||||
|
||||
@@ -12,6 +12,7 @@ import '../../../../api/marianumcloud/webdav/webdav_api.dart';
|
||||
import '../../../../state/app/modules/chat/bloc/chat_bloc.dart';
|
||||
import '../../../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
import '../../../../widget/async_action_button.dart';
|
||||
import '../../../../widget/demo_restricted.dart';
|
||||
import '../../../../widget/details_bottom_sheet.dart';
|
||||
import '../../../../widget/downloads/download_tray.dart';
|
||||
import '../../../../widget/emoji_picker_dialog.dart';
|
||||
@@ -125,6 +126,7 @@ class _ChatTextfieldState extends State<ChatTextfield> {
|
||||
}
|
||||
|
||||
void _showAttachmentSheet() {
|
||||
if (guardDemoAction(context)) return;
|
||||
showDetailsBottomSheet(
|
||||
context,
|
||||
children: (sheetCtx) => [
|
||||
@@ -187,6 +189,7 @@ class _ChatTextfieldState extends State<ChatTextfield> {
|
||||
|
||||
Future<void> _sendMessage(ChatBloc chatBloc) async {
|
||||
if (_textBoxController.text.isEmpty) return;
|
||||
if (guardDemoAction(context)) return;
|
||||
final text = _textBoxController.text;
|
||||
final replyTo = chatBloc.state.data?.referenceMessageId?.toString();
|
||||
final ownToken = widget.sendToToken;
|
||||
|
||||
Reference in New Issue
Block a user