Disable metadata service on nextcloud 28+

This commit is contained in:
Ming Ming 2024-11-10 22:18:54 +08:00
parent bc9bbe9455
commit d0b1568524
3 changed files with 13 additions and 1 deletions

View file

@ -13,6 +13,7 @@ part 'server_controller.g.dart';
enum ServerFeature {
ncAlbum,
ncMetadata,
}
@npLog
@ -37,6 +38,9 @@ class ServerController {
case ServerFeature.ncAlbum:
return !_statusStreamContorller.hasValue ||
_statusStreamContorller.value.majorVersion >= 25;
case ServerFeature.ncMetadata:
return !_statusStreamContorller.hasValue ||
_statusStreamContorller.value.majorVersion >= 28;
}
}

View file

@ -13,6 +13,7 @@ class _Bloc extends Bloc<_Event, _State>
required this.syncController,
required this.personsController,
required this.metadataController,
required this.serverController,
}) : super(_State.init(
zoom: prefController.homePhotosZoomLevelValue,
isEnableMemoryCollection:
@ -535,7 +536,11 @@ class _Bloc extends Bloc<_Event, _State>
personsController: personsController,
personProvider: accountPrefController.personProviderValue,
);
if (!serverController.isSupported(ServerFeature.ncMetadata)) {
metadataController.kickstart();
} else {
_log.info("[_syncRemote] Skipping metadata service");
}
_log.info(
"[_syncRemote] Elapsed time: ${stopwatch.elapsedMilliseconds}ms");
});
@ -711,6 +716,7 @@ class _Bloc extends Bloc<_Event, _State>
final SyncController syncController;
final PersonsController personsController;
final MetadataController metadataController;
final ServerController serverController;
final _itemTransformerQueue =
ComputeQueue<_ItemTransformerArgument, _ItemTransformerResult>();

View file

@ -21,6 +21,7 @@ import 'package:nc_photos/controller/files_controller.dart';
import 'package:nc_photos/controller/metadata_controller.dart';
import 'package:nc_photos/controller/persons_controller.dart';
import 'package:nc_photos/controller/pref_controller.dart';
import 'package:nc_photos/controller/server_controller.dart';
import 'package:nc_photos/controller/sync_controller.dart';
import 'package:nc_photos/db/entity_converter.dart';
import 'package:nc_photos/di_container.dart';
@ -97,6 +98,7 @@ class HomePhotos2 extends StatelessWidget {
syncController: accountController.syncController,
personsController: accountController.personsController,
metadataController: accountController.metadataController,
serverController: accountController.serverController,
),
child: const _WrappedHomePhotos(),
);