commit
b406458ff3
3 changed files with 15 additions and 4 deletions
|
|
@ -86,6 +86,7 @@ class NewGroupView extends StatelessWidget {
|
|||
// ),
|
||||
ConversationBotSettings(
|
||||
key: controller.addConversationBotKey,
|
||||
activeSpaceId: controller.activeSpaceId,
|
||||
),
|
||||
const Divider(height: 1),
|
||||
AddToSpaceToggles(
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class AddToSpaceState extends State<AddToSpaceToggles> {
|
|||
final activeSpace =
|
||||
Matrix.of(context).client.getRoomById(widget.activeSpaceId!);
|
||||
if (activeSpace != null && activeSpace.canIAddSpaceChild(null)) {
|
||||
parents.add(SuggestionStatus(false, activeSpace));
|
||||
parents.add(SuggestionStatus(true, activeSpace));
|
||||
} else {
|
||||
ErrorHandler.logError(
|
||||
e: Exception('activeSpaceId ${widget.activeSpaceId} not found'),
|
||||
|
|
@ -111,12 +111,13 @@ class AddToSpaceState extends State<AddToSpaceToggles> {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> _addSingleSpace(String roomToAddId, Room newParent) {
|
||||
Future<void> _addSingleSpace(String roomToAddId, Room newParent) async {
|
||||
GoogleAnalytics.addParent(roomToAddId, newParent.classCode);
|
||||
return newParent.setSpaceChild(
|
||||
await newParent.setSpaceChild(
|
||||
roomToAddId,
|
||||
suggested: isSuggestedInSpace(newParent),
|
||||
);
|
||||
await setSuggested(true, newParent);
|
||||
}
|
||||
|
||||
Future<void> addSpaces(String roomToAddId) async {
|
||||
|
|
@ -147,7 +148,7 @@ class AddToSpaceState extends State<AddToSpaceToggles> {
|
|||
|
||||
setState(
|
||||
() => add
|
||||
? parents.add(SuggestionStatus(false, possibleParent))
|
||||
? parents.add(SuggestionStatus(true, possibleParent))
|
||||
: parents.removeWhere(
|
||||
(suggestionStatus) =>
|
||||
suggestionStatus.room.id == possibleParent.id,
|
||||
|
|
|
|||
|
|
@ -20,12 +20,14 @@ import '../../utils/error_handler.dart';
|
|||
class ConversationBotSettings extends StatefulWidget {
|
||||
final Room? room;
|
||||
final bool startOpen;
|
||||
final String? activeSpaceId;
|
||||
// final ClassSettingsModel? initialSettings;
|
||||
|
||||
const ConversationBotSettings({
|
||||
super.key,
|
||||
this.room,
|
||||
this.startOpen = false,
|
||||
this.activeSpaceId,
|
||||
// this.initialSettings,
|
||||
});
|
||||
|
||||
|
|
@ -37,6 +39,7 @@ class ConversationBotSettingsState extends State<ConversationBotSettings> {
|
|||
late BotOptionsModel botOptions;
|
||||
late bool isOpen;
|
||||
bool addBot = false;
|
||||
Room? parentSpace;
|
||||
|
||||
ConversationBotSettingsState({Key? key});
|
||||
|
||||
|
|
@ -50,6 +53,12 @@ class ConversationBotSettingsState extends State<ConversationBotSettings> {
|
|||
addBot = isBotRoom;
|
||||
});
|
||||
});
|
||||
parentSpace = widget.activeSpaceId != null
|
||||
? Matrix.of(context).client.getRoomById(widget.activeSpaceId!)
|
||||
: null;
|
||||
if (parentSpace != null && botOptions.languageLevel == null) {
|
||||
botOptions.languageLevel = parentSpace?.classSettings?.languageLevel;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> updateBotOption(void Function() makeLocalChange) async {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue