2021-12-03 18:31:27 +01:00
|
|
|
import 'package:nc_photos/entity/album.dart';
|
2023-04-13 17:32:31 +02:00
|
|
|
import 'package:nc_photos/entity/album/repo2.dart';
|
2023-07-03 19:23:42 +02:00
|
|
|
import 'package:nc_photos/entity/face_recognition_person/repo.dart';
|
2022-01-25 11:08:13 +01:00
|
|
|
import 'package:nc_photos/entity/favorite.dart';
|
2021-12-03 18:31:27 +01:00
|
|
|
import 'package:nc_photos/entity/file.dart';
|
2022-05-05 16:06:47 +02:00
|
|
|
import 'package:nc_photos/entity/local_file.dart';
|
2023-04-13 17:32:31 +02:00
|
|
|
import 'package:nc_photos/entity/nc_album/repo.dart';
|
2023-07-17 09:35:45 +02:00
|
|
|
import 'package:nc_photos/entity/pref.dart';
|
2023-07-16 13:30:23 +02:00
|
|
|
import 'package:nc_photos/entity/recognize_face/repo.dart';
|
2022-08-06 06:21:11 +02:00
|
|
|
import 'package:nc_photos/entity/search.dart';
|
2021-12-03 18:31:27 +01:00
|
|
|
import 'package:nc_photos/entity/share.dart';
|
|
|
|
import 'package:nc_photos/entity/sharee.dart';
|
2023-02-20 15:21:35 +01:00
|
|
|
import 'package:nc_photos/entity/sqlite/database.dart' as sql;
|
2022-01-28 20:34:38 +01:00
|
|
|
import 'package:nc_photos/entity/tag.dart';
|
2022-01-29 12:31:32 +01:00
|
|
|
import 'package:nc_photos/entity/tagged_file.dart';
|
2022-09-23 10:37:34 +02:00
|
|
|
import 'package:nc_photos/touch_manager.dart';
|
2023-08-24 17:31:52 +02:00
|
|
|
import 'package:np_common/or_null.dart';
|
2021-12-03 18:31:27 +01:00
|
|
|
|
|
|
|
enum DiType {
|
|
|
|
albumRepo,
|
2023-04-13 17:32:31 +02:00
|
|
|
albumRepoRemote,
|
2022-07-05 22:20:24 +02:00
|
|
|
albumRepoLocal,
|
2023-04-13 17:32:31 +02:00
|
|
|
albumRepo2,
|
|
|
|
albumRepo2Remote,
|
|
|
|
albumRepo2Local,
|
2021-12-03 18:31:27 +01:00
|
|
|
fileRepo,
|
2022-07-05 22:20:24 +02:00
|
|
|
fileRepoRemote,
|
|
|
|
fileRepoLocal,
|
2021-12-03 18:31:27 +01:00
|
|
|
shareRepo,
|
|
|
|
shareeRepo,
|
2022-01-25 11:08:13 +01:00
|
|
|
favoriteRepo,
|
2022-01-28 20:34:38 +01:00
|
|
|
tagRepo,
|
2022-08-05 11:28:28 +02:00
|
|
|
tagRepoRemote,
|
|
|
|
tagRepoLocal,
|
2022-01-29 12:31:32 +01:00
|
|
|
taggedFileRepo,
|
2022-05-05 16:06:47 +02:00
|
|
|
localFileRepo,
|
2022-08-06 06:21:11 +02:00
|
|
|
searchRepo,
|
2023-04-13 17:32:31 +02:00
|
|
|
ncAlbumRepo,
|
|
|
|
ncAlbumRepoRemote,
|
|
|
|
ncAlbumRepoLocal,
|
2023-07-03 19:23:42 +02:00
|
|
|
faceRecognitionPersonRepo,
|
|
|
|
faceRecognitionPersonRepoRemote,
|
|
|
|
faceRecognitionPersonRepoLocal,
|
2023-07-16 13:30:23 +02:00
|
|
|
recognizeFaceRepo,
|
|
|
|
recognizeFaceRepoRemote,
|
|
|
|
recognizeFaceRepoLocal,
|
2021-12-03 18:31:27 +01:00
|
|
|
pref,
|
2022-07-05 22:20:24 +02:00
|
|
|
sqliteDb,
|
2022-09-23 10:37:34 +02:00
|
|
|
touchManager,
|
2021-12-03 18:31:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
class DiContainer {
|
2022-07-05 22:20:24 +02:00
|
|
|
DiContainer({
|
2021-12-03 18:31:27 +01:00
|
|
|
AlbumRepo? albumRepo,
|
2023-04-13 17:32:31 +02:00
|
|
|
AlbumRepo? albumRepoRemote,
|
2022-07-05 22:20:24 +02:00
|
|
|
AlbumRepo? albumRepoLocal,
|
2023-04-13 17:32:31 +02:00
|
|
|
AlbumRepo2? albumRepo2,
|
|
|
|
AlbumRepo2? albumRepo2Remote,
|
|
|
|
AlbumRepo2? albumRepo2Local,
|
2021-12-03 18:31:27 +01:00
|
|
|
FileRepo? fileRepo,
|
2022-07-05 22:20:24 +02:00
|
|
|
FileRepo? fileRepoRemote,
|
|
|
|
FileRepo? fileRepoLocal,
|
2021-12-03 18:31:27 +01:00
|
|
|
ShareRepo? shareRepo,
|
|
|
|
ShareeRepo? shareeRepo,
|
2022-01-25 11:08:13 +01:00
|
|
|
FavoriteRepo? favoriteRepo,
|
2022-01-28 20:34:38 +01:00
|
|
|
TagRepo? tagRepo,
|
2022-08-05 11:28:28 +02:00
|
|
|
TagRepo? tagRepoRemote,
|
|
|
|
TagRepo? tagRepoLocal,
|
2022-01-29 12:31:32 +01:00
|
|
|
TaggedFileRepo? taggedFileRepo,
|
2022-05-05 16:06:47 +02:00
|
|
|
LocalFileRepo? localFileRepo,
|
2022-08-06 06:21:11 +02:00
|
|
|
SearchRepo? searchRepo,
|
2023-04-13 17:32:31 +02:00
|
|
|
NcAlbumRepo? ncAlbumRepo,
|
|
|
|
NcAlbumRepo? ncAlbumRepoRemote,
|
|
|
|
NcAlbumRepo? ncAlbumRepoLocal,
|
2023-07-03 19:23:42 +02:00
|
|
|
FaceRecognitionPersonRepo? faceRecognitionPersonRepo,
|
|
|
|
FaceRecognitionPersonRepo? faceRecognitionPersonRepoRemote,
|
|
|
|
FaceRecognitionPersonRepo? faceRecognitionPersonRepoLocal,
|
2023-07-16 13:30:23 +02:00
|
|
|
RecognizeFaceRepo? recognizeFaceRepo,
|
|
|
|
RecognizeFaceRepo? recognizeFaceRepoRemote,
|
|
|
|
RecognizeFaceRepo? recognizeFaceRepoLocal,
|
2021-12-03 18:31:27 +01:00
|
|
|
Pref? pref,
|
2022-07-05 22:20:24 +02:00
|
|
|
sql.SqliteDb? sqliteDb,
|
2022-09-23 10:37:34 +02:00
|
|
|
TouchManager? touchManager,
|
2021-12-03 18:31:27 +01:00
|
|
|
}) : _albumRepo = albumRepo,
|
2023-04-13 17:32:31 +02:00
|
|
|
_albumRepoRemote = albumRepoRemote,
|
2022-07-05 22:20:24 +02:00
|
|
|
_albumRepoLocal = albumRepoLocal,
|
2023-04-13 17:32:31 +02:00
|
|
|
_albumRepo2 = albumRepo2,
|
|
|
|
_albumRepo2Remote = albumRepo2Remote,
|
|
|
|
_albumRepo2Local = albumRepo2Local,
|
2021-12-03 18:31:27 +01:00
|
|
|
_fileRepo = fileRepo,
|
2022-07-05 22:20:24 +02:00
|
|
|
_fileRepoRemote = fileRepoRemote,
|
|
|
|
_fileRepoLocal = fileRepoLocal,
|
2021-12-03 18:31:27 +01:00
|
|
|
_shareRepo = shareRepo,
|
|
|
|
_shareeRepo = shareeRepo,
|
2022-01-25 11:08:13 +01:00
|
|
|
_favoriteRepo = favoriteRepo,
|
2022-01-28 20:34:38 +01:00
|
|
|
_tagRepo = tagRepo,
|
2022-08-05 11:28:28 +02:00
|
|
|
_tagRepoRemote = tagRepoRemote,
|
|
|
|
_tagRepoLocal = tagRepoLocal,
|
2022-01-29 12:31:32 +01:00
|
|
|
_taggedFileRepo = taggedFileRepo,
|
2022-05-05 16:06:47 +02:00
|
|
|
_localFileRepo = localFileRepo,
|
2022-08-06 06:21:11 +02:00
|
|
|
_searchRepo = searchRepo,
|
2023-04-13 17:32:31 +02:00
|
|
|
_ncAlbumRepo = ncAlbumRepo,
|
|
|
|
_ncAlbumRepoRemote = ncAlbumRepoRemote,
|
|
|
|
_ncAlbumRepoLocal = ncAlbumRepoLocal,
|
2023-07-03 19:23:42 +02:00
|
|
|
_faceRecognitionPersonRepo = faceRecognitionPersonRepo,
|
|
|
|
_faceRecognitionPersonRepoRemote = faceRecognitionPersonRepoRemote,
|
|
|
|
_faceRecognitionPersonRepoLocal = faceRecognitionPersonRepoLocal,
|
2023-07-16 13:30:23 +02:00
|
|
|
_recognizeFaceRepo = recognizeFaceRepo,
|
|
|
|
_recognizeFaceRepoRemote = recognizeFaceRepoRemote,
|
|
|
|
_recognizeFaceRepoLocal = recognizeFaceRepoLocal,
|
2022-07-05 22:20:24 +02:00
|
|
|
_pref = pref,
|
2022-09-23 10:37:34 +02:00
|
|
|
_sqliteDb = sqliteDb,
|
|
|
|
_touchManager = touchManager;
|
2022-07-05 22:20:24 +02:00
|
|
|
|
|
|
|
DiContainer.late();
|
2021-12-03 18:31:27 +01:00
|
|
|
|
|
|
|
static bool has(DiContainer contianer, DiType type) {
|
|
|
|
switch (type) {
|
|
|
|
case DiType.albumRepo:
|
|
|
|
return contianer._albumRepo != null;
|
2023-04-13 17:32:31 +02:00
|
|
|
case DiType.albumRepoRemote:
|
|
|
|
return contianer._albumRepoRemote != null;
|
2022-07-05 22:20:24 +02:00
|
|
|
case DiType.albumRepoLocal:
|
|
|
|
return contianer._albumRepoLocal != null;
|
2023-04-13 17:32:31 +02:00
|
|
|
case DiType.albumRepo2:
|
|
|
|
return contianer._albumRepo2 != null;
|
|
|
|
case DiType.albumRepo2Remote:
|
|
|
|
return contianer._albumRepo2Remote != null;
|
|
|
|
case DiType.albumRepo2Local:
|
|
|
|
return contianer._albumRepo2Local != null;
|
2021-12-03 18:31:27 +01:00
|
|
|
case DiType.fileRepo:
|
|
|
|
return contianer._fileRepo != null;
|
2022-07-05 22:20:24 +02:00
|
|
|
case DiType.fileRepoRemote:
|
|
|
|
return contianer._fileRepoRemote != null;
|
|
|
|
case DiType.fileRepoLocal:
|
|
|
|
return contianer._fileRepoLocal != null;
|
2021-12-03 18:31:27 +01:00
|
|
|
case DiType.shareRepo:
|
|
|
|
return contianer._shareRepo != null;
|
|
|
|
case DiType.shareeRepo:
|
|
|
|
return contianer._shareeRepo != null;
|
2022-01-25 11:08:13 +01:00
|
|
|
case DiType.favoriteRepo:
|
|
|
|
return contianer._favoriteRepo != null;
|
2022-01-28 20:34:38 +01:00
|
|
|
case DiType.tagRepo:
|
|
|
|
return contianer._tagRepo != null;
|
2022-08-05 11:28:28 +02:00
|
|
|
case DiType.tagRepoRemote:
|
|
|
|
return contianer._tagRepoRemote != null;
|
|
|
|
case DiType.tagRepoLocal:
|
|
|
|
return contianer._tagRepoLocal != null;
|
2022-01-29 12:31:32 +01:00
|
|
|
case DiType.taggedFileRepo:
|
|
|
|
return contianer._taggedFileRepo != null;
|
2022-05-05 16:06:47 +02:00
|
|
|
case DiType.localFileRepo:
|
|
|
|
return contianer._localFileRepo != null;
|
2022-08-06 06:21:11 +02:00
|
|
|
case DiType.searchRepo:
|
|
|
|
return contianer._searchRepo != null;
|
2023-04-13 17:32:31 +02:00
|
|
|
case DiType.ncAlbumRepo:
|
|
|
|
return contianer._ncAlbumRepo != null;
|
|
|
|
case DiType.ncAlbumRepoRemote:
|
|
|
|
return contianer._ncAlbumRepoRemote != null;
|
|
|
|
case DiType.ncAlbumRepoLocal:
|
|
|
|
return contianer._ncAlbumRepoLocal != null;
|
2023-07-03 19:23:42 +02:00
|
|
|
case DiType.faceRecognitionPersonRepo:
|
|
|
|
return contianer._faceRecognitionPersonRepo != null;
|
|
|
|
case DiType.faceRecognitionPersonRepoRemote:
|
|
|
|
return contianer._faceRecognitionPersonRepoRemote != null;
|
|
|
|
case DiType.faceRecognitionPersonRepoLocal:
|
|
|
|
return contianer._faceRecognitionPersonRepoLocal != null;
|
2023-07-16 13:30:23 +02:00
|
|
|
case DiType.recognizeFaceRepo:
|
|
|
|
return contianer._recognizeFaceRepo != null;
|
|
|
|
case DiType.recognizeFaceRepoRemote:
|
|
|
|
return contianer._recognizeFaceRepoRemote != null;
|
|
|
|
case DiType.recognizeFaceRepoLocal:
|
|
|
|
return contianer._recognizeFaceRepoLocal != null;
|
2021-12-03 18:31:27 +01:00
|
|
|
case DiType.pref:
|
|
|
|
return contianer._pref != null;
|
2022-07-05 22:20:24 +02:00
|
|
|
case DiType.sqliteDb:
|
|
|
|
return contianer._sqliteDb != null;
|
2022-09-23 10:37:34 +02:00
|
|
|
case DiType.touchManager:
|
|
|
|
return contianer._touchManager != null;
|
2021-12-03 18:31:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-07 19:42:25 +01:00
|
|
|
DiContainer copyWith({
|
|
|
|
OrNull<AlbumRepo>? albumRepo,
|
2023-04-13 17:32:31 +02:00
|
|
|
OrNull<AlbumRepo2>? albumRepo2,
|
2021-12-07 19:42:25 +01:00
|
|
|
OrNull<FileRepo>? fileRepo,
|
|
|
|
OrNull<ShareRepo>? shareRepo,
|
|
|
|
OrNull<ShareeRepo>? shareeRepo,
|
2022-01-25 11:08:13 +01:00
|
|
|
OrNull<FavoriteRepo>? favoriteRepo,
|
2022-01-28 20:34:38 +01:00
|
|
|
OrNull<TagRepo>? tagRepo,
|
2022-01-29 12:31:32 +01:00
|
|
|
OrNull<TaggedFileRepo>? taggedFileRepo,
|
2022-05-05 16:06:47 +02:00
|
|
|
OrNull<LocalFileRepo>? localFileRepo,
|
2022-08-06 06:21:11 +02:00
|
|
|
OrNull<SearchRepo>? searchRepo,
|
2023-04-13 17:32:31 +02:00
|
|
|
OrNull<NcAlbumRepo>? ncAlbumRepo,
|
2023-07-03 19:23:42 +02:00
|
|
|
OrNull<FaceRecognitionPersonRepo>? faceRecognitionPersonRepo,
|
2023-07-16 13:30:23 +02:00
|
|
|
OrNull<RecognizeFaceRepo>? recognizeFaceRepo,
|
2021-12-07 19:42:25 +01:00
|
|
|
OrNull<Pref>? pref,
|
2022-07-05 22:20:24 +02:00
|
|
|
OrNull<sql.SqliteDb>? sqliteDb,
|
2022-09-23 10:37:34 +02:00
|
|
|
OrNull<TouchManager>? touchManager,
|
2021-12-07 19:42:25 +01:00
|
|
|
}) {
|
|
|
|
return DiContainer(
|
2022-01-22 18:00:53 +01:00
|
|
|
albumRepo: albumRepo == null ? _albumRepo : albumRepo.obj,
|
2023-04-13 17:32:31 +02:00
|
|
|
albumRepo2: albumRepo2 == null ? _albumRepo2 : albumRepo2.obj,
|
2022-01-22 18:00:53 +01:00
|
|
|
fileRepo: fileRepo == null ? _fileRepo : fileRepo.obj,
|
|
|
|
shareRepo: shareRepo == null ? _shareRepo : shareRepo.obj,
|
|
|
|
shareeRepo: shareeRepo == null ? _shareeRepo : shareeRepo.obj,
|
2022-01-25 11:08:13 +01:00
|
|
|
favoriteRepo: favoriteRepo == null ? _favoriteRepo : favoriteRepo.obj,
|
2022-01-28 20:34:38 +01:00
|
|
|
tagRepo: tagRepo == null ? _tagRepo : tagRepo.obj,
|
2022-01-29 12:31:32 +01:00
|
|
|
taggedFileRepo:
|
|
|
|
taggedFileRepo == null ? _taggedFileRepo : taggedFileRepo.obj,
|
2022-05-05 16:06:47 +02:00
|
|
|
localFileRepo: localFileRepo == null ? _localFileRepo : localFileRepo.obj,
|
2022-08-06 06:21:11 +02:00
|
|
|
searchRepo: searchRepo == null ? _searchRepo : searchRepo.obj,
|
2023-04-13 17:32:31 +02:00
|
|
|
ncAlbumRepo: ncAlbumRepo == null ? _ncAlbumRepo : ncAlbumRepo.obj,
|
2023-07-03 19:23:42 +02:00
|
|
|
faceRecognitionPersonRepo: faceRecognitionPersonRepo == null
|
|
|
|
? _faceRecognitionPersonRepo
|
|
|
|
: faceRecognitionPersonRepo.obj,
|
2023-07-16 13:30:23 +02:00
|
|
|
recognizeFaceRepo: recognizeFaceRepo == null
|
|
|
|
? _recognizeFaceRepo
|
|
|
|
: recognizeFaceRepo.obj,
|
2022-01-22 18:00:53 +01:00
|
|
|
pref: pref == null ? _pref : pref.obj,
|
2022-07-05 22:20:24 +02:00
|
|
|
sqliteDb: sqliteDb == null ? _sqliteDb : sqliteDb.obj,
|
2022-09-23 10:37:34 +02:00
|
|
|
touchManager: touchManager == null ? _touchManager : touchManager.obj,
|
2021-12-07 19:42:25 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-12-03 18:31:27 +01:00
|
|
|
AlbumRepo get albumRepo => _albumRepo!;
|
2023-04-13 17:32:31 +02:00
|
|
|
AlbumRepo get albumRepoRemote => _albumRepoRemote!;
|
2022-07-05 22:20:24 +02:00
|
|
|
AlbumRepo get albumRepoLocal => _albumRepoLocal!;
|
2023-04-13 17:32:31 +02:00
|
|
|
AlbumRepo2 get albumRepo2 => _albumRepo2!;
|
|
|
|
AlbumRepo2 get albumRepo2Remote => _albumRepo2Remote!;
|
|
|
|
AlbumRepo2 get albumRepo2Local => _albumRepo2Local!;
|
2021-12-03 18:31:27 +01:00
|
|
|
FileRepo get fileRepo => _fileRepo!;
|
2022-07-05 22:20:24 +02:00
|
|
|
FileRepo get fileRepoRemote => _fileRepoRemote!;
|
|
|
|
FileRepo get fileRepoLocal => _fileRepoLocal!;
|
2021-12-03 18:31:27 +01:00
|
|
|
ShareRepo get shareRepo => _shareRepo!;
|
|
|
|
ShareeRepo get shareeRepo => _shareeRepo!;
|
2022-01-25 11:08:13 +01:00
|
|
|
FavoriteRepo get favoriteRepo => _favoriteRepo!;
|
2022-01-28 20:34:38 +01:00
|
|
|
TagRepo get tagRepo => _tagRepo!;
|
2022-08-05 11:28:28 +02:00
|
|
|
TagRepo get tagRepoRemote => _tagRepoRemote!;
|
|
|
|
TagRepo get tagRepoLocal => _tagRepoLocal!;
|
2022-01-29 12:31:32 +01:00
|
|
|
TaggedFileRepo get taggedFileRepo => _taggedFileRepo!;
|
2022-05-05 16:06:47 +02:00
|
|
|
LocalFileRepo get localFileRepo => _localFileRepo!;
|
2022-08-06 06:21:11 +02:00
|
|
|
SearchRepo get searchRepo => _searchRepo!;
|
2023-04-13 17:32:31 +02:00
|
|
|
NcAlbumRepo get ncAlbumRepo => _ncAlbumRepo!;
|
|
|
|
NcAlbumRepo get ncAlbumRepoRemote => _ncAlbumRepoRemote!;
|
|
|
|
NcAlbumRepo get ncAlbumRepoLocal => _ncAlbumRepoLocal!;
|
2023-07-03 19:23:42 +02:00
|
|
|
FaceRecognitionPersonRepo get faceRecognitionPersonRepo =>
|
|
|
|
_faceRecognitionPersonRepo!;
|
|
|
|
FaceRecognitionPersonRepo get faceRecognitionPersonRepoRemote =>
|
|
|
|
_faceRecognitionPersonRepoRemote!;
|
|
|
|
FaceRecognitionPersonRepo get faceRecognitionPersonRepoLocal =>
|
|
|
|
_faceRecognitionPersonRepoLocal!;
|
2023-07-16 13:30:23 +02:00
|
|
|
RecognizeFaceRepo get recognizeFaceRepo => _recognizeFaceRepo!;
|
|
|
|
RecognizeFaceRepo get recognizeFaceRepoRemote => _recognizeFaceRepoRemote!;
|
|
|
|
RecognizeFaceRepo get recognizeFaceRepoLocal => _recognizeFaceRepoLocal!;
|
2021-12-03 18:31:27 +01:00
|
|
|
|
2022-07-05 22:20:24 +02:00
|
|
|
sql.SqliteDb get sqliteDb => _sqliteDb!;
|
2021-12-03 18:31:27 +01:00
|
|
|
Pref get pref => _pref!;
|
2023-07-03 19:23:42 +02:00
|
|
|
TouchManager get touchManager => _touchManager!;
|
2021-12-03 18:31:27 +01:00
|
|
|
|
2022-07-05 22:20:24 +02:00
|
|
|
set albumRepo(AlbumRepo v) {
|
|
|
|
assert(_albumRepo == null);
|
|
|
|
_albumRepo = v;
|
|
|
|
}
|
|
|
|
|
2023-04-13 17:32:31 +02:00
|
|
|
set albumRepoRemote(AlbumRepo v) {
|
|
|
|
assert(_albumRepoRemote == null);
|
|
|
|
_albumRepoRemote = v;
|
|
|
|
}
|
|
|
|
|
2022-07-05 22:20:24 +02:00
|
|
|
set albumRepoLocal(AlbumRepo v) {
|
|
|
|
assert(_albumRepoLocal == null);
|
|
|
|
_albumRepoLocal = v;
|
|
|
|
}
|
|
|
|
|
2023-04-13 17:32:31 +02:00
|
|
|
set albumRepo2(AlbumRepo2 v) {
|
|
|
|
assert(_albumRepo2 == null);
|
|
|
|
_albumRepo2 = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set albumRepo2Remote(AlbumRepo2 v) {
|
|
|
|
assert(_albumRepo2Remote == null);
|
|
|
|
_albumRepo2Remote = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set albumRepo2Local(AlbumRepo2 v) {
|
|
|
|
assert(_albumRepo2Local == null);
|
|
|
|
_albumRepo2Local = v;
|
|
|
|
}
|
|
|
|
|
2022-07-05 22:20:24 +02:00
|
|
|
set fileRepo(FileRepo v) {
|
|
|
|
assert(_fileRepo == null);
|
|
|
|
_fileRepo = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set fileRepoRemote(FileRepo v) {
|
|
|
|
assert(_fileRepoRemote == null);
|
|
|
|
_fileRepoRemote = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set fileRepoLocal(FileRepo v) {
|
|
|
|
assert(_fileRepoLocal == null);
|
|
|
|
_fileRepoLocal = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set shareRepo(ShareRepo v) {
|
|
|
|
assert(_shareRepo == null);
|
|
|
|
_shareRepo = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set shareeRepo(ShareeRepo v) {
|
|
|
|
assert(_shareeRepo == null);
|
|
|
|
_shareeRepo = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set favoriteRepo(FavoriteRepo v) {
|
|
|
|
assert(_favoriteRepo == null);
|
|
|
|
_favoriteRepo = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set tagRepo(TagRepo v) {
|
|
|
|
assert(_tagRepo == null);
|
|
|
|
_tagRepo = v;
|
|
|
|
}
|
|
|
|
|
2022-08-05 11:28:28 +02:00
|
|
|
set tagRepoRemote(TagRepo v) {
|
|
|
|
assert(_tagRepoRemote == null);
|
|
|
|
_tagRepoRemote = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set tagRepoLocal(TagRepo v) {
|
|
|
|
assert(_tagRepoLocal == null);
|
|
|
|
_tagRepoLocal = v;
|
|
|
|
}
|
|
|
|
|
2022-07-05 22:20:24 +02:00
|
|
|
set taggedFileRepo(TaggedFileRepo v) {
|
|
|
|
assert(_taggedFileRepo == null);
|
|
|
|
_taggedFileRepo = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set localFileRepo(LocalFileRepo v) {
|
|
|
|
assert(_localFileRepo == null);
|
|
|
|
_localFileRepo = v;
|
|
|
|
}
|
|
|
|
|
2022-08-06 06:21:11 +02:00
|
|
|
set searchRepo(SearchRepo v) {
|
|
|
|
assert(_searchRepo == null);
|
|
|
|
_searchRepo = v;
|
|
|
|
}
|
|
|
|
|
2023-04-13 17:32:31 +02:00
|
|
|
set ncAlbumRepo(NcAlbumRepo v) {
|
|
|
|
assert(_ncAlbumRepo == null);
|
|
|
|
_ncAlbumRepo = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set ncAlbumRepoRemote(NcAlbumRepo v) {
|
|
|
|
assert(_ncAlbumRepoRemote == null);
|
|
|
|
_ncAlbumRepoRemote = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set ncAlbumRepoLocal(NcAlbumRepo v) {
|
|
|
|
assert(_ncAlbumRepoLocal == null);
|
|
|
|
_ncAlbumRepoLocal = v;
|
|
|
|
}
|
|
|
|
|
2023-07-03 19:23:42 +02:00
|
|
|
set faceRecognitionPersonRepo(FaceRecognitionPersonRepo v) {
|
|
|
|
assert(_faceRecognitionPersonRepo == null);
|
|
|
|
_faceRecognitionPersonRepo = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set faceRecognitionPersonRepoRemote(FaceRecognitionPersonRepo v) {
|
|
|
|
assert(_faceRecognitionPersonRepoRemote == null);
|
|
|
|
_faceRecognitionPersonRepoRemote = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set faceRecognitionPersonRepoLocal(FaceRecognitionPersonRepo v) {
|
|
|
|
assert(_faceRecognitionPersonRepoLocal == null);
|
|
|
|
_faceRecognitionPersonRepoLocal = v;
|
2022-09-23 10:37:34 +02:00
|
|
|
}
|
|
|
|
|
2023-07-16 13:30:23 +02:00
|
|
|
set recognizeFaceRepo(RecognizeFaceRepo v) {
|
|
|
|
assert(_recognizeFaceRepo == null);
|
|
|
|
_recognizeFaceRepo = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set recognizeFaceRepoRemote(RecognizeFaceRepo v) {
|
|
|
|
assert(_recognizeFaceRepoRemote == null);
|
|
|
|
_recognizeFaceRepoRemote = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set recognizeFaceRepoLocal(RecognizeFaceRepo v) {
|
|
|
|
assert(_recognizeFaceRepoLocal == null);
|
|
|
|
_recognizeFaceRepoLocal = v;
|
|
|
|
}
|
|
|
|
|
2022-07-05 22:20:24 +02:00
|
|
|
set sqliteDb(sql.SqliteDb v) {
|
|
|
|
assert(_sqliteDb == null);
|
|
|
|
_sqliteDb = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
set pref(Pref v) {
|
|
|
|
assert(_pref == null);
|
|
|
|
_pref = v;
|
|
|
|
}
|
|
|
|
|
2023-07-03 19:23:42 +02:00
|
|
|
set touchManager(TouchManager v) {
|
|
|
|
assert(_touchManager == null);
|
|
|
|
_touchManager = v;
|
|
|
|
}
|
|
|
|
|
2022-07-05 22:20:24 +02:00
|
|
|
AlbumRepo? _albumRepo;
|
2023-04-13 17:32:31 +02:00
|
|
|
AlbumRepo? _albumRepoRemote;
|
2022-07-05 22:20:24 +02:00
|
|
|
// Explicitly request a AlbumRepo backed by local source
|
|
|
|
AlbumRepo? _albumRepoLocal;
|
2023-04-13 17:32:31 +02:00
|
|
|
AlbumRepo2? _albumRepo2;
|
|
|
|
AlbumRepo2? _albumRepo2Remote;
|
|
|
|
AlbumRepo2? _albumRepo2Local;
|
2022-07-05 22:20:24 +02:00
|
|
|
FileRepo? _fileRepo;
|
|
|
|
// Explicitly request a FileRepo backed by remote source
|
|
|
|
FileRepo? _fileRepoRemote;
|
|
|
|
// Explicitly request a FileRepo backed by local source
|
|
|
|
FileRepo? _fileRepoLocal;
|
|
|
|
ShareRepo? _shareRepo;
|
|
|
|
ShareeRepo? _shareeRepo;
|
|
|
|
FavoriteRepo? _favoriteRepo;
|
|
|
|
TagRepo? _tagRepo;
|
2022-08-05 11:28:28 +02:00
|
|
|
TagRepo? _tagRepoRemote;
|
|
|
|
TagRepo? _tagRepoLocal;
|
2022-07-05 22:20:24 +02:00
|
|
|
TaggedFileRepo? _taggedFileRepo;
|
|
|
|
LocalFileRepo? _localFileRepo;
|
2022-08-06 06:21:11 +02:00
|
|
|
SearchRepo? _searchRepo;
|
2023-04-13 17:32:31 +02:00
|
|
|
NcAlbumRepo? _ncAlbumRepo;
|
|
|
|
NcAlbumRepo? _ncAlbumRepoRemote;
|
|
|
|
NcAlbumRepo? _ncAlbumRepoLocal;
|
2023-07-03 19:23:42 +02:00
|
|
|
FaceRecognitionPersonRepo? _faceRecognitionPersonRepo;
|
|
|
|
FaceRecognitionPersonRepo? _faceRecognitionPersonRepoRemote;
|
|
|
|
FaceRecognitionPersonRepo? _faceRecognitionPersonRepoLocal;
|
2023-07-16 13:30:23 +02:00
|
|
|
RecognizeFaceRepo? _recognizeFaceRepo;
|
|
|
|
RecognizeFaceRepo? _recognizeFaceRepoRemote;
|
|
|
|
RecognizeFaceRepo? _recognizeFaceRepoLocal;
|
2022-07-05 22:20:24 +02:00
|
|
|
|
|
|
|
sql.SqliteDb? _sqliteDb;
|
|
|
|
Pref? _pref;
|
2023-07-03 19:23:42 +02:00
|
|
|
TouchManager? _touchManager;
|
2021-12-03 18:31:27 +01:00
|
|
|
}
|
2022-07-22 10:48:16 +02:00
|
|
|
|
|
|
|
extension DiContainerExtension on DiContainer {
|
2023-04-13 17:32:31 +02:00
|
|
|
/// Uses remote repo if available
|
|
|
|
///
|
|
|
|
/// Notice that not all repo support this
|
|
|
|
DiContainer withRemoteRepo() => copyWith(
|
2023-07-03 19:23:42 +02:00
|
|
|
albumRepo: OrNull(_albumRepoRemote),
|
|
|
|
albumRepo2: OrNull(_albumRepo2Remote),
|
|
|
|
fileRepo: OrNull(_fileRepoRemote),
|
|
|
|
tagRepo: OrNull(_tagRepoRemote),
|
|
|
|
ncAlbumRepo: OrNull(_ncAlbumRepoRemote),
|
|
|
|
faceRecognitionPersonRepo: OrNull(_faceRecognitionPersonRepoRemote),
|
2023-07-16 13:30:23 +02:00
|
|
|
recognizeFaceRepo: OrNull(_recognizeFaceRepoRemote),
|
2023-04-13 17:32:31 +02:00
|
|
|
);
|
|
|
|
|
2022-08-06 06:21:11 +02:00
|
|
|
/// Uses local repo if available
|
|
|
|
///
|
|
|
|
/// Notice that not all repo support this
|
|
|
|
DiContainer withLocalRepo() => copyWith(
|
2023-07-03 19:23:42 +02:00
|
|
|
albumRepo: OrNull(_albumRepoLocal),
|
|
|
|
albumRepo2: OrNull(_albumRepo2Local),
|
|
|
|
fileRepo: OrNull(_fileRepoLocal),
|
|
|
|
tagRepo: OrNull(_tagRepoLocal),
|
|
|
|
ncAlbumRepo: OrNull(_ncAlbumRepoLocal),
|
|
|
|
faceRecognitionPersonRepo: OrNull(_faceRecognitionPersonRepoLocal),
|
2023-07-16 13:30:23 +02:00
|
|
|
recognizeFaceRepo: OrNull(_recognizeFaceRepoLocal),
|
2022-08-06 06:21:11 +02:00
|
|
|
);
|
|
|
|
|
2022-08-05 11:44:52 +02:00
|
|
|
DiContainer withLocalAlbumRepo() =>
|
|
|
|
copyWith(albumRepo: OrNull(albumRepoLocal));
|
2022-07-22 10:48:16 +02:00
|
|
|
DiContainer withRemoteFileRepo() =>
|
|
|
|
copyWith(fileRepo: OrNull(fileRepoRemote));
|
2022-08-05 11:44:52 +02:00
|
|
|
DiContainer withLocalFileRepo() => copyWith(fileRepo: OrNull(fileRepoLocal));
|
2022-08-05 11:28:28 +02:00
|
|
|
DiContainer withRemoteTagRepo() => copyWith(tagRepo: OrNull(tagRepoRemote));
|
|
|
|
DiContainer withLocalTagRepo() => copyWith(tagRepo: OrNull(tagRepoLocal));
|
2022-07-22 10:48:16 +02:00
|
|
|
}
|