mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 16:56:19 +01:00
Fix initial sync not starting on first run
This commit is contained in:
parent
9e3ec0bfc3
commit
bc3c480223
2 changed files with 12 additions and 11 deletions
|
@ -551,9 +551,7 @@ class FilesController {
|
||||||
excludeRelativeRoots: [remote_storage_util.remoteStorageDirRelativePath],
|
excludeRelativeRoots: [remote_storage_util.remoteStorageDirRelativePath],
|
||||||
mimes: file_util.supportedFormatMimes,
|
mimes: file_util.supportedFormatMimes,
|
||||||
);
|
);
|
||||||
_summaryStreamController.addWithValue((value) => value.copyWith(
|
_summaryStreamController.add(FilesSummaryStreamEvent(summary: results));
|
||||||
summary: results,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_MockResult _mockRemove({
|
_MockResult _mockRemove({
|
||||||
|
@ -645,11 +643,7 @@ class FilesController {
|
||||||
);
|
);
|
||||||
|
|
||||||
var _isSummaryStreamInited = false;
|
var _isSummaryStreamInited = false;
|
||||||
final _summaryStreamController = BehaviorSubject.seeded(
|
final _summaryStreamController = BehaviorSubject<FilesSummaryStreamEvent>();
|
||||||
const FilesSummaryStreamEvent(
|
|
||||||
summary: DbFilesSummary(items: {}),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final _timelineStreamController = BehaviorSubject.seeded(
|
final _timelineStreamController = BehaviorSubject.seeded(
|
||||||
const TimelineStreamEvent(data: {}, isDummy: true),
|
const TimelineStreamEvent(data: {}, isDummy: true),
|
||||||
|
|
|
@ -130,9 +130,16 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
emit.forEach<FilesSummaryStreamEvent>(
|
emit.forEach<FilesSummaryStreamEvent>(
|
||||||
filesController.summaryStream,
|
filesController.summaryStream,
|
||||||
onData: (data) => state.copyWith(
|
onData: (data) {
|
||||||
|
if (data.summary.items.isEmpty && _isInitialLoad) {
|
||||||
|
// no data, initial sync
|
||||||
|
_isInitialLoad = false;
|
||||||
|
_syncRemote();
|
||||||
|
}
|
||||||
|
return state.copyWith(
|
||||||
filesSummary: data.summary,
|
filesSummary: data.summary,
|
||||||
),
|
);
|
||||||
|
},
|
||||||
onError: (e, stackTrace) {
|
onError: (e, stackTrace) {
|
||||||
_log.severe("[_onLoad] Uncaught exception", e, stackTrace);
|
_log.severe("[_onLoad] Uncaught exception", e, stackTrace);
|
||||||
return state.copyWith(
|
return state.copyWith(
|
||||||
|
|
Loading…
Reference in a new issue