Merge branch 'main' into fix-new-room-with-bot

This commit is contained in:
ggurdin 2024-10-31 11:22:13 -04:00 committed by GitHub
commit 5807019eb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 51 additions and 47 deletions

View file

@ -536,9 +536,9 @@ class Choreographer {
chatController.room,
);
bool get itAutoPlayEnabled {
return pangeaController.userController.profile.userSettings.itAutoPlay;
}
// bool get itAutoPlayEnabled {
// return pangeaController.userController.profile.userSettings.itAutoPlay;
// }
bool get definitionsEnabled =>
pangeaController.permissionsController.isToolEnabled(

View file

@ -99,7 +99,7 @@ class IgcController {
final PangeaMatch match = igcTextData!.matches[firstMatchIndex];
if (match.isITStart &&
choreographer.itAutoPlayEnabled &&
// choreographer.itAutoPlayEnabled &&
igcTextData != null) {
choreographer.onITStart(igcTextData!.matches[firstMatchIndex]);
return;

View file

@ -24,7 +24,7 @@ class ModelKey {
// making this a random string so that it's harder to guess
static const String activatedTrialKey = '7C4EuKIsph';
static const String autoPlayMessages = 'autoPlayMessages';
static const String itAutoPlay = 'itAutoPlay';
static const String itAutoPlay = 'autoPlayIT';
static const String clientClassCity = "city";
static const String clientClassCountry = "country";

View file

@ -105,23 +105,23 @@ extension ConstructUseTypeExtension on ConstructUseTypeEnum {
return 2;
case ConstructUseTypeEnum.corIt:
return 1;
case ConstructUseTypeEnum.ignIt:
case ConstructUseTypeEnum.ignIGC:
case ConstructUseTypeEnum.ignPA:
case ConstructUseTypeEnum.ignWL:
return 1;
case ConstructUseTypeEnum.unk:
case ConstructUseTypeEnum.nan:
return 0;
case ConstructUseTypeEnum.incIt:
case ConstructUseTypeEnum.incIGC:
return -1;
return -2;
case ConstructUseTypeEnum.incPA:
case ConstructUseTypeEnum.incWL:
return -2;
return -3;
}
}
}

View file

@ -12,7 +12,7 @@ class UserSettings {
DateTime? dateOfBirth;
DateTime? createdAt;
bool autoPlayMessages;
bool itAutoPlay;
// bool itAutoPlay;
bool activatedFreeTrial;
bool publicProfile;
String? targetLanguage;
@ -23,7 +23,7 @@ class UserSettings {
this.dateOfBirth,
this.createdAt,
this.autoPlayMessages = false,
this.itAutoPlay = false,
// this.itAutoPlay = true,
this.activatedFreeTrial = false,
this.publicProfile = false,
this.targetLanguage,
@ -37,7 +37,7 @@ class UserSettings {
? DateTime.parse(json[ModelKey.userCreatedAt])
: null,
autoPlayMessages: json[ModelKey.autoPlayMessages] ?? false,
itAutoPlay: json[ModelKey.itAutoPlay] ?? false,
// itAutoPlay: json[ModelKey.itAutoPlay] ?? true,
activatedFreeTrial: json[ModelKey.activatedTrialKey] ?? false,
publicProfile: json[ModelKey.publicProfile] ?? false,
targetLanguage: json[ModelKey.l2LanguageKey],
@ -50,7 +50,7 @@ class UserSettings {
data[ModelKey.userDateOfBirth] = dateOfBirth?.toIso8601String();
data[ModelKey.userCreatedAt] = createdAt?.toIso8601String();
data[ModelKey.autoPlayMessages] = autoPlayMessages;
data[ModelKey.itAutoPlay] = itAutoPlay;
// data[ModelKey.itAutoPlay] = itAutoPlay;
data[ModelKey.activatedTrialKey] = activatedFreeTrial;
data[ModelKey.publicProfile] = publicProfile;
data[ModelKey.l2LanguageKey] = targetLanguage;
@ -96,9 +96,9 @@ class UserSettings {
autoPlayMessages: (accountData[ModelKey.autoPlayMessages]
?.content[ModelKey.autoPlayMessages] as bool?) ??
false,
itAutoPlay: (accountData[ModelKey.itAutoPlay]
?.content[ModelKey.itAutoPlay] as bool?) ??
false,
// itAutoPlay: (accountData[ModelKey.itAutoPlay]
// ?.content[ModelKey.itAutoPlay] as bool?) ??
// true,
activatedFreeTrial: (accountData[ModelKey.activatedTrialKey]
?.content[ModelKey.activatedTrialKey] as bool?) ??
false,

View file

@ -48,19 +48,19 @@ class SettingsLearningView extends StatelessWidget {
value,
),
),
ProfileSettingsSwitchListTile.adaptive(
defaultValue: controller.pangeaController.userController.profile
.userSettings.itAutoPlay,
title:
L10n.of(context)!.interactiveTranslatorAutoPlaySliderHeader,
subtitle: L10n.of(context)!.interactiveTranslatorAutoPlayDesc,
onChange: (bool value) => controller
.pangeaController.userController
.updateProfile((profile) {
profile.userSettings.itAutoPlay = value;
return profile;
}),
),
// ProfileSettingsSwitchListTile.adaptive(
// defaultValue: controller.pangeaController.userController.profile
// .userSettings.itAutoPlay,
// title:
// L10n.of(context)!.interactiveTranslatorAutoPlaySliderHeader,
// subtitle: L10n.of(context)!.interactiveTranslatorAutoPlayDesc,
// onChange: (bool value) => controller
// .pangeaController.userController
// .updateProfile((profile) {
// profile.userSettings.itAutoPlay = value;
// return profile;
// }),
// ),
// ProfileSettingsSwitchListTile.adaptive(
// defaultValue: controller.pangeaController.userController.profile
// .userSettings.autoPlayMessages,

View file

@ -16,6 +16,11 @@ class AnalyticsPopup extends StatelessWidget {
super.key,
});
// we just want to show the constructs that have points
List<ConstructUses> get constructs => constructsModel.constructList
.where((constructUse) => constructUse.points > 0)
.toList();
@override
Widget build(BuildContext context) {
return Dialog(
@ -36,16 +41,16 @@ class AnalyticsPopup extends StatelessWidget {
),
body: Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: constructsModel.constructList.isEmpty
child: constructs.isEmpty
? Center(
child: Text(L10n.of(context)!.noDataFound),
)
: ListView.builder(
itemCount: constructsModel.constructList.length,
itemCount: constructs.length,
itemBuilder: (context, index) {
return Tooltip(
message:
"${constructsModel.constructList[index].points} / ${constructsModel.maxXPPerLemma}",
"${constructs[index].points} / ${constructsModel.maxXPPerLemma}",
child: ListTile(
onTap: () {},
title: Text(
@ -55,12 +60,11 @@ class AnalyticsPopup extends StatelessWidget {
.constructList[index].lemma,
context,
)
: constructsModel.constructList[index].lemma,
: constructs[index].lemma,
),
subtitle: LinearProgressIndicator(
value:
constructsModel.constructList[index].points /
constructsModel.maxXPPerLemma,
value: constructs[index].points /
constructsModel.maxXPPerLemma,
minHeight: 20,
borderRadius: const BorderRadius.all(
Radius.circular(AppConfig.borderRadius),

View file

@ -90,7 +90,7 @@ class PangeaTextController extends TextEditingController {
// if autoplay on and it start then just start it
if (matchIndex != -1 &&
choreographer.itAutoPlayEnabled &&
// choreographer.itAutoPlayEnabled &&
choreographer.igc.igcTextData!.matches[matchIndex].isITStart) {
return choreographer.onITStart(
choreographer.igc.igcTextData!.matches[matchIndex],

View file

@ -355,16 +355,16 @@ class WordMatchContent extends StatelessWidget {
),
],
),
if (controller.widget.scm.pangeaMatch!.isITStart)
DontShowSwitchListTile(
controller: pangeaController,
onSwitch: (bool value) {
pangeaController.userController.updateProfile((profile) {
profile.userSettings.itAutoPlay = value;
return profile;
});
},
),
// if (controller.widget.scm.pangeaMatch!.isITStart)
// DontShowSwitchListTile(
// controller: pangeaController,
// onSwitch: (bool value) {
// pangeaController.userController.updateProfile((profile) {
// profile.userSettings.itAutoPlay = value;
// return profile;
// });
// },
// ),
],
),
],