chore: when user sets lemma emoji, if analytics doesn't exist, make it (#2707)
This commit is contained in:
parent
7f417ff311
commit
ff7a5d85f7
2 changed files with 13 additions and 17 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue