kopia lustrzana https://gitlab.com/mysocialportal/relatica
Split up connection refresh with Future.delays to reduce jank
rodzic
6aecb654a2
commit
b91c114518
|
@ -129,7 +129,7 @@ Future<void> dependencyInjectionInitialization() async {
|
|||
Future<void> updateProfileDependencyInjectors(Profile profile) async {
|
||||
final objectBox = await ObjectBoxCache.create(
|
||||
baseDir: 'profileboxcaches',
|
||||
subDir: '${profile.id}_${profile.serverName}',
|
||||
subDir: profile.id,
|
||||
);
|
||||
final connectionReposSelector =
|
||||
getIt<ActiveProfileSelector<IConnectionsRepo>>();
|
||||
|
|
|
@ -53,9 +53,13 @@ class ConnectionsManager extends ChangeNotifier {
|
|||
);
|
||||
}
|
||||
|
||||
bool upsertAllConnections(Iterable<Connection> newConnections) {
|
||||
newConnections.forEach(upsertConnection);
|
||||
return true;
|
||||
Future<bool> upsertAllConnections(Iterable<Connection> newConnections) async {
|
||||
var result = true;
|
||||
for (var c in newConnections) {
|
||||
result &= await Future.delayed(Duration.zero, () => upsertConnection(c));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<void> acceptFollowRequest(Connection connection) async {
|
||||
|
@ -178,6 +182,7 @@ class ConnectionsManager extends ChangeNotifier {
|
|||
}, onError: (error) {
|
||||
_logger.severe('Error getting followers data: $error');
|
||||
});
|
||||
await Future.delayed(Duration.zero);
|
||||
}
|
||||
|
||||
moreResults = true;
|
||||
|
@ -201,6 +206,7 @@ class ConnectionsManager extends ChangeNotifier {
|
|||
}, onError: (error) {
|
||||
_logger.severe('Error getting followers data: $error');
|
||||
});
|
||||
await Future.delayed(Duration.zero);
|
||||
}
|
||||
|
||||
for (final noLongerFollowed in originalContacts) {
|
||||
|
|
Ładowanie…
Reference in New Issue