kopia lustrzana https://gitlab.com/mysocialportal/relatica
Fix ObjectBox connections DB to properly handle adds which shouldn't replace
rodzic
525b27c73e
commit
5b85fe27e3
|
@ -24,15 +24,18 @@ class ObjectBoxConnectionsRepo implements IConnectionsRepo {
|
|||
|
||||
@override
|
||||
bool addAllConnections(Iterable<Connection> newConnections) {
|
||||
memCache.addAllConnections(newConnections);
|
||||
final result = box.putMany(newConnections.toList());
|
||||
return result.length == newConnections.length;
|
||||
var allNew = true;
|
||||
for (final c in newConnections) {
|
||||
allNew &= addConnection(c);
|
||||
}
|
||||
return allNew;
|
||||
}
|
||||
|
||||
@override
|
||||
bool addConnection(Connection connection) {
|
||||
memCache.addConnection(connection);
|
||||
box.putAsync(connection);
|
||||
if (memCache.addConnection(connection)) {
|
||||
box.putAsync(connection);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue