mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-24 10:28:50 +01:00
Refactor: move OrNull away from main package
This commit is contained in:
parent
2c0e66beca
commit
c07819fb0e
41 changed files with 74 additions and 61 deletions
|
@ -15,7 +15,6 @@ import 'package:nc_photos/entity/collection_item/util.dart';
|
|||
import 'package:nc_photos/entity/file_descriptor.dart';
|
||||
import 'package:nc_photos/entity/sharee.dart';
|
||||
import 'package:nc_photos/exception.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/rx_extension.dart';
|
||||
import 'package:nc_photos/use_case/collection/create_collection.dart';
|
||||
import 'package:nc_photos/use_case/collection/edit_collection.dart';
|
||||
|
@ -25,6 +24,7 @@ import 'package:nc_photos/use_case/collection/remove_collections.dart';
|
|||
import 'package:nc_photos/use_case/collection/share_collection.dart';
|
||||
import 'package:nc_photos/use_case/collection/unshare_collection.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ import 'package:nc_photos/entity/sharee.dart';
|
|||
import 'package:nc_photos/entity/sqlite/database.dart' as sql;
|
||||
import 'package:nc_photos/entity/tag.dart';
|
||||
import 'package:nc_photos/entity/tagged_file.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/touch_manager.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
|
||||
enum DiType {
|
||||
albumRepo,
|
||||
|
|
|
@ -9,9 +9,9 @@ import 'package:nc_photos/entity/album/upgrader.dart';
|
|||
import 'package:nc_photos/entity/file.dart';
|
||||
import 'package:nc_photos/iterable_extension.dart';
|
||||
import 'package:nc_photos/object_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
import 'package:to_string/to_string.dart';
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@ import 'package:nc_photos/entity/file/data_source.dart';
|
|||
import 'package:nc_photos/entity/sqlite/database.dart' as sql;
|
||||
import 'package:nc_photos/entity/sqlite/type_converter.dart' as sql;
|
||||
import 'package:nc_photos/exception.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/remote_storage_util.dart' as remote_storage_util;
|
||||
import 'package:nc_photos/use_case/get_file_binary.dart';
|
||||
import 'package:nc_photos/use_case/ls_single_file.dart';
|
||||
import 'package:nc_photos/use_case/put_file_binary.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
|
||||
part 'data_source2.g.dart';
|
||||
|
@ -90,7 +90,7 @@ class AlbumRemoteDataSource2 implements AlbumDataSource2 {
|
|||
),
|
||||
);
|
||||
return album!.copyWith(
|
||||
lastUpdated: OrNull(null),
|
||||
lastUpdated: const OrNull(null),
|
||||
albumFile: OrNull(albumFile),
|
||||
);
|
||||
} catch (e, stacktrace) {
|
||||
|
|
|
@ -2,9 +2,9 @@ import 'package:equatable/equatable.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:nc_photos/entity/file.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
import 'package:to_string/to_string.dart';
|
||||
|
||||
|
@ -126,7 +126,7 @@ class AlbumFileItem extends AlbumItem {
|
|||
AlbumFileItem minimize() => AlbumFileItem(
|
||||
addedBy: addedBy,
|
||||
addedAt: addedAt,
|
||||
file: file.copyWith(metadata: OrNull(null)),
|
||||
file: file.copyWith(metadata: const OrNull(null)),
|
||||
);
|
||||
|
||||
@override
|
||||
|
|
|
@ -8,8 +8,8 @@ import 'package:nc_photos/entity/album/item.dart';
|
|||
import 'package:nc_photos/entity/file.dart';
|
||||
import 'package:nc_photos/entity/tag.dart';
|
||||
import 'package:nc_photos/iterable_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
import 'package:to_string/to_string.dart';
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ import 'package:nc_photos/entity/collection_item/new_item.dart';
|
|||
import 'package:nc_photos/entity/collection_item/util.dart';
|
||||
import 'package:nc_photos/entity/file_descriptor.dart';
|
||||
import 'package:nc_photos/entity/sharee.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
|
||||
abstract class CollectionAdapter {
|
||||
|
|
|
@ -6,8 +6,8 @@ import 'package:nc_photos/entity/collection_item.dart';
|
|||
import 'package:nc_photos/entity/collection_item/util.dart';
|
||||
import 'package:nc_photos/entity/file_descriptor.dart';
|
||||
import 'package:nc_photos/entity/sharee.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
|
||||
/// A read-only collection that does not support modifying its items
|
||||
|
|
|
@ -21,7 +21,6 @@ import 'package:nc_photos/entity/file_descriptor.dart';
|
|||
import 'package:nc_photos/entity/sharee.dart';
|
||||
import 'package:nc_photos/iterable_extension.dart';
|
||||
import 'package:nc_photos/object_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/use_case/album/add_file_to_album.dart';
|
||||
import 'package:nc_photos/use_case/album/edit_album.dart';
|
||||
import 'package:nc_photos/use_case/album/remove_album.dart';
|
||||
|
@ -34,6 +33,7 @@ import 'package:nc_photos/use_case/unimport_shared_album.dart';
|
|||
import 'package:nc_photos/use_case/update_album_with_actual_items.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import 'package:nc_photos/entity/collection_item/util.dart';
|
|||
import 'package:nc_photos/entity/file_descriptor.dart';
|
||||
import 'package:nc_photos/entity/nc_album.dart';
|
||||
import 'package:nc_photos/object_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/use_case/find_file_descriptor.dart';
|
||||
import 'package:nc_photos/use_case/nc_album/add_file_to_nc_album.dart';
|
||||
import 'package:nc_photos/use_case/nc_album/edit_nc_album.dart';
|
||||
|
@ -24,6 +23,7 @@ import 'package:nc_photos/use_case/nc_album/list_nc_album_item.dart';
|
|||
import 'package:nc_photos/use_case/nc_album/remove_from_nc_album.dart';
|
||||
import 'package:nc_photos/use_case/nc_album/remove_nc_album.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
|
||||
part 'nc_album.g.dart';
|
||||
|
|
|
@ -8,9 +8,9 @@ import 'package:nc_photos/entity/exif.dart';
|
|||
import 'package:nc_photos/entity/file_descriptor.dart';
|
||||
import 'package:nc_photos/entity/file_util.dart' as file_util;
|
||||
import 'package:nc_photos/json_util.dart' as json_util;
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/string_extension.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
import 'package:to_string/to_string.dart';
|
||||
|
|
|
@ -17,10 +17,10 @@ import 'package:nc_photos/exception.dart';
|
|||
import 'package:nc_photos/iterable_extension.dart';
|
||||
import 'package:nc_photos/np_api_util.dart';
|
||||
import 'package:nc_photos/object_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/use_case/compat/v32.dart';
|
||||
import 'package:np_api/np_api.dart' as api;
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:path/path.dart' as path_lib;
|
||||
|
||||
part 'data_source.g.dart';
|
||||
|
@ -327,7 +327,7 @@ class FileWebdavDataSource implements FileDataSource {
|
|||
return e;
|
||||
} else {
|
||||
_log.info("[list] Ignore outdated metadata for ${e.path}");
|
||||
return e.copyWith(metadata: OrNull(null));
|
||||
return e.copyWith(metadata: const OrNull(null));
|
||||
}
|
||||
})
|
||||
.toList();
|
||||
|
|
|
@ -17,9 +17,9 @@ import 'package:nc_photos/entity/sqlite/database.dart' as sql;
|
|||
import 'package:nc_photos/entity/tag.dart';
|
||||
import 'package:nc_photos/iterable_extension.dart';
|
||||
import 'package:nc_photos/object_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_api/np_api.dart' as api;
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
|
||||
extension SqlTagListExtension on List<sql.Tag> {
|
||||
|
|
|
@ -2,7 +2,7 @@ import 'package:equatable/equatable.dart';
|
|||
import 'package:nc_photos/account.dart';
|
||||
import 'package:nc_photos/entity/file.dart';
|
||||
import 'package:nc_photos/json_util.dart' as json_util;
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
import 'package:to_string/to_string.dart';
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@ import 'package:nc_photos/entity/file_descriptor.dart';
|
|||
import 'package:nc_photos/exception.dart';
|
||||
import 'package:nc_photos/mobile/platform.dart'
|
||||
if (dart.library.html) 'package:nc_photos/web/platform.dart' as platform;
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/remote_storage_util.dart' as remote_storage_util;
|
||||
import 'package:nc_photos/throttler.dart';
|
||||
import 'package:nc_photos/use_case/ls_single_file.dart';
|
||||
import 'package:nc_photos/use_case/put_file_binary.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:path/path.dart' as path_lib;
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ import 'package:nc_photos/entity/album/provider.dart';
|
|||
import 'package:nc_photos/entity/album/sort_provider.dart';
|
||||
import 'package:nc_photos/entity/collection_item/util.dart';
|
||||
import 'package:nc_photos/entity/file_descriptor.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/use_case/update_album.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
|
||||
part 'edit_album.g.dart';
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@ import 'package:nc_photos/entity/album.dart';
|
|||
import 'package:nc_photos/entity/album/item.dart';
|
||||
import 'package:nc_photos/entity/album/provider.dart';
|
||||
import 'package:nc_photos/entity/share.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/use_case/album/unshare_file_from_album.dart';
|
||||
import 'package:nc_photos/use_case/list_share.dart';
|
||||
import 'package:nc_photos/use_case/remove.dart';
|
||||
import 'package:nc_photos/use_case/remove_share.dart';
|
||||
import 'package:nc_photos/use_case/update_album.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
|
||||
part 'remove_album.g.dart';
|
||||
|
||||
|
@ -37,7 +37,7 @@ class RemoveAlbum {
|
|||
await UpdateAlbum(_c.albumRepo)(
|
||||
account,
|
||||
album.copyWith(
|
||||
shares: OrNull(null),
|
||||
shares: const OrNull(null),
|
||||
),
|
||||
);
|
||||
// remove file shares
|
||||
|
|
|
@ -8,11 +8,11 @@ import 'package:nc_photos/entity/file.dart';
|
|||
import 'package:nc_photos/entity/share.dart';
|
||||
import 'package:nc_photos/entity/sharee.dart';
|
||||
import 'package:nc_photos/iterable_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/use_case/create_share.dart';
|
||||
import 'package:nc_photos/use_case/update_album.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
|
||||
part 'share_album_with_user.g.dart';
|
||||
|
|
|
@ -6,13 +6,13 @@ import 'package:nc_photos/entity/album.dart';
|
|||
import 'package:nc_photos/entity/album/item.dart';
|
||||
import 'package:nc_photos/entity/album/provider.dart';
|
||||
import 'package:nc_photos/entity/share.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/use_case/album/unshare_file_from_album.dart';
|
||||
import 'package:nc_photos/use_case/list_share.dart';
|
||||
import 'package:nc_photos/use_case/remove_share.dart';
|
||||
import 'package:nc_photos/use_case/update_album.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
|
||||
part 'unshare_album_with_user.g.dart';
|
||||
|
|
|
@ -5,7 +5,7 @@ import 'package:nc_photos/entity/collection/adapter.dart';
|
|||
import 'package:nc_photos/entity/collection_item.dart';
|
||||
import 'package:nc_photos/entity/collection_item/util.dart';
|
||||
import 'package:nc_photos/entity/file_descriptor.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
|
||||
class EditCollection {
|
||||
const EditCollection(this._c);
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:nc_photos/entity/album/provider.dart';
|
|||
import 'package:nc_photos/entity/album/sort_provider.dart';
|
||||
import 'package:nc_photos/entity/file.dart';
|
||||
import 'package:nc_photos/entity/file_util.dart' as file_util;
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
|
||||
class UpdateAlbumTime {
|
||||
/// Update the latest item time of an album with unsorted items
|
||||
|
@ -37,7 +37,7 @@ class UpdateAlbumTime {
|
|||
if (sortedItems.isEmpty) {
|
||||
return album.copyWith(
|
||||
provider: (album.provider as AlbumProviderBase).copyWith(
|
||||
latestItemTime: OrNull(null),
|
||||
latestItemTime: const OrNull(null),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,13 +9,13 @@ import 'package:nc_photos/entity/file.dart';
|
|||
import 'package:nc_photos/event/event.dart';
|
||||
import 'package:nc_photos/exception.dart';
|
||||
import 'package:nc_photos/exception_event.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/reverse_geocoder.dart';
|
||||
import 'package:nc_photos/use_case/get_file_binary.dart';
|
||||
import 'package:nc_photos/use_case/load_metadata.dart';
|
||||
import 'package:nc_photos/use_case/scan_missing_metadata.dart';
|
||||
import 'package:nc_photos/use_case/update_property.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
|
||||
part 'update_missing_metadata.g.dart';
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import 'package:logging/logging.dart';
|
|||
import 'package:nc_photos/account.dart';
|
||||
import 'package:nc_photos/entity/file.dart';
|
||||
import 'package:nc_photos/event/event.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
|
||||
part 'update_property.g.dart';
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ import 'package:nc_photos/flutter_util.dart' as flutter_util;
|
|||
import 'package:nc_photos/k.dart' as k;
|
||||
import 'package:nc_photos/np_api_util.dart';
|
||||
import 'package:nc_photos/object_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/session_storage.dart';
|
||||
import 'package:nc_photos/snack_bar_manager.dart';
|
||||
import 'package:nc_photos/use_case/archive_file.dart';
|
||||
|
@ -62,6 +61,7 @@ import 'package:nc_photos/widget/shared_album_info_dialog.dart';
|
|||
import 'package:nc_photos/widget/simple_input_dialog.dart';
|
||||
import 'package:nc_photos/widget/viewer.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_ui/np_ui.dart';
|
||||
import 'package:sliver_tools/sliver_tools.dart';
|
||||
import 'package:to_string/to_string.dart';
|
||||
|
|
|
@ -243,7 +243,7 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|||
|
||||
void _onUnsetCover(_UnsetCover ev, Emitter<_State> emit) {
|
||||
_log.info("$ev");
|
||||
collectionsController.edit(state.collection, cover: OrNull(null));
|
||||
collectionsController.edit(state.collection, cover: const OrNull(null));
|
||||
}
|
||||
|
||||
void _onSetSelectedItems(_SetSelectedItems ev, Emitter<_State> emit) {
|
||||
|
|
|
@ -15,7 +15,6 @@ import 'package:nc_photos/entity/file.dart';
|
|||
import 'package:nc_photos/entity/file/data_source.dart';
|
||||
import 'package:nc_photos/entity/pref.dart';
|
||||
import 'package:nc_photos/k.dart' as k;
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/theme.dart';
|
||||
import 'package:nc_photos/theme/dimension.dart';
|
||||
import 'package:nc_photos/use_case/import_potential_shared_album.dart';
|
||||
|
@ -23,6 +22,7 @@ import 'package:nc_photos/widget/home_collections.dart';
|
|||
import 'package:nc_photos/widget/home_photos.dart';
|
||||
import 'package:nc_photos/widget/home_search.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
|
||||
part 'home.g.dart';
|
||||
|
||||
|
@ -180,7 +180,7 @@ class _HomeState extends State<Home> with TickerProviderStateMixin {
|
|||
Future<List<Album>> _importPotentialSharedAlbum() async {
|
||||
final c = KiwiContainer().resolve<DiContainer>().copyWith(
|
||||
// don't want the potential albums to be cached at this moment
|
||||
fileRepo: OrNull(const FileRepo(FileWebdavDataSource())),
|
||||
fileRepo: const OrNull(FileRepo(FileWebdavDataSource())),
|
||||
albumRepo: OrNull(AlbumRepo(AlbumRemoteDataSource())),
|
||||
);
|
||||
try {
|
||||
|
|
|
@ -18,7 +18,6 @@ import 'package:nc_photos/entity/share.dart';
|
|||
import 'package:nc_photos/exception_util.dart' as exception_util;
|
||||
import 'package:nc_photos/k.dart' as k;
|
||||
import 'package:nc_photos/object_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/snack_bar_manager.dart';
|
||||
import 'package:nc_photos/use_case/import_potential_shared_album.dart';
|
||||
import 'package:nc_photos/widget/collection_browser.dart';
|
||||
|
@ -26,6 +25,7 @@ import 'package:nc_photos/widget/empty_list_indicator.dart';
|
|||
import 'package:nc_photos/widget/network_thumbnail.dart';
|
||||
import 'package:nc_photos/widget/shared_file_viewer.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_ui/np_ui.dart';
|
||||
|
||||
part 'sharing_browser.g.dart';
|
||||
|
@ -285,7 +285,7 @@ class _SharingBrowserState extends State<SharingBrowser> {
|
|||
Future<List<Album>> _importPotentialSharedAlbum() async {
|
||||
final c = KiwiContainer().resolve<DiContainer>().copyWith(
|
||||
// don't want the potential albums to be cached at this moment
|
||||
fileRepo: OrNull(const FileRepo(FileWebdavDataSource())),
|
||||
fileRepo: const OrNull(FileRepo(FileWebdavDataSource())),
|
||||
albumRepo: OrNull(AlbumRepo(AlbumRemoteDataSource())),
|
||||
);
|
||||
try {
|
||||
|
|
|
@ -22,7 +22,6 @@ import 'package:nc_photos/entity/file_util.dart' as file_util;
|
|||
import 'package:nc_photos/k.dart' as k;
|
||||
import 'package:nc_photos/location_util.dart' as location_util;
|
||||
import 'package:nc_photos/object_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/platform/features.dart' as features;
|
||||
import 'package:nc_photos/platform/k.dart' as platform_k;
|
||||
import 'package:nc_photos/set_as_handler.dart';
|
||||
|
@ -37,6 +36,7 @@ import 'package:nc_photos/widget/handler/add_selection_to_collection_handler.dar
|
|||
import 'package:nc_photos/widget/list_tile_center_leading.dart';
|
||||
import 'package:nc_photos/widget/photo_date_time_edit_dialog.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:np_ui/np_ui.dart';
|
||||
import 'package:path/path.dart' as path_lib;
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
|
|
@ -8,8 +8,8 @@ import 'package:nc_photos/entity/album/sort_provider.dart';
|
|||
import 'package:nc_photos/entity/file.dart';
|
||||
import 'package:nc_photos/entity/sqlite/database.dart' as sql;
|
||||
import 'package:nc_photos/exception.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../../test_util.dart' as util;
|
||||
|
@ -325,7 +325,7 @@ Future<void> _dbUpdateDeleteShares() async {
|
|||
),
|
||||
coverProvider: AlbumManualCoverProvider(coverFile: files[1].toDescriptor()),
|
||||
sortProvider: const AlbumTimeSortProvider(isAscending: true),
|
||||
shares: OrNull(null),
|
||||
shares: const OrNull(null),
|
||||
);
|
||||
final src = AlbumSqliteDbDataSource(c);
|
||||
await src.update(account, updateAlbum);
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'package:nc_photos/entity/file.dart';
|
|||
import 'package:nc_photos/entity/file/data_source.dart';
|
||||
import 'package:nc_photos/entity/sqlite/database.dart' as sql;
|
||||
import 'package:nc_photos/list_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../../test_util.dart' as util;
|
||||
|
@ -228,11 +228,11 @@ Future<void> _updateFileProperty() async {
|
|||
await src.updateProperty(
|
||||
account,
|
||||
files[1],
|
||||
isArchived: OrNull(true),
|
||||
isArchived: const OrNull(true),
|
||||
overrideDateTime: OrNull(DateTime.utc(2020, 1, 2, 3, 4, 5)),
|
||||
);
|
||||
final expectFile = files[1].copyWith(
|
||||
isArchived: OrNull(true),
|
||||
isArchived: const OrNull(true),
|
||||
overrideDateTime: OrNull(DateTime.utc(2020, 1, 2, 3, 4, 5)),
|
||||
);
|
||||
expect(
|
||||
|
@ -358,10 +358,10 @@ Future<void> _updateDeleteMetadata() async {
|
|||
await src.updateProperty(
|
||||
account,
|
||||
files[1],
|
||||
metadata: OrNull(null),
|
||||
metadata: const OrNull(null),
|
||||
);
|
||||
final expectFile = files[1].copyWith(
|
||||
metadata: OrNull(null),
|
||||
metadata: const OrNull(null),
|
||||
);
|
||||
expect(
|
||||
await util.listSqliteDbFiles(c.sqliteDb),
|
||||
|
|
|
@ -5,7 +5,7 @@ import 'package:nc_photos/entity/file/file_cache_manager.dart';
|
|||
import 'package:nc_photos/entity/sqlite/database.dart' as sql;
|
||||
import 'package:nc_photos/int_extension.dart';
|
||||
import 'package:nc_photos/list_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../../mock_type.dart';
|
||||
|
@ -84,7 +84,7 @@ Future<void> _loaderOutdatedCache() async {
|
|||
);
|
||||
addTearDown(() => c.sqliteDb.close());
|
||||
final dbFiles = [
|
||||
files[0].copyWith(etag: OrNull("a")),
|
||||
files[0].copyWith(etag: const OrNull("a")),
|
||||
...files.slice(1),
|
||||
];
|
||||
await c.sqliteDb.transaction(() async {
|
||||
|
@ -134,7 +134,8 @@ Future<void> _loaderQueryRemoteSameEtag() async {
|
|||
final remoteSrc = MockFileWebdavDataSource(MockFileMemoryDataSource(files));
|
||||
final loader = FileCacheLoader(c, cacheSrc: cacheSrc, remoteSrc: remoteSrc);
|
||||
expect(
|
||||
(await loader(account, files[0].copyWith(etag: OrNull(null))))?.toSet(),
|
||||
(await loader(account, files[0].copyWith(etag: const OrNull(null))))
|
||||
?.toSet(),
|
||||
files.slice(0, 3).toSet(),
|
||||
);
|
||||
expect(loader.isGood, true);
|
||||
|
@ -158,7 +159,7 @@ Future<void> _loaderQueryRemoteDiffEtag() async {
|
|||
);
|
||||
addTearDown(() => c.sqliteDb.close());
|
||||
final dbFiles = [
|
||||
files[0].copyWith(etag: OrNull("a")),
|
||||
files[0].copyWith(etag: const OrNull("a")),
|
||||
...files.slice(1),
|
||||
];
|
||||
await c.sqliteDb.transaction(() async {
|
||||
|
@ -173,7 +174,8 @@ Future<void> _loaderQueryRemoteDiffEtag() async {
|
|||
final remoteSrc = MockFileWebdavDataSource(MockFileMemoryDataSource(files));
|
||||
final loader = FileCacheLoader(c, cacheSrc: cacheSrc, remoteSrc: remoteSrc);
|
||||
expect(
|
||||
(await loader(account, files[0].copyWith(etag: OrNull(null))))?.toSet(),
|
||||
(await loader(account, files[0].copyWith(etag: const OrNull(null))))
|
||||
?.toSet(),
|
||||
dbFiles.slice(0, 3).toSet(),
|
||||
);
|
||||
expect(loader.isGood, false);
|
||||
|
|
|
@ -2,8 +2,8 @@ import 'package:clock/clock.dart';
|
|||
import 'package:nc_photos/entity/exif.dart';
|
||||
import 'package:nc_photos/entity/file.dart';
|
||||
import 'package:nc_photos/entity/file_descriptor.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
|
@ -815,7 +815,7 @@ void main() {
|
|||
});
|
||||
|
||||
test("etag", () {
|
||||
final file = src.copyWith(etag: OrNull("000"));
|
||||
final file = src.copyWith(etag: const OrNull("000"));
|
||||
expect(
|
||||
file,
|
||||
File(
|
||||
|
@ -1090,7 +1090,7 @@ void main() {
|
|||
isArchived: true,
|
||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||
);
|
||||
final file = src.copyWith(metadata: OrNull(null));
|
||||
final file = src.copyWith(metadata: const OrNull(null));
|
||||
expect(
|
||||
file,
|
||||
File(
|
||||
|
@ -1113,7 +1113,7 @@ void main() {
|
|||
});
|
||||
|
||||
test("isArchived", () {
|
||||
final file = src.copyWith(isArchived: OrNull(false));
|
||||
final file = src.copyWith(isArchived: const OrNull(false));
|
||||
expect(
|
||||
file,
|
||||
File(
|
||||
|
@ -1136,7 +1136,7 @@ void main() {
|
|||
});
|
||||
|
||||
test("clear isArchived", () {
|
||||
final file = src.copyWith(isArchived: OrNull(null));
|
||||
final file = src.copyWith(isArchived: const OrNull(null));
|
||||
expect(
|
||||
file,
|
||||
File(
|
||||
|
@ -1182,7 +1182,7 @@ void main() {
|
|||
});
|
||||
|
||||
test("clear overrideDateTime", () {
|
||||
final file = src.copyWith(overrideDateTime: OrNull(null));
|
||||
final file = src.copyWith(overrideDateTime: const OrNull(null));
|
||||
expect(
|
||||
file,
|
||||
File(
|
||||
|
|
|
@ -19,8 +19,8 @@ import 'package:nc_photos/entity/sharee.dart';
|
|||
import 'package:nc_photos/entity/tag.dart';
|
||||
import 'package:nc_photos/exception_event.dart';
|
||||
import 'package:nc_photos/future_util.dart' as future_util;
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:path/path.dart' as path_lib;
|
||||
|
||||
/// Mock of [AlbumRepo] where all methods will throw UnimplementedError
|
||||
|
|
|
@ -17,8 +17,8 @@ import 'package:nc_photos/entity/sharee.dart';
|
|||
import 'package:nc_photos/entity/sqlite/database.dart' as sql;
|
||||
import 'package:nc_photos/entity/sqlite/type_converter.dart';
|
||||
import 'package:nc_photos/iterable_extension.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
class FilesBuilder {
|
||||
|
@ -612,7 +612,7 @@ Future<Set<Album>> listSqliteDbAlbums(sql.SqliteDb db) async {
|
|||
..where((t) => t.album.equals(a.item1));
|
||||
final dbShares = await shareQuery.get();
|
||||
results.add(a.item2.copyWith(
|
||||
lastUpdated: OrNull(null),
|
||||
lastUpdated: const OrNull(null),
|
||||
shares: dbShares.isEmpty
|
||||
? null
|
||||
: OrNull(dbShares
|
||||
|
|
|
@ -6,8 +6,8 @@ import 'package:nc_photos/entity/album/cover_provider.dart';
|
|||
import 'package:nc_photos/entity/album/provider.dart';
|
||||
import 'package:nc_photos/entity/album/sort_provider.dart';
|
||||
import 'package:nc_photos/entity/sqlite/database.dart' as sql;
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/use_case/album/remove_from_album.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../mock_type.dart';
|
||||
|
|
|
@ -8,8 +8,8 @@ import 'package:nc_photos/entity/album/sort_provider.dart';
|
|||
import 'package:nc_photos/entity/pref.dart';
|
||||
import 'package:nc_photos/entity/pref/provider/memory.dart';
|
||||
import 'package:nc_photos/entity/sqlite/database.dart' as sql;
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/use_case/remove.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../mock_type.dart';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import 'package:event_bus/event_bus.dart';
|
||||
import 'package:kiwi/kiwi.dart';
|
||||
import 'package:nc_photos/or_null.dart';
|
||||
import 'package:nc_photos/use_case/album/share_album_with_user.dart';
|
||||
import 'package:np_common/ci_string.dart';
|
||||
import 'package:np_common/or_null.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../mock_type.dart';
|
||||
|
|
|
@ -65,7 +65,7 @@ extension _$RecognizeFaceToString on RecognizeFace {
|
|||
extension _$RecognizeFaceItemToString on RecognizeFaceItem {
|
||||
String _$toString() {
|
||||
// ignore: unnecessary_string_interpolations
|
||||
return "RecognizeFaceItem {href: $href, ${contentLength == null ? "" : "contentLength: $contentLength, "}${contentType == null ? "" : "contentType: $contentType, "}${etag == null ? "" : "etag: $etag, "}${lastModified == null ? "" : "lastModified: $lastModified, "}${faceDetections == null ? "" : "faceDetections: $faceDetections, "}fileMetadataSize: $fileMetadataSize, ${hasPreview == null ? "" : "hasPreview: $hasPreview, "}${realPath == null ? "" : "realPath: $realPath, "}${favorite == null ? "" : "favorite: $favorite, "}${fileId == null ? "" : "fileId: $fileId"}}";
|
||||
return "RecognizeFaceItem {href: $href, ${contentLength == null ? "" : "contentLength: $contentLength, "}${contentType == null ? "" : "contentType: $contentType, "}${etag == null ? "" : "etag: $etag, "}${lastModified == null ? "" : "lastModified: $lastModified, "}${faceDetections == null ? "" : "faceDetections: $faceDetections, "}${fileMetadataSize == null ? "" : "fileMetadataSize: $fileMetadataSize, "}${hasPreview == null ? "" : "hasPreview: $hasPreview, "}${realPath == null ? "" : "realPath: $realPath, "}${favorite == null ? "" : "favorite: $favorite, "}${fileId == null ? "" : "fileId: $fileId"}}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ part 'or_null.g.dart';
|
|||
/// To hold optional arguments that themselves could be null
|
||||
@toString
|
||||
class OrNull<T> {
|
||||
OrNull(this.obj);
|
||||
const OrNull(this.obj);
|
||||
|
||||
/// Return iff the value of [x] is set to null, which means if [x] itself is
|
||||
/// null, false will still be returned
|
|
@ -8,8 +8,19 @@ environment:
|
|||
sdk: '>=2.18.0 <3.0.0'
|
||||
|
||||
dependencies:
|
||||
to_string:
|
||||
git:
|
||||
url: https://gitlab.com/nkming2/dart-to-string
|
||||
ref: to_string-1.0.0
|
||||
path: to_string
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.2.1
|
||||
np_lints:
|
||||
path: ../np_lints
|
||||
test: any
|
||||
to_string_build:
|
||||
git:
|
||||
url: https://gitlab.com/nkming2/dart-to-string
|
||||
ref: to_string_build-1.0.0
|
||||
path: to_string_build
|
||||
|
|
Loading…
Reference in a new issue