From c1717a1f5907bda098265115dd5300a9b11d1e90 Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Sat, 26 Aug 2023 00:37:17 +0800 Subject: [PATCH] Refactor: extract string utilities --- app/lib/account.dart | 3 +-- app/lib/api/entity_converter.dart | 3 +-- app/lib/bloc/app_password_exchange.dart | 2 +- app/lib/bloc/home_search_suggestion.dart | 2 +- app/lib/bloc/list_album_share_outlier.dart | 2 +- app/lib/bloc/search_suggestion.dart | 2 +- app/lib/debug_util.dart | 2 +- app/lib/entity/album.dart | 2 +- app/lib/entity/album/item.dart | 2 +- app/lib/entity/album/upgrader.dart | 2 +- app/lib/entity/collection/adapter.dart | 2 +- .../entity/collection/adapter/adapter_mixin.dart | 2 +- app/lib/entity/collection/adapter/album.dart | 2 +- app/lib/entity/collection/util.dart | 2 +- app/lib/entity/file.dart | 3 +-- app/lib/entity/file_util.dart | 3 +-- app/lib/entity/nc_album.dart | 3 +-- app/lib/entity/nc_album_item.dart | 2 +- app/lib/entity/recognize_face_item.dart | 2 +- app/lib/entity/search/data_source.dart | 2 +- app/lib/entity/share.dart | 3 +-- app/lib/entity/share/data_source.dart | 2 +- app/lib/entity/sharee.dart | 2 +- app/lib/entity/sharee/data_source.dart | 2 +- app/lib/entity/sqlite/files_query_builder.dart | 2 +- app/lib/entity/sqlite/type_converter.dart | 2 +- app/lib/legacy/connect.dart | 3 +-- app/lib/legacy/sign_in.dart | 3 +-- app/lib/location_util.dart | 2 +- app/lib/mobile/universal_storage.dart | 2 +- app/lib/suggester.dart | 2 +- app/lib/use_case/album/share_album_with_user.dart | 2 +- app/lib/use_case/album/unshare_album_with_user.dart | 2 +- app/lib/use_case/album/unshare_file_from_album.dart | 2 +- app/lib/use_case/collection/unshare_collection.dart | 2 +- app/lib/use_case/ls.dart | 2 +- app/lib/use_case/remove.dart | 2 +- app/lib/widget/album_share_outlier_browser.dart | 3 +-- app/lib/widget/connect.dart | 3 +-- app/lib/widget/home_search_suggestion.dart | 2 +- app/lib/widget/image_editor/color_toolbar.dart | 2 +- app/lib/widget/share_collection_dialog.dart | 2 +- app/lib/widget/sign_in.dart | 2 +- app/lib/widget/tag_picker_dialog.dart | 2 +- app/lib/widget/viewer_detail_pane.dart | 2 +- app/pubspec.lock | 7 +++++++ app/pubspec.yaml | 2 ++ app/test/account_test.dart | 2 +- app/test/bloc/list_album_share_outlier_test.dart | 2 +- app/test/entity/album/data_source_test.dart | 2 +- app/test/entity/album_test.dart | 2 +- app/test/entity/file_test.dart | 2 +- app/test/mock_type.dart | 2 +- app/test/test_util.dart | 2 +- app/test/use_case/add_file_to_album_test.dart | 2 +- app/test/use_case/share_album_with_user_test.dart | 2 +- app/test/use_case/unshare_album_with_user_test.dart | 2 +- np_api/lib/src/type.dart | 2 +- np_api/pubspec.yaml | 2 ++ np_common/pubspec.yaml | 1 - np_string/.gitignore | 7 +++++++ np_string/analysis_options.yaml | 1 + np_string/lib/np_string.dart | 5 +++++ {np_common/lib => np_string/lib/src}/ci_string.dart | 2 +- .../lib => np_string/lib/src}/double_extension.dart | 2 +- .../lib => np_string/lib/src}/string_extension.dart | 0 np_string/pubspec.yaml | 13 +++++++++++++ {np_common => np_string}/test/ci_string_test.dart | 2 +- {app => np_string}/test/double_extension_test.dart | 2 +- .../test/string_extension_test.dart | 2 +- 70 files changed, 98 insertions(+), 72 deletions(-) create mode 100644 np_string/.gitignore create mode 100644 np_string/analysis_options.yaml create mode 100644 np_string/lib/np_string.dart rename {np_common/lib => np_string/lib/src}/ci_string.dart (97%) rename {app/lib => np_string/lib/src}/double_extension.dart (88%) rename {np_common/lib => np_string/lib/src}/string_extension.dart (100%) create mode 100644 np_string/pubspec.yaml rename {np_common => np_string}/test/ci_string_test.dart (98%) rename {app => np_string}/test/double_extension_test.dart (87%) rename {np_common => np_string}/test/string_extension_test.dart (96%) diff --git a/app/lib/account.dart b/app/lib/account.dart index ce84423b..3f22a5be 100644 --- a/app/lib/account.dart +++ b/app/lib/account.dart @@ -7,9 +7,8 @@ import 'package:flutter/foundation.dart'; import 'package:logging/logging.dart'; import 'package:nc_photos/iterable_extension.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; -import 'package:np_common/string_extension.dart'; import 'package:np_common/type.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'account.g.dart'; diff --git a/app/lib/api/entity_converter.dart b/app/lib/api/entity_converter.dart index 44e918f2..75f7b28f 100644 --- a/app/lib/api/entity_converter.dart +++ b/app/lib/api/entity_converter.dart @@ -17,8 +17,7 @@ import 'package:nc_photos/entity/tagged_file.dart'; import 'package:nc_photos/object_extension.dart'; import 'package:np_api/np_api.dart' as api; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; part 'entity_converter.g.dart'; diff --git a/app/lib/bloc/app_password_exchange.dart b/app/lib/bloc/app_password_exchange.dart index 8acc7cf4..b446f526 100644 --- a/app/lib/bloc/app_password_exchange.dart +++ b/app/lib/bloc/app_password_exchange.dart @@ -7,7 +7,7 @@ import 'package:nc_photos/account.dart'; import 'package:nc_photos/api/api_util.dart' as api_util; import 'package:nc_photos/exception.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'app_password_exchange.g.dart'; diff --git a/app/lib/bloc/home_search_suggestion.dart b/app/lib/bloc/home_search_suggestion.dart index 66e0efbd..da9d22de 100644 --- a/app/lib/bloc/home_search_suggestion.dart +++ b/app/lib/bloc/home_search_suggestion.dart @@ -17,7 +17,7 @@ import 'package:nc_photos/use_case/list_location_group.dart'; import 'package:nc_photos/use_case/list_tag.dart'; import 'package:nc_photos/use_case/person/list_person.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; import 'package:tuple/tuple.dart'; import 'package:woozy_search/woozy_search.dart'; diff --git a/app/lib/bloc/list_album_share_outlier.dart b/app/lib/bloc/list_album_share_outlier.dart index a2176a4b..1452e8b8 100644 --- a/app/lib/bloc/list_album_share_outlier.dart +++ b/app/lib/bloc/list_album_share_outlier.dart @@ -15,7 +15,7 @@ import 'package:nc_photos/object_extension.dart'; import 'package:nc_photos/use_case/list_share.dart'; import 'package:nc_photos/use_case/list_sharee.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'list_album_share_outlier.g.dart'; diff --git a/app/lib/bloc/search_suggestion.dart b/app/lib/bloc/search_suggestion.dart index efe05d60..8b94c533 100644 --- a/app/lib/bloc/search_suggestion.dart +++ b/app/lib/bloc/search_suggestion.dart @@ -4,7 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:logging/logging.dart'; import 'package:nc_photos/iterable_extension.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; import 'package:tuple/tuple.dart'; import 'package:woozy_search/woozy_search.dart'; diff --git a/app/lib/debug_util.dart b/app/lib/debug_util.dart index 22e5c0c3..a9793502 100644 --- a/app/lib/debug_util.dart +++ b/app/lib/debug_util.dart @@ -4,8 +4,8 @@ import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:nc_photos/mobile/platform.dart' if (dart.library.html) 'package:nc_photos/web/platform.dart' as platform; -import 'package:np_common/string_extension.dart'; import 'package:np_log/np_log.dart'; +import 'package:np_string/np_string.dart'; import 'package:path/path.dart' as path_lib; class LogCapturer { diff --git a/app/lib/entity/album.dart b/app/lib/entity/album.dart index 6d33f84d..54b6e411 100644 --- a/app/lib/entity/album.dart +++ b/app/lib/entity/album.dart @@ -10,9 +10,9 @@ import 'package:nc_photos/entity/file.dart'; import 'package:nc_photos/iterable_extension.dart'; import 'package:nc_photos/object_extension.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:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'album.g.dart'; diff --git a/app/lib/entity/album/item.dart b/app/lib/entity/album/item.dart index 9aab8cc2..f7a8e0bc 100644 --- a/app/lib/entity/album/item.dart +++ b/app/lib/entity/album/item.dart @@ -3,9 +3,9 @@ import 'package:flutter/foundation.dart'; import 'package:logging/logging.dart'; import 'package:nc_photos/entity/file.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:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'item.g.dart'; diff --git a/app/lib/entity/album/upgrader.dart b/app/lib/entity/album/upgrader.dart index 5b03aabe..bb940c2e 100644 --- a/app/lib/entity/album/upgrader.dart +++ b/app/lib/entity/album/upgrader.dart @@ -9,8 +9,8 @@ import 'package:nc_photos/entity/file.dart'; import 'package:nc_photos/entity/sqlite/database.dart' as sql; import 'package:nc_photos/object_extension.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; import 'package:np_common/type.dart'; +import 'package:np_string/np_string.dart'; import 'package:tuple/tuple.dart'; part 'upgrader.g.dart'; diff --git a/app/lib/entity/collection/adapter.dart b/app/lib/entity/collection/adapter.dart index 7c609dcc..9c260ae1 100644 --- a/app/lib/entity/collection/adapter.dart +++ b/app/lib/entity/collection/adapter.dart @@ -20,9 +20,9 @@ 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:np_common/ci_string.dart'; import 'package:np_common/or_null.dart'; import 'package:np_common/type.dart'; +import 'package:np_string/np_string.dart'; abstract class CollectionAdapter { const CollectionAdapter(); diff --git a/app/lib/entity/collection/adapter/adapter_mixin.dart b/app/lib/entity/collection/adapter/adapter_mixin.dart index 2121ca5f..9c920c4e 100644 --- a/app/lib/entity/collection/adapter/adapter_mixin.dart +++ b/app/lib/entity/collection/adapter/adapter_mixin.dart @@ -6,9 +6,9 @@ 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:np_common/ci_string.dart'; import 'package:np_common/or_null.dart'; import 'package:np_common/type.dart'; +import 'package:np_string/np_string.dart'; /// A read-only collection that does not support modifying its items mixin CollectionAdapterReadOnlyTag implements CollectionAdapter { diff --git a/app/lib/entity/collection/adapter/album.dart b/app/lib/entity/collection/adapter/album.dart index 5bc615cd..a768d8de 100644 --- a/app/lib/entity/collection/adapter/album.dart +++ b/app/lib/entity/collection/adapter/album.dart @@ -32,9 +32,9 @@ import 'package:nc_photos/use_case/preprocess_album.dart'; 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:np_string/np_string.dart'; import 'package:tuple/tuple.dart'; part 'album.g.dart'; diff --git a/app/lib/entity/collection/util.dart b/app/lib/entity/collection/util.dart index 905cec22..b955ed42 100644 --- a/app/lib/entity/collection/util.dart +++ b/app/lib/entity/collection/util.dart @@ -1,7 +1,7 @@ import 'package:collection/collection.dart'; import 'package:equatable/equatable.dart'; import 'package:nc_photos/entity/collection.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; import 'package:tuple/tuple.dart'; diff --git a/app/lib/entity/file.dart b/app/lib/entity/file.dart index 487e0586..a639d62d 100644 --- a/app/lib/entity/file.dart +++ b/app/lib/entity/file.dart @@ -9,10 +9,9 @@ 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: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:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'file.g.dart'; diff --git a/app/lib/entity/file_util.dart b/app/lib/entity/file_util.dart index 62ca345d..50b83271 100644 --- a/app/lib/entity/file_util.dart +++ b/app/lib/entity/file_util.dart @@ -6,8 +6,7 @@ import 'package:nc_photos/entity/file_descriptor.dart'; import 'package:nc_photos/platform/k.dart' as platform_k; import 'package:nc_photos/remote_storage_util.dart' as remote_storage_util; import 'package:np_api/np_api.dart' as api; -import 'package:np_common/ci_string.dart'; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; import 'package:path/path.dart' as path_lib; bool isSupportedMime(String mime) => supportedFormatMimes.contains(mime); diff --git a/app/lib/entity/nc_album.dart b/app/lib/entity/nc_album.dart index 0bb02115..ca2172cc 100644 --- a/app/lib/entity/nc_album.dart +++ b/app/lib/entity/nc_album.dart @@ -2,9 +2,8 @@ import 'package:copy_with/copy_with.dart'; import 'package:equatable/equatable.dart'; import 'package:nc_photos/account.dart'; import 'package:np_api/np_api.dart' as api; -import 'package:np_common/ci_string.dart'; -import 'package:np_common/string_extension.dart'; import 'package:np_common/type.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'nc_album.g.dart'; diff --git a/app/lib/entity/nc_album_item.dart b/app/lib/entity/nc_album_item.dart index b7fa2bbf..f842d234 100644 --- a/app/lib/entity/nc_album_item.dart +++ b/app/lib/entity/nc_album_item.dart @@ -1,6 +1,6 @@ import 'package:nc_photos/entity/file.dart'; import 'package:np_api/np_api.dart' as api; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'nc_album_item.g.dart'; diff --git a/app/lib/entity/recognize_face_item.dart b/app/lib/entity/recognize_face_item.dart index 973b5cf1..316f50c5 100644 --- a/app/lib/entity/recognize_face_item.dart +++ b/app/lib/entity/recognize_face_item.dart @@ -1,7 +1,7 @@ import 'package:equatable/equatable.dart'; import 'package:nc_photos/entity/file.dart'; import 'package:np_api/np_api.dart' as api; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'recognize_face_item.g.dart'; diff --git a/app/lib/entity/search/data_source.dart b/app/lib/entity/search/data_source.dart index 3458e177..15e660b5 100644 --- a/app/lib/entity/search/data_source.dart +++ b/app/lib/entity/search/data_source.dart @@ -16,7 +16,7 @@ import 'package:nc_photos/use_case/inflate_file_descriptor.dart'; import 'package:nc_photos/use_case/list_tagged_file.dart'; import 'package:nc_photos/use_case/person/list_person_face.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; part 'data_source.g.dart'; diff --git a/app/lib/entity/share.dart b/app/lib/entity/share.dart index 98de4dfd..13614eda 100644 --- a/app/lib/entity/share.dart +++ b/app/lib/entity/share.dart @@ -1,8 +1,7 @@ import 'package:equatable/equatable.dart'; import 'package:nc_photos/account.dart'; import 'package:nc_photos/entity/file.dart'; -import 'package:np_common/ci_string.dart'; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; import 'package:path/path.dart' as path_lib; import 'package:to_string/to_string.dart'; diff --git a/app/lib/entity/share/data_source.dart b/app/lib/entity/share/data_source.dart index 490989db..0fdf72fd 100644 --- a/app/lib/entity/share/data_source.dart +++ b/app/lib/entity/share/data_source.dart @@ -10,8 +10,8 @@ import 'package:nc_photos/exception.dart'; import 'package:nc_photos/np_api_util.dart'; import 'package:np_api/np_api.dart' as api; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; import 'package:np_common/type.dart'; +import 'package:np_string/np_string.dart'; part 'data_source.g.dart'; diff --git a/app/lib/entity/sharee.dart b/app/lib/entity/sharee.dart index e31393b3..8075ebec 100644 --- a/app/lib/entity/sharee.dart +++ b/app/lib/entity/sharee.dart @@ -1,6 +1,6 @@ import 'package:equatable/equatable.dart'; import 'package:nc_photos/account.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'sharee.g.dart'; diff --git a/app/lib/entity/sharee/data_source.dart b/app/lib/entity/sharee/data_source.dart index d949439b..f001b92b 100644 --- a/app/lib/entity/sharee/data_source.dart +++ b/app/lib/entity/sharee/data_source.dart @@ -8,8 +8,8 @@ import 'package:nc_photos/exception.dart'; import 'package:nc_photos/np_api_util.dart'; import 'package:np_api/np_api.dart' as api; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; import 'package:np_common/type.dart'; +import 'package:np_string/np_string.dart'; part 'data_source.g.dart'; diff --git a/app/lib/entity/sqlite/files_query_builder.dart b/app/lib/entity/sqlite/files_query_builder.dart index 67fbc4f3..f157a7f8 100644 --- a/app/lib/entity/sqlite/files_query_builder.dart +++ b/app/lib/entity/sqlite/files_query_builder.dart @@ -2,7 +2,7 @@ import 'package:drift/drift.dart'; import 'package:nc_photos/account.dart' as app; import 'package:nc_photos/entity/sqlite/database.dart'; import 'package:nc_photos/location_util.dart' as location_util; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; enum FilesQueryMode { file, diff --git a/app/lib/entity/sqlite/type_converter.dart b/app/lib/entity/sqlite/type_converter.dart index 7d3a9b6b..aac8c8c9 100644 --- a/app/lib/entity/sqlite/type_converter.dart +++ b/app/lib/entity/sqlite/type_converter.dart @@ -18,9 +18,9 @@ import 'package:nc_photos/entity/tag.dart'; import 'package:nc_photos/iterable_extension.dart'; import 'package:nc_photos/object_extension.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'; +import 'package:np_string/np_string.dart'; extension SqlTagListExtension on List { Future> convertToAppTag() { diff --git a/app/lib/legacy/connect.dart b/app/lib/legacy/connect.dart index ff1e2b67..b88328b4 100644 --- a/app/lib/legacy/connect.dart +++ b/app/lib/legacy/connect.dart @@ -19,8 +19,7 @@ import 'package:nc_photos/snack_bar_manager.dart'; import 'package:nc_photos/url_launcher_util.dart'; import 'package:nc_photos/use_case/ls_single_file.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; part 'connect.g.dart'; diff --git a/app/lib/legacy/sign_in.dart b/app/lib/legacy/sign_in.dart index 4d81e50a..f543ee28 100644 --- a/app/lib/legacy/sign_in.dart +++ b/app/lib/legacy/sign_in.dart @@ -18,8 +18,7 @@ import 'package:nc_photos/url_launcher_util.dart'; import 'package:nc_photos/widget/home.dart'; import 'package:nc_photos/widget/root_picker.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; part 'sign_in.g.dart'; diff --git a/app/lib/location_util.dart b/app/lib/location_util.dart index 9300a6be..81cf0d46 100644 --- a/app/lib/location_util.dart +++ b/app/lib/location_util.dart @@ -1,4 +1,4 @@ -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; /// Convert a ISO 3166-1 alpha-2 code into country name String? alpha2CodeToName(String cc) => _ccMap.byCc(cc); diff --git a/app/lib/mobile/universal_storage.dart b/app/lib/mobile/universal_storage.dart index 0c22a357..d52fd075 100644 --- a/app/lib/mobile/universal_storage.dart +++ b/app/lib/mobile/universal_storage.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'dart:typed_data'; import 'package:nc_photos/platform/universal_storage.dart' as itf; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; import 'package:path/path.dart' as path_lib; import 'package:path_provider/path_provider.dart'; diff --git a/app/lib/suggester.dart b/app/lib/suggester.dart index 20f0dc07..b415ccb5 100644 --- a/app/lib/suggester.dart +++ b/app/lib/suggester.dart @@ -3,7 +3,7 @@ import 'package:flutter/foundation.dart'; import 'package:logging/logging.dart'; import 'package:nc_photos/iterable_extension.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:tuple/tuple.dart'; import 'package:woozy_search/woozy_search.dart'; diff --git a/app/lib/use_case/album/share_album_with_user.dart b/app/lib/use_case/album/share_album_with_user.dart index 94ca0408..f2d0af20 100644 --- a/app/lib/use_case/album/share_album_with_user.dart +++ b/app/lib/use_case/album/share_album_with_user.dart @@ -11,9 +11,9 @@ import 'package:nc_photos/iterable_extension.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'; +import 'package:np_string/np_string.dart'; part 'share_album_with_user.g.dart'; diff --git a/app/lib/use_case/album/unshare_album_with_user.dart b/app/lib/use_case/album/unshare_album_with_user.dart index 20100408..d6dca056 100644 --- a/app/lib/use_case/album/unshare_album_with_user.dart +++ b/app/lib/use_case/album/unshare_album_with_user.dart @@ -11,9 +11,9 @@ 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'; +import 'package:np_string/np_string.dart'; part 'unshare_album_with_user.g.dart'; diff --git a/app/lib/use_case/album/unshare_file_from_album.dart b/app/lib/use_case/album/unshare_file_from_album.dart index 3e205d86..8a5983ea 100644 --- a/app/lib/use_case/album/unshare_file_from_album.dart +++ b/app/lib/use_case/album/unshare_file_from_album.dart @@ -13,8 +13,8 @@ import 'package:nc_photos/use_case/album/list_album.dart'; import 'package:nc_photos/use_case/list_share.dart'; import 'package:nc_photos/use_case/remove_share.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; import 'package:np_common/type.dart'; +import 'package:np_string/np_string.dart'; part 'unshare_file_from_album.g.dart'; diff --git a/app/lib/use_case/collection/unshare_collection.dart b/app/lib/use_case/collection/unshare_collection.dart index ed2a4270..741f9b50 100644 --- a/app/lib/use_case/collection/unshare_collection.dart +++ b/app/lib/use_case/collection/unshare_collection.dart @@ -4,7 +4,7 @@ import 'package:nc_photos/di_container.dart'; import 'package:nc_photos/entity/collection.dart'; import 'package:nc_photos/entity/collection/adapter.dart'; import 'package:nc_photos/entity/collection/util.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; class UnshareCollection { const UnshareCollection(this._c); diff --git a/app/lib/use_case/ls.dart b/app/lib/use_case/ls.dart index 5e88deac..e8ef3e20 100644 --- a/app/lib/use_case/ls.dart +++ b/app/lib/use_case/ls.dart @@ -1,6 +1,6 @@ import 'package:nc_photos/account.dart'; import 'package:nc_photos/entity/file.dart'; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; class Ls { Ls(this.fileRepo); diff --git a/app/lib/use_case/remove.dart b/app/lib/use_case/remove.dart index ee226ab4..131728ee 100644 --- a/app/lib/use_case/remove.dart +++ b/app/lib/use_case/remove.dart @@ -17,8 +17,8 @@ import 'package:nc_photos/use_case/album/remove_from_album.dart'; import 'package:nc_photos/use_case/list_share.dart'; import 'package:nc_photos/use_case/remove_share.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; import 'package:np_common/type.dart'; +import 'package:np_string/np_string.dart'; part 'remove.g.dart'; diff --git a/app/lib/widget/album_share_outlier_browser.dart b/app/lib/widget/album_share_outlier_browser.dart index 5dd650d7..c8806bb3 100644 --- a/app/lib/widget/album_share_outlier_browser.dart +++ b/app/lib/widget/album_share_outlier_browser.dart @@ -20,8 +20,7 @@ import 'package:nc_photos/use_case/remove_share.dart'; import 'package:nc_photos/widget/empty_list_indicator.dart'; import 'package:nc_photos/widget/network_thumbnail.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; import 'package:np_ui/np_ui.dart'; part 'album_share_outlier_browser.g.dart'; diff --git a/app/lib/widget/connect.dart b/app/lib/widget/connect.dart index 32e1669e..31eb3199 100644 --- a/app/lib/widget/connect.dart +++ b/app/lib/widget/connect.dart @@ -21,8 +21,7 @@ import 'package:nc_photos/url_launcher_util.dart'; import 'package:nc_photos/use_case/ls_single_file.dart'; import 'package:nc_photos/widget/cloud_progress_indicator.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; part 'connect.g.dart'; diff --git a/app/lib/widget/home_search_suggestion.dart b/app/lib/widget/home_search_suggestion.dart index b7271799..3d79323d 100644 --- a/app/lib/widget/home_search_suggestion.dart +++ b/app/lib/widget/home_search_suggestion.dart @@ -16,7 +16,7 @@ import 'package:nc_photos/use_case/list_location_group.dart'; import 'package:nc_photos/widget/collection_browser.dart'; import 'package:nc_photos/widget/page_visibility_mixin.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; part 'home_search_suggestion.g.dart'; diff --git a/app/lib/widget/image_editor/color_toolbar.dart b/app/lib/widget/image_editor/color_toolbar.dart index cf66ec4d..31b9cc56 100644 --- a/app/lib/widget/image_editor/color_toolbar.dart +++ b/app/lib/widget/image_editor/color_toolbar.dart @@ -1,10 +1,10 @@ import 'package:flutter/material.dart'; import 'package:nc_photos/app_localizations.dart'; -import 'package:nc_photos/double_extension.dart'; import 'package:nc_photos/iterable_extension.dart'; import 'package:nc_photos/object_extension.dart'; import 'package:nc_photos/widget/image_editor/toolbar_button.dart'; import 'package:nc_photos_plugin/nc_photos_plugin.dart'; +import 'package:np_string/np_string.dart'; import 'package:np_ui/np_ui.dart'; enum ColorToolType { diff --git a/app/lib/widget/share_collection_dialog.dart b/app/lib/widget/share_collection_dialog.dart index 3b47bd85..20eaa650 100644 --- a/app/lib/widget/share_collection_dialog.dart +++ b/app/lib/widget/share_collection_dialog.dart @@ -23,7 +23,7 @@ import 'package:nc_photos/k.dart' as k; import 'package:nc_photos/suggester.dart'; import 'package:nc_photos/toast.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'share_collection_dialog.g.dart'; diff --git a/app/lib/widget/sign_in.dart b/app/lib/widget/sign_in.dart index afccd2ee..a809ddb9 100644 --- a/app/lib/widget/sign_in.dart +++ b/app/lib/widget/sign_in.dart @@ -17,7 +17,7 @@ import 'package:nc_photos/widget/connect.dart'; import 'package:nc_photos/widget/home.dart'; import 'package:nc_photos/widget/root_picker.dart'; import 'package:np_codegen/np_codegen.dart'; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; part 'sign_in.g.dart'; diff --git a/app/lib/widget/tag_picker_dialog.dart b/app/lib/widget/tag_picker_dialog.dart index be0ba820..4ee2598c 100644 --- a/app/lib/widget/tag_picker_dialog.dart +++ b/app/lib/widget/tag_picker_dialog.dart @@ -11,7 +11,7 @@ import 'package:nc_photos/exception_util.dart' as exception_util; import 'package:nc_photos/k.dart' as k; import 'package:nc_photos/snack_bar_manager.dart'; import 'package:nc_photos/widget/dialog_scaffold.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; class TagPickerDialog extends StatefulWidget { const TagPickerDialog({ diff --git a/app/lib/widget/viewer_detail_pane.dart b/app/lib/widget/viewer_detail_pane.dart index c55bdc5f..1e141d0f 100644 --- a/app/lib/widget/viewer_detail_pane.dart +++ b/app/lib/widget/viewer_detail_pane.dart @@ -11,7 +11,6 @@ import 'package:nc_photos/app_localizations.dart'; import 'package:nc_photos/controller/account_controller.dart'; import 'package:nc_photos/debug_util.dart'; import 'package:nc_photos/di_container.dart'; -import 'package:nc_photos/double_extension.dart'; import 'package:nc_photos/entity/collection.dart'; import 'package:nc_photos/entity/collection/adapter.dart'; import 'package:nc_photos/entity/collection_item.dart'; @@ -37,6 +36,7 @@ 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_string/np_string.dart'; import 'package:np_ui/np_ui.dart'; import 'package:path/path.dart' as path_lib; import 'package:tuple/tuple.dart'; diff --git a/app/pubspec.lock b/app/pubspec.lock index 8c9b36cf..96f18380 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -990,6 +990,13 @@ packages: relative: true source: path version: "1.0.0" + np_string: + dependency: "direct main" + description: + path: "../np_string" + relative: true + source: path + version: "1.0.0" np_ui: dependency: "direct main" description: diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 1386c4cd..79650acc 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -107,6 +107,8 @@ dependencies: path: ../np_log np_math: path: ../np_math + np_string: + path: ../np_string np_ui: path: ../np_ui octo_image: any diff --git a/app/test/account_test.dart b/app/test/account_test.dart index 2485a668..d7b6747f 100644 --- a/app/test/account_test.dart +++ b/app/test/account_test.dart @@ -1,5 +1,5 @@ import 'package:nc_photos/account.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:test/test.dart'; void main() { diff --git a/app/test/bloc/list_album_share_outlier_test.dart b/app/test/bloc/list_album_share_outlier_test.dart index 4406addb..182252cb 100644 --- a/app/test/bloc/list_album_share_outlier_test.dart +++ b/app/test/bloc/list_album_share_outlier_test.dart @@ -2,7 +2,7 @@ import 'package:bloc_test/bloc_test.dart'; import 'package:nc_photos/bloc/list_album_share_outlier.dart'; import 'package:nc_photos/di_container.dart'; import 'package:nc_photos/entity/sqlite/database.dart' as sql; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:test/test.dart'; import '../mock_type.dart'; diff --git a/app/test/entity/album/data_source_test.dart b/app/test/entity/album/data_source_test.dart index 63778dfd..9369ae8f 100644 --- a/app/test/entity/album/data_source_test.dart +++ b/app/test/entity/album/data_source_test.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:np_common/ci_string.dart'; import 'package:np_common/or_null.dart'; +import 'package:np_string/np_string.dart'; import 'package:test/test.dart'; import '../../test_util.dart' as util; diff --git a/app/test/entity/album_test.dart b/app/test/entity/album_test.dart index 1bf5b0e8..723def31 100644 --- a/app/test/entity/album_test.dart +++ b/app/test/entity/album_test.dart @@ -11,8 +11,8 @@ import 'package:nc_photos/entity/album/upgrader.dart'; import 'package:nc_photos/entity/file.dart'; import 'package:nc_photos/entity/file_descriptor.dart'; import 'package:nc_photos/entity/sqlite/database.dart' as sql; -import 'package:np_common/ci_string.dart'; import 'package:np_common/type.dart'; +import 'package:np_string/np_string.dart'; import 'package:test/test.dart'; import '../test_util.dart' as util; diff --git a/app/test/entity/file_test.dart b/app/test/entity/file_test.dart index 1f06c8bd..a91311c8 100644 --- a/app/test/entity/file_test.dart +++ b/app/test/entity/file_test.dart @@ -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:np_common/ci_string.dart'; import 'package:np_common/or_null.dart'; +import 'package:np_string/np_string.dart'; import 'package:test/test.dart'; void main() { diff --git a/app/test/mock_type.dart b/app/test/mock_type.dart index 4231e85e..f26c7ff8 100644 --- a/app/test/mock_type.dart +++ b/app/test/mock_type.dart @@ -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:np_common/ci_string.dart'; import 'package:np_common/or_null.dart'; +import 'package:np_string/np_string.dart'; import 'package:path/path.dart' as path_lib; /// Mock of [AlbumRepo] where all methods will throw UnimplementedError diff --git a/app/test/test_util.dart b/app/test/test_util.dart index 9b6cd001..ea1f186b 100644 --- a/app/test/test_util.dart +++ b/app/test/test_util.dart @@ -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:np_common/ci_string.dart'; import 'package:np_common/or_null.dart'; +import 'package:np_string/np_string.dart'; import 'package:tuple/tuple.dart'; class FilesBuilder { diff --git a/app/test/use_case/add_file_to_album_test.dart b/app/test/use_case/add_file_to_album_test.dart index eff1015d..6e8d718d 100644 --- a/app/test/use_case/add_file_to_album_test.dart +++ b/app/test/use_case/add_file_to_album_test.dart @@ -12,7 +12,7 @@ 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/use_case/album/add_file_to_album.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:test/test.dart'; import '../mock_type.dart'; diff --git a/app/test/use_case/share_album_with_user_test.dart b/app/test/use_case/share_album_with_user_test.dart index ea1570b7..c6dc62ce 100644 --- a/app/test/use_case/share_album_with_user_test.dart +++ b/app/test/use_case/share_album_with_user_test.dart @@ -1,8 +1,8 @@ import 'package:event_bus/event_bus.dart'; import 'package:kiwi/kiwi.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:np_string/np_string.dart'; import 'package:test/test.dart'; import '../mock_type.dart'; diff --git a/app/test/use_case/unshare_album_with_user_test.dart b/app/test/use_case/unshare_album_with_user_test.dart index 59e6cf5d..978b118a 100644 --- a/app/test/use_case/unshare_album_with_user_test.dart +++ b/app/test/use_case/unshare_album_with_user_test.dart @@ -2,7 +2,7 @@ import 'package:event_bus/event_bus.dart'; import 'package:kiwi/kiwi.dart'; import 'package:nc_photos/di_container.dart'; import 'package:nc_photos/use_case/album/unshare_album_with_user.dart'; -import 'package:np_common/ci_string.dart'; +import 'package:np_string/np_string.dart'; import 'package:test/test.dart'; import '../mock_type.dart'; diff --git a/np_api/lib/src/type.dart b/np_api/lib/src/type.dart index a589cff7..2d621bc4 100644 --- a/np_api/lib/src/type.dart +++ b/np_api/lib/src/type.dart @@ -2,7 +2,7 @@ import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:np_api/src/util.dart'; -import 'package:np_common/string_extension.dart'; +import 'package:np_string/np_string.dart'; import 'package:to_string/to_string.dart'; part 'type.g.dart'; diff --git a/np_api/pubspec.yaml b/np_api/pubspec.yaml index b97997bc..52ffc158 100644 --- a/np_api/pubspec.yaml +++ b/np_api/pubspec.yaml @@ -20,6 +20,8 @@ dependencies: path: ../np_common np_log: path: ../np_log + np_string: + path: ../np_string to_string: git: url: https://gitlab.com/nkming2/dart-to-string diff --git a/np_common/pubspec.yaml b/np_common/pubspec.yaml index a2602761..d9518c32 100644 --- a/np_common/pubspec.yaml +++ b/np_common/pubspec.yaml @@ -18,7 +18,6 @@ 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 diff --git a/np_string/.gitignore b/np_string/.gitignore new file mode 100644 index 00000000..3cceda55 --- /dev/null +++ b/np_string/.gitignore @@ -0,0 +1,7 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ + +# Avoid committing pubspec.lock for library packages; see +# https://dart.dev/guides/libraries/private-files#pubspeclock. +pubspec.lock diff --git a/np_string/analysis_options.yaml b/np_string/analysis_options.yaml new file mode 100644 index 00000000..f92d2567 --- /dev/null +++ b/np_string/analysis_options.yaml @@ -0,0 +1 @@ +include: package:np_lints/np.yaml diff --git a/np_string/lib/np_string.dart b/np_string/lib/np_string.dart new file mode 100644 index 00000000..00c3f628 --- /dev/null +++ b/np_string/lib/np_string.dart @@ -0,0 +1,5 @@ +library np_string; + +export 'src/ci_string.dart'; +export 'src/double_extension.dart'; +export 'src/string_extension.dart'; diff --git a/np_common/lib/ci_string.dart b/np_string/lib/src/ci_string.dart similarity index 97% rename from np_common/lib/ci_string.dart rename to np_string/lib/src/ci_string.dart index 4b1430b7..7bc1712a 100644 --- a/np_common/lib/ci_string.dart +++ b/np_string/lib/src/ci_string.dart @@ -1,4 +1,4 @@ -import 'package:np_common/string_extension.dart'; +import 'package:np_string/src/string_extension.dart'; /// Case-insensitive string class CiString implements Comparable { diff --git a/app/lib/double_extension.dart b/np_string/lib/src/double_extension.dart similarity index 88% rename from app/lib/double_extension.dart rename to np_string/lib/src/double_extension.dart index 2c9b9a46..5a83b26f 100644 --- a/app/lib/double_extension.dart +++ b/np_string/lib/src/double_extension.dart @@ -1,4 +1,4 @@ -import 'package:np_common/string_extension.dart'; +import 'package:np_string/src/string_extension.dart'; extension DoubleExtension on double { /// Same as toStringAsFixed but with trailing zeros truncated diff --git a/np_common/lib/string_extension.dart b/np_string/lib/src/string_extension.dart similarity index 100% rename from np_common/lib/string_extension.dart rename to np_string/lib/src/string_extension.dart diff --git a/np_string/pubspec.yaml b/np_string/pubspec.yaml new file mode 100644 index 00000000..fb147e0a --- /dev/null +++ b/np_string/pubspec.yaml @@ -0,0 +1,13 @@ +name: np_string +description: A starting point for Dart libraries or applications. +version: 1.0.0 +# repository: https://github.com/my_org/my_repo +publish_to: none + +environment: + sdk: '>=2.19.6 <3.0.0' + +dev_dependencies: + np_lints: + path: ../np_lints + test: ^1.21.0 diff --git a/np_common/test/ci_string_test.dart b/np_string/test/ci_string_test.dart similarity index 98% rename from np_common/test/ci_string_test.dart rename to np_string/test/ci_string_test.dart index f5531754..cda9b96f 100644 --- a/np_common/test/ci_string_test.dart +++ b/np_string/test/ci_string_test.dart @@ -1,6 +1,6 @@ // ignore_for_file: unrelated_type_equality_checks -import 'package:np_common/ci_string.dart'; +import 'package:np_string/src/ci_string.dart'; import 'package:test/test.dart'; void main() { diff --git a/app/test/double_extension_test.dart b/np_string/test/double_extension_test.dart similarity index 87% rename from app/test/double_extension_test.dart rename to np_string/test/double_extension_test.dart index b12209a3..ecefff7a 100644 --- a/app/test/double_extension_test.dart +++ b/np_string/test/double_extension_test.dart @@ -1,4 +1,4 @@ -import 'package:nc_photos/double_extension.dart'; +import 'package:np_string/src/double_extension.dart'; import 'package:test/test.dart'; void main() { diff --git a/np_common/test/string_extension_test.dart b/np_string/test/string_extension_test.dart similarity index 96% rename from np_common/test/string_extension_test.dart rename to np_string/test/string_extension_test.dart index 9ac2e24b..854ea14b 100644 --- a/np_common/test/string_extension_test.dart +++ b/np_string/test/string_extension_test.dart @@ -1,4 +1,4 @@ -import 'package:np_common/string_extension.dart'; +import 'package:np_string/src/string_extension.dart'; import 'package:test/test.dart'; void main() {