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 {
|
Future<void> updateProfileDependencyInjectors(Profile profile) async {
|
||||||
final objectBox = await ObjectBoxCache.create(
|
final objectBox = await ObjectBoxCache.create(
|
||||||
baseDir: 'profileboxcaches',
|
baseDir: 'profileboxcaches',
|
||||||
subDir: '${profile.id}_${profile.serverName}',
|
subDir: profile.id,
|
||||||
);
|
);
|
||||||
final connectionReposSelector =
|
final connectionReposSelector =
|
||||||
getIt<ActiveProfileSelector<IConnectionsRepo>>();
|
getIt<ActiveProfileSelector<IConnectionsRepo>>();
|
||||||
|
|
|
@ -53,9 +53,13 @@ class ConnectionsManager extends ChangeNotifier {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool upsertAllConnections(Iterable<Connection> newConnections) {
|
Future<bool> upsertAllConnections(Iterable<Connection> newConnections) async {
|
||||||
newConnections.forEach(upsertConnection);
|
var result = true;
|
||||||
return true;
|
for (var c in newConnections) {
|
||||||
|
result &= await Future.delayed(Duration.zero, () => upsertConnection(c));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> acceptFollowRequest(Connection connection) async {
|
Future<void> acceptFollowRequest(Connection connection) async {
|
||||||
|
@ -178,6 +182,7 @@ class ConnectionsManager extends ChangeNotifier {
|
||||||
}, onError: (error) {
|
}, onError: (error) {
|
||||||
_logger.severe('Error getting followers data: $error');
|
_logger.severe('Error getting followers data: $error');
|
||||||
});
|
});
|
||||||
|
await Future.delayed(Duration.zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
moreResults = true;
|
moreResults = true;
|
||||||
|
@ -201,6 +206,7 @@ class ConnectionsManager extends ChangeNotifier {
|
||||||
}, onError: (error) {
|
}, onError: (error) {
|
||||||
_logger.severe('Error getting followers data: $error');
|
_logger.severe('Error getting followers data: $error');
|
||||||
});
|
});
|
||||||
|
await Future.delayed(Duration.zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final noLongerFollowed in originalContacts) {
|
for (final noLongerFollowed in originalContacts) {
|
||||||
|
|
Ładowanie…
Reference in New Issue