Merge branch 'new-merge' into combine-into-spaces

This commit is contained in:
ggurdin 2024-06-19 15:26:15 -04:00
commit 9c21ac3f8f
2 changed files with 31 additions and 1 deletions

View file

@ -166,6 +166,11 @@ class ChatListController extends State<ChatList>
// Pangea#
selectedRoomIds.clear();
activeFilter = getActiveFilterByDestination(i);
// #Pangea
if (activeFilter != ActiveFilter.spaces) {
activeSpaceId = null;
}
// Pangea#
});
// #Pangea
final bool clickedAllSpaces = (!AppConfig.separateChatTypes && i == 1) ||

View file

@ -148,7 +148,28 @@ class MyAnalyticsController extends BaseController {
}
}
Completer<void>? _updateCompleter;
Future<void> updateAnalytics() async {
if (!(_updateCompleter?.isCompleted ?? true)) {
await _updateCompleter!.future;
return;
}
_updateCompleter = Completer<void>();
try {
await _updateAnalytics();
} catch (err, s) {
ErrorHandler.logError(
e: err,
m: "Failed to update analytics",
s: s,
);
} finally {
_updateCompleter?.complete();
_updateCompleter = null;
}
}
Future<void> _updateAnalytics() async {
// top level analytics sending function. Send analytics
// for each type of analytics event
// to each of the applicable analytics rooms
@ -238,7 +259,11 @@ class MyAnalyticsController extends BaseController {
}
// send the analytics data to the analytics room
if (analyticsContent.isEmpty) return;
// if there is no data to send, don't send an event,
// unless no events have been sent yet. In that case, send an event
// with no data to indicate that the the system checked for data
// and found none, so the system doesn't repeatedly check for data
if (analyticsContent.isEmpty && lastUpdated != null) return;
await AnalyticsEvent.sendEvent(
analyticsRoom,
type,