chore: add warning popup to empty chats (#2342)

This commit is contained in:
ggurdin 2025-04-03 12:19:52 -04:00 committed by GitHub
parent 0c988d55f7
commit 7120e0c1ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 1 deletions

View file

@ -4856,5 +4856,7 @@
"makingProgress": "You're making progress!",
"keepPracticing": "Keep practicing!",
"niceJob": "Nice job!",
"publicSpacesTitle": "Learning communities"
"publicSpacesTitle": "Learning communities",
"emptyChatWarningTitle": "Chat is empty",
"emptyChatWarningDesc": "You haven't invited anyone to your chat. Go to Chat settings to invite your contacts or the Bot. You can also do this later."
}

View file

@ -47,6 +47,7 @@ import 'package:fluffychat/pangea/events/models/representation_content_model.dar
import 'package:fluffychat/pangea/events/models/tokens_event_content_model.dart';
import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
import 'package:fluffychat/pangea/instructions/instructions_enum.dart';
import 'package:fluffychat/pangea/instructions/instructions_show_popup.dart';
import 'package:fluffychat/pangea/learning_settings/widgets/p_language_dialog.dart';
import 'package:fluffychat/pangea/toolbar/enums/message_mode_enum.dart';
import 'package:fluffychat/pangea/toolbar/widgets/message_selection_overlay.dart';
@ -420,6 +421,16 @@ class ChatController extends State<ChatPageWithRoom>
ignorePointer: true,
);
});
if (room.summary.mJoinedMemberCount == 1) {
WidgetsBinding.instance.addPostFrameCallback(
(_) => instructionsShowPopup(
context,
InstructionsEnum.emptyChatWarning,
choreographer.inputLayerLinkAndKey.transformTargetId,
),
);
}
// Pangea#
_tryLoadTimeline();
if (kIsWeb) {

View file

@ -29,6 +29,7 @@ enum InstructionsEnum {
analyticsVocabList,
morphAnalyticsList,
readingAssistanceOverview,
emptyChatWarning,
}
extension InstructionsEnumExtension on InstructionsEnum {
@ -69,6 +70,8 @@ extension InstructionsEnumExtension on InstructionsEnum {
);
debugger(when: kDebugMode);
return "";
case InstructionsEnum.emptyChatWarning:
return l10n.emptyChatWarningTitle;
}
}
@ -131,6 +134,8 @@ extension InstructionsEnumExtension on InstructionsEnum {
return l10n.morphAnalyticsListBody;
case InstructionsEnum.readingAssistanceOverview:
return l10n.readingAssistanceOverviewBody;
case InstructionsEnum.emptyChatWarning:
return l10n.emptyChatWarningDesc;
}
}