chore: when user sets lemma emoji, if analytics doesn't exist, make it (#2707)

This commit is contained in:
ggurdin 2025-05-07 11:15:25 -04:00 committed by GitHub
parent 7f417ff311
commit ff7a5d85f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 17 deletions

View file

@ -176,11 +176,14 @@ class ConstructIdentifier {
}
Future<void> setUserLemmaInfo(UserSetLemmaInfo newLemmaInfo) async {
final analyticsRoom =
MatrixState.pangeaController.matrixState.client.analyticsRoomLocal();
final client = MatrixState.pangeaController.matrixState.client;
final l2 = MatrixState.pangeaController.languageController.userL2;
if (l2 == null) return;
final analyticsRoom = await client.getMyAnalyticsRoom(l2);
if (analyticsRoom == null) return;
try {
final client = MatrixState.pangeaController.matrixState.client;
final syncFuture = client.onRoomState.stream.firstWhere((event) {
return event.roomId == analyticsRoom.id &&
event.state.type == PangeaEventTypes.userSetLemmaInfo;

View file

@ -104,26 +104,19 @@ class LemmaEmojiRowState extends State<LemmaEmojiRow> {
try {
displayEmoji = emoji;
widget.cId
.setUserLemmaInfo(
await widget.cId.setUserLemmaInfo(
UserSetLemmaInfo(
emojis: [emoji],
),
)
.catchError((e, s) {
debugger(when: kDebugMode);
ErrorHandler.logError(data: widget.cId.toJson(), e: e, s: s);
}).then((_) {
if (mounted) {
widget.emojiSetCallback?.call();
setState(() {});
}
});
);
if (mounted) {
widget.emojiSetCallback?.call();
setState(() {});
}
MatrixState.pAnyState.closeOverlay();
widget.emojiSetCallback?.call();
setState(() {});
} catch (e, s) {
debugger(when: kDebugMode);