mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:17:11 -05:00 
			
		
		
		
	show dev route in profile mode
This commit is contained in:
		
							parent
							
								
									57668a8382
								
							
						
					
					
						commit
						28434aa6d1
					
				@ -16,7 +16,7 @@ class DeviceSyncService {
 | 
			
		||||
  final ILocalAlbumRepository _localAlbumRepository;
 | 
			
		||||
  final Platform _platform;
 | 
			
		||||
  final platform.ImHostService _hostService;
 | 
			
		||||
  final Logger _log = Logger("SyncService");
 | 
			
		||||
  final Logger _log = Logger("DeviceSyncService");
 | 
			
		||||
 | 
			
		||||
  DeviceSyncService({
 | 
			
		||||
    required IAlbumMediaRepository albumMediaRepository,
 | 
			
		||||
@ -29,6 +29,7 @@ class DeviceSyncService {
 | 
			
		||||
        _hostService = hostService;
 | 
			
		||||
 | 
			
		||||
  Future<void> sync() async {
 | 
			
		||||
    final Stopwatch stopwatch = Stopwatch()..start();
 | 
			
		||||
    try {
 | 
			
		||||
      if (await _hostService.shouldFullSync()) {
 | 
			
		||||
        _log.fine("Cannot use partial sync. Performing full sync");
 | 
			
		||||
@ -57,6 +58,8 @@ class DeviceSyncService {
 | 
			
		||||
    } catch (e, s) {
 | 
			
		||||
      _log.severe("Error performing device sync", e, s);
 | 
			
		||||
    }
 | 
			
		||||
    stopwatch.stop();
 | 
			
		||||
    _log.info("Device sync took - ${stopwatch.elapsedMilliseconds}ms");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Future<void> fullSync() async {
 | 
			
		||||
@ -91,7 +94,7 @@ class DeviceSyncService {
 | 
			
		||||
 | 
			
		||||
  Future<void> addAlbum(LocalAlbum newAlbum) async {
 | 
			
		||||
    try {
 | 
			
		||||
      _log.info("Adding device album ${newAlbum.name}");
 | 
			
		||||
      _log.fine("Adding device album ${newAlbum.name}");
 | 
			
		||||
      final album = await _albumMediaRepository.refresh(newAlbum.id);
 | 
			
		||||
 | 
			
		||||
      final assets = album.assetCount > 0
 | 
			
		||||
@ -106,7 +109,7 @@ class DeviceSyncService {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Future<void> removeAlbum(LocalAlbum a) async {
 | 
			
		||||
    _log.info("Removing device album ${a.name}");
 | 
			
		||||
    _log.fine("Removing device album ${a.name}");
 | 
			
		||||
    try {
 | 
			
		||||
      // Asset deletion is handled in the repository
 | 
			
		||||
      await _localAlbumRepository.delete(a.id);
 | 
			
		||||
@ -118,7 +121,7 @@ class DeviceSyncService {
 | 
			
		||||
  // The deviceAlbum is ignored since we are going to refresh it anyways
 | 
			
		||||
  FutureOr<bool> updateAlbum(LocalAlbum dbAlbum, LocalAlbum _) async {
 | 
			
		||||
    try {
 | 
			
		||||
      _log.info("Syncing device album ${dbAlbum.name}");
 | 
			
		||||
      _log.fine("Syncing device album ${dbAlbum.name}");
 | 
			
		||||
 | 
			
		||||
      final deviceAlbum = await _albumMediaRepository.refresh(dbAlbum.id);
 | 
			
		||||
 | 
			
		||||
@ -131,7 +134,7 @@ class DeviceSyncService {
 | 
			
		||||
        return false;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      _log.info("Device album ${dbAlbum.name} has changed. Syncing...");
 | 
			
		||||
      _log.fine("Device album ${dbAlbum.name} has changed. Syncing...");
 | 
			
		||||
 | 
			
		||||
      // Faster path - only new assets added
 | 
			
		||||
      if (await checkAddition(dbAlbum, deviceAlbum)) {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										57
									
								
								mobile/lib/platform/messages.g.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										57
									
								
								mobile/lib/platform/messages.g.dart
									
									
									
										generated
									
									
									
								
							@ -14,6 +14,7 @@ PlatformException _createConnectionError(String channelName) {
 | 
			
		||||
    message: 'Unable to establish connection on channel: "$channelName".',
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool _deepEquals(Object? a, Object? b) {
 | 
			
		||||
  if (a is List && b is List) {
 | 
			
		||||
    return a.length == b.length &&
 | 
			
		||||
@ -21,14 +22,14 @@ bool _deepEquals(Object? a, Object? b) {
 | 
			
		||||
            .every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]));
 | 
			
		||||
  }
 | 
			
		||||
  if (a is Map && b is Map) {
 | 
			
		||||
    return a.length == b.length && a.entries.every((MapEntry<Object?, Object?> entry) =>
 | 
			
		||||
    return a.length == b.length &&
 | 
			
		||||
        a.entries.every((MapEntry<Object?, Object?> entry) =>
 | 
			
		||||
            (b as Map<Object?, Object?>).containsKey(entry.key) &&
 | 
			
		||||
            _deepEquals(entry.value, b[entry.key]));
 | 
			
		||||
  }
 | 
			
		||||
  return a == b;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class PlatformAsset {
 | 
			
		||||
  PlatformAsset({
 | 
			
		||||
    required this.id,
 | 
			
		||||
@ -67,7 +68,8 @@ class PlatformAsset {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Object encode() {
 | 
			
		||||
    return _toList();  }
 | 
			
		||||
    return _toList();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static PlatformAsset decode(Object result) {
 | 
			
		||||
    result as List<Object?>;
 | 
			
		||||
@ -96,8 +98,7 @@ class PlatformAsset {
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  // ignore: avoid_equals_and_hash_code_on_mutable_classes
 | 
			
		||||
  int get hashCode => Object.hashAll(_toList())
 | 
			
		||||
;
 | 
			
		||||
  int get hashCode => Object.hashAll(_toList());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class SyncDelta {
 | 
			
		||||
@ -122,7 +123,8 @@ class SyncDelta {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Object encode() {
 | 
			
		||||
    return _toList();  }
 | 
			
		||||
    return _toList();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static SyncDelta decode(Object result) {
 | 
			
		||||
    result as List<Object?>;
 | 
			
		||||
@ -147,11 +149,9 @@ class SyncDelta {
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  // ignore: avoid_equals_and_hash_code_on_mutable_classes
 | 
			
		||||
  int get hashCode => Object.hashAll(_toList())
 | 
			
		||||
;
 | 
			
		||||
  int get hashCode => Object.hashAll(_toList());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class _PigeonCodec extends StandardMessageCodec {
 | 
			
		||||
  const _PigeonCodec();
 | 
			
		||||
  @override
 | 
			
		||||
@ -187,9 +187,11 @@ class ImHostService {
 | 
			
		||||
  /// Constructor for [ImHostService].  The [binaryMessenger] named argument is
 | 
			
		||||
  /// available for dependency injection.  If it is left null, the default
 | 
			
		||||
  /// BinaryMessenger will be used which routes to the host platform.
 | 
			
		||||
  ImHostService({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
 | 
			
		||||
  ImHostService(
 | 
			
		||||
      {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
 | 
			
		||||
      : pigeonVar_binaryMessenger = binaryMessenger,
 | 
			
		||||
        pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
 | 
			
		||||
        pigeonVar_messageChannelSuffix =
 | 
			
		||||
            messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
 | 
			
		||||
  final BinaryMessenger? pigeonVar_binaryMessenger;
 | 
			
		||||
 | 
			
		||||
  static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
 | 
			
		||||
@ -197,8 +199,10 @@ class ImHostService {
 | 
			
		||||
  final String pigeonVar_messageChannelSuffix;
 | 
			
		||||
 | 
			
		||||
  Future<bool> shouldFullSync() async {
 | 
			
		||||
    final String pigeonVar_channelName = 'dev.flutter.pigeon.immich_mobile.ImHostService.shouldFullSync$pigeonVar_messageChannelSuffix';
 | 
			
		||||
    final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
 | 
			
		||||
    final String pigeonVar_channelName =
 | 
			
		||||
        'dev.flutter.pigeon.immich_mobile.ImHostService.shouldFullSync$pigeonVar_messageChannelSuffix';
 | 
			
		||||
    final BasicMessageChannel<Object?> pigeonVar_channel =
 | 
			
		||||
        BasicMessageChannel<Object?>(
 | 
			
		||||
      pigeonVar_channelName,
 | 
			
		||||
      pigeonChannelCodec,
 | 
			
		||||
      binaryMessenger: pigeonVar_binaryMessenger,
 | 
			
		||||
@ -225,8 +229,10 @@ class ImHostService {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Future<SyncDelta> getMediaChanges() async {
 | 
			
		||||
    final String pigeonVar_channelName = 'dev.flutter.pigeon.immich_mobile.ImHostService.getMediaChanges$pigeonVar_messageChannelSuffix';
 | 
			
		||||
    final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
 | 
			
		||||
    final String pigeonVar_channelName =
 | 
			
		||||
        'dev.flutter.pigeon.immich_mobile.ImHostService.getMediaChanges$pigeonVar_messageChannelSuffix';
 | 
			
		||||
    final BasicMessageChannel<Object?> pigeonVar_channel =
 | 
			
		||||
        BasicMessageChannel<Object?>(
 | 
			
		||||
      pigeonVar_channelName,
 | 
			
		||||
      pigeonChannelCodec,
 | 
			
		||||
      binaryMessenger: pigeonVar_binaryMessenger,
 | 
			
		||||
@ -253,8 +259,10 @@ class ImHostService {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Future<void> checkpointSync() async {
 | 
			
		||||
    final String pigeonVar_channelName = 'dev.flutter.pigeon.immich_mobile.ImHostService.checkpointSync$pigeonVar_messageChannelSuffix';
 | 
			
		||||
    final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
 | 
			
		||||
    final String pigeonVar_channelName =
 | 
			
		||||
        'dev.flutter.pigeon.immich_mobile.ImHostService.checkpointSync$pigeonVar_messageChannelSuffix';
 | 
			
		||||
    final BasicMessageChannel<Object?> pigeonVar_channel =
 | 
			
		||||
        BasicMessageChannel<Object?>(
 | 
			
		||||
      pigeonVar_channelName,
 | 
			
		||||
      pigeonChannelCodec,
 | 
			
		||||
      binaryMessenger: pigeonVar_binaryMessenger,
 | 
			
		||||
@ -276,8 +284,10 @@ class ImHostService {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Future<void> clearSyncCheckpoint() async {
 | 
			
		||||
    final String pigeonVar_channelName = 'dev.flutter.pigeon.immich_mobile.ImHostService.clearSyncCheckpoint$pigeonVar_messageChannelSuffix';
 | 
			
		||||
    final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
 | 
			
		||||
    final String pigeonVar_channelName =
 | 
			
		||||
        'dev.flutter.pigeon.immich_mobile.ImHostService.clearSyncCheckpoint$pigeonVar_messageChannelSuffix';
 | 
			
		||||
    final BasicMessageChannel<Object?> pigeonVar_channel =
 | 
			
		||||
        BasicMessageChannel<Object?>(
 | 
			
		||||
      pigeonVar_channelName,
 | 
			
		||||
      pigeonChannelCodec,
 | 
			
		||||
      binaryMessenger: pigeonVar_binaryMessenger,
 | 
			
		||||
@ -299,13 +309,16 @@ class ImHostService {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Future<List<String>> getAssetIdsForAlbum(String albumId) async {
 | 
			
		||||
    final String pigeonVar_channelName = 'dev.flutter.pigeon.immich_mobile.ImHostService.getAssetIdsForAlbum$pigeonVar_messageChannelSuffix';
 | 
			
		||||
    final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
 | 
			
		||||
    final String pigeonVar_channelName =
 | 
			
		||||
        'dev.flutter.pigeon.immich_mobile.ImHostService.getAssetIdsForAlbum$pigeonVar_messageChannelSuffix';
 | 
			
		||||
    final BasicMessageChannel<Object?> pigeonVar_channel =
 | 
			
		||||
        BasicMessageChannel<Object?>(
 | 
			
		||||
      pigeonVar_channelName,
 | 
			
		||||
      pigeonChannelCodec,
 | 
			
		||||
      binaryMessenger: pigeonVar_binaryMessenger,
 | 
			
		||||
    );
 | 
			
		||||
    final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[albumId]);
 | 
			
		||||
    final Future<Object?> pigeonVar_sendFuture =
 | 
			
		||||
        pigeonVar_channel.send(<Object?>[albumId]);
 | 
			
		||||
    final List<Object?>? pigeonVar_replyList =
 | 
			
		||||
        await pigeonVar_sendFuture as List<Object?>?;
 | 
			
		||||
    if (pigeonVar_replyList == null) {
 | 
			
		||||
 | 
			
		||||
@ -179,7 +179,7 @@ class ImmichAppBar extends ConsumerWidget implements PreferredSizeWidget {
 | 
			
		||||
              child: action,
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
        if (kDebugMode)
 | 
			
		||||
        if (kDebugMode || kProfileMode)
 | 
			
		||||
          IconButton(
 | 
			
		||||
            icon: const Icon(Icons.science_rounded),
 | 
			
		||||
            onPressed: () => context.pushRoute(const FeatInDevRoute()),
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user