some fixes
This commit is contained in:
parent
dfbc1ab0b9
commit
4a9e312cce
4 changed files with 20 additions and 12 deletions
|
|
@ -476,11 +476,9 @@ class AnalyticsDataService {
|
|||
return events;
|
||||
}
|
||||
|
||||
Future<List<AnalyticsUpdateEvent>> updateServerAnalytics(
|
||||
Future<void> updateServerAnalytics(
|
||||
List<ConstructAnalyticsEvent> events,
|
||||
) async {
|
||||
final List<AnalyticsUpdateEvent> updates = [];
|
||||
|
||||
_invalidateCaches();
|
||||
final blocked = blockedConstructs;
|
||||
for (final event in events) {
|
||||
|
|
@ -493,8 +491,6 @@ class AnalyticsDataService {
|
|||
final totalXP = constructs.fold(0, (total, c) => total + c.points);
|
||||
|
||||
await _analyticsClientGetter.database.updateTotalXP(totalXP);
|
||||
updates.add(XPGainedEvent(0, null));
|
||||
return updates;
|
||||
}
|
||||
|
||||
Future<void> updateBlockedConstructs(ConstructIdentifier constructId) async {
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ class AnalyticsSyncController {
|
|||
.where((id) => !prevRoomIds.contains(id))
|
||||
.toList();
|
||||
|
||||
for (final roomId in newRoomIds) {
|
||||
dataService.updateDispatcher.sendActivityAnalyticsUpdate(roomId);
|
||||
if (newRoomIds.isNotEmpty) {
|
||||
dataService.updateDispatcher.sendActivityAnalyticsUpdate(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,10 +100,8 @@ class AnalyticsUpdateDispatcher {
|
|||
Future<void> sendServerAnalyticsUpdate(
|
||||
List<ConstructAnalyticsEvent> events,
|
||||
) async {
|
||||
final updates = await dataService.updateServerAnalytics(events);
|
||||
for (final event in updates) {
|
||||
_dispatch(event);
|
||||
}
|
||||
await dataService.updateServerAnalytics(events);
|
||||
sendEmptyAnalyticsUpdate();
|
||||
}
|
||||
|
||||
Future<void> sendLocalAnalyticsUpdate(AnalyticsUpdate analyticsUpdate) async {
|
||||
|
|
|
|||
|
|
@ -57,10 +57,24 @@ class UserController {
|
|||
|
||||
final profileData = client.accountData[ModelKey.userProfile]?.content;
|
||||
final Profile? fromAccountData = Profile.fromAccountData(profileData);
|
||||
if (fromAccountData != null) {
|
||||
if (fromAccountData != null && fromAccountData != _cachedProfile) {
|
||||
_cachedProfile = fromAccountData;
|
||||
|
||||
if ((prevTargetLang != userL2) || (prevBaseLang != userL1)) {
|
||||
if (userL1 == null || userL2 == null) {
|
||||
// if either language is null, then we want to send a settings update instead of a language update
|
||||
ErrorHandler.logError(
|
||||
e: "One of the user languages is null. Sending settings update instead of language update.",
|
||||
data: {
|
||||
'prevBaseLang': prevBaseLang?.langCode,
|
||||
'prevTargetLang': prevTargetLang?.langCode,
|
||||
'userL1': userL1?.langCode,
|
||||
'userL2': userL2?.langCode,
|
||||
},
|
||||
);
|
||||
settingsUpdateStream.add(fromAccountData);
|
||||
return;
|
||||
}
|
||||
languageStream.add(
|
||||
LanguageUpdate(
|
||||
baseLang: userL1!,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue