Merge pull request #183 from pangeachat/usability

Usability
pull/1116/head
ggurdin 2 years ago committed by GitHub
commit b406458ff3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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…
Cancel
Save