chore(mobile): remove obsolete files (#2482)

This commit is contained in:
Fynn Petersen-Frey
2023-05-20 05:06:39 +02:00
committed by GitHub
parent c8e649f190
commit 89edbcacfa
9 changed files with 0 additions and 808 deletions

View File

@@ -1,11 +0,0 @@
class ImageViewerPageData {
final String heroTag;
final String imageUrl;
final String thumbnailUrl;
ImageViewerPageData({
required this.heroTag,
required this.imageUrl,
required this.thumbnailUrl,
});
}

View File

@@ -1,57 +0,0 @@
import 'dart:convert';
class UploadProfileImageResponse {
final String userId;
final String profileImagePath;
UploadProfileImageResponse({
required this.userId,
required this.profileImagePath,
});
UploadProfileImageResponse copyWith({
String? userId,
String? profileImagePath,
}) {
return UploadProfileImageResponse(
userId: userId ?? this.userId,
profileImagePath: profileImagePath ?? this.profileImagePath,
);
}
Map<String, dynamic> toMap() {
final result = <String, dynamic>{};
result.addAll({'userId': userId});
result.addAll({'profileImagePath': profileImagePath});
return result;
}
factory UploadProfileImageResponse.fromMap(Map<String, dynamic> map) {
return UploadProfileImageResponse(
userId: map['userId'] ?? '',
profileImagePath: map['profileImagePath'] ?? '',
);
}
String toJson() => json.encode(toMap());
factory UploadProfileImageResponse.fromJson(String source) =>
UploadProfileImageResponse.fromMap(json.decode(source));
@override
String toString() =>
'UploadProfileImageReponse(userId: $userId, profileImagePath: $profileImagePath)';
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is UploadProfileImageResponse &&
other.userId == userId &&
other.profileImagePath == profileImagePath;
}
@override
int get hashCode => userId.hashCode ^ profileImagePath.hashCode;
}

View File

@@ -1,82 +0,0 @@
// ignore: depend_on_referenced_packages
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/modules/settings/providers/app_settings.provider.dart';
import 'package:immich_mobile/modules/settings/services/app_settings.service.dart';
import 'package:immich_mobile/utils/immich_cache_info_repository.dart';
enum CacheType {
// Shared cache for asset thumbnails in various modules
thumbnail,
imageViewerPreview,
imageViewerFull,
albumThumbnail,
sharedAlbumThumbnail;
}
final cacheServiceProvider = Provider(
(ref) => CacheService(ref.watch(appSettingsServiceProvider)),
);
class CacheService {
final AppSettingsService _settingsService;
final _cacheRepositoryInstances = <CacheType, ImmichCacheRepository>{};
CacheService(this._settingsService);
BaseCacheManager getCache(CacheType type) {
return _getDefaultCache(
type.name,
_getCacheSize(type) + 1,
getCacheRepo(type),
);
}
ImmichCacheRepository getCacheRepo(CacheType type) {
if (!_cacheRepositoryInstances.containsKey(type)) {
final repo = ImmichCacheInfoRepository(
"cache_${type.name}",
"cacheKeys_${type.name}",
);
_cacheRepositoryInstances[type] = repo;
}
return _cacheRepositoryInstances[type]!;
}
Future<void> emptyAllCaches() async {
for (var type in CacheType.values) {
await getCache(type).emptyCache();
}
}
int _getCacheSize(CacheType type) {
switch (type) {
case CacheType.thumbnail:
return _settingsService.getSetting(AppSettingsEnum.thumbnailCacheSize);
case CacheType.imageViewerPreview:
case CacheType.imageViewerFull:
return _settingsService.getSetting(AppSettingsEnum.imageCacheSize);
case CacheType.sharedAlbumThumbnail:
case CacheType.albumThumbnail:
return _settingsService
.getSetting(AppSettingsEnum.albumThumbnailCacheSize);
default:
return 200;
}
}
BaseCacheManager _getDefaultCache(
String cacheName,
int size,
CacheInfoRepository repo,
) {
return CacheManager(
Config(
cacheName,
maxNrOfCacheObjects: size,
repo: repo,
),
);
}
}