inital work to combine class and exchanges into generalized spaces
This commit is contained in:
parent
75f64e57d0
commit
a2fb240c6e
78 changed files with 1826 additions and 3250 deletions
|
|
@ -410,7 +410,6 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"classes": "Classes",
|
||||
"chooseAStrongPassword": "Choose a strong password",
|
||||
"@chooseAStrongPassword": {
|
||||
"type": "text",
|
||||
|
|
@ -616,16 +615,11 @@
|
|||
}
|
||||
},
|
||||
"createGroup": "Create group",
|
||||
"createNewSpace": "Create an exchange space",
|
||||
"createNewGroup": "Create a new chat",
|
||||
"@createNewGroup": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"@createNewSpace": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"currentlyActive": "Currently active",
|
||||
"@currentlyActive": {
|
||||
"type": "text",
|
||||
|
|
@ -2401,7 +2395,7 @@
|
|||
"@noKeyForThisMessage": {},
|
||||
"newGroup": "New chat",
|
||||
"@newGroup": {},
|
||||
"newSpace": "New class",
|
||||
"newSpace": "New space",
|
||||
"@newSpace": {},
|
||||
"enterSpace": "Enter space",
|
||||
"@enterSpace": {},
|
||||
|
|
@ -2540,7 +2534,7 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"interactiveTranslatorNotAllowedDesc": "Translation assistance is disabled in space group chats for all participants. This restriction does not apply to Class/Exchange Admin or direct chats.",
|
||||
"interactiveTranslatorNotAllowedDesc": "Translation assistance is disabled in space group chats for all participants. This restriction does not apply to space admins or direct chats.",
|
||||
"@interactiveTranslatorNotAllowedDesc": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
|
|
@ -2550,7 +2544,7 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"interactiveTranslatorRequiredDesc": "Students cannot turn off translation assistance. They can choose not to accept the translation suggestions. This restriction does not apply to Class/Exchange or direct chats.",
|
||||
"interactiveTranslatorRequiredDesc": "Students cannot turn off translation assistance. They can choose not to accept the translation suggestions. This restriction does not apply to spaces or direct chats.",
|
||||
"@interactiveTranslatorRequiredDesc": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
|
|
@ -2560,12 +2554,7 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"multiLingualClass": "Multilingual Class",
|
||||
"classAnalytics": "Class Analytics",
|
||||
"@classAnalytics": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"multiLingualSpace": "Multilingual Space",
|
||||
"allClasses": "All Classes",
|
||||
"@allClasses": {
|
||||
"type": "text",
|
||||
|
|
@ -2601,18 +2590,8 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"requestAnExchange": "Request an Exchange",
|
||||
"@requestAnExchange": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"findLanguageExchange": "Find a class exchange partner",
|
||||
"@findLanguageExchange": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"classAnalyticsDesc": "Detailed information on student engagement and language use",
|
||||
"@classAnalyticsDesc": {
|
||||
"spaceAnalyticsDesc": "Detailed information on student engagement and language use",
|
||||
"@spaceAnalyticsDesc": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
|
|
@ -2629,28 +2608,28 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"classSettings": "Class Settings",
|
||||
"@classSettings": {
|
||||
"languageSettings": "Language Settings",
|
||||
"@languageSettings": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"classSettingsDesc": "Edit class languages and proficiency level.",
|
||||
"@classSettingsDesc": {
|
||||
"languageSettingsDesc": "Edit space languages and proficiency level.",
|
||||
"@languageSettingsDesc": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"selectClassRoomDominantLanguage": "What is the base language of your class?",
|
||||
"@selectClassRoomDominantLanguage": {
|
||||
"selectSpaceDominantLanguage": "What's the most common language of space members?",
|
||||
"@selectSpaceDominantLanguage": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"selectTargetLanguage": "What language are you teaching?",
|
||||
"@selectTargetLanguage": {
|
||||
"selectSpaceTargetLanguage": "What is the most common target language of the space?",
|
||||
"@selectSpaceTargetLanguage": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"whatIsYourClassLanguageLevel": "What is the average language level of your class?",
|
||||
"@whatIsYourClassLanguageLevel": {
|
||||
"whatIsYourSpaceLanguageLevel": "What is the average language level of the space?",
|
||||
"@whatIsYourSpaceLanguageLevel": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
|
|
@ -2679,7 +2658,7 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"createGroupChatsDesc": "Toggle this on to allow students to create group chats within the class/exchange space.",
|
||||
"createGroupChatsDesc": "Toggle this on to allow students to create group chats within the space.",
|
||||
"@createGroupChatsDesc": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
|
|
@ -2794,12 +2773,12 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"joinWithClassCode": "Join class or exchange",
|
||||
"joinWithClassCode": "Join space",
|
||||
"@joinWithClassCode": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"joinWithClassCodeDesc": "Connect to a class or exchange space with the 6-digit invite code provided by the space administrator.",
|
||||
"joinWithClassCodeDesc": "Connect to a space with the 6-digit invite code provided by the space administrator.",
|
||||
"@joinWithClassCodeDesc": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
|
|
@ -2809,7 +2788,7 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"unableToFindClass": "We are unable to find the class or exchange. Please double-check the information with the space administrator. If you are still experiencing an issue, please contact support@pangea.chat.",
|
||||
"unableToFindClass": "We are unable to find the space. Please double-check the information with the space administrator. If you are still experiencing an issue, please contact support@pangea.chat.",
|
||||
"@unableToFindClass": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
|
|
@ -2869,12 +2848,12 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"welcomeToPangea18Plus": "Welcome to Pangea Chat! 🙂\nWhat's next?\nCreate or join a class!\nOr search for a conversation partner!",
|
||||
"welcomeToPangea18Plus": "Welcome to Pangea Chat! 🙂\nWhat's next?\nCreate or join a space!\nOr search for a conversation partner!",
|
||||
"@welcomeToPangea18Plus": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"welcomeToPangeaMinor": "Welcome to Pangea Chat! 🙂\nWhat's next?\nJoin a class!\nAsk your teacher for an invite code.",
|
||||
"welcomeToPangeaMinor": "Welcome to Pangea Chat! 🙂\nWhat's next?\nJoin a space!\nAsk your teacher for an invite code.",
|
||||
"@welcomeToPangeaMinor": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
|
|
@ -3174,7 +3153,7 @@
|
|||
"igcToggleDescription": "This language learning tool will identify common spelling, grammar and punctuation errors in your message and suggest corrections. Though rare, the AI can make correction errors.",
|
||||
"sendOnEnterDescription": "Turn this off to be able to add line spaces in messages. When the toggle is off on the browser app, you can press Shift + Enter to start a new line. When the toggle is off on mobile apps, just Enter will start a new line.",
|
||||
"alreadyInClass": "You are already in this space.",
|
||||
"pleaseLoginFirst": "Please login or sign up first and then you will be added to your class/exchange space.",
|
||||
"pleaseLoginFirst": "Please login or sign up first and then you will be added to your space.",
|
||||
"originalMessage": "Original Message",
|
||||
"sentMessage": "Sent Message",
|
||||
"useType": "Use Type",
|
||||
|
|
@ -3185,16 +3164,13 @@
|
|||
"definitionsToolDescription": "When enabled, words underlined in blue can be clicked for definitions. Click messages to access definitions.",
|
||||
"translationsToolDescrption": "When enabled, click a message and the translation icon to see a message in your base language.",
|
||||
"welcomeBack": "Welcome back! If you were part of the 2023-2024 pilot, please contact us for your special pilot subscription. If you are a teacher who has (or whose institution has) purchased licenses for your class, contact us for your teacher subscription.",
|
||||
"classExchanges": "Exchanges",
|
||||
"createNewClass": "New class space",
|
||||
"newExchange": "New exchange space",
|
||||
"kickAllStudents": "Kick All Students",
|
||||
"kickAllStudentsConfirmation": "Are you sure you want to kick all students?",
|
||||
"inviteAllStudents": "Invite All Students",
|
||||
"inviteAllStudentsConfirmation": "Are you sure you want to invite all students?",
|
||||
"inviteStudentsFromOtherClasses": "Invite students from other spaces",
|
||||
"inviteUsersFromPangea": "Add teachers",
|
||||
"allExchanges": "All Exchanges",
|
||||
"redeemPromoCode": "Redeem Promo Code",
|
||||
"enterPromoCode": "Enter Promo Code",
|
||||
"downloadTxtFile": "Download Text File",
|
||||
|
|
@ -3652,22 +3628,24 @@
|
|||
"pay": "Pay",
|
||||
"allPrivateChats": "Direct chats",
|
||||
"unknownPrivateChat": "Unknown private chat",
|
||||
"copyClassCodeDesc": "Students who are already in the app can 'Join class or exchange' via the main menu.",
|
||||
"addToClass": "Add exchange to class",
|
||||
"addToClassDesc": "Adding an exchange to a class will make the exchange appear within the class for students and give them access to all chats within the exchange.",
|
||||
"addToClassOrExchange": "Add chat to class or exchange",
|
||||
"addToClassOrExchangeDesc": "Adding a chat to a class or exchange will make the chat appear within the class or exchange for students and give them access.",
|
||||
"invitedToClassOrExchange": "{user} has invited you to join a space: {classOrExchange}! Do you wish to accept?",
|
||||
"@invitedToClassOrExchange": {
|
||||
"copyClassCodeDesc": "Students who are already in the app can 'Join space' via the main menu.",
|
||||
"addToSpaceDesc": "Adding a chat to a space will make the chat appear within the space for students and give them access.",
|
||||
"@addToSpaceDesc": {
|
||||
"placeholders": {
|
||||
"classOrExchange": {},
|
||||
"roomtype": {}
|
||||
}
|
||||
},
|
||||
"invitedToSpace": "{user} has invited you to join a space: {space}! Do you wish to accept?",
|
||||
"@invitedToSpace": {
|
||||
"placeholders": {
|
||||
"space": {},
|
||||
"user": {}
|
||||
}
|
||||
},
|
||||
"declinedInvitation": "Declined invitation",
|
||||
"acceptedInvitation": "Accepted invitation",
|
||||
"youreInvited": "📩 You're invited!",
|
||||
"studentPermissionsDesc": "Set permissions for this space. They will only apply to the class/exchange space. They will override individual user settings.",
|
||||
"studentPermissionsDesc": "Set permissions for this space. They will only apply to the space. They will override individual user settings.",
|
||||
"noEligibleSpaces": "There are no eligible spaces to add this to.",
|
||||
"youAddedToSpace": "You added {child} to {space}",
|
||||
"@youAddedToSpace": {
|
||||
|
|
@ -3705,9 +3683,9 @@
|
|||
},
|
||||
"emptyChatNameWarning": "Please enter a name for this chat",
|
||||
"emptyClassNameWarning": "Please enter a name for this class",
|
||||
"emptyExchangeNameWarning": "Please enter a name for this exchange",
|
||||
"emptySpaceNameWarning": "Please enter a name for this space",
|
||||
"blurMeansTranslateTitle": "Why is the message blurred?",
|
||||
"blurMeansTranslateBody": "While Immersion Mode is on, messages that are sent in your base language will be blurred while Pangea Bot translates them to your target language. Immersion Mode can be toggled in individual and class settings.",
|
||||
"blurMeansTranslateBody": "While Immersion Mode is on, messages that are sent in your base language will be blurred while Pangea Bot translates them to your target language. Immersion Mode can be toggled in individual and space settings.",
|
||||
"someErrorTitle": "Hm, something's not right",
|
||||
"someErrorBody": "It could be an error or something in your base language.",
|
||||
"bestCorrectionFeedback": "That's correct!",
|
||||
|
|
@ -3717,7 +3695,7 @@
|
|||
"practiceDefaultPrompt": "What is the best answer?",
|
||||
"correctionDefaultPrompt": "What is the best replacement?",
|
||||
"itStartDefaultPrompt": "Do you want help translating?",
|
||||
"languageLevelWarning": "Please select a class language level",
|
||||
"languageLevelWarning": "Please select a space language level",
|
||||
"lockedChatWarning": "🔒 This chat has been locked",
|
||||
"lockSpace": "Lock Space",
|
||||
"lockChat": "Lock Chat",
|
||||
|
|
@ -3730,7 +3708,6 @@
|
|||
"why": "Why?",
|
||||
"definition": "Definition",
|
||||
"exampleSentence": "Example Sentence",
|
||||
"addToClassTitle": "Add Exchange to Class",
|
||||
"reportToTeacher": "Who do you want to report this message to?",
|
||||
"reportMessageTitle": "{reportingUserId} has reported a message from {reportedUserId} in the chat {roomName}",
|
||||
"@reportMessageTitle": {
|
||||
|
|
@ -3777,7 +3754,6 @@
|
|||
},
|
||||
"searchChatsRooms": "Search for #chats, @users...",
|
||||
"createClass": "Create class",
|
||||
"createExchange": "Create exchange",
|
||||
"viewArchive": "View Archive",
|
||||
"trialExpiration": "Your free trial expires on {expiration}",
|
||||
"@trialExpiration": {
|
||||
|
|
@ -3787,10 +3763,10 @@
|
|||
},
|
||||
"freeTrialDesc": "New users recieve a one week free trial of Pangea Chat",
|
||||
"activateTrial": "Activate Free Trial",
|
||||
"inNoSpaces": "You are not a member of any classes or exchanges",
|
||||
"inNoSpaces": "You are not a member of any spaces",
|
||||
"successfullySubscribed": "You have successfully subscribed!",
|
||||
"clickToManageSubscription": "Click here to manage your subscription.",
|
||||
"emptyInviteWarning": "Add this chat to a class or exchange to invite other users.",
|
||||
"emptyInviteWarning": "Add this chat to a space to invite other users.",
|
||||
"errorGettingAudio": "Error getting audio. Please refresh and try again.",
|
||||
"nothingFound": "Nothing found...",
|
||||
"groupName": "Group name",
|
||||
|
|
@ -4059,5 +4035,17 @@
|
|||
"restricted": "Restricted",
|
||||
"@restricted": {},
|
||||
"knockRestricted": "Knock restricted",
|
||||
"@knockRestricted": {}
|
||||
"@knockRestricted": {},
|
||||
"nonexistentSelection": "Selection no longer exists.",
|
||||
"cantAddSpaceChild": "You do not have permission to add a child to this space.",
|
||||
"roomAddedToSpace": "Room(s) have been added to the selected space.",
|
||||
"createNewSpace": "New space",
|
||||
"@createNewSpace": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"addChatToSpaceDesc": "Adding a chat to a space will make the chat appear within the space for students and give them access.",
|
||||
"addSpaceToSpaceDesc": "Adding a space to another space will make the child space appear within the parent space for students and give them access.",
|
||||
"spaceAnalytics": "Space Analytics",
|
||||
"changeAnalyticsLanguage": "Change Analytics Language"
|
||||
}
|
||||
|
|
@ -2752,31 +2752,11 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"openToExchanges": "¿Abierto a intercambios?",
|
||||
"@openToExchanges": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"oneToOneChatsWithinExchanges": "Chats Privados dentro de Intercambios",
|
||||
"@oneToOneChatsWithinExchanges": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"createGroupChats": "Crear Chats Grupales",
|
||||
"@createGroupChats": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"createGroupChatsInExchanges": "Crear Chats Grupales en Intercambios",
|
||||
"@createGroupChatsInExchanges": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"createGroupChatsInExchangesDesc": "Active esta opción para permitir que los estudiantes creen chats grupales dentro de los intercambios.",
|
||||
"@createGroupChatsInExchangesDesc": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"shareStories": "Subir historias",
|
||||
"@shareStories": {
|
||||
"type": "text",
|
||||
|
|
@ -2917,21 +2897,11 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"findLanguageExchange": "Encuentre una clase de intercambio",
|
||||
"@findLanguageExchange": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"requestToEnroll": "Solicitar inscripción",
|
||||
"@requestToEnroll": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"requestAnExchange": "Solicitar un intercambio",
|
||||
"@requestAnExchange": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"targetLanguage": "Idioma a aprender",
|
||||
"@targetLanguage": {
|
||||
"type": "text",
|
||||
|
|
@ -2982,11 +2952,6 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"classSettings": "Ajustes de clase",
|
||||
"@classSettings": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"suggestToClass": "Sugiera el chat a",
|
||||
"@suggestToClass": {
|
||||
"type": "text",
|
||||
|
|
@ -3032,8 +2997,8 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"classAnalyticsDesc": "Información detallada sobre la participación de los estudiantes y el uso del idioma",
|
||||
"@classAnalyticsDesc": {
|
||||
"spaceAnalyticsDesc": "Información detallada sobre la participación de los estudiantes y el uso del idioma",
|
||||
"@spaceAnalyticsDesc": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
|
|
@ -3815,7 +3780,6 @@
|
|||
"sentMessage": "Mensaje enviado",
|
||||
"useType": "Tipo de Uso",
|
||||
"notAvailable": "No disponible",
|
||||
"classExchanges": "Intercambios",
|
||||
"kickAllStudents": "Patear a todos los estudiantes",
|
||||
"kickAllStudentsConfirmation": "¿Estás seguro de que quieres echar a todos los estudiantes?",
|
||||
"inviteAllStudents": "Invitar a todos los estudiantes",
|
||||
|
|
@ -4296,7 +4260,6 @@
|
|||
"copyClassLink": "Copiar enlace de invitación",
|
||||
"copyClassLinkDesc": "Al hacer clic en este enlace, los usuarios accederán a la aplicación, se abrirán una cuenta y se unirán automáticamente a este espacio.",
|
||||
"copyClassCode": "Copiar código de invitación",
|
||||
"classSettingsDesc": "Editar idiomas de clase y nivel",
|
||||
"createGroupChatsDesc": "Active esta opción para permitir a los estudiantes crear chats de grupo dentro del espacio de clase/intercambio.",
|
||||
"joinWithClassCode": "Únete a una clase o a un intercambio",
|
||||
"joinWithClassCodeDesc": "Conéctese a una clase o espacio de intercambio con el código de invitación de 6 dígitos proporcionado por el administrador del espacio.",
|
||||
|
|
@ -4304,8 +4267,6 @@
|
|||
"unableToFindClass": "No podemos encontrar la clase o el intercambio. Por favor, vuelva a comprobar la información con el administrador del espacio. Si sigue teniendo problemas, póngase en contacto con support@pangea.chat.",
|
||||
"welcomeToYourNewClass": "Bienvenido 🙂",
|
||||
"welcomeToClass": "Bienvenido! 🙂\n- ¡Prueba a unirte a un chat!\n- ¡Diviértete chateando!",
|
||||
"welcomeToPangea18Plus": "Bienvenido al chat de Pangea 🙂 .\n¿Qué es lo siguiente?\n¡Crea una clase o únete a ella!\n¡O busca un compañero de conversación!",
|
||||
"welcomeToPangeaMinor": "Bienvenido al chat de Pangea 🙂 .\n¿Qué es lo siguiente?\n¡Únete a una clase!\nPide a tu profesor un código de invitación.",
|
||||
"unableToFindClassCode": "No se puede encontrar el código.",
|
||||
"errorDisableITClassDesc": "La ayuda a la traducción está desactivada para el espacio en el que se encuentra este chat.",
|
||||
"errorDisableIGCClassDesc": "La asistencia gramatical está desactivada para el espacio en el que se encuentra este chat.",
|
||||
|
|
@ -4317,26 +4278,14 @@
|
|||
"pleaseLoginFirst": "Inicie sesión o regístrese primero y, a continuación, se le añadirá a su clase/espacio de intercambio.",
|
||||
"welcomeBack": "¡Bienvenido de nuevo! Si formó parte del piloto 2023-2024, póngase en contacto con nosotros para obtener su suscripción especial de piloto. Si es usted un profesor que ha adquirido (o cuya institución ha adquirido) licencias para su clase, póngase en contacto con nosotros para obtener su suscripción de profesor.",
|
||||
"createNewClass": "Nuevo espacio para clases",
|
||||
"newExchange": "Nuevo espacio de intercambio",
|
||||
"inviteStudentsFromOtherClasses": "Invitar a estudiantes de otros espacios",
|
||||
"allExchanges": "Todos los intercambios",
|
||||
"creatingSpacePleaseWait": "Creando espacio. Por favor, espere...",
|
||||
"pay": "Pagar",
|
||||
"copyClassCodeDesc": "Los estudiantes que ya están en la aplicación pueden 'Unirse a una clase o a un intercambio' a través del menú principal.",
|
||||
"inviteUsersFromPangea": "Añadir profesores",
|
||||
"addToClass": "Añadir intercambio a la clase",
|
||||
"addToClassOrExchange": "Añadir chat a la clase o al intercambio",
|
||||
"classAnalytics": "Análisis de clase",
|
||||
"myLearning": "Mis análisis",
|
||||
"addToClassDesc": "Añadir un intercambio a una clase hará que el intercambio aparezca dentro de la clase para los estudiantes y les dará acceso a todos los chats dentro del intercambio.",
|
||||
"addToClassOrExchangeDesc": "Añadir un chat a una clase o intercambio hará que el chat aparezca dentro de la clase o intercambio para los estudiantes y les dará acceso.",
|
||||
"invitedToClassOrExchange": "{user} te ha invitado a unirte a ¡{classOrExchange}! ¿Deseas aceptar?",
|
||||
"@invitedToClassOrExchange": {
|
||||
"placeholders": {
|
||||
"classOrExchange": {},
|
||||
"user": {}
|
||||
}
|
||||
},
|
||||
"decline": "Disminución",
|
||||
"declinedInvitation": "Invitación rechazada",
|
||||
"acceptedInvitation": "Invitación aceptada",
|
||||
|
|
@ -4369,14 +4318,11 @@
|
|||
},
|
||||
"emptyChatNameWarning": "Introduzca un nombre para este chat",
|
||||
"emptyClassNameWarning": "Introduzca un nombre para esta clase",
|
||||
"emptyExchangeNameWarning": "Introduzca un nombre para este intercambio",
|
||||
"blurMeansTranslateTitle": "¿Por qué está borroso el mensaje?",
|
||||
"blurMeansTranslateBody": "Mientras el Modo Inmersión esté activado, los mensajes que se envíen en su idioma base aparecerán borrosos mientras Pangea Bot los traduce a su idioma de destino. El modo inmersión puede activarse en los ajustes individuales y de clase.",
|
||||
"monthlySubscription": "Mensualmente",
|
||||
"yearlySubscription": "Anualmente",
|
||||
"defaultSubscription": "Suscripción al chat de Pangea",
|
||||
"freeTrial": "Prueba gratuita",
|
||||
"languageLevelWarning": "Seleccione un nivel de idioma de clase",
|
||||
"lockedChatWarning": "🔒 Este chat ha sido bloqueado",
|
||||
"lockSpace": "Espacio de bloqueo",
|
||||
"lockChat": "Chat de bloqueo",
|
||||
|
|
@ -4393,7 +4339,6 @@
|
|||
"itStartDefaultPrompt": "¿Quiere ayuda para traducir?",
|
||||
"suggestTo": "Sugerir a {spaceName}",
|
||||
"suggestChatDesc": "Los chats sugeridos aparecerán en la lista de chats de {spaceName}.",
|
||||
"suggestExchangeDesc": "Los intercambios sugeridos aparecerán en la lista de chat de {spaceName}.",
|
||||
"acceptSelection": "Aceptar corrección",
|
||||
"acceptSelectionAnyway": "Use esto de todos modos",
|
||||
"makingActivity": "Actividad de fabricación",
|
||||
|
|
@ -4460,7 +4405,6 @@
|
|||
"groupCanBeFoundViaSearch": "El grupo se puede encontrar a través de la búsqueda",
|
||||
"inNoSpaces": "No es miembro de ninguna clase o bolsa",
|
||||
"createClass": "Crear clase",
|
||||
"createExchange": "Crear intercambio",
|
||||
"viewArchive": "Ver archivo",
|
||||
"trialExpiration": "Su prueba gratuita caduca el {expiration}.",
|
||||
"@trialExpiration": {
|
||||
|
|
@ -4675,5 +4619,86 @@
|
|||
"tooltipInstructionsTitle": "¿No sabes para qué sirve?",
|
||||
"tooltipInstructionsMobileBody": "Mantenga pulsados los elementos para ver la información sobre herramientas.",
|
||||
"tooltipInstructionsBrowserBody": "Pase el ratón sobre los elementos para ver información sobre herramientas.",
|
||||
"buildTranslation": "Construye tu traducción a partir de las opciones anteriores"
|
||||
"buildTranslation": "Construye tu traducción a partir de las opciones anteriores",
|
||||
"appLockDescription": "Bloquea la aplicación cuando no la uses con un código pin",
|
||||
"swipeRightToLeftToReply": "Desliza el dedo de derecha a izquierda para responder",
|
||||
"globalChatId": "ID global del chat",
|
||||
"accessAndVisibility": "Acceso y visibilidad",
|
||||
"accessAndVisibilityDescription": "Quién puede participar en este chat y cómo se puede descubrir el chat.",
|
||||
"calls": "Llamadas",
|
||||
"customEmojisAndStickers": "Emojis y pegatinas personalizados",
|
||||
"customEmojisAndStickersBody": "Añade o comparte emojis o stickers personalizados que podrás utilizar en cualquier chat.",
|
||||
"hideRedactedMessages": "Ocultar mensajes redactados",
|
||||
"hideRedactedMessagesBody": "Si alguien borra un mensaje, éste ya no será visible en el chat.",
|
||||
"hideInvalidOrUnknownMessageFormats": "Ocultar formatos de mensaje no válidos o desconocidos",
|
||||
"hideMemberChangesInPublicChats": "Ocultar los cambios de los miembros en los chats públicos",
|
||||
"hideMemberChangesInPublicChatsBody": "No mostrar en la línea de tiempo del chat si alguien se une o abandona un chat público para mejorar la legibilidad.",
|
||||
"overview": "Visión general",
|
||||
"notifyMeFor": "Notificarme para",
|
||||
"passwordRecoverySettings": "Configuración de recuperación de contraseña",
|
||||
"usersMustKnock": "Los usuarios deben golpear",
|
||||
"userWouldLikeToChangeTheChat": "{user} desea unirse al chat.",
|
||||
"@userWouldLikeToChangeTheChat": {
|
||||
"placeholders": {
|
||||
"user": {}
|
||||
}
|
||||
},
|
||||
"noPublicLinkHasBeenCreatedYet": "Aún no se ha creado ningún enlace público",
|
||||
"knock": "Knock",
|
||||
"multiLingualSpace": "Espacio multilingüe",
|
||||
"languageSettings": "Ajustes de idioma",
|
||||
"languageSettingsDesc": "Editar idiomas espaciales y nivel de competencia.",
|
||||
"selectSpaceDominantLanguage": "¿Cuál es la lengua más común de los miembros del espacio?",
|
||||
"selectSpaceTargetLanguage": "¿Cuál es la lengua de destino más común del espacio?",
|
||||
"whatIsYourSpaceLanguageLevel": "¿Cuál es el nivel lingüístico medio del espacio?",
|
||||
"welcomeToPangea18Plus": "Bienvenido al chat de Pangea 🙂 .\n¿Qué es lo siguiente?\n¡Crea o únete a un espacio!\n¡O busca un compañero de conversación!",
|
||||
"welcomeToPangeaMinor": "Bienvenido al chat de Pangea 🙂 .\n¿Qué es lo siguiente?\n¡Únete a un espacio!\nPide a tu profesor un código de invitación.",
|
||||
"addToSpaceDesc": "Añadir un chat a un espacio hará que el chat aparezca dentro del espacio para los estudiantes y les dará acceso.",
|
||||
"invitedToSpace": "{user} te ha invitado a unirte a un espacio: ¡{space}! ¿Deseas aceptar?",
|
||||
"@invitedToSpace": {
|
||||
"placeholders": {
|
||||
"space": {},
|
||||
"user": {}
|
||||
}
|
||||
},
|
||||
"emptySpaceNameWarning": "Introduzca un nombre para este espacio",
|
||||
"blurMeansTranslateBody": "Mientras el Modo Inmersión esté activado, los mensajes que se envíen en tu idioma base aparecerán borrosos mientras Pangea Bot los traduce a tu idioma de destino. El Modo Inmersión puede activarse en los ajustes individuales y espaciales.",
|
||||
"languageLevelWarning": "Seleccione un nivel de lengua espacial",
|
||||
"knocking": "Golpeando",
|
||||
"chatCanBeDiscoveredViaSearchOnServer": "El chat puede descubrirse mediante la búsqueda en {server}.",
|
||||
"@chatCanBeDiscoveredViaSearchOnServer": {
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"server": {}
|
||||
}
|
||||
},
|
||||
"publicChatAddresses": "Direcciones de chat públicas",
|
||||
"createNewAddress": "Crear una nueva dirección",
|
||||
"userRole": "Función del usuario",
|
||||
"minimumPowerLevel": "{level} es el nivel mínimo de potencia.",
|
||||
"@minimumPowerLevel": {
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"level": {}
|
||||
}
|
||||
},
|
||||
"searchMore": "Buscar más...",
|
||||
"gallery": "Galería",
|
||||
"files": "Archivos",
|
||||
"addSpaceToSpaceDescription": "Seleccione un espacio para añadir como padre",
|
||||
"noDatabaseEncryption": "La encriptación de la base de datos no es compatible con esta plataforma",
|
||||
"thereAreCountUsersBlocked": "Ahora mismo hay {count} usuarios bloqueados.",
|
||||
"@thereAreCountUsersBlocked": {
|
||||
"type": "text",
|
||||
"count": {}
|
||||
},
|
||||
"restricted": "Restringido",
|
||||
"knockRestricted": "Golpe restringido",
|
||||
"nonexistentSelection": "La selección ya no existe.",
|
||||
"cantAddSpaceChild": "No tiene permiso para añadir un niño a este espacio.",
|
||||
"roomAddedToSpace": "Se han añadido habitaciones al espacio seleccionado.",
|
||||
"addChatToSpaceDesc": "Añadir un chat a un espacio hará que el chat aparezca dentro del espacio para los estudiantes y les dará acceso.",
|
||||
"addSpaceToSpaceDesc": "Añadir un espacio a otro espacio hará que el espacio hijo aparezca dentro del espacio padre para los estudiantes y les dará acceso.",
|
||||
"spaceAnalytics": "Analítica espacial",
|
||||
"changeAnalyticsLanguage": "Cambiar el lenguaje analítico"
|
||||
}
|
||||
|
|
@ -29,7 +29,6 @@ import 'package:fluffychat/pages/settings_style/settings_style.dart';
|
|||
import 'package:fluffychat/pangea/enum/bar_chart_view_enum.dart';
|
||||
import 'package:fluffychat/pangea/guard/p_vguard.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/student_analytics/student_analytics.dart';
|
||||
import 'package:fluffychat/pangea/pages/exchange/add_exchange_to_class.dart';
|
||||
import 'package:fluffychat/pangea/pages/find_partner/find_partner.dart';
|
||||
import 'package:fluffychat/pangea/pages/p_user_age/p_user_age.dart';
|
||||
import 'package:fluffychat/pangea/pages/settings_learning/settings_learning.dart';
|
||||
|
|
@ -43,8 +42,8 @@ import 'package:fluffychat/widgets/matrix.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../pangea/pages/analytics/class_analytics/class_analytics.dart';
|
||||
import '../pangea/pages/analytics/class_list/class_list.dart';
|
||||
import '../pangea/pages/analytics/space_analytics/space_analytics.dart';
|
||||
import '../pangea/pages/analytics/space_list/space_list.dart';
|
||||
|
||||
abstract class AppRoutes {
|
||||
static FutureOr<String?> loggedInRedirect(
|
||||
|
|
@ -202,17 +201,17 @@ abstract class AppRoutes {
|
|||
pageBuilder: (context, state) => defaultPageBuilder(
|
||||
context,
|
||||
state,
|
||||
const AnalyticsClassList(),
|
||||
const AnalyticsSpaceList(),
|
||||
),
|
||||
redirect: loggedOutRedirect,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: ':classid',
|
||||
path: ':spaceid',
|
||||
redirect: loggedOutRedirect,
|
||||
pageBuilder: (context, state) => defaultPageBuilder(
|
||||
context,
|
||||
state,
|
||||
const ClassAnalyticsPage(),
|
||||
const SpaceAnalyticsPage(),
|
||||
),
|
||||
routes: [
|
||||
GoRoute(
|
||||
|
|
@ -220,7 +219,7 @@ abstract class AppRoutes {
|
|||
pageBuilder: (context, state) => defaultPageBuilder(
|
||||
context,
|
||||
state,
|
||||
ClassAnalyticsPage(
|
||||
SpaceAnalyticsPage(
|
||||
// when going to sub-space from within a parent space's analytics, the
|
||||
// analytics list tiles do not properly update. Adding a unique key to this page is the best fix
|
||||
// I can find at the moment
|
||||
|
|
@ -234,7 +233,7 @@ abstract class AppRoutes {
|
|||
pageBuilder: (context, state) => defaultPageBuilder(
|
||||
context,
|
||||
state,
|
||||
ClassAnalyticsPage(
|
||||
SpaceAnalyticsPage(
|
||||
// when going to sub-space from within a parent space's analytics, the
|
||||
// analytics list tiles do not properly update. Adding a unique key to this page is the best fix
|
||||
// I can find at the moment
|
||||
|
|
@ -319,24 +318,6 @@ abstract class AppRoutes {
|
|||
redirect: loggedOutRedirect,
|
||||
),
|
||||
// #Pangea
|
||||
GoRoute(
|
||||
path: 'newspace/:newexchange',
|
||||
pageBuilder: (context, state) => defaultPageBuilder(
|
||||
context,
|
||||
state,
|
||||
const NewSpace(),
|
||||
),
|
||||
redirect: loggedOutRedirect,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'join_exchange/:exchangeid',
|
||||
pageBuilder: (context, state) => defaultPageBuilder(
|
||||
context,
|
||||
state,
|
||||
const AddExchangeToClass(),
|
||||
),
|
||||
redirect: loggedOutRedirect,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'partner',
|
||||
pageBuilder: (context, state) => defaultPageBuilder(
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ import 'package:fluffychat/pangea/enum/use_type.dart';
|
|||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_message_event.dart';
|
||||
import 'package:fluffychat/pangea/models/choreo_record.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/representation_content_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/models/tokens_event_content_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/utils/firebase_analytics.dart';
|
||||
|
|
@ -317,10 +317,10 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
Future.delayed(const Duration(seconds: 1), () async {
|
||||
if (!mounted) return;
|
||||
debugPrint(
|
||||
"chat.dart l1 ${pangeaController.languageController.activeL1Code(roomID: roomId)}",
|
||||
"chat.dart l1 ${pangeaController.languageController.userL1?.langCode}",
|
||||
);
|
||||
debugPrint(
|
||||
"chat.dart l2 ${pangeaController.languageController.activeL2Code(roomID: roomId)}",
|
||||
"chat.dart l2 ${pangeaController.languageController.userL2?.langCode}",
|
||||
);
|
||||
if (mounted) {
|
||||
pangeaController.languageController.showDialogOnEmptyLanguage(
|
||||
|
|
@ -654,8 +654,6 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
);
|
||||
return;
|
||||
}
|
||||
// ensure that analytics room exists / is created for the active langCode
|
||||
await room.ensureAnalyticsRoomExists();
|
||||
},
|
||||
onError: (err, stack) => ErrorHandler.logError(e: err, s: stack),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,10 +11,8 @@ import 'package:fluffychat/pangea/pages/class_settings/p_class_widgets/class_nam
|
|||
import 'package:fluffychat/pangea/pages/class_settings/p_class_widgets/room_capacity_button.dart';
|
||||
import 'package:fluffychat/pangea/pages/class_settings/p_class_widgets/room_rules_editor.dart';
|
||||
import 'package:fluffychat/pangea/utils/lock_room.dart';
|
||||
import 'package:fluffychat/pangea/widgets/class/add_class_and_invite.dart';
|
||||
import 'package:fluffychat/pangea/widgets/class/add_space_toggles.dart';
|
||||
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_settings.dart';
|
||||
import 'package:fluffychat/pangea/widgets/space/class_settings.dart';
|
||||
import 'package:fluffychat/utils/fluffy_share.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
|
|
@ -257,11 +255,10 @@ class ChatDetailsView extends StatelessWidget {
|
|||
controller: controller,
|
||||
),
|
||||
// Pangea#
|
||||
if ((room.isPangeaClass || room.isExchange) &&
|
||||
room.isRoomAdmin)
|
||||
if (room.isSpace && room.isRoomAdmin)
|
||||
ListTile(
|
||||
title: Text(
|
||||
L10n.of(context)!.classAnalytics,
|
||||
L10n.of(context)!.spaceAnalytics,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
@ -279,11 +276,12 @@ class ChatDetailsView extends StatelessWidget {
|
|||
'/rooms/analytics/${room.id}',
|
||||
),
|
||||
),
|
||||
if (room.classSettings != null && room.isRoomAdmin)
|
||||
ClassSettings(
|
||||
roomId: controller.roomId,
|
||||
startOpen: false,
|
||||
),
|
||||
// commenting out language settings in spaces for now
|
||||
// if (room.languageSettings != null && room.isRoomAdmin)
|
||||
// LanguageSettings(
|
||||
// roomId: controller.roomId,
|
||||
// startOpen: false,
|
||||
// ),
|
||||
if (room.pangeaRoomRules != null && room.isRoomAdmin)
|
||||
RoomRulesEditor(
|
||||
roomId: controller.roomId,
|
||||
|
|
@ -459,16 +457,11 @@ class ChatDetailsView extends StatelessWidget {
|
|||
room: room,
|
||||
),
|
||||
const Divider(height: 1),
|
||||
if (!room.isPangeaClass &&
|
||||
!room.isDirectChat &&
|
||||
room.isRoomAdmin)
|
||||
if (!room.isDirectChat && room.isRoomAdmin)
|
||||
AddToSpaceToggles(
|
||||
roomId: room.id,
|
||||
key: controller.addToSpaceKey,
|
||||
startOpen: false,
|
||||
mode: room.isExchange
|
||||
? AddToClassMode.exchange
|
||||
: AddToClassMode.chat,
|
||||
),
|
||||
const Divider(height: 1),
|
||||
if (!room.isDirectChat)
|
||||
|
|
|
|||
|
|
@ -183,10 +183,9 @@ class ChatListController extends State<ChatList>
|
|||
bool Function(Room) getRoomFilterByActiveFilter(ActiveFilter activeFilter) {
|
||||
switch (activeFilter) {
|
||||
case ActiveFilter.allChats:
|
||||
return (room) =>
|
||||
!room.isSpace // #Pangea
|
||||
&&
|
||||
!room.isAnalyticsRoom;
|
||||
return (room) => !room.isSpace; // #Pangea
|
||||
// &&
|
||||
// !room.isAnalyticsRoom;
|
||||
// Pangea#;
|
||||
case ActiveFilter.groups:
|
||||
return (room) =>
|
||||
|
|
@ -818,7 +817,7 @@ class ChatListController extends State<ChatList>
|
|||
&&
|
||||
selectedRoomIds
|
||||
.map((id) => Matrix.of(context).client.getRoomById(id))
|
||||
.where((e) => !(e?.isPangeaClass ?? true))
|
||||
.where((e) => !(e?.isSpace ?? false))
|
||||
.every((e) => r.canIAddSpaceChild(e)),
|
||||
//Pangea#
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:fluffychat/pangea/constants/class_default_values.dart';
|
||||
import 'package:fluffychat/pangea/utils/class_code.dart';
|
||||
import 'package:fluffychat/pangea/utils/find_conversation_partner_dialog.dart';
|
||||
import 'package:fluffychat/pangea/utils/logout.dart';
|
||||
import 'package:fluffychat/pangea/utils/space_code.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
|
@ -58,12 +58,12 @@ class ClientChooserButton extends StatelessWidget {
|
|||
room.isSpace &&
|
||||
room.ownPowerLevel >= ClassDefaultValues.powerLevelOfAdmin,
|
||||
),
|
||||
value: SettingsAction.classAnalytics,
|
||||
value: SettingsAction.spaceAnalytics,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.analytics_outlined),
|
||||
const SizedBox(width: 18),
|
||||
Expanded(child: Text(L10n.of(context)!.classAnalytics)),
|
||||
Expanded(child: Text(L10n.of(context)!.spaceAnalytics)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -84,7 +84,7 @@ class ClientChooserButton extends StatelessWidget {
|
|||
children: [
|
||||
const Icon(Icons.school),
|
||||
const SizedBox(width: 18),
|
||||
Expanded(child: Text(L10n.of(context)!.createNewClass)),
|
||||
Expanded(child: Text(L10n.of(context)!.createNewSpace)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -98,16 +98,6 @@ class ClientChooserButton extends StatelessWidget {
|
|||
// ],
|
||||
// ),
|
||||
// ),
|
||||
PopupMenuItem(
|
||||
value: SettingsAction.newExchange,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.connecting_airports),
|
||||
const SizedBox(width: 18),
|
||||
Expanded(child: Text(L10n.of(context)!.newExchange)),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (controller.pangeaController.permissionsController.isUser18())
|
||||
PopupMenuItem(
|
||||
value: SettingsAction.findAConversationPartner,
|
||||
|
|
@ -397,11 +387,8 @@ class ClientChooserButton extends StatelessWidget {
|
|||
case SettingsAction.newClass:
|
||||
context.go('/rooms/newspace');
|
||||
break;
|
||||
case SettingsAction.newExchange:
|
||||
context.go('/rooms/newspace/exchange');
|
||||
break;
|
||||
case SettingsAction.joinWithClassCode:
|
||||
ClassCodeUtil.joinWithClassCodeDialog(
|
||||
SpaceCodeUtil.joinWithSpaceCodeDialog(
|
||||
context,
|
||||
controller.pangeaController,
|
||||
);
|
||||
|
|
@ -412,7 +399,7 @@ class ClientChooserButton extends StatelessWidget {
|
|||
controller.pangeaController,
|
||||
);
|
||||
break;
|
||||
case SettingsAction.classAnalytics:
|
||||
case SettingsAction.spaceAnalytics:
|
||||
context.go('/rooms/analytics');
|
||||
break;
|
||||
case SettingsAction.myAnalytics:
|
||||
|
|
@ -507,11 +494,10 @@ enum SettingsAction {
|
|||
// #Pangea
|
||||
learning,
|
||||
joinWithClassCode,
|
||||
classAnalytics,
|
||||
spaceAnalytics,
|
||||
myAnalytics,
|
||||
findAConversationPartner,
|
||||
logout,
|
||||
newClass,
|
||||
newExchange
|
||||
// Pangea#
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ class NewGroupController extends State<NewGroup> {
|
|||
void initState() {
|
||||
Future.delayed(Duration.zero, () {
|
||||
chatTopic.langCode =
|
||||
pangeaController.languageController.activeL2Code(roomID: null) ??
|
||||
pangeaController.languageController.userL2?.langCode ??
|
||||
pangeaController.pLanguageStore.targetOptions.first.langCode;
|
||||
setState(() {});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:fluffychat/config/themes.dart';
|
||||
import 'package:fluffychat/pages/new_group/new_group.dart';
|
||||
import 'package:fluffychat/pangea/pages/class_settings/p_class_widgets/room_capacity_button.dart';
|
||||
import 'package:fluffychat/pangea/widgets/class/add_class_and_invite.dart';
|
||||
import 'package:fluffychat/pangea/widgets/class/add_space_toggles.dart';
|
||||
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_settings.dart';
|
||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||
|
|
@ -100,7 +99,6 @@ class NewGroupView extends StatelessWidget {
|
|||
key: controller.addToSpaceKey,
|
||||
startOpen: true,
|
||||
activeSpaceId: controller.activeSpaceId,
|
||||
mode: AddToClassMode.chat,
|
||||
),
|
||||
// const SizedBox(height: 16),
|
||||
// SwitchListTile.adaptive(
|
||||
|
|
|
|||
|
|
@ -8,16 +8,14 @@ import 'package:fluffychat/pangea/pages/class_settings/p_class_widgets/room_capa
|
|||
import 'package:fluffychat/pangea/pages/class_settings/p_class_widgets/room_rules_editor.dart';
|
||||
import 'package:fluffychat/pangea/utils/bot_name.dart';
|
||||
import 'package:fluffychat/pangea/utils/class_chat_power_levels.dart';
|
||||
import 'package:fluffychat/pangea/utils/class_code.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/utils/firebase_analytics.dart';
|
||||
import 'package:fluffychat/pangea/utils/space_code.dart';
|
||||
import 'package:fluffychat/pangea/widgets/class/add_space_toggles.dart';
|
||||
import 'package:fluffychat/pangea/widgets/space/class_settings.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:matrix/matrix.dart' as sdk;
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
|
|
@ -36,8 +34,9 @@ class NewSpaceController extends State<NewSpace> {
|
|||
bool publicGroup = true;
|
||||
final GlobalKey<RoomRulesState> rulesEditorKey = GlobalKey<RoomRulesState>();
|
||||
final GlobalKey<AddToSpaceState> addToSpaceKey = GlobalKey<AddToSpaceState>();
|
||||
final GlobalKey<ClassSettingsState> classSettingsKey =
|
||||
GlobalKey<ClassSettingsState>();
|
||||
// commenting out language settings in spaces for now
|
||||
// final GlobalKey<LanguageSettingsState> languageSettingsKey =
|
||||
// GlobalKey<LanguageSettingsState>();
|
||||
final GlobalKey<RoomCapacityButtonState> addCapacityKey =
|
||||
GlobalKey<RoomCapacityButtonState>();
|
||||
|
||||
|
|
@ -68,8 +67,6 @@ class NewSpaceController extends State<NewSpace> {
|
|||
void setPublicGroup(bool b) => setState(() => publicGroup = b);
|
||||
|
||||
// #Pangea
|
||||
bool newClassMode = true;
|
||||
|
||||
List<StateEvent> get initialState {
|
||||
final events = <StateEvent>[];
|
||||
|
||||
|
|
@ -95,11 +92,11 @@ class NewSpaceController extends State<NewSpace> {
|
|||
} else {
|
||||
debugger(when: kDebugMode);
|
||||
}
|
||||
if (classSettingsKey.currentState != null) {
|
||||
events.add(classSettingsKey.currentState!.classSettings.toStateEvent);
|
||||
} else {
|
||||
debugger(when: kDebugMode && newClassMode);
|
||||
}
|
||||
// commenting out language settings in spaces for now
|
||||
// if (languageSettingsKey.currentState != null) {
|
||||
// events
|
||||
// .add(languageSettingsKey.currentState!.languageSettings.toStateEvent);
|
||||
// }
|
||||
|
||||
return events;
|
||||
}
|
||||
|
|
@ -117,33 +114,30 @@ class NewSpaceController extends State<NewSpace> {
|
|||
debugger(when: kDebugMode);
|
||||
return;
|
||||
}
|
||||
if (classSettingsKey.currentState != null &&
|
||||
classSettingsKey.currentState!.sameLanguages) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(L10n.of(context)!.noIdenticalLanguages),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (newClassMode) {
|
||||
final int? languageLevel =
|
||||
classSettingsKey.currentState!.classSettings.languageLevel;
|
||||
if (languageLevel == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(L10n.of(context)!.languageLevelWarning)),
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// commenting out language settings in spaces for now
|
||||
// if (languageSettingsKey.currentState != null &&
|
||||
// languageSettingsKey.currentState!.sameLanguages) {
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text(L10n.of(context)!.noIdenticalLanguages),
|
||||
// ),
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
// final int? languageLevel =
|
||||
// languageSettingsKey.currentState!.languageSettings.languageLevel;
|
||||
// if (languageLevel == null) {
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(content: Text(L10n.of(context)!.languageLevelWarning)),
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
// Pangea#
|
||||
if (nameController.text.isEmpty) {
|
||||
setState(() {
|
||||
// #Pangea
|
||||
// nameError = L10n.of(context)!.pleaseChoose;
|
||||
final String warning = newClassMode
|
||||
? L10n.of(context)!.emptyClassNameWarning
|
||||
: L10n.of(context)!.emptyExchangeNameWarning;
|
||||
final String warning = L10n.of(context)!.emptySpaceNameWarning;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(warning)),
|
||||
);
|
||||
|
|
@ -168,7 +162,7 @@ class NewSpaceController extends State<NewSpace> {
|
|||
// roomAliasName: publicGroup
|
||||
// ? nameController.text.trim().toLowerCase().replaceAll(' ', '_')
|
||||
// : null,
|
||||
roomAliasName: ClassCodeUtil.generateClassCode(),
|
||||
roomAliasName: SpaceCodeUtil.generateSpaceCode(),
|
||||
// Pangea#
|
||||
name: nameController.text.trim(),
|
||||
topic: topicController.text.isEmpty ? null : topicController.text,
|
||||
|
|
@ -224,15 +218,10 @@ class NewSpaceController extends State<NewSpace> {
|
|||
}
|
||||
|
||||
room.setSpaceChild(newChatRoomId, suggested: true);
|
||||
newClassMode
|
||||
? GoogleAnalytics.addParent(
|
||||
newChatRoomId,
|
||||
room.classCode,
|
||||
)
|
||||
: GoogleAnalytics.addChatToExchange(
|
||||
newChatRoomId,
|
||||
room.classCode,
|
||||
);
|
||||
GoogleAnalytics.addParent(
|
||||
newChatRoomId,
|
||||
room.classCode,
|
||||
);
|
||||
|
||||
GoogleAnalytics.createClass(room.name, room.classCode);
|
||||
try {
|
||||
|
|
@ -267,8 +256,6 @@ class NewSpaceController extends State<NewSpace> {
|
|||
// #Pangea
|
||||
// Widget build(BuildContext context) => NewSpaceView(this);
|
||||
Widget build(BuildContext context) {
|
||||
newClassMode =
|
||||
GoRouterState.of(context).pathParameters['newexchange'] != 'exchange';
|
||||
return NewSpaceView(this);
|
||||
}
|
||||
// Pangea#
|
||||
|
|
|
|||
|
|
@ -1,17 +1,14 @@
|
|||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/extensions/client_extension/client_extension.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/pages/class_settings/p_class_widgets/room_capacity_button.dart';
|
||||
import 'package:fluffychat/pangea/pages/class_settings/p_class_widgets/room_rules_editor.dart';
|
||||
import 'package:fluffychat/pangea/widgets/class/add_class_and_invite.dart';
|
||||
import 'package:fluffychat/pangea/widgets/class/add_space_toggles.dart';
|
||||
import 'package:fluffychat/pangea/widgets/space/class_settings.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'new_space.dart';
|
||||
|
||||
|
|
@ -32,29 +29,8 @@ class NewSpaceView extends StatelessWidget {
|
|||
appBar: AppBar(
|
||||
// #Pangea
|
||||
centerTitle: true,
|
||||
title: Text(
|
||||
controller.newClassMode
|
||||
? L10n.of(context)!.createNewClass
|
||||
: L10n.of(context)!.newExchange,
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.class_outlined),
|
||||
selectedIcon: const Icon(Icons.class_),
|
||||
color: controller.newClassMode ? activeColor : null,
|
||||
isSelected: controller.newClassMode,
|
||||
onPressed: () => context.go('/rooms/newspace'),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.connecting_airports),
|
||||
selectedIcon: const Icon(Icons.connecting_airports),
|
||||
color: !controller.newClassMode ? activeColor : null,
|
||||
isSelected: !controller.newClassMode,
|
||||
onPressed: () => context.go('/rooms/newspace/exchange'),
|
||||
),
|
||||
],
|
||||
// title: Text(L10n.of(context)!.createNewSpace),
|
||||
// Pangea#
|
||||
title: Text(L10n.of(context)!.createNewSpace),
|
||||
),
|
||||
body: MaxWidthBody(
|
||||
child: Column(
|
||||
|
|
@ -135,22 +111,19 @@ class NewSpaceView extends StatelessWidget {
|
|||
RoomCapacityButton(
|
||||
key: controller.addCapacityKey,
|
||||
),
|
||||
if (controller.newClassMode)
|
||||
ClassSettings(
|
||||
key: controller.classSettingsKey,
|
||||
roomId: null,
|
||||
startOpen: true,
|
||||
initialSettings:
|
||||
Matrix.of(context).client.lastUpdatedClassSettings,
|
||||
),
|
||||
if (!controller.newClassMode)
|
||||
AddToSpaceToggles(
|
||||
key: controller.addToSpaceKey,
|
||||
startOpen: true,
|
||||
mode: !controller.newClassMode
|
||||
? AddToClassMode.exchange
|
||||
: AddToClassMode.chat,
|
||||
),
|
||||
// commenting out language settings in spaces for now
|
||||
// LanguageSettings(
|
||||
// key: controller.languageSettingsKey,
|
||||
// roomId: null,
|
||||
// startOpen: true,
|
||||
// initialSettings:
|
||||
// Matrix.of(context).client.lastUpdatedLanguageSettings,
|
||||
// ),
|
||||
AddToSpaceToggles(
|
||||
key: controller.addToSpaceKey,
|
||||
startOpen: true,
|
||||
spaceMode: true,
|
||||
),
|
||||
FutureBuilder<PangeaRoomRules?>(
|
||||
future: Matrix.of(context).client.lastUpdatedRoomRules,
|
||||
builder: (context, snapshot) {
|
||||
|
|
@ -194,12 +167,7 @@ class NewSpaceView extends StatelessWidget {
|
|||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
// #Pangea
|
||||
// L10n.of(context)!.createNewSpace,
|
||||
controller.newClassMode
|
||||
? L10n.of(context)!.createClass
|
||||
: L10n.of(context)!.createExchange,
|
||||
// Pangea#
|
||||
L10n.of(context)!.createNewSpace,
|
||||
),
|
||||
),
|
||||
Icon(Icons.adaptive.arrow_forward_outlined),
|
||||
|
|
|
|||
|
|
@ -6,15 +6,13 @@ import 'package:fluffychat/pangea/choreographer/controllers/alternative_translat
|
|||
import 'package:fluffychat/pangea/choreographer/controllers/igc_controller.dart';
|
||||
import 'package:fluffychat/pangea/choreographer/controllers/message_options.dart';
|
||||
import 'package:fluffychat/pangea/constants/language_keys.dart';
|
||||
import 'package:fluffychat/pangea/constants/pangea_event_types.dart';
|
||||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/controllers/subscription_controller.dart';
|
||||
import 'package:fluffychat/pangea/enum/edit_type.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/it_step.dart';
|
||||
import 'package:fluffychat/pangea/models/language_detection_model.dart';
|
||||
import 'package:fluffychat/pangea/models/representation_content_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/models/tokens_event_content_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/any_state_holder.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
|
|
@ -451,17 +449,9 @@ class Choreographer {
|
|||
String? get l2LangCode => l2Lang?.langCode;
|
||||
|
||||
LanguageModel? get l1Lang =>
|
||||
pangeaController.languageController.activeL1Model(
|
||||
roomID: roomId,
|
||||
);
|
||||
String? get l1LangCode => l1Lang?.langCode;
|
||||
pangeaController.languageController.activeL1Model();
|
||||
|
||||
String? get classId => roomId != null
|
||||
? pangeaController.matrixState.client
|
||||
.getRoomById(roomId)
|
||||
?.firstParentWithState(PangeaEventTypes.classSettings)
|
||||
?.id
|
||||
: null;
|
||||
String? get l1LangCode => l1Lang?.langCode;
|
||||
|
||||
String? get userId => pangeaController.userController.userId;
|
||||
|
||||
|
|
|
|||
|
|
@ -265,7 +265,6 @@ class ITController {
|
|||
targetLangCode: targetLangCode,
|
||||
userId: choreographer.userId!,
|
||||
roomId: choreographer.roomId!,
|
||||
classId: choreographer.classId,
|
||||
goldTranslation: goldRouteTracker.fullTranslation,
|
||||
goldContinuances: goldRouteTracker.continuances,
|
||||
),
|
||||
|
|
@ -283,7 +282,6 @@ class ITController {
|
|||
translationId: translationId,
|
||||
targetLangCode: targetLangCode,
|
||||
sourceLangCode: sourceLangCode,
|
||||
classId: choreographer.classId,
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import 'dart:developer';
|
|||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/choreographer/controllers/choreographer.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
|
|
|
|||
|
|
@ -27,11 +27,8 @@ class ModelKey {
|
|||
|
||||
static const String clientIsPublic = "isPublic";
|
||||
static const String clientIsOpenEnrollment = 'isOpenEnrollment';
|
||||
static const String clientIsOpenExchange = 'isOpenExchange';
|
||||
static const String clientIsOneToOneChatClass = 'oneToOneChatClass';
|
||||
static const String clientIsOneToOneChatExchange = 'oneToOneChatExchange';
|
||||
static const String clientIsCreateRooms = 'isCreateRooms';
|
||||
static const String clientIsCreateRoomsExchange = 'isCreateRoomsExchange';
|
||||
static const String clientIsShareVideo = 'isShareVideo';
|
||||
static const String clientIsSharePhoto = 'isSharePhoto';
|
||||
static const String clientIsShareFiles = 'isShareFiles';
|
||||
|
|
@ -39,7 +36,6 @@ class ModelKey {
|
|||
static const String clientIsCreateStories = 'isCreateStories';
|
||||
static const String clientIsVoiceNotes = 'isVoiceNotes';
|
||||
static const String clientIsInviteOnlyStudents = 'isInviteOnlyStudents';
|
||||
static const String clientIsInviteOnlyExchanges = 'isInviteOnlyExchanges';
|
||||
|
||||
static const String userL1 = "user_l1";
|
||||
static const String userL2 = "user_l2";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
class PangeaEventTypes {
|
||||
static const classSettings = "pangea.class";
|
||||
static const pangeaExchange = "p.exchange";
|
||||
static const languageSettings = "pangea.class";
|
||||
|
||||
static const transcript = "pangea.transcript";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
class PangeaRoomTypes {
|
||||
static const analytics = 'p.analytics';
|
||||
static const exchange = 'p.exchange';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import 'package:fluffychat/pangea/constants/pangea_event_types.dart';
|
|||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/extensions/client_extension/client_extension.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/class_code.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/utils/space_code.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
|
@ -35,8 +35,8 @@ class ClassController extends BaseController {
|
|||
Future<void> fixClassPowerLevels() async {
|
||||
try {
|
||||
final List<Future<void>> classFixes = [];
|
||||
final teacherSpaces = await _pangeaController
|
||||
.matrixState.client.classesAndExchangesImTeaching;
|
||||
final teacherSpaces =
|
||||
await _pangeaController.matrixState.client.spacesImTeaching;
|
||||
for (final room in teacherSpaces) {
|
||||
classFixes.add(room.setClassPowerLevels());
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ class ClassController extends BaseController {
|
|||
classCode,
|
||||
).onError(
|
||||
(error, stackTrace) =>
|
||||
ClassCodeUtil.messageSnack(context, ErrorCopy(context, error).body),
|
||||
SpaceCodeUtil.messageSnack(context, ErrorCopy(context, error).body),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -78,8 +78,7 @@ class ClassController extends BaseController {
|
|||
if (!room.isDirectChat) return [];
|
||||
final List<String> existingParentsIds =
|
||||
room.pangeaSpaceParents.map((e) => e.id).toList();
|
||||
final List<Room> spaces =
|
||||
_pangeaController.matrixState.client.classesAndExchangesImIn;
|
||||
final List<Room> spaces = _pangeaController.matrixState.client.spacesImIn;
|
||||
|
||||
//make sure we have the latest participants
|
||||
await Future.wait(spaces.map((e) => e.requestParticipants()));
|
||||
|
|
@ -121,7 +120,7 @@ class ClassController extends BaseController {
|
|||
});
|
||||
|
||||
if (classChunk == null) {
|
||||
ClassCodeUtil.messageSnack(
|
||||
SpaceCodeUtil.messageSnack(
|
||||
context,
|
||||
L10n.of(context)!.unableToFindClass,
|
||||
);
|
||||
|
|
@ -131,7 +130,7 @@ class ClassController extends BaseController {
|
|||
if (_pangeaController.matrixState.client.rooms
|
||||
.any((room) => room.id == classChunk.roomId)) {
|
||||
setActiveSpaceIdInChatListController(classChunk.roomId);
|
||||
ClassCodeUtil.messageSnack(context, L10n.of(context)!.alreadyInClass);
|
||||
SpaceCodeUtil.messageSnack(context, L10n.of(context)!.alreadyInClass);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -170,9 +169,6 @@ class ClassController extends BaseController {
|
|||
final Room? joinedSpace =
|
||||
_pangeaController.matrixState.client.getRoomById(classChunk.roomId);
|
||||
|
||||
// ensure that the user has an analytics room for this space's language
|
||||
await joinedSpace?.ensureAnalyticsRoomExists();
|
||||
|
||||
// when possible, add user's analytics room the to space they joined
|
||||
await joinedSpace?.addAnalyticsRoomsToSpace();
|
||||
|
||||
|
|
@ -181,7 +177,7 @@ class ClassController extends BaseController {
|
|||
GoogleAnalytics.joinClass(classCode);
|
||||
return;
|
||||
} catch (err) {
|
||||
ClassCodeUtil.messageSnack(
|
||||
SpaceCodeUtil.messageSnack(
|
||||
context,
|
||||
ErrorCopy(context, err).body,
|
||||
);
|
||||
|
|
@ -199,7 +195,7 @@ class ClassController extends BaseController {
|
|||
final Room? room = _pangeaController.matrixState.client.getRoomById(roomId);
|
||||
if (room == null) return;
|
||||
|
||||
if (room.classSettings != null && room.pangeaRoomRules == null) {
|
||||
if (room.pangeaRoomRules == null) {
|
||||
try {
|
||||
await _pangeaController.matrixState.client.setRoomStateWithKey(
|
||||
roomId,
|
||||
|
|
|
|||
|
|
@ -3,12 +3,9 @@ import 'dart:developer';
|
|||
import 'package:fluffychat/pangea/constants/language_keys.dart';
|
||||
import 'package:fluffychat/pangea/controllers/language_list_controller.dart';
|
||||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/language_model.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
import '../widgets/user_settings/p_language_dialog.dart';
|
||||
|
|
@ -63,50 +60,51 @@ class LanguageController {
|
|||
return _userL2Code != null ? PangeaLanguage.byLangCode(_userL2Code!) : null;
|
||||
}
|
||||
|
||||
String? activeL1Code({String? roomID}) {
|
||||
final String? activeL2 = activeL2Code(roomID: roomID);
|
||||
if (roomID == null || activeL2 != _userL1Code) {
|
||||
return _userL1Code;
|
||||
}
|
||||
final ClassSettingsModel? classContext = _pangeaController
|
||||
.matrixState.client
|
||||
.getRoomById(roomID)
|
||||
?.firstLanguageSettings;
|
||||
final String? classL1 = classContext?.dominantLanguage;
|
||||
if (classL1 == LanguageKeys.mixedLanguage ||
|
||||
classL1 == LanguageKeys.multiLanguage ||
|
||||
classL1 == null) {
|
||||
if (_userL2Code != _userL1Code) {
|
||||
return _userL2Code;
|
||||
}
|
||||
return LanguageKeys.unknownLanguage;
|
||||
}
|
||||
return classL1;
|
||||
String? activeL1Code() {
|
||||
return _userL1Code;
|
||||
// final String? activeL2 = activeL2Code(roomID: roomID);
|
||||
// if (roomID == null || activeL2 != _userL1Code) {
|
||||
// return _userL1Code;
|
||||
// }
|
||||
// final LanguageSettingsModel? classContext = _pangeaController
|
||||
// .matrixState.client
|
||||
// .getRoomById(roomID)
|
||||
// ?.firstLanguageSettings;
|
||||
// final String? classL1 = classContext?.dominantLanguage;
|
||||
// if (classL1 == LanguageKeys.mixedLanguage ||
|
||||
// classL1 == LanguageKeys.multiLanguage ||
|
||||
// classL1 == null) {
|
||||
// if (_userL2Code != _userL1Code) {
|
||||
// return _userL2Code;
|
||||
// }
|
||||
// return LanguageKeys.unknownLanguage;
|
||||
// }
|
||||
// return classL1;
|
||||
}
|
||||
|
||||
/// Class languages override user languages within a class context
|
||||
String? activeL2Code({String? roomID}) {
|
||||
if (roomID == null) {
|
||||
return _userL2Code;
|
||||
}
|
||||
final ClassSettingsModel? classContext = _pangeaController
|
||||
.matrixState.client
|
||||
.getRoomById(roomID)
|
||||
?.firstLanguageSettings;
|
||||
return classContext?.targetLanguage ?? _userL2Code;
|
||||
String? activeL2Code() {
|
||||
return _userL2Code;
|
||||
// if (roomID == null) {
|
||||
// return _userL2Code;
|
||||
// }
|
||||
// final LanguageSettingsModel? classContext = _pangeaController
|
||||
// .matrixState.client
|
||||
// .getRoomById(roomID)
|
||||
// ?.firstLanguageSettings;
|
||||
// return classContext?.targetLanguage ?? _userL2Code;
|
||||
}
|
||||
|
||||
LanguageModel? activeL1Model({String? roomID}) {
|
||||
final activeL1 = activeL1Code(roomID: roomID);
|
||||
return activeL1 != null ? PangeaLanguage.byLangCode(activeL1) : null;
|
||||
LanguageModel? activeL1Model() {
|
||||
return userL1;
|
||||
// final activeL1 = activeL1Code(roomID: roomID);
|
||||
// return activeL1 != null ? PangeaLanguage.byLangCode(activeL1) : null;
|
||||
}
|
||||
|
||||
LanguageModel? activeL2Model({String? roomID}) {
|
||||
final activeL2 = activeL2Code(roomID: roomID);
|
||||
final model = activeL2 != null ? PangeaLanguage.byLangCode(activeL2) : null;
|
||||
return model;
|
||||
return userL2;
|
||||
// final activeL2 = activeL2Code(roomID: roomID);
|
||||
// final model = activeL2 != null ? PangeaLanguage.byLangCode(activeL2) : null;
|
||||
// return model;
|
||||
}
|
||||
|
||||
bool equalActiveL1AndActiveL2({Room? room}) =>
|
||||
activeL1Code() == activeL2Code(roomID: room?.id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
|
||||
class LocalSettings {
|
||||
late PangeaController _pangeaController;
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@ import 'dart:developer';
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:fluffychat/pangea/constants/match_rule_ids.dart';
|
||||
import 'package:fluffychat/pangea/constants/pangea_event_types.dart';
|
||||
import 'package:fluffychat/pangea/controllers/language_list_controller.dart';
|
||||
import 'package:fluffychat/pangea/enum/construct_type_enum.dart';
|
||||
import 'package:fluffychat/pangea/enum/time_span.dart';
|
||||
import 'package:fluffychat/pangea/models/analytics/analytics_event.dart';
|
||||
import 'package:fluffychat/pangea/models/analytics/constructs_event.dart';
|
||||
import 'package:fluffychat/pangea/models/analytics/summary_analytics_event.dart';
|
||||
import 'package:fluffychat/pangea/models/language_model.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/base_analytics.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
|
@ -62,6 +64,33 @@ class AnalyticsController extends BaseController {
|
|||
);
|
||||
}
|
||||
|
||||
///////// SPACE ANALYTICS LANGUAGES //////////
|
||||
String get _analyticsSpaceLangKey => "ANALYTICS_SPACE_LANG_KEY";
|
||||
|
||||
LanguageModel get currentAnalyticsSpaceLang {
|
||||
try {
|
||||
final String? str = _pangeaController.pStoreService.read(
|
||||
_analyticsSpaceLangKey,
|
||||
local: true,
|
||||
);
|
||||
return str != null
|
||||
? PangeaLanguage.byLangCode(str)
|
||||
: _pangeaController.languageController.userL2 ??
|
||||
_pangeaController.pLanguageStore.targetOptions.first;
|
||||
} catch (err) {
|
||||
debugger(when: kDebugMode);
|
||||
return _pangeaController.pLanguageStore.targetOptions.first;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setCurrentAnalyticsSpaceLang(LanguageModel lang) async {
|
||||
await _pangeaController.pStoreService.save(
|
||||
_analyticsSpaceLangKey,
|
||||
lang.langCode,
|
||||
local: true,
|
||||
);
|
||||
}
|
||||
|
||||
Future<DateTime?> myAnalyticsLastUpdated(String type) async {
|
||||
// given an analytics event type, get the last updated times
|
||||
// for each of the user's analytics rooms and return the most recent
|
||||
|
|
@ -96,7 +125,6 @@ class AnalyticsController extends BaseController {
|
|||
Future<DateTime?> spaceAnalyticsLastUpdated(
|
||||
String type,
|
||||
Room space,
|
||||
String langCode,
|
||||
) async {
|
||||
// check if any students have recently updated their analytics
|
||||
// if any have, then the cache needs to be updated
|
||||
|
|
@ -106,7 +134,7 @@ class AnalyticsController extends BaseController {
|
|||
final List<Future<DateTime?>> lastUpdatedFutures = [];
|
||||
for (final student in space.students) {
|
||||
final Room? analyticsRoom = _pangeaController.matrixState.client
|
||||
.analyticsRoomLocal(langCode, student.id);
|
||||
.analyticsRoomLocal(currentAnalyticsSpaceLang.langCode, student.id);
|
||||
if (analyticsRoom == null) continue;
|
||||
lastUpdatedFutures.add(
|
||||
analyticsRoom.analyticsLastUpdated(
|
||||
|
|
@ -168,9 +196,6 @@ class AnalyticsController extends BaseController {
|
|||
) async {
|
||||
// gets all the summary analytics events for the students
|
||||
// in a space since the current timespace's cut off date
|
||||
final langCode = _pangeaController.languageController.activeL2Code(
|
||||
roomID: space.id,
|
||||
);
|
||||
|
||||
// ensure that all the space's events are loaded (mainly the for langCode)
|
||||
// and that the participants are loaded
|
||||
|
|
@ -181,7 +206,7 @@ class AnalyticsController extends BaseController {
|
|||
final List<SummaryAnalyticsEvent> analyticsEvents = [];
|
||||
for (final student in space.students) {
|
||||
final Room? analyticsRoom = _pangeaController.matrixState.client
|
||||
.analyticsRoomLocal(langCode, student.id);
|
||||
.analyticsRoomLocal(currentAnalyticsSpaceLang.langCode, student.id);
|
||||
|
||||
if (analyticsRoom != null) {
|
||||
final List<AnalyticsEvent>? roomEvents =
|
||||
|
|
@ -225,7 +250,8 @@ class AnalyticsController extends BaseController {
|
|||
(e.defaultSelected.id == defaultSelected.id) &&
|
||||
(e.defaultSelected.type == defaultSelected.type) &&
|
||||
(e.selected?.id == selected?.id) &&
|
||||
(e.selected?.type == selected?.type),
|
||||
(e.selected?.type == selected?.type) &&
|
||||
(e.langCode == currentAnalyticsSpaceLang.langCode),
|
||||
);
|
||||
|
||||
if (index != -1) {
|
||||
|
|
@ -253,6 +279,7 @@ class AnalyticsController extends BaseController {
|
|||
chartAnalyticsModel: chartAnalyticsModel,
|
||||
defaultSelected: defaultSelected,
|
||||
selected: selected,
|
||||
langCode: currentAnalyticsSpaceLang.langCode,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -401,11 +428,11 @@ class AnalyticsController extends BaseController {
|
|||
bool forceUpdate = false,
|
||||
}) async {
|
||||
try {
|
||||
debugPrint("getting analytics");
|
||||
await _pangeaController.matrixState.client.roomsLoading;
|
||||
|
||||
// if the user is looking at space analytics, then fetch the space
|
||||
Room? space;
|
||||
String? langCode;
|
||||
if (defaultSelected.type == AnalyticsEntryType.space) {
|
||||
space = _pangeaController.matrixState.client.getRoomById(
|
||||
defaultSelected.id,
|
||||
|
|
@ -423,23 +450,7 @@ class AnalyticsController extends BaseController {
|
|||
timeSpan: currentAnalyticsTimeSpan,
|
||||
);
|
||||
}
|
||||
|
||||
await space.postLoad();
|
||||
langCode = _pangeaController.languageController.activeL2Code(
|
||||
roomID: space.id,
|
||||
);
|
||||
if (langCode == null) {
|
||||
ErrorHandler.logError(
|
||||
m: "langCode missing in getAnalytics",
|
||||
data: {
|
||||
"space": space,
|
||||
},
|
||||
);
|
||||
return ChartAnalyticsModel(
|
||||
msgs: [],
|
||||
timeSpan: currentAnalyticsTimeSpan,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
DateTime? lastUpdated;
|
||||
|
|
@ -456,7 +467,6 @@ class AnalyticsController extends BaseController {
|
|||
lastUpdated = await spaceAnalyticsLastUpdated(
|
||||
PangeaEventTypes.summaryAnalytics,
|
||||
space!,
|
||||
langCode!,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -467,8 +477,10 @@ class AnalyticsController extends BaseController {
|
|||
lastUpdated: lastUpdated,
|
||||
);
|
||||
if (local != null && !forceUpdate) {
|
||||
debugPrint("returning local analytics");
|
||||
return local;
|
||||
}
|
||||
debugPrint("fetching new analytics");
|
||||
|
||||
// get all the relevant summary analytics events for the current timespan
|
||||
final List<SummaryAnalyticsEvent> summaryEvents =
|
||||
|
|
@ -548,24 +560,10 @@ class AnalyticsController extends BaseController {
|
|||
) async {
|
||||
await space.postLoad();
|
||||
await space.requestParticipants();
|
||||
final String? langCode = _pangeaController.languageController.activeL2Code(
|
||||
roomID: space.id,
|
||||
);
|
||||
|
||||
if (langCode == null) {
|
||||
ErrorHandler.logError(
|
||||
m: "langCode missing in allSpaceMemberConstructs",
|
||||
data: {
|
||||
"space": space,
|
||||
},
|
||||
);
|
||||
return [];
|
||||
}
|
||||
|
||||
final List<ConstructAnalyticsEvent> constructEvents = [];
|
||||
for (final student in space.students) {
|
||||
final Room? analyticsRoom = _pangeaController.matrixState.client
|
||||
.analyticsRoomLocal(langCode, student.id);
|
||||
.analyticsRoomLocal(currentAnalyticsSpaceLang.langCode, student.id);
|
||||
if (analyticsRoom != null) {
|
||||
final List<ConstructAnalyticsEvent>? roomEvents =
|
||||
(await analyticsRoom.getAnalyticsEvents(
|
||||
|
|
@ -665,7 +663,8 @@ class AnalyticsController extends BaseController {
|
|||
e.defaultSelected.id == defaultSelected.id &&
|
||||
e.defaultSelected.type == defaultSelected.type &&
|
||||
e.selected?.id == selected?.id &&
|
||||
e.selected?.type == selected?.type,
|
||||
e.selected?.type == selected?.type &&
|
||||
e.langCode == currentAnalyticsSpaceLang.langCode,
|
||||
);
|
||||
|
||||
if (index > -1) {
|
||||
|
|
@ -691,6 +690,7 @@ class AnalyticsController extends BaseController {
|
|||
events: List.from(events),
|
||||
defaultSelected: defaultSelected,
|
||||
selected: selected,
|
||||
langCode: currentAnalyticsSpaceLang.langCode,
|
||||
);
|
||||
_cachedConstructs.add(entry);
|
||||
}
|
||||
|
|
@ -784,10 +784,10 @@ class AnalyticsController extends BaseController {
|
|||
bool removeIT = true,
|
||||
bool forceUpdate = false,
|
||||
}) async {
|
||||
debugPrint("getting constructs");
|
||||
await _pangeaController.matrixState.client.roomsLoading;
|
||||
|
||||
Room? space;
|
||||
String? langCode;
|
||||
if (defaultSelected.type == AnalyticsEntryType.space) {
|
||||
space = _pangeaController.matrixState.client.getRoomById(
|
||||
defaultSelected.id,
|
||||
|
|
@ -803,18 +803,6 @@ class AnalyticsController extends BaseController {
|
|||
return [];
|
||||
}
|
||||
await space.postLoad();
|
||||
langCode = _pangeaController.languageController.activeL2Code(
|
||||
roomID: space.id,
|
||||
);
|
||||
if (langCode == null) {
|
||||
ErrorHandler.logError(
|
||||
m: "langCode missing in setConstructs",
|
||||
data: {
|
||||
"space": space,
|
||||
},
|
||||
);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
DateTime? lastUpdated;
|
||||
|
|
@ -831,7 +819,6 @@ class AnalyticsController extends BaseController {
|
|||
lastUpdated = await spaceAnalyticsLastUpdated(
|
||||
PangeaEventTypes.construct,
|
||||
space!,
|
||||
langCode!,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -843,8 +830,10 @@ class AnalyticsController extends BaseController {
|
|||
lastUpdated: lastUpdated,
|
||||
);
|
||||
if (local != null && !forceUpdate) {
|
||||
debugPrint("returning local constructs");
|
||||
return local;
|
||||
}
|
||||
debugPrint("fetching new constructs");
|
||||
|
||||
final filteredConstructs = space == null
|
||||
? await getMyConstructs(
|
||||
|
|
@ -884,6 +873,7 @@ class AnalyticsController extends BaseController {
|
|||
}
|
||||
|
||||
abstract class CacheEntry {
|
||||
final String langCode;
|
||||
final TimeSpan timeSpan;
|
||||
final AnalyticsSelected defaultSelected;
|
||||
AnalyticsSelected? selected;
|
||||
|
|
@ -892,6 +882,7 @@ abstract class CacheEntry {
|
|||
CacheEntry({
|
||||
required this.timeSpan,
|
||||
required this.defaultSelected,
|
||||
required this.langCode,
|
||||
this.selected,
|
||||
}) {
|
||||
_createdAt = DateTime.now();
|
||||
|
|
@ -924,17 +915,19 @@ class ConstructCacheEntry extends CacheEntry {
|
|||
required this.type,
|
||||
required this.events,
|
||||
required super.timeSpan,
|
||||
required super.langCode,
|
||||
required super.defaultSelected,
|
||||
super.selected,
|
||||
});
|
||||
}
|
||||
|
||||
class AnalyticsCacheModel extends CacheEntry {
|
||||
ChartAnalyticsModel chartAnalyticsModel;
|
||||
final ChartAnalyticsModel chartAnalyticsModel;
|
||||
|
||||
AnalyticsCacheModel({
|
||||
required this.chartAnalyticsModel,
|
||||
required super.timeSpan,
|
||||
required super.langCode,
|
||||
required super.defaultSelected,
|
||||
super.selected,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -176,14 +176,20 @@ class MessageDataController extends BaseController {
|
|||
required String target,
|
||||
required Room room,
|
||||
}) async {
|
||||
if (_pangeaController.languageController.userL2 == null ||
|
||||
_pangeaController.languageController.userL1 == null) {
|
||||
ErrorHandler.logError(
|
||||
e: "userL1 or userL2 is null in _getPangeaRepresentation",
|
||||
s: StackTrace.current,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
final req = FullTextTranslationRequestModel(
|
||||
text: text,
|
||||
tgtLang: target,
|
||||
srcLang: source,
|
||||
userL2:
|
||||
_pangeaController.languageController.activeL2Code(roomID: room.id)!,
|
||||
userL1:
|
||||
_pangeaController.languageController.activeL1Code(roomID: room.id)!,
|
||||
userL2: _pangeaController.languageController.userL2!.langCode,
|
||||
userL1: _pangeaController.languageController.userL1!.langCode,
|
||||
);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -207,8 +207,9 @@ class MyAnalyticsController extends BaseController {
|
|||
for (final Room chat in _studentChats) {
|
||||
// for each chat the student studies in, check if the langCode
|
||||
// matches the langCode of the analytics room
|
||||
// TODO gabby - replace this
|
||||
final String? chatLangCode =
|
||||
_pangeaController.languageController.activeL2Code(roomID: chat.id);
|
||||
_pangeaController.languageController.activeL2Code();
|
||||
if (chatLangCode != langCode) continue;
|
||||
|
||||
// get messages the logged in user has sent in all chats
|
||||
|
|
@ -251,11 +252,10 @@ class MyAnalyticsController extends BaseController {
|
|||
List<String> targetLangs = [];
|
||||
final String? userL2 = _pangeaController.languageController.activeL2Code();
|
||||
if (userL2 != null) targetLangs.add(userL2);
|
||||
// TODO gabby - replace this
|
||||
final List<String?> spaceL2s = studentSpaces
|
||||
.map(
|
||||
(space) => _pangeaController.languageController.activeL2Code(
|
||||
roomID: space.id,
|
||||
),
|
||||
(space) => _pangeaController.languageController.activeL2Code(),
|
||||
)
|
||||
.toList();
|
||||
targetLangs.addAll(spaceL2s.where((l2) => l2 != null).cast<String>());
|
||||
|
|
@ -296,8 +296,8 @@ class MyAnalyticsController extends BaseController {
|
|||
List<Room> _studentSpaces = [];
|
||||
|
||||
Future<void> setStudentSpaces() async {
|
||||
_studentSpaces = await _pangeaController
|
||||
.matrixState.client.classesAndExchangesImStudyingIn;
|
||||
_studentSpaces =
|
||||
await _pangeaController.matrixState.client.spacesImStudyingIn;
|
||||
}
|
||||
|
||||
List<Room> get studentSpaces {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import 'package:fluffychat/pangea/constants/pangea_event_types.dart';
|
|||
import 'package:fluffychat/pangea/controllers/base_controller.dart';
|
||||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/models/user_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/p_extension.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
|
@ -117,27 +117,4 @@ class PermissionsController extends BaseController {
|
|||
return isToolEnabled(ToolSetting.interactiveTranslator, room) &&
|
||||
isToolEnabled(ToolSetting.interactiveGrammar, room);
|
||||
}
|
||||
|
||||
// bool get showChatListStartChatFloatingActionButton {
|
||||
// //for now, I'm turning off chat button when not in the context of a clas
|
||||
// //it will still be possible to private chat outside of a class
|
||||
// //need to investigate if private chats can be put in a space. i suppose they can
|
||||
// //if so, do we want that?
|
||||
// try {
|
||||
// if (_pangeaController.classController.activeClass == null) return false;
|
||||
|
||||
// // final isExchange =
|
||||
// // (_pangeaController.classController.activeClass?.isExchange ?? false);
|
||||
// const isExchange = false;
|
||||
// final regular = (canUserPrivateChat() || canUserGroupChat());
|
||||
// final inExchange =
|
||||
// (canUserPrivateChatExchanges() || canUserGroupChatExchanges());
|
||||
// final theAnswer = isExchange ? inExchange : regular;
|
||||
// // debugger(when: kDebugMode && !theAnswer);
|
||||
// return theAnswer;
|
||||
// } catch (e, s) {
|
||||
// ErrorHandler.logError(e: e, s: s);
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import 'package:fluffychat/pangea/constants/pangea_event_types.dart';
|
|||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import '../extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import '../models/class_model.dart';
|
||||
import '../models/space_model.dart';
|
||||
|
||||
class RoomRulesEditController {
|
||||
final Room? room;
|
||||
|
|
|
|||
|
|
@ -1,83 +0,0 @@
|
|||
part of "client_extension.dart";
|
||||
|
||||
extension ClassesAndExchangesClientExtension on Client {
|
||||
List<Room> get _classes => rooms.where((e) => e.isPangeaClass).toList();
|
||||
|
||||
List<Room> get _classesImTeaching => rooms
|
||||
.where(
|
||||
(e) =>
|
||||
e.isPangeaClass &&
|
||||
e.ownPowerLevel == ClassDefaultValues.powerLevelOfAdmin,
|
||||
)
|
||||
.toList();
|
||||
|
||||
Future<List<Room>> get _classesAndExchangesImTeaching async {
|
||||
final allSpaces = rooms.where((room) => room.isSpace);
|
||||
for (final Room space in allSpaces) {
|
||||
if (space.getState(EventTypes.RoomPowerLevels) == null) {
|
||||
await space.postLoad();
|
||||
}
|
||||
}
|
||||
|
||||
final spaces = rooms
|
||||
.where(
|
||||
(e) =>
|
||||
(e.isPangeaClass || e.isExchange) &&
|
||||
e.ownPowerLevel == ClassDefaultValues.powerLevelOfAdmin,
|
||||
)
|
||||
.toList();
|
||||
return spaces;
|
||||
}
|
||||
|
||||
List<Room> get _classesImIn => rooms
|
||||
.where(
|
||||
(e) =>
|
||||
e.isPangeaClass &&
|
||||
e.ownPowerLevel < ClassDefaultValues.powerLevelOfAdmin,
|
||||
)
|
||||
.toList();
|
||||
|
||||
Future<List<Room>> get _classesAndExchangesImStudyingIn async {
|
||||
final List<Room> joinedSpaces = rooms
|
||||
.where(
|
||||
(room) => room.isSpace && room.membership == Membership.join,
|
||||
)
|
||||
.toList();
|
||||
|
||||
for (final Room space in joinedSpaces) {
|
||||
if (space.getState(EventTypes.RoomPowerLevels) == null) {
|
||||
await space.postLoad();
|
||||
}
|
||||
}
|
||||
|
||||
final spaces = rooms
|
||||
.where(
|
||||
(e) =>
|
||||
(e.isPangeaClass || e.isExchange) &&
|
||||
e.ownPowerLevel < ClassDefaultValues.powerLevelOfAdmin,
|
||||
)
|
||||
.toList();
|
||||
return spaces;
|
||||
}
|
||||
|
||||
List<Room> get _classesAndExchangesImIn =>
|
||||
rooms.where((e) => e.isPangeaClass || e.isExchange).toList();
|
||||
|
||||
Future<PangeaRoomRules?> get _lastUpdatedRoomRules async =>
|
||||
(await _classesAndExchangesImTeaching)
|
||||
.where((space) => space.rulesUpdatedAt != null)
|
||||
.sorted(
|
||||
(a, b) => b.rulesUpdatedAt!.compareTo(a.rulesUpdatedAt!),
|
||||
)
|
||||
.firstOrNull
|
||||
?.pangeaRoomRules;
|
||||
|
||||
ClassSettingsModel? get _lastUpdatedClassSettings => classesImTeaching
|
||||
.where((space) => space.classSettingsUpdatedAt != null)
|
||||
.sorted(
|
||||
(a, b) =>
|
||||
b.classSettingsUpdatedAt!.compareTo(a.classSettingsUpdatedAt!),
|
||||
)
|
||||
.firstOrNull
|
||||
?.classSettings;
|
||||
}
|
||||
|
|
@ -123,7 +123,7 @@ extension AnalyticsClientExtension on Client {
|
|||
// Allows teachers to join analytics rooms without being invited
|
||||
Future<void> _joinAnalyticsRoomsInAllSpaces() async {
|
||||
final List<Future> joinFutures = [];
|
||||
for (final Room space in (await _classesAndExchangesImTeaching)) {
|
||||
for (final Room space in (await _spacesImTeaching)) {
|
||||
joinFutures.add(space.joinAnalyticsRoomsInSpace());
|
||||
}
|
||||
await Future.wait(joinFutures);
|
||||
|
|
|
|||
|
|
@ -5,15 +5,15 @@ import 'package:fluffychat/pangea/constants/class_default_values.dart';
|
|||
import 'package:fluffychat/pangea/constants/model_keys.dart';
|
||||
import 'package:fluffychat/pangea/constants/pangea_room_types.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/bot_name.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
part "classes_and_exchanges_extension.dart";
|
||||
part "client_analytics_extension.dart";
|
||||
part "general_info_extension.dart";
|
||||
part "space_extension.dart";
|
||||
|
||||
extension PangeaClient on Client {
|
||||
// analytics
|
||||
|
|
@ -43,27 +43,17 @@ extension PangeaClient on Client {
|
|||
|
||||
Future<void> migrateAnalyticsRooms() async => await _migrateAnalyticsRooms();
|
||||
|
||||
// classes_and_exchanges
|
||||
// spaces
|
||||
|
||||
List<Room> get classes => _classes;
|
||||
Future<List<Room>> get spacesImTeaching async => await _spacesImTeaching;
|
||||
|
||||
List<Room> get classesImTeaching => _classesImTeaching;
|
||||
Future<List<Room>> get spacesImStudyingIn async => await _spacesImStudyingIn;
|
||||
|
||||
Future<List<Room>> get classesAndExchangesImTeaching async =>
|
||||
await _classesAndExchangesImTeaching;
|
||||
|
||||
List<Room> get classesImIn => _classesImIn;
|
||||
|
||||
Future<List<Room>> get classesAndExchangesImStudyingIn async =>
|
||||
await _classesAndExchangesImStudyingIn;
|
||||
|
||||
List<Room> get classesAndExchangesImIn => _classesAndExchangesImIn;
|
||||
List<Room> get spacesImIn => _spacesImIn;
|
||||
|
||||
Future<PangeaRoomRules?> get lastUpdatedRoomRules async =>
|
||||
await _lastUpdatedRoomRules;
|
||||
|
||||
ClassSettingsModel? get lastUpdatedClassSettings => _lastUpdatedClassSettings;
|
||||
|
||||
// general_info
|
||||
|
||||
Future<List<String>> get teacherRoomIds async => await _teacherRoomIds;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ part of "client_extension.dart";
|
|||
extension GeneralInfoClientExtension on Client {
|
||||
Future<List<String>> get _teacherRoomIds async {
|
||||
final List<String> adminRoomIds = [];
|
||||
for (final Room adminSpace in (await _classesAndExchangesImTeaching)) {
|
||||
for (final Room adminSpace in (await _spacesImTeaching)) {
|
||||
adminRoomIds.add(adminSpace.id);
|
||||
final List<String> adminSpaceRooms = adminSpace.allSpaceChildRoomIds;
|
||||
adminRoomIds.addAll(adminSpaceRooms);
|
||||
|
|
@ -13,7 +13,7 @@ extension GeneralInfoClientExtension on Client {
|
|||
|
||||
Future<List<User>> get _myTeachers async {
|
||||
final List<User> teachers = [];
|
||||
for (final classRoom in classesAndExchangesImIn) {
|
||||
for (final classRoom in spacesImIn) {
|
||||
for (final teacher in await classRoom.teachers) {
|
||||
// If person requesting list of teachers is a teacher in another classroom, don't add them to the list
|
||||
if (!teachers.any((e) => e.id == teacher.id) && userID != teacher.id) {
|
||||
|
|
|
|||
64
lib/pangea/extensions/client_extension/space_extension.dart
Normal file
64
lib/pangea/extensions/client_extension/space_extension.dart
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
part of "client_extension.dart";
|
||||
|
||||
extension SpaceClientExtension on Client {
|
||||
Future<List<Room>> get _spacesImTeaching async {
|
||||
final allSpaces = rooms.where((room) => room.isSpace);
|
||||
for (final Room space in allSpaces) {
|
||||
if (space.getState(EventTypes.RoomPowerLevels) == null) {
|
||||
await space.postLoad();
|
||||
}
|
||||
}
|
||||
|
||||
final spaces = rooms
|
||||
.where(
|
||||
(e) =>
|
||||
(e.isSpace) &&
|
||||
e.ownPowerLevel == ClassDefaultValues.powerLevelOfAdmin,
|
||||
)
|
||||
.toList();
|
||||
return spaces;
|
||||
}
|
||||
|
||||
Future<List<Room>> get _spacesImStudyingIn async {
|
||||
final List<Room> joinedSpaces = rooms
|
||||
.where(
|
||||
(room) => room.isSpace && room.membership == Membership.join,
|
||||
)
|
||||
.toList();
|
||||
|
||||
for (final Room space in joinedSpaces) {
|
||||
if (space.getState(EventTypes.RoomPowerLevels) == null) {
|
||||
await space.postLoad();
|
||||
}
|
||||
}
|
||||
|
||||
final spaces = rooms
|
||||
.where(
|
||||
(e) =>
|
||||
e.isSpace &&
|
||||
e.ownPowerLevel < ClassDefaultValues.powerLevelOfAdmin,
|
||||
)
|
||||
.toList();
|
||||
return spaces;
|
||||
}
|
||||
|
||||
List<Room> get _spacesImIn => rooms.where((e) => e.isSpace).toList();
|
||||
|
||||
Future<PangeaRoomRules?> get _lastUpdatedRoomRules async =>
|
||||
(await _spacesImTeaching)
|
||||
.where((space) => space.rulesUpdatedAt != null)
|
||||
.sorted(
|
||||
(a, b) => b.rulesUpdatedAt!.compareTo(a.rulesUpdatedAt!),
|
||||
)
|
||||
.firstOrNull
|
||||
?.pangeaRoomRules;
|
||||
|
||||
// LanguageSettingsModel? get _lastUpdatedLanguageSettings => rooms
|
||||
// .where((room) => room.isSpace && room.languageSettingsUpdatedAt != null)
|
||||
// .sorted(
|
||||
// (a, b) => b.languageSettingsUpdatedAt!
|
||||
// .compareTo(a.languageSettingsUpdatedAt!),
|
||||
// )
|
||||
// .firstOrNull
|
||||
// ?.languageSettings;
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ extension ChildrenAndParentsRoomExtension on Room {
|
|||
//resolve somehow if multiple rooms have the state?
|
||||
//check logic
|
||||
Room? _firstParentWithState(String stateType) {
|
||||
if (![PangeaEventTypes.classSettings, PangeaEventTypes.rules]
|
||||
if (![PangeaEventTypes.languageSettings, PangeaEventTypes.rules]
|
||||
.contains(stateType)) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -77,13 +77,6 @@ extension ChildrenAndParentsRoomExtension on Room {
|
|||
return null;
|
||||
}
|
||||
|
||||
/// find any parents and return the rooms
|
||||
List<Room> get _immediateClassParents => pangeaSpaceParents
|
||||
.where(
|
||||
(element) => element.isPangeaClass,
|
||||
)
|
||||
.toList();
|
||||
|
||||
List<Room> get _pangeaSpaceParents => client.rooms
|
||||
.where(
|
||||
(r) => r.isSpace,
|
||||
|
|
@ -98,16 +91,16 @@ extension ChildrenAndParentsRoomExtension on Room {
|
|||
String _nameIncludingParents(BuildContext context) {
|
||||
String nameSoFar = getLocalizedDisplayname(MatrixLocals(L10n.of(context)!));
|
||||
Room currentRoom = this;
|
||||
if (currentRoom.immediateClassParents.isEmpty) {
|
||||
if (currentRoom.pangeaSpaceParents.isEmpty) {
|
||||
return nameSoFar;
|
||||
}
|
||||
currentRoom = currentRoom.immediateClassParents.first;
|
||||
currentRoom = currentRoom.pangeaSpaceParents.first;
|
||||
var nameToAdd =
|
||||
currentRoom.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!));
|
||||
nameToAdd =
|
||||
nameToAdd.length <= 10 ? nameToAdd : "${nameToAdd.substring(0, 10)}...";
|
||||
nameSoFar = '$nameToAdd > $nameSoFar';
|
||||
if (currentRoom.immediateClassParents.isEmpty) {
|
||||
if (currentRoom.pangeaSpaceParents.isEmpty) {
|
||||
return nameSoFar;
|
||||
}
|
||||
return "... > $nameSoFar";
|
||||
|
|
@ -127,4 +120,14 @@ extension ChildrenAndParentsRoomExtension on Room {
|
|||
}
|
||||
return childIds;
|
||||
}
|
||||
|
||||
// Checks if has permissions to add child chat
|
||||
// Or whether potential child space is ancestor of this
|
||||
bool _canAddAsParentOf(Room? child, {bool spaceMode = false}) {
|
||||
if (child == null || !child.isSpace) {
|
||||
return _canIAddSpaceChild(child, spaceMode: spaceMode);
|
||||
}
|
||||
if (id == child.id) return false;
|
||||
return !child._allSpaceChildRoomIds.contains(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import 'package:fluffychat/pangea/models/analytics/constructs_event.dart';
|
|||
import 'package:fluffychat/pangea/models/analytics/summary_analytics_event.dart';
|
||||
import 'package:fluffychat/pangea/models/analytics/summary_analytics_model.dart';
|
||||
import 'package:fluffychat/pangea/models/bot_options_model.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/models/tokens_event_content_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/bot_name.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
|
|
@ -36,11 +36,11 @@ import '../../models/representation_content_model.dart';
|
|||
import '../client_extension/client_extension.dart';
|
||||
|
||||
part "children_and_parents_extension.dart";
|
||||
part "class_and_exchange_settings_extension.dart";
|
||||
part "events_extension.dart";
|
||||
part "room_analytics_extension.dart";
|
||||
part "room_information_extension.dart";
|
||||
part "room_settings_extension.dart";
|
||||
part "space_settings_extension.dart";
|
||||
part "user_permissions_extension.dart";
|
||||
|
||||
extension PangeaRoom on Room {
|
||||
|
|
@ -49,9 +49,6 @@ extension PangeaRoom on Room {
|
|||
Future<void> joinAnalyticsRoomsInSpace() async =>
|
||||
await _joinAnalyticsRoomsInSpace();
|
||||
|
||||
Future<void> ensureAnalyticsRoomExists() async =>
|
||||
await _ensureAnalyticsRoomExists();
|
||||
|
||||
Future<void> addAnalyticsRoomToSpace(Room analyticsRoom) async =>
|
||||
await _addAnalyticsRoomToSpace(analyticsRoom);
|
||||
|
||||
|
|
@ -105,8 +102,6 @@ extension PangeaRoom on Room {
|
|||
Room? firstParentWithState(String stateType) =>
|
||||
_firstParentWithState(stateType);
|
||||
|
||||
List<Room> get immediateClassParents => _immediateClassParents;
|
||||
|
||||
List<Room> get pangeaSpaceParents => _pangeaSpaceParents;
|
||||
|
||||
String nameIncludingParents(BuildContext context) =>
|
||||
|
|
@ -114,7 +109,10 @@ extension PangeaRoom on Room {
|
|||
|
||||
List<String> get allSpaceChildRoomIds => _allSpaceChildRoomIds;
|
||||
|
||||
// class_and_exchange_settings
|
||||
bool canAddAsParentOf(Room? child, {spaceMode = false}) =>
|
||||
_canAddAsParentOf(child, spaceMode: spaceMode);
|
||||
|
||||
// space settings
|
||||
|
||||
DateTime? get rulesUpdatedAt => _rulesUpdatedAt;
|
||||
|
||||
|
|
@ -128,16 +126,8 @@ extension PangeaRoom on Room {
|
|||
|
||||
Future<void> setClassPowerLevels() async => await _setClassPowerLevels();
|
||||
|
||||
DateTime? get classSettingsUpdatedAt => _classSettingsUpdatedAt;
|
||||
|
||||
ClassSettingsModel? get classSettings => _classSettings;
|
||||
|
||||
Event? get languageSettingsStateEvent => _languageSettingsStateEvent;
|
||||
|
||||
Event? get pangeaRoomRulesStateEvent => _pangeaRoomRulesStateEvent;
|
||||
|
||||
ClassSettingsModel? get firstLanguageSettings => _firstLanguageSettings;
|
||||
|
||||
// events
|
||||
|
||||
Future<bool> leaveIfFull() async => await _leaveIfFull();
|
||||
|
|
@ -216,8 +206,6 @@ extension PangeaRoom on Room {
|
|||
|
||||
bool isFirstOrSecondChild(String roomId) => _isFirstOrSecondChild(roomId);
|
||||
|
||||
bool get isExchange => _isExchange;
|
||||
|
||||
bool get isDirectChatWithoutMe => _isDirectChatWithoutMe;
|
||||
|
||||
// bool isMadeForLang(String langCode) => _isMadeForLang(langCode);
|
||||
|
|
@ -228,8 +216,6 @@ extension PangeaRoom on Room {
|
|||
|
||||
bool get isLocked => _isLocked;
|
||||
|
||||
bool get isPangeaClass => _isPangeaClass;
|
||||
|
||||
bool isAnalyticsRoomOfUser(String userId) => _isAnalyticsRoomOfUser(userId);
|
||||
|
||||
bool get isAnalyticsRoom => _isAnalyticsRoom;
|
||||
|
|
@ -277,7 +263,8 @@ extension PangeaRoom on Room {
|
|||
|
||||
bool get canDelete => _canDelete;
|
||||
|
||||
bool canIAddSpaceChild(Room? room) => _canIAddSpaceChild(room);
|
||||
bool canIAddSpaceChild(Room? room, {bool spaceMode = false}) =>
|
||||
_canIAddSpaceChild(room, spaceMode: spaceMode);
|
||||
|
||||
bool get canIAddSpaceParents => _canIAddSpaceParents;
|
||||
|
||||
|
|
|
|||
|
|
@ -55,14 +55,6 @@ extension AnalyticsRoomExtension on Room {
|
|||
}
|
||||
}
|
||||
|
||||
// check if analytics room exists for a given language code
|
||||
// and if not, create it
|
||||
Future<void> _ensureAnalyticsRoomExists() async {
|
||||
await postLoad();
|
||||
if (firstLanguageSettings?.targetLanguage == null) return;
|
||||
await client.getMyAnalyticsRoom(firstLanguageSettings!.targetLanguage);
|
||||
}
|
||||
|
||||
// add 1 analytics room to 1 space
|
||||
Future<void> _addAnalyticsRoomToSpace(Room analyticsRoom) async {
|
||||
if (!isSpace) {
|
||||
|
|
@ -107,7 +99,7 @@ extension AnalyticsRoomExtension on Room {
|
|||
return;
|
||||
}
|
||||
|
||||
for (final Room space in (await client.classesAndExchangesImStudyingIn)) {
|
||||
for (final Room space in (await client.spacesImStudyingIn)) {
|
||||
if (space.spaceChildren.any((sc) => sc.roomId == id)) continue;
|
||||
await space.addAnalyticsRoomToSpace(this);
|
||||
}
|
||||
|
|
@ -183,7 +175,7 @@ extension AnalyticsRoomExtension on Room {
|
|||
return;
|
||||
}
|
||||
|
||||
for (final Room space in (await client.classesAndExchangesImStudyingIn)) {
|
||||
for (final Room space in (await client.spacesImStudyingIn)) {
|
||||
await space.inviteSpaceTeachersToAnalyticsRoom(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,11 +40,6 @@ extension RoomInformationRoomExtension on Room {
|
|||
));
|
||||
}
|
||||
|
||||
bool get _isExchange =>
|
||||
isSpace &&
|
||||
languageSettingsStateEvent == null &&
|
||||
pangeaRoomRulesStateEvent != null;
|
||||
|
||||
bool get _isDirectChatWithoutMe =>
|
||||
isDirectChat && !getParticipants().any((e) => e.id == client.userID);
|
||||
|
||||
|
|
@ -85,8 +80,6 @@ extension RoomInformationRoomExtension on Room {
|
|||
return joinedRooms > 0 ? true : false;
|
||||
}
|
||||
|
||||
bool get _isPangeaClass => isSpace && languageSettingsStateEvent != null;
|
||||
|
||||
bool _isAnalyticsRoomOfUser(String userId) =>
|
||||
isAnalyticsRoom && isMadeByUser(userId);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@ extension RoomSettingsRoomExtension on Room {
|
|||
|
||||
IconData? get _roomTypeIcon {
|
||||
if (membership == Membership.invite) return Icons.add;
|
||||
if (isPangeaClass) return Icons.school;
|
||||
if (isExchange) return Icons.connecting_airports;
|
||||
if (isSpace) return Icons.school;
|
||||
if (isAnalyticsRoom) return Icons.analytics;
|
||||
if (isDirectChat) return Icons.forum;
|
||||
return Icons.group;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
part of "pangea_room_extension.dart";
|
||||
|
||||
extension ClassAndExchangeSettingsRoomExtension on Room {
|
||||
extension SpaceRoomExtension on Room {
|
||||
DateTime? get _rulesUpdatedAt {
|
||||
if (!isSpace) return null;
|
||||
return pangeaRoomRulesStateEvent?.originServerTs ?? creationTime;
|
||||
|
|
@ -9,7 +9,7 @@ extension ClassAndExchangeSettingsRoomExtension on Room {
|
|||
String get _classCode {
|
||||
if (!isSpace) {
|
||||
for (final Room potentialClassRoom in pangeaSpaceParents) {
|
||||
if (potentialClassRoom.isPangeaClass) {
|
||||
if (potentialClassRoom.isSpace) {
|
||||
return potentialClassRoom.classCode;
|
||||
}
|
||||
}
|
||||
|
|
@ -84,46 +84,6 @@ extension ClassAndExchangeSettingsRoomExtension on Room {
|
|||
}
|
||||
}
|
||||
|
||||
DateTime? get _classSettingsUpdatedAt {
|
||||
if (!isSpace) return null;
|
||||
return languageSettingsStateEvent?.originServerTs ?? creationTime;
|
||||
}
|
||||
|
||||
/// the pangeaClass event is listed an importantStateEvent so, if event exists,
|
||||
/// it's already local. If it's an old class and doesn't, then the class_controller
|
||||
/// should automatically migrate during this same session, when the space is first loaded
|
||||
ClassSettingsModel? get _classSettings {
|
||||
try {
|
||||
if (!isSpace) {
|
||||
return null;
|
||||
}
|
||||
final Map<String, dynamic>? content = languageSettingsStateEvent?.content;
|
||||
if (content != null) {
|
||||
final ClassSettingsModel classSettings =
|
||||
ClassSettingsModel.fromJson(content);
|
||||
return classSettings;
|
||||
}
|
||||
return null;
|
||||
} catch (err, s) {
|
||||
Sentry.addBreadcrumb(
|
||||
Breadcrumb(
|
||||
message: "Error in classSettings",
|
||||
data: {"room": toJson()},
|
||||
),
|
||||
);
|
||||
ErrorHandler.logError(e: err, s: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Event? get _languageSettingsStateEvent {
|
||||
final dynamic classSettings = getState(PangeaEventTypes.classSettings);
|
||||
if (classSettings is Event) {
|
||||
return classSettings;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Event? get _pangeaRoomRulesStateEvent {
|
||||
final dynamic roomRules = getState(PangeaEventTypes.rules);
|
||||
if (roomRules is Event) {
|
||||
|
|
@ -132,7 +92,48 @@ extension ClassAndExchangeSettingsRoomExtension on Room {
|
|||
return null;
|
||||
}
|
||||
|
||||
ClassSettingsModel? get _firstLanguageSettings =>
|
||||
classSettings ??
|
||||
firstParentWithState(PangeaEventTypes.classSettings)?.classSettings;
|
||||
// DateTime? get _languageSettingsUpdatedAt {
|
||||
// if (!isSpace) return null;
|
||||
// return languageSettingsStateEvent?.originServerTs ?? creationTime;
|
||||
// }
|
||||
|
||||
/// the pangeaClass event is listed an importantStateEvent so, if event exists,
|
||||
/// it's already local. If it's an old class and doesn't, then the class_controller
|
||||
/// should automatically migrate during this same session, when the space is first loaded
|
||||
// LanguageSettingsModel? get _languageSettings {
|
||||
// try {
|
||||
// if (!isSpace) {
|
||||
// return null;
|
||||
// }
|
||||
// final Map<String, dynamic>? content = languageSettingsStateEvent?.content;
|
||||
// if (content != null) {
|
||||
// final LanguageSettingsModel languageSettings =
|
||||
// LanguageSettingsModel.fromJson(content);
|
||||
// return languageSettings;
|
||||
// }
|
||||
// return null;
|
||||
// } catch (err, s) {
|
||||
// Sentry.addBreadcrumb(
|
||||
// Breadcrumb(
|
||||
// message: "Error in languageSettings",
|
||||
// data: {"room": toJson()},
|
||||
// ),
|
||||
// );
|
||||
// ErrorHandler.logError(e: err, s: s);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Event? get _languageSettingsStateEvent {
|
||||
// final dynamic languageSettings =
|
||||
// getState(PangeaEventTypes.languageSettings);
|
||||
// if (languageSettings is Event) {
|
||||
// return languageSettings;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// LanguageSettingsModel? get _firstLanguageSettings =>
|
||||
// languageSettings ??
|
||||
// firstParentWithState(PangeaEventTypes.languageSettings)?.languageSettings;
|
||||
}
|
||||
|
|
@ -78,39 +78,30 @@ extension UserPermissionsRoomExtension on Room {
|
|||
|
||||
bool get _canDelete => isSpaceAdmin;
|
||||
|
||||
bool _canIAddSpaceChild(Room? room) {
|
||||
bool _canIAddSpaceChild(Room? room, {bool spaceMode = false}) {
|
||||
if (!isSpace) {
|
||||
ErrorHandler.logError(
|
||||
m: "should not call canIAddSpaceChildren on non-space room",
|
||||
m: "should not call canIAddSpaceChildren on non-space room. Room id: $id",
|
||||
data: toJson(),
|
||||
s: StackTrace.current,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (room != null && !room._isRoomAdmin) {
|
||||
return false;
|
||||
}
|
||||
if (!pangeaCanSendEvent(EventTypes.SpaceChild) && !_isRoomAdmin) {
|
||||
return false;
|
||||
}
|
||||
if (room == null) {
|
||||
return isRoomAdmin || (pangeaRoomRules?.isCreateRooms ?? false);
|
||||
}
|
||||
if (room.isExchange) {
|
||||
return isRoomAdmin;
|
||||
}
|
||||
if (!room.isSpace) {
|
||||
return pangeaRoomRules?.isCreateRooms ?? false;
|
||||
}
|
||||
if (room.isPangeaClass) {
|
||||
ErrorHandler.logError(
|
||||
m: "should not call canIAddSpaceChild with class",
|
||||
data: room.toJson(),
|
||||
s: StackTrace.current,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
final isSpaceAdmin = isRoomAdmin;
|
||||
final isChildRoomAdmin = room?.isRoomAdmin ?? true;
|
||||
|
||||
// if user is not admin of child room, return false
|
||||
if (!isChildRoomAdmin) return false;
|
||||
|
||||
// if the child room is a space, or will be a space,
|
||||
// then the user must be an admin of the parent space
|
||||
if (room?.isSpace ?? spaceMode) return isSpaceAdmin;
|
||||
|
||||
// otherwise, the user can add the child room to the parent
|
||||
// if they're the admin of the parent or if the parent creation
|
||||
// of group chats
|
||||
return isSpaceAdmin || (pangeaRoomRules?.isCreateRooms ?? false);
|
||||
}
|
||||
|
||||
bool get _canIAddSpaceParents =>
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import 'package:fluffychat/pangea/enum/audio_encoding_enum.dart';
|
|||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_representation_event.dart';
|
||||
import 'package:fluffychat/pangea/models/choreo_record.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/pangea_match_model.dart';
|
||||
import 'package:fluffychat/pangea/models/representation_content_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/models/speech_to_text_models.dart';
|
||||
import 'package:fluffychat/pangea/models/tokens_event_content_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/bot_name.dart';
|
||||
|
|
@ -553,8 +553,8 @@ class PangeaMessageEvent {
|
|||
final bool immersionMode = MatrixState
|
||||
.pangeaController.permissionsController
|
||||
.isToolEnabled(ToolSetting.immersionMode, room);
|
||||
final String? l2Code = MatrixState.pangeaController.languageController
|
||||
.activeL2Code(roomID: room.id);
|
||||
final String? l2Code =
|
||||
MatrixState.pangeaController.languageController.activeL2Code();
|
||||
final String? originalLangCode =
|
||||
(originalWritten ?? originalSent)?.langCode;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_message_event.dart';
|
||||
import 'package:fluffychat/pangea/models/analytics/analytics_model.dart';
|
||||
import 'package:fluffychat/pangea/models/pangea_token_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
|
|
@ -57,7 +54,7 @@ class ConstructAnalyticsModel extends AnalyticsModel {
|
|||
s: s,
|
||||
m: "Error parsing ConstructAnalyticsModel",
|
||||
);
|
||||
debugger(when: kDebugMode);
|
||||
// debugger(when: kDebugMode);
|
||||
}
|
||||
}
|
||||
return ConstructAnalyticsModel(
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ class CustomInputRequestModel {
|
|||
String targetLangCode;
|
||||
String userId;
|
||||
String roomId;
|
||||
String? classId;
|
||||
|
||||
String? goldTranslation;
|
||||
List<Continuance>? goldContinuances;
|
||||
|
|
@ -20,7 +19,6 @@ class CustomInputRequestModel {
|
|||
required this.targetLangCode,
|
||||
required this.userId,
|
||||
required this.roomId,
|
||||
required this.classId,
|
||||
required this.goldTranslation,
|
||||
required this.goldContinuances,
|
||||
});
|
||||
|
|
@ -32,7 +30,6 @@ class CustomInputRequestModel {
|
|||
targetLangCode: json[ModelKey.tgtLang],
|
||||
userId: json['user_id'],
|
||||
roomId: json['room_id'],
|
||||
classId: json['class_id'],
|
||||
goldTranslation: json['gold_translation'],
|
||||
goldContinuances: json['gold_continuances'] != null
|
||||
? List.from(json['gold_continuances'])
|
||||
|
|
@ -48,7 +45,6 @@ class CustomInputRequestModel {
|
|||
ModelKey.tgtLang: targetLangCode,
|
||||
'user_id': userId,
|
||||
'room_id': roomId,
|
||||
'class_id': classId,
|
||||
'gold_translation': goldTranslation,
|
||||
'gold_continuances': goldContinuances != null
|
||||
? List.from(goldContinuances!.map((e) => e.toJson()))
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:fluffychat/pangea/constants/model_keys.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'class_model.dart';
|
||||
|
||||
class ExchangeModel {
|
||||
PangeaRoomRules permissions;
|
||||
|
||||
ExchangeModel({
|
||||
required this.permissions,
|
||||
});
|
||||
|
||||
factory ExchangeModel.fromJson(Map<String, dynamic> json) {
|
||||
return ExchangeModel(
|
||||
permissions: PangeaRoomRules.fromJson(json[ModelKey.permissions]),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
try {
|
||||
data[ModelKey.permissions] = permissions.toJson();
|
||||
return data;
|
||||
} catch (e, s) {
|
||||
debugger(when: kDebugMode);
|
||||
ErrorHandler.logError(e: e, s: s);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
updateEditableClassField(String key, dynamic value) {
|
||||
switch (key) {
|
||||
default:
|
||||
throw Exception('Invalid key for setting permissions - $key');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -79,8 +79,8 @@ class LanguageModel {
|
|||
|
||||
static LanguageModel multiLingual([BuildContext? context]) => LanguageModel(
|
||||
displayName: context != null
|
||||
? L10n.of(context)!.multiLingualClass
|
||||
: "Multilingual Class",
|
||||
? L10n.of(context)!.multiLingualSpace
|
||||
: "Multilingual Space",
|
||||
l2: false,
|
||||
l1: false,
|
||||
langCode: LanguageKeys.multiLanguage,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:fluffychat/pangea/constants/model_keys.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -12,7 +11,7 @@ import '../constants/language_keys.dart';
|
|||
import '../constants/pangea_event_types.dart';
|
||||
import 'language_model.dart';
|
||||
|
||||
class ClassSettingsModel {
|
||||
class LanguageSettingsModel {
|
||||
String? city;
|
||||
String? country;
|
||||
String? schoolName;
|
||||
|
|
@ -20,7 +19,7 @@ class ClassSettingsModel {
|
|||
String dominantLanguage;
|
||||
String targetLanguage;
|
||||
|
||||
ClassSettingsModel({
|
||||
LanguageSettingsModel({
|
||||
this.dominantLanguage = ClassDefaultValues.defaultDominantLanguage,
|
||||
this.targetLanguage = ClassDefaultValues.defaultTargetLanguage,
|
||||
this.languageLevel,
|
||||
|
|
@ -29,17 +28,8 @@ class ClassSettingsModel {
|
|||
this.schoolName,
|
||||
});
|
||||
|
||||
static ClassSettingsModel get newClass => ClassSettingsModel(
|
||||
city: null,
|
||||
country: null,
|
||||
dominantLanguage: ClassDefaultValues.defaultDominantLanguage,
|
||||
languageLevel: null,
|
||||
schoolName: null,
|
||||
targetLanguage: ClassDefaultValues.defaultTargetLanguage,
|
||||
);
|
||||
|
||||
factory ClassSettingsModel.fromJson(Map<String, dynamic> json) {
|
||||
return ClassSettingsModel(
|
||||
factory LanguageSettingsModel.fromJson(Map<String, dynamic> json) {
|
||||
return LanguageSettingsModel(
|
||||
city: json['city'],
|
||||
country: json['country'],
|
||||
dominantLanguage: LanguageModel.codeFromNameOrCode(
|
||||
|
|
@ -72,35 +62,9 @@ class ClassSettingsModel {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: define enum with all possible values
|
||||
updateEditableClassField(String key, dynamic value) {
|
||||
switch (key) {
|
||||
case ModelKey.clientClassCity:
|
||||
city = value;
|
||||
break;
|
||||
case ModelKey.clientClassCountry:
|
||||
country = value;
|
||||
break;
|
||||
case ModelKey.clientClassDominantLanguage:
|
||||
dominantLanguage = value;
|
||||
break;
|
||||
case ModelKey.clientClassTargetLanguage:
|
||||
targetLanguage = value;
|
||||
break;
|
||||
case ModelKey.clientLanguageLevel:
|
||||
languageLevel = value;
|
||||
break;
|
||||
case ModelKey.clientSchool:
|
||||
schoolName = value;
|
||||
break;
|
||||
default:
|
||||
throw Exception('Invalid key for setting permissions - $key');
|
||||
}
|
||||
}
|
||||
|
||||
StateEvent get toStateEvent => StateEvent(
|
||||
content: toJson(),
|
||||
type: PangeaEventTypes.classSettings,
|
||||
type: PangeaEventTypes.languageSettings,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -4,7 +4,7 @@ import 'package:country_picker/country_picker.dart';
|
|||
import 'package:fluffychat/pangea/constants/local.key.dart';
|
||||
import 'package:fluffychat/pangea/constants/model_keys.dart';
|
||||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/instructions.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
|
|
|||
38
lib/pangea/pages/analytics/analytics_language_button.dart
Normal file
38
lib/pangea/pages/analytics/analytics_language_button.dart
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import 'package:fluffychat/pangea/models/language_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
class AnalyticsLanguageButton extends StatelessWidget {
|
||||
final List<LanguageModel> languages;
|
||||
final LanguageModel value;
|
||||
final void Function(LanguageModel) onChange;
|
||||
const AnalyticsLanguageButton({
|
||||
super.key,
|
||||
required this.value,
|
||||
required this.onChange,
|
||||
required this.languages,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PopupMenuButton<LanguageModel>(
|
||||
icon: const Icon(Icons.language_outlined),
|
||||
tooltip: L10n.of(context)!.changeAnalyticsLanguage,
|
||||
initialValue: value,
|
||||
onSelected: (LanguageModel? lang) {
|
||||
if (lang == null) {
|
||||
debugPrint("when is lang null?");
|
||||
return;
|
||||
}
|
||||
onChange(lang);
|
||||
},
|
||||
itemBuilder: (BuildContext context) =>
|
||||
languages.map((LanguageModel lang) {
|
||||
return PopupMenuItem<LanguageModel>(
|
||||
value: lang,
|
||||
child: Text(lang.getDisplayName(context) ?? lang.langCode),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -87,73 +87,68 @@ class AnalyticsListTileState extends State<AnalyticsListTile> {
|
|||
color: widget.isSelected
|
||||
? Theme.of(context).colorScheme.secondaryContainer
|
||||
: Colors.transparent,
|
||||
child: Tooltip(
|
||||
message: widget.selected.type == AnalyticsEntryType.room
|
||||
? L10n.of(context)!.joinToView
|
||||
: L10n.of(context)!.studentAnalyticsNotAvailable,
|
||||
child: ListTile(
|
||||
leading: widget.selected.type == AnalyticsEntryType.privateChats
|
||||
? CircleAvatar(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
foregroundColor: Colors.white,
|
||||
radius: Avatar.defaultSize / 2,
|
||||
child: const Icon(Icons.forum),
|
||||
)
|
||||
: Avatar(
|
||||
mxContent: widget.avatar,
|
||||
name: widget.selected.displayName,
|
||||
littleIcon: room?.roomTypeIcon,
|
||||
),
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.selected.displayName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).textTheme.bodyLarge!.color,
|
||||
),
|
||||
child: ListTile(
|
||||
leading: widget.selected.type == AnalyticsEntryType.privateChats
|
||||
? CircleAvatar(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
foregroundColor: Colors.white,
|
||||
radius: Avatar.defaultSize / 2,
|
||||
child: const Icon(Icons.forum),
|
||||
)
|
||||
: Avatar(
|
||||
mxContent: widget.avatar,
|
||||
name: widget.selected.displayName,
|
||||
littleIcon: room?.roomTypeIcon,
|
||||
),
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.selected.displayName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).textTheme.bodyLarge!.color,
|
||||
),
|
||||
),
|
||||
Tooltip(
|
||||
message: L10n.of(context)!.timeOfLastMessage,
|
||||
child: Text(
|
||||
tileData?.lastMessageTime?.localizedTimeShort(context) ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Theme.of(context).textTheme.bodyMedium!.color,
|
||||
),
|
||||
),
|
||||
Tooltip(
|
||||
message: L10n.of(context)!.timeOfLastMessage,
|
||||
child: Text(
|
||||
tileData?.lastMessageTime?.localizedTimeShort(context) ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Theme.of(context).textTheme.bodyMedium!.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: ListSummaryAnalytics(
|
||||
chartAnalytics: tileData,
|
||||
),
|
||||
selected: widget.isSelected,
|
||||
onTap: () {
|
||||
if (widget.controller?.widget.selectedView == null) {
|
||||
widget.onTap(widget.selected);
|
||||
return;
|
||||
}
|
||||
if ((room?.isSpace ?? false) && widget.allowNavigateOnSelect) {
|
||||
final String selectedView =
|
||||
widget.controller!.widget.selectedView!.route;
|
||||
context.go('/rooms/analytics/${room!.id}/$selectedView');
|
||||
return;
|
||||
}
|
||||
widget.onTap(widget.selected);
|
||||
},
|
||||
trailing: (room?.isSpace ?? false) &&
|
||||
widget.selected.type != AnalyticsEntryType.privateChats &&
|
||||
widget.allowNavigateOnSelect
|
||||
? const Icon(Icons.chevron_right)
|
||||
: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: ListSummaryAnalytics(
|
||||
chartAnalytics: tileData,
|
||||
),
|
||||
selected: widget.isSelected,
|
||||
onTap: () {
|
||||
if (widget.controller?.widget.selectedView == null) {
|
||||
widget.onTap(widget.selected);
|
||||
return;
|
||||
}
|
||||
if ((room?.isSpace ?? false) && widget.allowNavigateOnSelect) {
|
||||
final String selectedView =
|
||||
widget.controller!.widget.selectedView!.route;
|
||||
context.go('/rooms/analytics/${room!.id}/$selectedView');
|
||||
return;
|
||||
}
|
||||
widget.onTap(widget.selected);
|
||||
},
|
||||
trailing: (room?.isSpace ?? false) &&
|
||||
widget.selected.type != AnalyticsEntryType.privateChats &&
|
||||
widget.allowNavigateOnSelect
|
||||
? const Icon(Icons.chevron_right)
|
||||
: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import 'package:fluffychat/pangea/constants/pangea_event_types.dart';
|
|||
import 'package:fluffychat/pangea/extensions/client_extension/client_extension.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/models/analytics/analytics_event.dart';
|
||||
import 'package:fluffychat/pangea/models/language_model.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/base_analytics_view.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/student_analytics/student_analytics.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -157,6 +158,12 @@ class BaseAnalyticsController extends State<BaseAnalyticsPage> {
|
|||
refreshStream.add(false);
|
||||
}
|
||||
|
||||
Future<void> toggleSpaceLang(LanguageModel lang) async {
|
||||
await pangeaController.analytics.setCurrentAnalyticsSpaceLang(lang);
|
||||
await setChartData();
|
||||
refreshStream.add(false);
|
||||
}
|
||||
|
||||
void setCurrentLemma(String? lemma) {
|
||||
currentLemma = lemma;
|
||||
setState(() {});
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'dart:math';
|
|||
import 'package:fluffychat/pangea/enum/bar_chart_view_enum.dart';
|
||||
import 'package:fluffychat/pangea/enum/construct_type_enum.dart';
|
||||
import 'package:fluffychat/pangea/enum/time_span.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/analytics_language_button.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/analytics_list_tile.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/base_analytics.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/construct_list.dart';
|
||||
|
|
@ -121,6 +122,15 @@ class BaseAnalyticsView extends StatelessWidget {
|
|||
onChange: (TimeSpan value) =>
|
||||
controller.toggleTimeSpan(context, value),
|
||||
),
|
||||
if (controller.widget.defaultSelected.type ==
|
||||
AnalyticsEntryType.space)
|
||||
AnalyticsLanguageButton(
|
||||
value: controller.pangeaController.analytics
|
||||
.currentAnalyticsSpaceLang,
|
||||
onChange: (lang) => controller.toggleSpaceLang(lang),
|
||||
languages: controller
|
||||
.pangeaController.pLanguageStore.targetOptions,
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
|
|
|
|||
|
|
@ -14,48 +14,47 @@ import 'package:matrix/matrix.dart';
|
|||
|
||||
import '../../../../widgets/matrix.dart';
|
||||
import '../../../utils/sync_status_util_v2.dart';
|
||||
import 'class_analytics_view.dart';
|
||||
import 'space_analytics_view.dart';
|
||||
|
||||
enum AnalyticsPageType { classList, student, classDetails }
|
||||
|
||||
class ClassAnalyticsPage extends StatefulWidget {
|
||||
class SpaceAnalyticsPage extends StatefulWidget {
|
||||
final BarChartViewSelection? selectedView;
|
||||
const ClassAnalyticsPage({super.key, this.selectedView});
|
||||
const SpaceAnalyticsPage({super.key, this.selectedView});
|
||||
|
||||
@override
|
||||
State<ClassAnalyticsPage> createState() => ClassAnalyticsV2Controller();
|
||||
State<SpaceAnalyticsPage> createState() => SpaceAnalyticsV2Controller();
|
||||
}
|
||||
|
||||
class ClassAnalyticsV2Controller extends State<ClassAnalyticsPage> {
|
||||
class SpaceAnalyticsV2Controller extends State<SpaceAnalyticsPage> {
|
||||
bool _initialized = false;
|
||||
// StreamSubscription<Event>? stateSub;
|
||||
// Timer? refreshTimer;
|
||||
|
||||
List<SpaceRoomsChunk> chats = [];
|
||||
List<User> students = [];
|
||||
String? get classId => GoRouterState.of(context).pathParameters['classid'];
|
||||
Room? _classRoom;
|
||||
String? get spaceId => GoRouterState.of(context).pathParameters['spaceid'];
|
||||
Room? _spaceRoom;
|
||||
|
||||
Room? get classRoom {
|
||||
if (_classRoom == null || _classRoom!.id != classId) {
|
||||
debugPrint("updating _classRoom");
|
||||
_classRoom = classId != null
|
||||
? Matrix.of(context).client.getRoomById(classId!)
|
||||
Room? get spaceRoom {
|
||||
if (_spaceRoom == null || _spaceRoom!.id != spaceId) {
|
||||
debugPrint("updating _spaceRoom");
|
||||
_spaceRoom = spaceId != null
|
||||
? Matrix.of(context).client.getRoomById(spaceId!)
|
||||
: null;
|
||||
if (_classRoom == null) {
|
||||
if (_spaceRoom == null) {
|
||||
context.go('/rooms/analytics');
|
||||
return null;
|
||||
}
|
||||
getChatAndStudents();
|
||||
}
|
||||
return _classRoom;
|
||||
return _spaceRoom;
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
debugPrint("init class analytics");
|
||||
debugPrint("init space analytics");
|
||||
Future.delayed(Duration.zero, () async {
|
||||
if (classRoom == null || (!(classRoom?.isSpace ?? false))) {
|
||||
if (spaceRoom == null || (!(spaceRoom?.isSpace ?? false))) {
|
||||
context.go('/rooms');
|
||||
}
|
||||
getChatAndStudents();
|
||||
|
|
@ -64,25 +63,25 @@ class ClassAnalyticsV2Controller extends State<ClassAnalyticsPage> {
|
|||
|
||||
Future<void> getChatAndStudents() async {
|
||||
try {
|
||||
await classRoom?.postLoad();
|
||||
await classRoom?.requestParticipants();
|
||||
await spaceRoom?.postLoad();
|
||||
await spaceRoom?.requestParticipants();
|
||||
|
||||
if (classRoom != null) {
|
||||
if (spaceRoom != null) {
|
||||
final response = await Matrix.of(context).client.getSpaceHierarchy(
|
||||
classRoom!.id,
|
||||
spaceRoom!.id,
|
||||
);
|
||||
|
||||
// set the latest fetched full hierarchy in message analytics controller
|
||||
// we want to avoid calling this endpoint again and again, so whenever the
|
||||
// data is made available, set it in the controller
|
||||
MatrixState.pangeaController.analytics
|
||||
.setLatestHierarchy(_classRoom!.id, response);
|
||||
.setLatestHierarchy(_spaceRoom!.id, response);
|
||||
|
||||
students = classRoom!.students;
|
||||
students = spaceRoom!.students;
|
||||
chats = response.rooms
|
||||
.where(
|
||||
(room) =>
|
||||
room.roomId != classRoom!.id &&
|
||||
room.roomId != spaceRoom!.id &&
|
||||
room.roomType != PangeaRoomTypes.analytics,
|
||||
)
|
||||
.toList();
|
||||
|
|
@ -116,7 +115,7 @@ class ClassAnalyticsV2Controller extends State<ClassAnalyticsPage> {
|
|||
// onFinish: () {
|
||||
// getChatAndStudentAnalytics(context);
|
||||
// },
|
||||
child: ClassAnalyticsView(this),
|
||||
child: SpaceAnalyticsView(this),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,17 +3,15 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import '../base_analytics.dart';
|
||||
import 'class_analytics.dart';
|
||||
import 'space_analytics.dart';
|
||||
|
||||
class ClassAnalyticsView extends StatelessWidget {
|
||||
final ClassAnalyticsV2Controller controller;
|
||||
const ClassAnalyticsView(this.controller, {super.key});
|
||||
class SpaceAnalyticsView extends StatelessWidget {
|
||||
final SpaceAnalyticsV2Controller controller;
|
||||
const SpaceAnalyticsView(this.controller, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// final String pageTitle =
|
||||
// "${L10n.of(context)!.classAnalytics}: ${controller.className(context)}";
|
||||
final String pageTitle = L10n.of(context)!.classAnalytics;
|
||||
final String pageTitle = L10n.of(context)!.spaceAnalytics;
|
||||
final TabData tab1 = TabData(
|
||||
type: AnalyticsEntryType.room,
|
||||
icon: Icons.chat_bubble_outline,
|
||||
|
|
@ -46,20 +44,20 @@ class ClassAnalyticsView extends StatelessWidget {
|
|||
.toList(),
|
||||
);
|
||||
|
||||
return controller.classId != null
|
||||
return controller.spaceId != null
|
||||
? BaseAnalyticsPage(
|
||||
selectedView: controller.widget.selectedView,
|
||||
pageTitle: pageTitle,
|
||||
tabs: [tab1, tab2],
|
||||
alwaysSelected: AnalyticsSelected(
|
||||
controller.classId!,
|
||||
controller.spaceId!,
|
||||
AnalyticsEntryType.space,
|
||||
controller.classRoom?.name ?? "",
|
||||
controller.spaceRoom?.name ?? "",
|
||||
),
|
||||
defaultSelected: AnalyticsSelected(
|
||||
controller.classId!,
|
||||
controller.spaceId!,
|
||||
AnalyticsEntryType.space,
|
||||
controller.classRoom?.name ?? "",
|
||||
controller.spaceRoom?.name ?? "",
|
||||
),
|
||||
)
|
||||
: const SizedBox();
|
||||
|
|
@ -3,7 +3,7 @@ import 'dart:async';
|
|||
import 'package:fluffychat/pangea/enum/time_span.dart';
|
||||
import 'package:fluffychat/pangea/extensions/client_extension/client_extension.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/base_analytics.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/class_list/class_list_view.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/space_list/space_list_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
|
|
@ -13,14 +13,14 @@ import '../../../models/analytics/chart_analytics_model.dart';
|
|||
import '../../../utils/sync_status_util_v2.dart';
|
||||
import '../../../widgets/common/list_placeholder.dart';
|
||||
|
||||
class AnalyticsClassList extends StatefulWidget {
|
||||
const AnalyticsClassList({super.key});
|
||||
class AnalyticsSpaceList extends StatefulWidget {
|
||||
const AnalyticsSpaceList({super.key});
|
||||
|
||||
@override
|
||||
State<AnalyticsClassList> createState() => AnalyticsClassListController();
|
||||
State<AnalyticsSpaceList> createState() => AnalyticsSpaceListController();
|
||||
}
|
||||
|
||||
class AnalyticsClassListController extends State<AnalyticsClassList> {
|
||||
class AnalyticsSpaceListController extends State<AnalyticsSpaceList> {
|
||||
PangeaController pangeaController = MatrixState.pangeaController;
|
||||
List<ChartAnalyticsModel> models = [];
|
||||
List<Room> spaces = [];
|
||||
|
|
@ -28,7 +28,7 @@ class AnalyticsClassListController extends State<AnalyticsClassList> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Matrix.of(context).client.classesAndExchangesImTeaching.then((spaceList) {
|
||||
Matrix.of(context).client.spacesImTeaching.then((spaceList) {
|
||||
spaceList = spaceList
|
||||
.where(
|
||||
(space) => !spaceList.any(
|
||||
|
|
@ -46,14 +46,14 @@ class AnalyticsClassListController extends State<AnalyticsClassList> {
|
|||
Widget build(BuildContext context) {
|
||||
return PLoadingStatusV2(
|
||||
shimmerChild: const ListPlaceholder(),
|
||||
child: AnalyticsClassListView(this),
|
||||
child: AnalyticsSpaceListView(this),
|
||||
onFinish: () {
|
||||
// getAllClassAnalytics(context);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<ChartAnalyticsModel?> updateClassAnalytics(
|
||||
Future<ChartAnalyticsModel?> updateSpaceAnalytics(
|
||||
Room? space,
|
||||
) async {
|
||||
if (space == null) {
|
||||
|
|
@ -6,11 +6,11 @@ import 'package:go_router/go_router.dart';
|
|||
|
||||
import '../../../enum/time_span.dart';
|
||||
import '../base_analytics.dart';
|
||||
import 'class_list.dart';
|
||||
import 'space_list.dart';
|
||||
|
||||
class AnalyticsClassListView extends StatelessWidget {
|
||||
final AnalyticsClassListController controller;
|
||||
const AnalyticsClassListView(this.controller, {super.key});
|
||||
class AnalyticsSpaceListView extends StatelessWidget {
|
||||
final AnalyticsSpaceListController controller;
|
||||
const AnalyticsSpaceListView(this.controller, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -18,7 +18,7 @@ class AnalyticsClassListView extends StatelessWidget {
|
|||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: Text(
|
||||
L10n.of(context)!.classAnalytics,
|
||||
L10n.of(context)!.spaceAnalytics,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).textTheme.bodyLarge!.color,
|
||||
fontSize: 18,
|
||||
|
|
@ -15,7 +15,6 @@ class TimeSpanMenuButton extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PopupMenuButton<TimeSpan>(
|
||||
offset: const Offset(0, 100),
|
||||
icon: const Icon(Icons.calendar_month_outlined),
|
||||
tooltip: L10n.of(context)!.changeDateRange,
|
||||
initialValue: value,
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class ClassAnalyticsButton extends StatelessWidget {
|
||||
const ClassAnalyticsButton({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final roomId = GoRouterState.of(context).pathParameters['roomid'];
|
||||
final iconColor = Theme.of(context).textTheme.bodyLarge!.color;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(
|
||||
L10n.of(context)!.classAnalytics,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
subtitle: Text(L10n.of(context)!.classAnalyticsDesc),
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
foregroundColor: iconColor,
|
||||
child: const Icon(Icons.analytics_outlined),
|
||||
),
|
||||
onTap: () => context.go('/rooms/analytics/$roomId'),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
import 'package:fluffychat/pangea/widgets/class/add_class_and_invite.dart';
|
||||
import 'package:fluffychat/pangea/widgets/class/add_space_toggles.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class AddExchangeToClass extends StatefulWidget {
|
||||
const AddExchangeToClass({super.key});
|
||||
|
||||
@override
|
||||
AddExchangeToClassState createState() => AddExchangeToClassState();
|
||||
}
|
||||
|
||||
class AddExchangeToClassState extends State<AddExchangeToClass> {
|
||||
final GlobalKey<AddToSpaceState> addToSpaceKey = GlobalKey<AddToSpaceState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String? spaceId =
|
||||
GoRouterState.of(context).pathParameters['exchangeid'];
|
||||
if (spaceId == null) {
|
||||
return const SizedBox();
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: Text(L10n.of(context)!.addToClassTitle),
|
||||
),
|
||||
body: FutureBuilder(
|
||||
future:
|
||||
Matrix.of(context).client.waitForRoomInSync(spaceId, join: true),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return ListView(
|
||||
children: <Widget>[
|
||||
const SizedBox(height: 40),
|
||||
AddToSpaceToggles(
|
||||
roomId:
|
||||
GoRouterState.of(context).pathParameters['exchangeid'],
|
||||
key: addToSpaceKey,
|
||||
startOpen: true,
|
||||
mode: AddToClassMode.exchange,
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
},
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => context.go("/rooms"),
|
||||
child: const Icon(Icons.arrow_forward_outlined),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:fluffychat/pangea/constants/local.key.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/pages/settings_learning/settings_learning.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/widgets/user_settings/country_picker_tile.dart';
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
// import 'dart:convert';
|
||||
// import 'dart:developer';
|
||||
|
||||
// import 'package:fluffychat/pangea/network/requests.dart';
|
||||
// import 'package:fluffychat/pangea/utils/analytics_util.dart';
|
||||
// import 'package:flutter/foundation.dart';
|
||||
// import 'package:http/http.dart';
|
||||
|
||||
// import '../../config/environment.dart';
|
||||
// import '../models/analytics_model_oldest.dart';
|
||||
// import '../network/urls.dart';
|
||||
|
||||
class PClassAnalyticsRepo {
|
||||
/// deprecated in favor of new analytics
|
||||
static Future<dynamic> repoGetAnalyticsByIds(
|
||||
String accessToken,
|
||||
String timeSpan, {
|
||||
List<String>? classIds,
|
||||
List<String>? userIds,
|
||||
List<String>? chatIds,
|
||||
}) async {
|
||||
// if (!AnalyticsUtil.isValidSpan(timeSpan)) throw "Invalid span";
|
||||
|
||||
// final Requests req = Requests(
|
||||
// accessToken: accessToken, choreoApiKey: Environment.choreoApiKey);
|
||||
|
||||
// final body = {};
|
||||
// body["timespan"] = timeSpan;
|
||||
// if (classIds != null) body["class_ids"] = classIds;
|
||||
// if (chatIds != null) body["chat_ids"] = chatIds;
|
||||
// if (userIds != null) body["user_ids"] = userIds;
|
||||
|
||||
// final Response res =
|
||||
// await req.post(url: PApiUrls.classAnalytics, body: body);
|
||||
// final json = jsonDecode(res.body);
|
||||
|
||||
// final Iterable<dynamic>? classJson = json["class_analytics"];
|
||||
// final Iterable<dynamic>? chatJson = json["chat_analytics"];
|
||||
// final Iterable<dynamic>? userJson = json["user_analytics"];
|
||||
|
||||
// final classInfo = classJson != null
|
||||
// ? (classJson)
|
||||
// .map((e) {
|
||||
// e["timespan"] = timeSpan;
|
||||
// return chartAnalytics(e);
|
||||
// })
|
||||
// .toList()
|
||||
// .cast<chartAnalytics>()
|
||||
// : [];
|
||||
// final chatInfo = chatJson != null
|
||||
// ? (chatJson)
|
||||
// .map((e) {
|
||||
// e["timespan"] = timeSpan;
|
||||
// return chartAnalytics(e);
|
||||
// })
|
||||
// .toList()
|
||||
// .cast<chartAnalytics>()
|
||||
// : [];
|
||||
// final userInfo = userJson != null
|
||||
// ? (userJson)
|
||||
// .map((e) {
|
||||
// e["timespan"] = timeSpan;
|
||||
// return chartAnalytics(e);
|
||||
// })
|
||||
// .toList()
|
||||
// .cast<chartAnalytics>()
|
||||
// : [];
|
||||
|
||||
// final List<chartAnalytics> allAnalytics = [
|
||||
// ...classInfo,
|
||||
// ...chatInfo,
|
||||
// ...userInfo
|
||||
// ];
|
||||
// return allAnalytics;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class PExchangeRepo {
|
||||
static fetchExchangeClassInfo(String exchangePangeaId) async {}
|
||||
|
||||
static saveExchangeRecord(
|
||||
String requestFromClass,
|
||||
String requestToClass,
|
||||
String requestTeacher,
|
||||
String requestToClassAuthor,
|
||||
String exchangePangeaId,
|
||||
) async {}
|
||||
|
||||
static exchangeRejectRequest(String roomId, String teacherName) async {}
|
||||
|
||||
static validateExchange({
|
||||
required String requestFromClass,
|
||||
required String requestToClass,
|
||||
required BuildContext context,
|
||||
}) async {}
|
||||
|
||||
static createExchangeRequest({
|
||||
required String roomId,
|
||||
required String teacherID,
|
||||
required String toClass,
|
||||
required BuildContext context,
|
||||
}) async {}
|
||||
|
||||
static isExchange(
|
||||
BuildContext context,
|
||||
String accessToken,
|
||||
String exchangeId,
|
||||
) async {}
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ void chatListHandleSpaceTap(
|
|||
title: L10n.of(context)!.youreInvited,
|
||||
message: space.isSpace
|
||||
? L10n.of(context)!
|
||||
.invitedToClassOrExchange(space.name, space.creatorId ?? "???")
|
||||
.invitedToSpace(space.name, space.creatorId ?? "???")
|
||||
: L10n.of(context)!
|
||||
.invitedToChat(space.name, space.creatorId ?? "???"),
|
||||
okLabel: L10n.of(context)!.accept,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:csv/csv.dart';
|
||||
import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_message_event.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:csv/csv.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
|
@ -15,16 +16,12 @@ import 'package:permission_handler/permission_handler.dart';
|
|||
import 'package:syncfusion_flutter_xlsio/xlsio.dart';
|
||||
import 'package:universal_html/html.dart' as webFile;
|
||||
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_message_event.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import '../models/choreo_record.dart';
|
||||
|
||||
enum DownloadType { txt, csv, xlsx }
|
||||
|
||||
Future<void> downloadChat(
|
||||
Room room,
|
||||
ClassSettingsModel classSettings,
|
||||
DownloadType type,
|
||||
Client client,
|
||||
BuildContext context,
|
||||
|
|
@ -43,7 +40,6 @@ Future<void> downloadChat(
|
|||
allEvents,
|
||||
timeline,
|
||||
room,
|
||||
classSettings.targetLanguage,
|
||||
);
|
||||
} catch (err) {
|
||||
ErrorHandler.logError(
|
||||
|
|
@ -123,7 +119,6 @@ List<PangeaMessageEvent> getPangeaMessageEvents(
|
|||
List<Event> events,
|
||||
Timeline timeline,
|
||||
Room room,
|
||||
String? targetLang,
|
||||
) {
|
||||
final List<PangeaMessageEvent> allPangeaMessages = events
|
||||
.where(
|
||||
|
|
|
|||
|
|
@ -68,13 +68,6 @@ class GoogleAnalytics {
|
|||
);
|
||||
}
|
||||
|
||||
static createExchange(String exchangeName, String classCode) {
|
||||
logEvent(
|
||||
'create_exchange',
|
||||
parameters: {'name': exchangeName, 'group_id': classCode},
|
||||
);
|
||||
}
|
||||
|
||||
static createChat(String newChatRoomId) {
|
||||
logEvent('create_chat', parameters: {"chat_id": newChatRoomId});
|
||||
}
|
||||
|
|
@ -93,27 +86,6 @@ class GoogleAnalytics {
|
|||
);
|
||||
}
|
||||
|
||||
static addChatToExchange(String chatRoomId, String classCode) {
|
||||
logEvent(
|
||||
'add_chat_to_exchange',
|
||||
parameters: {"chat_id": chatRoomId, 'group_id': classCode},
|
||||
);
|
||||
}
|
||||
|
||||
static inviteClassToExchange(String classId, String exchangeId) {
|
||||
logEvent(
|
||||
'invite_class_to_exchange',
|
||||
parameters: {'group_id': classId, 'exchange_id': exchangeId},
|
||||
);
|
||||
}
|
||||
|
||||
static kickClassFromExchange(String classId, String exchangeId) {
|
||||
logEvent(
|
||||
'kick_class_from_exchange',
|
||||
parameters: {'group_id': classId, 'exchange_id': exchangeId},
|
||||
);
|
||||
}
|
||||
|
||||
static joinClass(String classCode) {
|
||||
logEvent('join_group', parameters: {'group_id': classCode});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import 'package:fluffychat/pangea/constants/language_keys.dart';
|
|||
import 'package:fluffychat/pangea/constants/model_keys.dart';
|
||||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_message_event.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
|
@ -69,9 +69,7 @@ class GetChatListItemSubtitle {
|
|||
timeline: timeline,
|
||||
ownMessage: false,
|
||||
);
|
||||
final l2Code = pangeaController.languageController
|
||||
.activeL2Code(roomID: event.roomId);
|
||||
|
||||
final l2Code = pangeaController.languageController.activeL2Code();
|
||||
if (l2Code == null || l2Code == LanguageKeys.unknownLanguage) {
|
||||
return event.body;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ Future<List<SpaceTeacher>> getReportTeachers(
|
|||
|
||||
final List<Room> otherSpaces = Matrix.of(context)
|
||||
.client
|
||||
.classesAndExchangesImIn
|
||||
.spacesImIn
|
||||
.where((space) => !reportRoomParentSpaces.contains(space))
|
||||
.toList();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,25 +6,25 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|||
|
||||
import '../controllers/pangea_controller.dart';
|
||||
|
||||
class ClassCodeUtil {
|
||||
class SpaceCodeUtil {
|
||||
static const codeLength = 6;
|
||||
|
||||
static bool isValidCode(String? classcode) {
|
||||
return classcode == null || classcode.length > 4;
|
||||
static bool isValidCode(String? spacecode) {
|
||||
return spacecode == null || spacecode.length > 4;
|
||||
}
|
||||
|
||||
static String generateClassCode() {
|
||||
static String generateSpaceCode() {
|
||||
final r = Random();
|
||||
const chars = 'AaBbCcDdEeFfGgHhiJjKkLMmNnoPpQqRrSsTtUuVvWwXxYyZz1234567890';
|
||||
return List.generate(codeLength, (index) => chars[r.nextInt(chars.length)])
|
||||
.join();
|
||||
}
|
||||
|
||||
static Future<void> joinWithClassCodeDialog(
|
||||
static Future<void> joinWithSpaceCodeDialog(
|
||||
BuildContext context,
|
||||
PangeaController pangeaController,
|
||||
) async {
|
||||
final List<String>? classCode = await showTextInputDialog(
|
||||
final List<String>? spaceCode = await showTextInputDialog(
|
||||
context: context,
|
||||
title: L10n.of(context)!.joinWithClassCode,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
|
|
@ -33,10 +33,10 @@ class ClassCodeUtil {
|
|||
DialogTextField(hintText: L10n.of(context)!.joinWithClassCodeHint),
|
||||
],
|
||||
);
|
||||
if (classCode == null || classCode.single.isEmpty) return;
|
||||
if (spaceCode == null || spaceCode.single.isEmpty) return;
|
||||
await pangeaController.classController.joinClasswithCode(
|
||||
context,
|
||||
classCode.first,
|
||||
spaceCode.first,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -35,13 +35,9 @@ class MessageSpeechToTextCardState extends State<MessageSpeechToTextCard> {
|
|||
STTToken? selectedToken;
|
||||
|
||||
String? get l1Code =>
|
||||
MatrixState.pangeaController.languageController.activeL1Code(
|
||||
roomID: widget.messageEvent.room.id,
|
||||
);
|
||||
MatrixState.pangeaController.languageController.activeL1Code();
|
||||
String? get l2Code =>
|
||||
MatrixState.pangeaController.languageController.activeL2Code(
|
||||
roomID: widget.messageEvent.room.id,
|
||||
);
|
||||
MatrixState.pangeaController.languageController.activeL2Code();
|
||||
|
||||
// look for transcription in message event
|
||||
// if not found, call API to transcribe audio
|
||||
|
|
|
|||
|
|
@ -107,12 +107,8 @@ class MessageTranslationCardState extends State<MessageTranslationCard> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
l1Code = MatrixState.pangeaController.languageController.activeL1Code(
|
||||
roomID: widget.messageEvent.room.id,
|
||||
);
|
||||
l2Code = MatrixState.pangeaController.languageController.activeL2Code(
|
||||
roomID: widget.messageEvent.room.id,
|
||||
);
|
||||
l1Code = MatrixState.pangeaController.languageController.activeL1Code();
|
||||
l2Code = MatrixState.pangeaController.languageController.activeL2Code();
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,298 +0,0 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import '../../../widgets/matrix.dart';
|
||||
import '../../utils/error_handler.dart';
|
||||
import '../../utils/firebase_analytics.dart';
|
||||
|
||||
enum AddToClassMode { exchange, chat }
|
||||
|
||||
class AddToClassAndInviteToggles extends StatefulWidget {
|
||||
final String? roomId;
|
||||
final bool startOpen;
|
||||
final Function? setParentState;
|
||||
final AddToClassMode mode;
|
||||
|
||||
const AddToClassAndInviteToggles({
|
||||
super.key,
|
||||
this.roomId,
|
||||
this.startOpen = false,
|
||||
this.setParentState,
|
||||
required this.mode,
|
||||
});
|
||||
|
||||
@override
|
||||
AddToClassAndInviteState createState() => AddToClassAndInviteState();
|
||||
}
|
||||
|
||||
class AddToClassAndInviteState extends State<AddToClassAndInviteToggles> {
|
||||
late Room? room;
|
||||
late List<Room> parents;
|
||||
late List<Room> possibleParents;
|
||||
late bool isOpen;
|
||||
|
||||
AddToClassAndInviteState({Key? key});
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
room = widget.roomId != null
|
||||
? Matrix.of(context).client.getRoomById(widget.roomId!)
|
||||
: null;
|
||||
|
||||
if (room != null && room!.isPangeaClass) {
|
||||
debugger(when: kDebugMode);
|
||||
ErrorHandler.logError(
|
||||
m: "should not be able to add class to space, not yet at least",
|
||||
);
|
||||
context.go('/rooms');
|
||||
}
|
||||
|
||||
possibleParents = Matrix.of(context)
|
||||
.client
|
||||
.rooms
|
||||
.where(
|
||||
widget.mode == AddToClassMode.exchange
|
||||
? (Room r) => r.isPangeaClass && widget.roomId != r.id
|
||||
: (Room r) =>
|
||||
(r.isPangeaClass || r.isExchange) && widget.roomId != r.id,
|
||||
)
|
||||
.toList();
|
||||
|
||||
parents = widget.roomId != null
|
||||
? possibleParents
|
||||
.where(
|
||||
(r) =>
|
||||
r.spaceChildren.any((room) => room.roomId == widget.roomId),
|
||||
)
|
||||
.toList()
|
||||
: [];
|
||||
|
||||
isOpen = widget.startOpen;
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> addParents(String roomToAddId) async {
|
||||
final List<Future<void>> addFutures = [];
|
||||
for (final Room newParent in parents) {
|
||||
addFutures.add(_addSingleParent(roomToAddId, newParent));
|
||||
}
|
||||
await addFutures.wait;
|
||||
}
|
||||
|
||||
Future<void> _addSingleParent(String roomToAddId, Room newParent) async {
|
||||
GoogleAnalytics.addParent(roomToAddId, newParent.classCode);
|
||||
final List<List<User>> existingMembers = await Future.wait([
|
||||
room?.requestParticipants() ?? Future.value([]),
|
||||
newParent.requestParticipants(),
|
||||
]);
|
||||
final List<User> roomMembers = existingMembers[0];
|
||||
final List<User> spaceMembers = existingMembers[1];
|
||||
|
||||
final List<Future<void>> inviteFutures = [
|
||||
newParent.setSpaceChild(roomToAddId, suggested: true),
|
||||
];
|
||||
for (final spaceMember
|
||||
in spaceMembers.where((element) => element.id != room?.client.userID)) {
|
||||
if (!roomMembers.any(
|
||||
(m) => m.id == spaceMember.id && m.membership == Membership.join,
|
||||
)) {
|
||||
inviteFutures.add(_inviteSpaceMember(spaceMember));
|
||||
} else {
|
||||
debugPrint('User ${spaceMember.id} is already in the room');
|
||||
}
|
||||
}
|
||||
await Future.wait(inviteFutures);
|
||||
return;
|
||||
}
|
||||
|
||||
//function for kicking single student and haandling error
|
||||
Future<void> _kickSpaceMember(User spaceMember) async {
|
||||
try {
|
||||
await room?.kick(spaceMember.id);
|
||||
debugPrint('Kicked ${spaceMember.id}');
|
||||
} catch (e) {
|
||||
debugger(when: kDebugMode);
|
||||
ErrorHandler.logError(e: e);
|
||||
}
|
||||
}
|
||||
|
||||
//function for adding single student and haandling error
|
||||
Future<void> _inviteSpaceMember(User spaceMember) async {
|
||||
try {
|
||||
await room?.invite(spaceMember.id);
|
||||
debugPrint('added ${spaceMember.id}');
|
||||
} catch (e) {
|
||||
debugger(when: kDebugMode);
|
||||
ErrorHandler.logError(e: e);
|
||||
}
|
||||
}
|
||||
|
||||
//remove single class
|
||||
Future<void> _removeSingleSpaceFromParents(
|
||||
String roomToRemoveId,
|
||||
Room spaceToRemove,
|
||||
) async {
|
||||
GoogleAnalytics.removeChatFromClass(
|
||||
roomToRemoveId,
|
||||
spaceToRemove.classCode,
|
||||
);
|
||||
|
||||
if (room == null) {
|
||||
ErrorHandler.logError(m: 'Room is null in kickSpaceMembers');
|
||||
debugger(when: kDebugMode);
|
||||
return;
|
||||
}
|
||||
final List<List<User>> roomsMembers = await Future.wait([
|
||||
room?.requestParticipants() ?? Future.value([]),
|
||||
spaceToRemove.requestParticipants(),
|
||||
]);
|
||||
|
||||
final List<User> toKick = roomsMembers[1]
|
||||
.where(
|
||||
(element) =>
|
||||
element.id != room?.client.userID &&
|
||||
roomsMembers[0].any((m) => m.id == element.id),
|
||||
)
|
||||
.toList();
|
||||
|
||||
final List<Future<void>> kickFutures = [
|
||||
spaceToRemove.removeSpaceChild(roomToRemoveId),
|
||||
];
|
||||
for (final spaceMember in toKick) {
|
||||
kickFutures.add(_kickSpaceMember(spaceMember));
|
||||
}
|
||||
await Future.wait(kickFutures);
|
||||
|
||||
// if (widget.setParentState != null) {
|
||||
// widget.setParentState!();
|
||||
// }
|
||||
await room?.requestParticipants();
|
||||
|
||||
if (room != null) {
|
||||
GoogleAnalytics.kickClassFromExchange(room!.id, spaceToRemove.id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// ignore: curly_braces_in_flow_control_structures
|
||||
Future<void> _handleAdd(bool add, Room possibleParent) async {
|
||||
//in this case, the room has already been made so we handle adding as it happens
|
||||
if (room != null) {
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () async {
|
||||
await (add
|
||||
? _addSingleParent(room!.id, possibleParent)
|
||||
: _removeSingleSpaceFromParents(room!.id, possibleParent));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
add
|
||||
? L10n.of(context)!.youAddedToSpace(
|
||||
room!.name,
|
||||
possibleParent.name,
|
||||
)
|
||||
: L10n.of(context)!.youRemovedFromSpace(
|
||||
room!.name,
|
||||
possibleParent.name,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
setState(
|
||||
() => add
|
||||
? parents.add(possibleParent)
|
||||
: parents.removeWhere((r) => r.id == possibleParent.id),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
if (!widget.startOpen)
|
||||
ListTile(
|
||||
enableFeedback: !widget.startOpen,
|
||||
title: Text(
|
||||
widget.mode == AddToClassMode.exchange
|
||||
? L10n.of(context)!.addToClass
|
||||
: L10n.of(context)!.addToClassOrExchange,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
foregroundColor: Theme.of(context).textTheme.bodyLarge!.color,
|
||||
child: const Icon(
|
||||
Icons.workspaces_outline,
|
||||
),
|
||||
),
|
||||
trailing: !widget.startOpen
|
||||
? Icon(
|
||||
isOpen
|
||||
? Icons.keyboard_arrow_down_outlined
|
||||
: Icons.keyboard_arrow_right_outlined,
|
||||
)
|
||||
: null,
|
||||
onTap: () => setState(() => isOpen = !isOpen),
|
||||
),
|
||||
if (isOpen)
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16.0, 0, 16.0, 0),
|
||||
child: Column(
|
||||
children: [
|
||||
if (possibleParents.isEmpty)
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.noEligibleSpaces),
|
||||
),
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: possibleParents.length,
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
final bool canIAddSpaceChildren =
|
||||
possibleParents[i].canIAddSpaceChild(room) &&
|
||||
(room?.canIAddSpaceParents ?? true);
|
||||
return Column(
|
||||
children: [
|
||||
Opacity(
|
||||
opacity: canIAddSpaceChildren ? 1 : 0.5,
|
||||
child: SwitchListTile.adaptive(
|
||||
title: possibleParents[i].nameAndRoomTypeIcon(),
|
||||
activeColor: AppConfig.activeToggleColor,
|
||||
value: parents
|
||||
.any((r) => r.id == possibleParents[i].id),
|
||||
onChanged: (bool add) => canIAddSpaceChildren
|
||||
? _handleAdd(add, possibleParents[i])
|
||||
: ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content:
|
||||
Text(L10n.of(context)!.noPermission),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -10,21 +10,20 @@ import 'package:matrix/matrix.dart';
|
|||
|
||||
import '../../../widgets/matrix.dart';
|
||||
import '../../utils/firebase_analytics.dart';
|
||||
import 'add_class_and_invite.dart';
|
||||
|
||||
//PTODO - auto invite students when you add a space and delete the add_class_and_invite.dart file
|
||||
class AddToSpaceToggles extends StatefulWidget {
|
||||
final String? roomId;
|
||||
final bool startOpen;
|
||||
final String? activeSpaceId;
|
||||
final AddToClassMode mode;
|
||||
final bool spaceMode;
|
||||
|
||||
const AddToSpaceToggles({
|
||||
super.key,
|
||||
this.roomId,
|
||||
this.startOpen = false,
|
||||
this.activeSpaceId,
|
||||
required this.mode,
|
||||
this.spaceMode = false,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -54,10 +53,7 @@ class AddToSpaceState extends State<AddToSpaceToggles> {
|
|||
.client
|
||||
.rooms
|
||||
.where(
|
||||
widget.mode == AddToClassMode.exchange
|
||||
? (Room r) => r.isPangeaClass && widget.roomId != r.id
|
||||
: (Room r) =>
|
||||
(r.isPangeaClass || r.isExchange) && widget.roomId != r.id,
|
||||
(Room r) => r.isSpace && widget.roomId != r.id,
|
||||
)
|
||||
.toList();
|
||||
|
||||
|
|
@ -144,9 +140,10 @@ class AddToSpaceState extends State<AddToSpaceToggles> {
|
|||
|
||||
Widget getAddToSpaceToggleItem(int index) {
|
||||
final Room possibleParent = possibleParents[index];
|
||||
final bool canAdd = !(!possibleParent.isRoomAdmin &&
|
||||
widget.mode == AddToClassMode.exchange) &&
|
||||
possibleParent.canIAddSpaceChild(room);
|
||||
final bool canAdd = possibleParent.canAddAsParentOf(
|
||||
room,
|
||||
spaceMode: widget.spaceMode,
|
||||
);
|
||||
|
||||
return Opacity(
|
||||
opacity: canAdd ? 1 : 0.5,
|
||||
|
|
@ -185,24 +182,21 @@ class AddToSpaceState extends State<AddToSpaceToggles> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String title = widget.mode == AddToClassMode.exchange
|
||||
? L10n.of(context)!.addToClass
|
||||
: L10n.of(context)!.addToClassOrExchange;
|
||||
final String subtitle = widget.mode == AddToClassMode.exchange
|
||||
? L10n.of(context)!.addToClassDesc
|
||||
: L10n.of(context)!.addToClassOrExchangeDesc;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(
|
||||
title,
|
||||
L10n.of(context)!.addToSpace,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
subtitle: Text(subtitle),
|
||||
subtitle: Text(
|
||||
widget.spaceMode || (room?.isSpace ?? false)
|
||||
? L10n.of(context)!.addSpaceToSpaceDesc
|
||||
: L10n.of(context)!.addChatToSpaceDesc,
|
||||
),
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
foregroundColor: Theme.of(context).textTheme.bodyLarge!.color,
|
||||
|
|
|
|||
|
|
@ -1,342 +0,0 @@
|
|||
// import 'dart:developer';
|
||||
|
||||
// import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
|
||||
// import 'package:flutter/foundation.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
// import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
// import 'package:matrix/matrix.dart';
|
||||
|
||||
// import '../../../utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
// import '../../../widgets/avatar.dart';
|
||||
// import '../../../widgets/matrix.dart';
|
||||
// import '../../utils/error_handler.dart';
|
||||
// import '../../utils/firebase_analytics.dart';
|
||||
|
||||
// class InviteStudentsFromClass extends StatefulWidget {
|
||||
// final String? roomId;
|
||||
// final bool startOpen;
|
||||
// final Function setParentState;
|
||||
|
||||
// const InviteStudentsFromClass({
|
||||
// Key? key,
|
||||
// this.roomId,
|
||||
// this.startOpen = false,
|
||||
// required this.setParentState,
|
||||
// }) : super(key: key);
|
||||
|
||||
// @override
|
||||
// InviteStudentsFromClassState createState() => InviteStudentsFromClassState();
|
||||
// }
|
||||
|
||||
// class InviteStudentsFromClassState extends State<InviteStudentsFromClass> {
|
||||
// late Room? room;
|
||||
// late List<Room> otherSpaces;
|
||||
// late bool isOpen;
|
||||
// final List<String> invitedSpaces = [];
|
||||
// final List<String> kickedSpaces = [];
|
||||
|
||||
// InviteStudentsFromClassState({Key? key, cont});
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// room = widget.roomId != null
|
||||
// ? Matrix.of(context).client.getRoomById(widget.roomId!)
|
||||
// : null;
|
||||
|
||||
// otherSpaces = Matrix.of(context)
|
||||
// .client
|
||||
// .rooms
|
||||
// .where((r) => r.isPangeaClass && r.id != widget.roomId)
|
||||
// .toList();
|
||||
|
||||
// isOpen = widget.startOpen;
|
||||
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
// Future<void> inviteSpaceMembers(BuildContext context, Room spaceToInvite) =>
|
||||
// showFutureLoadingDialog(
|
||||
// context: context,
|
||||
// future: () async {
|
||||
// if (room == null) {
|
||||
// ErrorHandler.logError(m: 'Room is null in inviteSpaceMembers');
|
||||
// debugger(when: kDebugMode);
|
||||
// return;
|
||||
// }
|
||||
// final List<List<User>> existingMembers = await Future.wait([
|
||||
// room!.requestParticipants(),
|
||||
// spaceToInvite.requestParticipants(),
|
||||
// ]);
|
||||
// final List<User> roomMembers = existingMembers[0];
|
||||
// final List<User> spaceMembers = existingMembers[1];
|
||||
// final List<Future<void>> inviteFutures = [];
|
||||
// for (final spaceMember in spaceMembers
|
||||
// .where((element) => element.id != room!.client.userID)) {
|
||||
// if (!roomMembers.any((m) =>
|
||||
// m.id == spaceMember.id && m.membership == Membership.join)) {
|
||||
// inviteFutures.add(inviteSpaceMember(spaceMember));
|
||||
// //add to invitedSpaces
|
||||
// invitedSpaces.add(spaceToInvite.id);
|
||||
// //if in kickedSpaces, remove
|
||||
// kickedSpaces.remove(spaceToInvite.id);
|
||||
// } else {
|
||||
// debugPrint('User ${spaceMember.id} is already in the room');
|
||||
// }
|
||||
// }
|
||||
// await Future.wait(inviteFutures);
|
||||
// debugPrint('Invited ${spaceMembers.length} members');
|
||||
// GoogleAnalytics.inviteClassToExchange(room!.id, spaceToInvite.id);
|
||||
// // setState(() {
|
||||
// // widget.setParentState();
|
||||
// // });
|
||||
// },
|
||||
// onError: handleError,
|
||||
// );
|
||||
|
||||
// //function for kicking single student and haandling error
|
||||
// Future<void> kickSpaceMember(User spaceMember) async {
|
||||
// try {
|
||||
// await room!.kick(spaceMember.id);
|
||||
// debugPrint('Kicked ${spaceMember.id}');
|
||||
// } catch (e) {
|
||||
// debugger(when: kDebugMode);
|
||||
// ErrorHandler.logError(e: e);
|
||||
// }
|
||||
// }
|
||||
|
||||
// //function for adding single student and haandling error
|
||||
// Future<void> inviteSpaceMember(User spaceMember) async {
|
||||
// try {
|
||||
// await room!.invite(spaceMember.id);
|
||||
// debugPrint('added ${spaceMember.id}');
|
||||
// } catch (e) {
|
||||
// debugger(when: kDebugMode);
|
||||
// ErrorHandler.logError(e: e);
|
||||
// }
|
||||
// }
|
||||
|
||||
// Future<void> kickSpaceMembers(BuildContext context, Room spaceToKick) =>
|
||||
// showFutureLoadingDialog(
|
||||
// context: context,
|
||||
// future: () async {
|
||||
// if (room == null) {
|
||||
// ErrorHandler.logError(m: 'Room is null in kickSpaceMembers');
|
||||
// debugger(when: kDebugMode);
|
||||
// return;
|
||||
// }
|
||||
// final List<List<User>> existingMembers = await Future.wait([
|
||||
// room!.requestParticipants(),
|
||||
// spaceToKick.requestParticipants(),
|
||||
// ]);
|
||||
// final List<User> roomMembers = existingMembers[0];
|
||||
// final List<User> spaceMembers = existingMembers[1];
|
||||
// final List<User> toKick = spaceMembers
|
||||
// .where((element) =>
|
||||
// element.id != room!.client.userID &&
|
||||
// roomMembers.any((m) => m.id == element.id))
|
||||
// .toList();
|
||||
// //add to kickedSpaces
|
||||
// kickedSpaces.add(spaceToKick.id);
|
||||
// //if in invitedSpaces, remove from invitedSpaces
|
||||
// invitedSpaces.remove(spaceToKick.id);
|
||||
// final List<Future<void>> kickFutures = [];
|
||||
|
||||
// for (final spaceMember in toKick) {
|
||||
// kickFutures.add(kickSpaceMember(spaceMember));
|
||||
// }
|
||||
// await Future.wait(kickFutures);
|
||||
// GoogleAnalytics.kickClassFromExchange(room!.id, spaceToKick.id);
|
||||
// setState(() {
|
||||
// widget.setParentState();
|
||||
// });
|
||||
// return;
|
||||
// },
|
||||
// onError: handleError,
|
||||
// );
|
||||
|
||||
// String handleError(dynamic exception) {
|
||||
// ErrorHandler.logError(
|
||||
// e: exception, m: 'Error inviting or kicking students');
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text(exception.toString()),
|
||||
// ),
|
||||
// );
|
||||
// return exception.toString();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// if (room == null) return Container();
|
||||
// return Column(
|
||||
// children: [
|
||||
// ListTile(
|
||||
// title: Text(
|
||||
// L10n.of(context)!.inviteStudentsFromOtherClasses,
|
||||
// style: TextStyle(
|
||||
// color: Theme.of(context).colorScheme.secondary,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// ),
|
||||
// ),
|
||||
// leading: CircleAvatar(
|
||||
// backgroundColor: Theme.of(context).primaryColor,
|
||||
// foregroundColor: Colors.white,
|
||||
// radius: Avatar.defaultSize / 2,
|
||||
// child: const Icon(Icons.workspaces_outlined),
|
||||
// ),
|
||||
// trailing: Icon(
|
||||
// isOpen
|
||||
// ? Icons.keyboard_arrow_down_outlined
|
||||
// : Icons.keyboard_arrow_right_outlined,
|
||||
// ),
|
||||
// onTap: () => setState(() => isOpen = !isOpen),
|
||||
// ),
|
||||
// if (isOpen)
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.fromLTRB(16.0, 0, 16.0, 0),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// if (otherSpaces.isEmpty)
|
||||
// ListTile(title: Text(L10n.of(context)!.noEligibleSpaces)),
|
||||
// ListView.builder(
|
||||
// shrinkWrap: true,
|
||||
// itemCount: otherSpaces.length,
|
||||
// itemBuilder: (BuildContext context, int i) {
|
||||
// final bool canIAddSpaceChildren =
|
||||
// otherSpaces[i].canIAddSpaceChild(room);
|
||||
// return Column(
|
||||
// children: [
|
||||
// Opacity(
|
||||
// opacity: canIAddSpaceChildren ? 1 : 0.5,
|
||||
// child: InviteKickClass(
|
||||
// room: otherSpaces[i],
|
||||
// inviteCallback: (Room room) =>
|
||||
// inviteSpaceMembers(context, otherSpaces[i]),
|
||||
// kickCallback: (Room room) =>
|
||||
// kickSpaceMembers(context, otherSpaces[i]),
|
||||
// controller: this,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// // END: ed8c6549bwf9
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// //listTile with two buttons - one to invite all students in the class and the other to kick them all out
|
||||
// // parameters
|
||||
// // 1. Room
|
||||
// // 2. invite callback
|
||||
// // 3. kick callback
|
||||
// // when the user clicks either button, a dialog pops up asking for confirmation
|
||||
// // after the dialog is confirmed, the callback is executed
|
||||
// class InviteKickClass extends StatelessWidget {
|
||||
// final Room room;
|
||||
// final Function inviteCallback;
|
||||
// final Function kickCallback;
|
||||
// final InviteStudentsFromClassState controller;
|
||||
|
||||
// const InviteKickClass({
|
||||
// Key? key,
|
||||
// required this.room,
|
||||
// required this.inviteCallback,
|
||||
// required this.kickCallback,
|
||||
// required this.controller,
|
||||
// }) : super(key: key);
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return ListTile(
|
||||
// title: Text(
|
||||
// room.getLocalizedDisplayname(
|
||||
// MatrixLocals(L10n.of(context)!),
|
||||
// ),
|
||||
// ),
|
||||
// leading: const SizedBox(
|
||||
// height: Avatar.defaultSize,
|
||||
// width: Avatar.defaultSize,
|
||||
// ),
|
||||
// trailing: Row(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.add),
|
||||
// isSelected: controller.invitedSpaces.contains(room.id),
|
||||
// onPressed: () async {
|
||||
// final bool? result = await showDialog<bool>(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) => AlertDialog(
|
||||
// title: Text(
|
||||
// L10n.of(context)!.inviteAllStudents,
|
||||
// style: TextStyle(
|
||||
// color: Theme.of(context).colorScheme.secondary,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// ),
|
||||
// ),
|
||||
// content: Text(
|
||||
// L10n.of(context)!.inviteAllStudentsConfirmation,
|
||||
// ),
|
||||
// actions: [
|
||||
// TextButton(
|
||||
// onPressed: () => Navigator.of(context).pop(false),
|
||||
// child: Text(L10n.of(context)!.cancel),
|
||||
// ),
|
||||
// TextButton(
|
||||
// onPressed: () => Navigator.of(context).pop(true),
|
||||
// child: Text(L10n.of(context)!.ok),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// if (result != null && result) {
|
||||
// inviteCallback(room);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.remove),
|
||||
// isSelected: controller.kickedSpaces.contains(room.id),
|
||||
// onPressed: () async {
|
||||
// final bool? result = await showDialog<bool>(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) => AlertDialog(
|
||||
// title: Text(
|
||||
// L10n.of(context)!.kickAllStudents,
|
||||
// style: TextStyle(
|
||||
// color: Theme.of(context).colorScheme.secondary,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// ),
|
||||
// ),
|
||||
// content: Text(
|
||||
// L10n.of(context)!.kickAllStudentsConfirmation,
|
||||
// ),
|
||||
// actions: [
|
||||
// TextButton(
|
||||
// onPressed: () => Navigator.of(context).pop(false),
|
||||
// child: Text(L10n.of(context)!.cancel),
|
||||
// ),
|
||||
// TextButton(
|
||||
// onPressed: () => Navigator.of(context).pop(true),
|
||||
// child: Text(L10n.of(context)!.ok),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// if (result != null && result) {
|
||||
// kickCallback(room);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
|
@ -21,14 +21,12 @@ 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,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -56,9 +54,6 @@ class ConversationBotSettingsState extends State<ConversationBotSettings> {
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -203,14 +203,7 @@ class PangeaRichTextState extends State<PangeaRichText> {
|
|||
userL2LangCode != null && userL2LangCode != LanguageKeys.unknownLanguage;
|
||||
|
||||
String? get userL2LangCode =>
|
||||
pangeaController.languageController.activeL2Code(
|
||||
roomID: widget.pangeaMessageEvent.room.id,
|
||||
);
|
||||
|
||||
String? get userL1LangCode =>
|
||||
pangeaController.languageController.activeL1Code(
|
||||
roomID: widget.pangeaMessageEvent.room.id,
|
||||
);
|
||||
pangeaController.languageController.activeL2Code();
|
||||
|
||||
Future<void> onIgnore() async {
|
||||
debugPrint("PTODO implement onIgnore");
|
||||
|
|
|
|||
|
|
@ -61,8 +61,7 @@ class WordDataCardController extends State<WordDataCard> {
|
|||
@override
|
||||
void initState() {
|
||||
if (!mounted) return;
|
||||
activeL1 =
|
||||
controller.languageController.activeL1Model(roomID: widget.room.id)!;
|
||||
activeL1 = controller.languageController.activeL1Model()!;
|
||||
activeL2 =
|
||||
controller.languageController.activeL2Model(roomID: widget.room.id)!;
|
||||
if (activeL1 == null || activeL2 == null) {
|
||||
|
|
|
|||
|
|
@ -1,183 +0,0 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/widgets/space/language_level_dropdown.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import '../../../widgets/matrix.dart';
|
||||
import '../../constants/language_keys.dart';
|
||||
import '../../constants/pangea_event_types.dart';
|
||||
import '../../controllers/language_list_controller.dart';
|
||||
import '../../controllers/pangea_controller.dart';
|
||||
import '../../extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import '../../models/language_model.dart';
|
||||
import '../../utils/error_handler.dart';
|
||||
import '../user_settings/p_language_dropdown.dart';
|
||||
import '../user_settings/p_question_container.dart';
|
||||
|
||||
class ClassSettings extends StatefulWidget {
|
||||
final String? roomId;
|
||||
final bool startOpen;
|
||||
final ClassSettingsModel? initialSettings;
|
||||
|
||||
const ClassSettings({
|
||||
super.key,
|
||||
this.roomId,
|
||||
this.startOpen = false,
|
||||
this.initialSettings,
|
||||
});
|
||||
|
||||
@override
|
||||
ClassSettingsState createState() => ClassSettingsState();
|
||||
}
|
||||
|
||||
class ClassSettingsState extends State<ClassSettings> {
|
||||
Room? room;
|
||||
late ClassSettingsModel classSettings;
|
||||
late bool isOpen;
|
||||
final PangeaController pangeaController = MatrixState.pangeaController;
|
||||
|
||||
final cityController = TextEditingController();
|
||||
final countryController = TextEditingController();
|
||||
final schoolController = TextEditingController();
|
||||
|
||||
ClassSettingsState({Key? key});
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
room = widget.roomId != null
|
||||
? Matrix.of(context).client.getRoomById(widget.roomId!)
|
||||
: null;
|
||||
|
||||
classSettings =
|
||||
room?.classSettings ?? widget.initialSettings ?? ClassSettingsModel();
|
||||
|
||||
isOpen = widget.startOpen;
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
bool get sameLanguages =>
|
||||
classSettings.targetLanguage == classSettings.dominantLanguage;
|
||||
|
||||
LanguageModel getLanguage({required bool isBase, required String? langCode}) {
|
||||
final LanguageModel backup = isBase
|
||||
? pangeaController.pLanguageStore.baseOptions.first
|
||||
: pangeaController.pLanguageStore.targetOptions.first;
|
||||
if (langCode == null) return backup;
|
||||
final LanguageModel byCode = PangeaLanguage.byLangCode(langCode);
|
||||
return byCode.langCode != LanguageKeys.unknownLanguage ? byCode : backup;
|
||||
}
|
||||
|
||||
Future<void> updatePermission(void Function() makeLocalRuleChange) async {
|
||||
makeLocalRuleChange();
|
||||
if (room != null) {
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => setClassSettings(room!.id),
|
||||
);
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
void setTextControllerValues() {
|
||||
classSettings.city = cityController.text;
|
||||
classSettings.country = countryController.text;
|
||||
classSettings.schoolName = schoolController.text;
|
||||
}
|
||||
|
||||
Future<void> setClassSettings(String roomId) async {
|
||||
try {
|
||||
setTextControllerValues();
|
||||
|
||||
await Matrix.of(context).client.setRoomStateWithKey(
|
||||
roomId,
|
||||
PangeaEventTypes.classSettings,
|
||||
'',
|
||||
classSettings.toJson(),
|
||||
);
|
||||
} catch (err, stack) {
|
||||
debugger(when: kDebugMode);
|
||||
ErrorHandler.logError(e: err, s: stack);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Column(
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(
|
||||
L10n.of(context)!.classSettings,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
subtitle: Text(L10n.of(context)!.classSettingsDesc),
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
foregroundColor: Theme.of(context).textTheme.bodyLarge!.color,
|
||||
child: const Icon(Icons.language),
|
||||
),
|
||||
trailing: Icon(
|
||||
isOpen
|
||||
? Icons.keyboard_arrow_down_outlined
|
||||
: Icons.keyboard_arrow_right_outlined,
|
||||
),
|
||||
onTap: () => setState(() => isOpen = !isOpen),
|
||||
),
|
||||
if (isOpen)
|
||||
AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
height: isOpen ? null : 0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16.0, 0, 16.0, 8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
PQuestionContainer(
|
||||
title: L10n.of(context)!.selectClassRoomDominantLanguage,
|
||||
),
|
||||
PLanguageDropdown(
|
||||
onChange: (p0) => updatePermission(() {
|
||||
classSettings.dominantLanguage = p0.langCode;
|
||||
}),
|
||||
initialLanguage: getLanguage(
|
||||
isBase: true,
|
||||
langCode: classSettings.dominantLanguage,
|
||||
),
|
||||
languages: pangeaController.pLanguageStore.baseOptions,
|
||||
showMultilingual: true,
|
||||
),
|
||||
PQuestionContainer(
|
||||
title: L10n.of(context)!.selectTargetLanguage,
|
||||
),
|
||||
PLanguageDropdown(
|
||||
onChange: (p0) => updatePermission(() {
|
||||
classSettings.targetLanguage = p0.langCode;
|
||||
}),
|
||||
initialLanguage: getLanguage(
|
||||
isBase: false,
|
||||
langCode: classSettings.targetLanguage,
|
||||
),
|
||||
languages: pangeaController.pLanguageStore.targetOptions,
|
||||
),
|
||||
PQuestionContainer(
|
||||
title: L10n.of(context)!.whatIsYourClassLanguageLevel,
|
||||
),
|
||||
LanguageLevelDropdown(
|
||||
initialLevel: classSettings.languageLevel,
|
||||
onChanged: (int? newValue) => updatePermission(() {
|
||||
classSettings.languageLevel = newValue!;
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
184
lib/pangea/widgets/space/language_settings.dart
Normal file
184
lib/pangea/widgets/space/language_settings.dart
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
// import 'dart:developer';
|
||||
|
||||
// import 'package:fluffychat/pangea/models/space_model.dart';
|
||||
// import 'package:fluffychat/pangea/widgets/space/language_level_dropdown.dart';
|
||||
// import 'package:flutter/foundation.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
// import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
// import 'package:matrix/matrix.dart';
|
||||
|
||||
// import '../../../widgets/matrix.dart';
|
||||
// import '../../constants/language_keys.dart';
|
||||
// import '../../constants/pangea_event_types.dart';
|
||||
// import '../../controllers/language_list_controller.dart';
|
||||
// import '../../controllers/pangea_controller.dart';
|
||||
// import '../../extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
// import '../../models/language_model.dart';
|
||||
// import '../../utils/error_handler.dart';
|
||||
// import '../user_settings/p_language_dropdown.dart';
|
||||
// import '../user_settings/p_question_container.dart';
|
||||
|
||||
// class LanguageSettings extends StatefulWidget {
|
||||
// final String? roomId;
|
||||
// final bool startOpen;
|
||||
// final LanguageSettingsModel? initialSettings;
|
||||
|
||||
// const LanguageSettings({
|
||||
// super.key,
|
||||
// this.roomId,
|
||||
// this.startOpen = false,
|
||||
// this.initialSettings,
|
||||
// });
|
||||
|
||||
// @override
|
||||
// LanguageSettingsState createState() => LanguageSettingsState();
|
||||
// }
|
||||
|
||||
// class LanguageSettingsState extends State<LanguageSettings> {
|
||||
// Room? room;
|
||||
// late LanguageSettingsModel languageSettings;
|
||||
// late bool isOpen;
|
||||
// final PangeaController pangeaController = MatrixState.pangeaController;
|
||||
|
||||
// final cityController = TextEditingController();
|
||||
// final countryController = TextEditingController();
|
||||
// final schoolController = TextEditingController();
|
||||
|
||||
// LanguageSettingsState({Key? key});
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// room = widget.roomId != null
|
||||
// ? Matrix.of(context).client.getRoomById(widget.roomId!)
|
||||
// : null;
|
||||
|
||||
// languageSettings = room?.languageSettings ??
|
||||
// widget.initialSettings ??
|
||||
// LanguageSettingsModel();
|
||||
|
||||
// isOpen = widget.startOpen;
|
||||
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
// bool get sameLanguages =>
|
||||
// languageSettings.targetLanguage == languageSettings.dominantLanguage;
|
||||
|
||||
// LanguageModel getLanguage({required bool isBase, required String? langCode}) {
|
||||
// final LanguageModel backup = isBase
|
||||
// ? pangeaController.pLanguageStore.baseOptions.first
|
||||
// : pangeaController.pLanguageStore.targetOptions.first;
|
||||
// if (langCode == null) return backup;
|
||||
// final LanguageModel byCode = PangeaLanguage.byLangCode(langCode);
|
||||
// return byCode.langCode != LanguageKeys.unknownLanguage ? byCode : backup;
|
||||
// }
|
||||
|
||||
// Future<void> updatePermission(void Function() makeLocalRuleChange) async {
|
||||
// makeLocalRuleChange();
|
||||
// if (room != null) {
|
||||
// await showFutureLoadingDialog(
|
||||
// context: context,
|
||||
// future: () => setLanguageSettings(room!.id),
|
||||
// );
|
||||
// }
|
||||
// setState(() {});
|
||||
// }
|
||||
|
||||
// void setTextControllerValues() {
|
||||
// languageSettings.city = cityController.text;
|
||||
// languageSettings.country = countryController.text;
|
||||
// languageSettings.schoolName = schoolController.text;
|
||||
// }
|
||||
|
||||
// Future<void> setLanguageSettings(String roomId) async {
|
||||
// try {
|
||||
// setTextControllerValues();
|
||||
|
||||
// await Matrix.of(context).client.setRoomStateWithKey(
|
||||
// roomId,
|
||||
// PangeaEventTypes.languageSettings,
|
||||
// '',
|
||||
// languageSettings.toJson(),
|
||||
// );
|
||||
// } catch (err, stack) {
|
||||
// debugger(when: kDebugMode);
|
||||
// ErrorHandler.logError(e: err, s: stack);
|
||||
// }
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) => Column(
|
||||
// children: [
|
||||
// ListTile(
|
||||
// title: Text(
|
||||
// L10n.of(context)!.languageSettings,
|
||||
// style: TextStyle(
|
||||
// color: Theme.of(context).colorScheme.secondary,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// ),
|
||||
// ),
|
||||
// subtitle: Text(L10n.of(context)!.languageSettingsDesc),
|
||||
// leading: CircleAvatar(
|
||||
// backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
// foregroundColor: Theme.of(context).textTheme.bodyLarge!.color,
|
||||
// child: const Icon(Icons.language),
|
||||
// ),
|
||||
// trailing: Icon(
|
||||
// isOpen
|
||||
// ? Icons.keyboard_arrow_down_outlined
|
||||
// : Icons.keyboard_arrow_right_outlined,
|
||||
// ),
|
||||
// onTap: () => setState(() => isOpen = !isOpen),
|
||||
// ),
|
||||
// if (isOpen)
|
||||
// AnimatedContainer(
|
||||
// duration: const Duration(milliseconds: 300),
|
||||
// height: isOpen ? null : 0,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.fromLTRB(16.0, 0, 16.0, 8.0),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// PQuestionContainer(
|
||||
// title: L10n.of(context)!.selectSpaceDominantLanguage,
|
||||
// ),
|
||||
// PLanguageDropdown(
|
||||
// onChange: (p0) => updatePermission(() {
|
||||
// languageSettings.dominantLanguage = p0.langCode;
|
||||
// }),
|
||||
// initialLanguage: getLanguage(
|
||||
// isBase: true,
|
||||
// langCode: languageSettings.dominantLanguage,
|
||||
// ),
|
||||
// languages: pangeaController.pLanguageStore.baseOptions,
|
||||
// showMultilingual: true,
|
||||
// ),
|
||||
// PQuestionContainer(
|
||||
// title: L10n.of(context)!.selectSpaceTargetLanguage,
|
||||
// ),
|
||||
// PLanguageDropdown(
|
||||
// onChange: (p0) => updatePermission(() {
|
||||
// languageSettings.targetLanguage = p0.langCode;
|
||||
// }),
|
||||
// initialLanguage: getLanguage(
|
||||
// isBase: false,
|
||||
// langCode: languageSettings.targetLanguage,
|
||||
// ),
|
||||
// languages: pangeaController.pLanguageStore.targetOptions,
|
||||
// ),
|
||||
// PQuestionContainer(
|
||||
// title: L10n.of(context)!.whatIsYourSpaceLanguageLevel,
|
||||
// ),
|
||||
// LanguageLevelDropdown(
|
||||
// initialLevel: languageSettings.languageLevel,
|
||||
// onChanged: (int? newValue) => updatePermission(() {
|
||||
// languageSettings.languageLevel = newValue!;
|
||||
// }),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
|
@ -111,7 +111,7 @@ abstract class ClientManager {
|
|||
// To make room emotes work
|
||||
'im.ponies.room_emotes',
|
||||
// #Pangea
|
||||
PangeaEventTypes.classSettings,
|
||||
PangeaEventTypes.languageSettings,
|
||||
PangeaEventTypes.rules,
|
||||
PangeaEventTypes.botOptions,
|
||||
EventTypes.RoomTopic,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/download_chat.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
|
@ -49,13 +47,6 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// #Pangea
|
||||
final PangeaController pangeaController = MatrixState.pangeaController;
|
||||
final ClassSettingsModel? classSettings = pangeaController
|
||||
.matrixState.client
|
||||
.getRoomById(widget.room.id)
|
||||
?.firstLanguageSettings;
|
||||
// Pangea#
|
||||
notificationChangeSub ??= Matrix.of(context)
|
||||
.client
|
||||
.onSync
|
||||
|
|
@ -151,7 +142,6 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
context: context,
|
||||
future: () => downloadChat(
|
||||
widget.room,
|
||||
classSettings!,
|
||||
DownloadType.txt,
|
||||
Matrix.of(context).client,
|
||||
context,
|
||||
|
|
@ -163,7 +153,6 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
context: context,
|
||||
future: () => downloadChat(
|
||||
widget.room,
|
||||
classSettings!,
|
||||
DownloadType.csv,
|
||||
Matrix.of(context).client,
|
||||
context,
|
||||
|
|
@ -175,7 +164,6 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
context: context,
|
||||
future: () => downloadChat(
|
||||
widget.room,
|
||||
classSettings!,
|
||||
DownloadType.xlsx,
|
||||
Matrix.of(context).client,
|
||||
context,
|
||||
|
|
@ -189,6 +177,17 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
}
|
||||
},
|
||||
itemBuilder: (BuildContext context) => [
|
||||
if (widget.displayChatDetails)
|
||||
PopupMenuItem<ChatPopupMenuActions>(
|
||||
value: ChatPopupMenuActions.details,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.info_outline_rounded),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context)!.chatDetails),
|
||||
],
|
||||
),
|
||||
),
|
||||
// #Pangea
|
||||
PopupMenuItem<ChatPopupMenuActions>(
|
||||
value: ChatPopupMenuActions.learningSettings,
|
||||
|
|
@ -201,17 +200,6 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
),
|
||||
),
|
||||
// Pangea#
|
||||
if (widget.displayChatDetails)
|
||||
PopupMenuItem<ChatPopupMenuActions>(
|
||||
value: ChatPopupMenuActions.details,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.info_outline_rounded),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context)!.chatDetails),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (widget.room.pushRuleState == PushRuleState.notify)
|
||||
PopupMenuItem<ChatPopupMenuActions>(
|
||||
value: ChatPopupMenuActions.mute,
|
||||
|
|
@ -270,39 +258,36 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
],
|
||||
),
|
||||
),
|
||||
if (classSettings != null)
|
||||
PopupMenuItem<ChatPopupMenuActions>(
|
||||
value: ChatPopupMenuActions.downloadTxt,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.download_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context)!.downloadTxtFile),
|
||||
],
|
||||
),
|
||||
PopupMenuItem<ChatPopupMenuActions>(
|
||||
value: ChatPopupMenuActions.downloadTxt,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.download_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context)!.downloadTxtFile),
|
||||
],
|
||||
),
|
||||
if (classSettings != null)
|
||||
PopupMenuItem<ChatPopupMenuActions>(
|
||||
value: ChatPopupMenuActions.downloadCsv,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.download_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context)!.downloadCSVFile),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem<ChatPopupMenuActions>(
|
||||
value: ChatPopupMenuActions.downloadCsv,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.download_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context)!.downloadCSVFile),
|
||||
],
|
||||
),
|
||||
if (classSettings != null)
|
||||
PopupMenuItem<ChatPopupMenuActions>(
|
||||
value: ChatPopupMenuActions.downloadXlsx,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.download_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context)!.downloadXLSXFile),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem<ChatPopupMenuActions>(
|
||||
value: ChatPopupMenuActions.downloadXlsx,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.download_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context)!.downloadXLSXFile),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Pangea#
|
||||
],
|
||||
),
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue