From 41f4cab506d29998c39c2f752cfd2a42552f8eda Mon Sep 17 00:00:00 2001 From: Yevhenii Zapletin Date: Sun, 2 May 2021 19:47:07 +0300 Subject: [PATCH] more local preferences tests --- .../action/mute/account_action_mute_bloc.dart | 2 +- .../mute/account_action_mute_bloc_impl.dart | 2 +- ...rrent_auth_instance_context_bloc_impl.dart | 42 ++++++------- .../database_cache_settings_bloc_impl.dart | 10 +-- ...global_database_cache_settings_dialog.dart | 8 +-- ...cache_settings_local_preference_bloc.dart} | 6 +- ..._settings_local_preference_bloc_impl.dart} | 8 +-- ...cache_settings_local_preference_bloc.dart} | 10 +-- ..._settings_local_preference_bloc_impl.dart} | 12 ++-- ...cache_settings_local_preference_bloc.dart} | 10 +-- ..._settings_local_preference_bloc_impl.dart} | 12 ++-- ...it_global_files_cache_settings_dialog.dart | 6 +- .../files_cache_settings_bloc_impl.dart | 10 +-- ...cache_settings_local_preference_bloc.dart} | 6 +- ..._settings_local_preference_bloc_impl.dart} | 8 +-- ...cache_settings_local_preference_bloc.dart} | 4 +- ..._settings_local_preference_bloc_impl.dart} | 10 +-- ...cache_settings_local_preference_bloc.dart} | 10 +-- ..._settings_local_preference_bloc_impl.dart} | 12 ++-- .../settings/chat_settings_bloc_impl.dart | 4 +- lib/app/context/app_context_bloc_impl.dart | 20 +++--- lib/app/custom_list/custom_list_page.dart | 12 ++-- lib/app/hashtag/hashtag_page.dart | 12 ++-- ...me_tab_storage_local_preference_bloc.dart} | 6 +- ...b_storage_local_preference_bloc_impl.dart} | 16 ++--- .../timelines_home_tab_storage_bloc_impl.dart | 12 ++-- .../timelines_home_tab_storage_model.dart | 8 ++- .../timelines/timelines_home_tab_page.dart | 8 +-- ...eferences_service_migration_bloc_impl.dart | 16 ++--- ...ation_settings_local_preference_bloc.dart} | 2 +- ..._settings_local_preference_bloc_impl.dart} | 4 +- ...ation_settings_local_preference_bloc.dart} | 0 ..._settings_local_preference_bloc_impl.dart} | 2 +- .../localization_settings_bloc_impl.dart | 2 +- .../settings/media_settings_bloc_impl.dart | 4 +- .../pagination_settings_bloc_impl.dart | 4 +- lib/app/pending/pending_model.dart | 12 ---- ...rmission_asked_local_preference_bloc.dart} | 6 +- ...ion_asked_local_preference_bloc_impl.dart} | 8 +-- ...fcm_push_permission_checker_bloc_impl.dart | 4 +- lib/app/search/search_model.dart | 7 ++- ..._settings_bloc_local_preference_impl.dart} | 4 +- .../post_status_settings_bloc_impl.dart | 4 +- .../status_sensitive_settings_bloc_impl.dart | 4 +- .../create/create_timeline_bloc_impl.dart | 8 +-- .../timeline_local_preference_bloc.dart} | 6 +- .../timeline_local_preference_bloc_impl.dart} | 16 ++--- .../edit/edit_timeline_settings_dialog.dart | 14 ++--- .../settings/timeline_settings_bloc_impl.dart | 4 +- ...timeline_status_cached_list_bloc_impl.dart | 6 +- lib/app/timeline/tab/timeline_tab_bloc.dart | 4 +- .../timeline/tab/timeline_tab_bloc_impl.dart | 8 +-- lib/app/timeline/timeline_widget.dart | 4 +- .../settings/toast_settings_bloc_impl.dart | 4 +- .../web_sockets_settings_bloc_impl.dart | 4 +- ...atabase_cache_settings_bloc_impl_test.dart | 16 ++--- ...tings_local_preference_bloc_impl_test.dart | 8 +-- ...tings_local_preference_bloc_impl_test.dart | 8 +-- .../files_cache_settings_bloc_impl_test.dart | 16 ++--- ...tings_local_preference_bloc_impl_test.dart | 8 +-- ...tings_local_preference_bloc_impl_test.dart | 8 +-- ...orage_local_preference_bloc_impl_test.dart | 26 ++++++++ ...timelines_home_tab_storage_model_test.dart | 62 +++++++++++++++++++ ...es_home_tab_storage_model_test_helper.dart | 12 ++++ ...tings_local_preference_bloc_impl_test.dart | 4 +- .../localization_settings_bloc_impl_test.dart | 2 +- ...sked_local_preference_bloc_impl_test.dart} | 8 +-- ...ings_local_preference_bloc_impl_test.dart} | 0 ...eline_local_preference_bloc_impl_test.dart | 38 ++++++++++++ .../timeline_settings_model_test.dart | 43 +++++++++++++ .../timeline_settings_model_test_helper.dart | 43 +++++++++++++ test/app/timeline/timeline_model_test.dart | 40 ++++++++++++ .../timeline/timeline_model_test_helper.dart | 22 +++++++ 73 files changed, 547 insertions(+), 264 deletions(-) rename lib/app/cache/database/settings/local_preferences/{database_cache_settings_local_preferences_bloc.dart => database_cache_settings_local_preference_bloc.dart} (70%) rename lib/app/cache/database/settings/local_preferences/{database_cache_settings_local_preferences_bloc_impl.dart => database_cache_settings_local_preference_bloc_impl.dart} (74%) rename lib/app/cache/database/settings/local_preferences/global/{global_database_cache_settings_local_preferences_bloc.dart => global_database_cache_settings_local_preference_bloc.dart} (50%) rename lib/app/cache/database/settings/local_preferences/global/{global_database_cache_settings_local_preferences_bloc_impl.dart => global_database_cache_settings_local_preference_bloc_impl.dart} (70%) rename lib/app/cache/database/settings/local_preferences/instance/{instance_database_cache_settings_local_preferences_bloc.dart => instance_database_cache_settings_local_preference_bloc.dart} (50%) rename lib/app/cache/database/settings/local_preferences/instance/{instance_database_cache_settings_local_preferences_bloc_impl.dart => instance_database_cache_settings_local_preference_bloc_impl.dart} (61%) rename lib/app/cache/files/settings/local_preferences/{files_cache_settings_local_preferences_bloc.dart => files_cache_settings_local_preference_bloc.dart} (65%) rename lib/app/cache/files/settings/local_preferences/{files_cache_settings_local_preferences_bloc_impl.dart => files_cache_settings_local_preference_bloc_impl.dart} (71%) rename lib/app/cache/files/settings/local_preferences/global/{global_files_cache_settings_local_preferences_bloc.dart => global_files_cache_settings_local_preference_bloc.dart} (80%) rename lib/app/cache/files/settings/local_preferences/global/{global_files_cache_settings_local_preferences_bloc_impl.dart => global_files_cache_settings_local_preference_bloc_impl.dart} (75%) rename lib/app/cache/files/settings/local_preferences/instance/{instance_files_cache_settings_local_preferences_bloc.dart => instance_files_cache_settings_local_preference_bloc.dart} (51%) rename lib/app/cache/files/settings/local_preferences/instance/{instance_files_cache_settings_local_preferences_bloc_impl.dart => instance_files_cache_settings_local_preference_bloc_impl.dart} (61%) rename lib/app/home/tab/timelines/storage/{timelines_home_tab_storage_local_preferences_bloc.dart => local_preferences/timelines_home_tab_storage_local_preference_bloc.dart} (69%) rename lib/app/home/tab/timelines/storage/{timelines_home_tab_storage_local_preferences_bloc_impl.dart => local_preferences/timelines_home_tab_storage_local_preference_bloc_impl.dart} (57%) rename lib/app/localization/settings/{local_preference/global/global_localization_settings_local_preferences_bloc.dart => local_preferences/global/global_localization_settings_local_preference_bloc.dart} (82%) rename lib/app/localization/settings/{local_preference/global/global_localization_settings_local_preferences_bloc_impl.dart => local_preferences/global/global_localization_settings_local_preference_bloc_impl.dart} (73%) rename lib/app/localization/settings/{local_preference/localization_settings_local_preferences_bloc.dart => local_preferences/localization_settings_local_preference_bloc.dart} (100%) rename lib/app/localization/settings/{local_preference/localization_settings_local_preferences_bloc_impl.dart => local_preferences/localization_settings_local_preference_bloc_impl.dart} (86%) rename lib/app/push/fcm/asked/local_preferences/{fcm_push_permission_asked_local_preferences_bloc.dart => fcm_push_permission_asked_local_preference_bloc.dart} (62%) rename lib/app/push/fcm/asked/local_preferences/{fcm_push_permission_asked_local_preferences_bloc_impl.dart => fcm_push_permission_asked_local_preference_bloc_impl.dart} (68%) rename lib/app/settings/global_or_instance/{global_or_instance_settings_bloc_local_preferences_impl.dart => local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart} (96%) rename lib/app/timeline/{timeline_local_preferences_bloc.dart => local_preferences/timeline_local_preference_bloc.dart} (65%) rename lib/app/timeline/{timeline_local_preferences_bloc_impl.dart => local_preferences/timeline_local_preference_bloc_impl.dart} (88%) create mode 100644 test/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc_impl_test.dart create mode 100644 test/app/home/tab/timelines/storage/timelines_home_tab_storage_model_test.dart create mode 100644 test/app/home/tab/timelines/storage/timelines_home_tab_storage_model_test_helper.dart rename test/app/push/fcm/asked/local_preferences/{fcm_push_permission_asked_local_preferences_bloc_impl_test.dart => fcm_push_permission_asked_local_preference_bloc_impl_test.dart} (69%) rename test/app/push/settings/local_preferences/instance/{instance_push_settings_local_preferences_bloc_impl_test.dart => instance_push_settings_local_preference_bloc_impl_test.dart} (100%) create mode 100644 test/app/timeline/local_preferences/timeline_local_preference_bloc_impl_test.dart create mode 100644 test/app/timeline/settings/timeline_settings_model_test.dart create mode 100644 test/app/timeline/settings/timeline_settings_model_test_helper.dart create mode 100644 test/app/timeline/timeline_model_test.dart create mode 100644 test/app/timeline/timeline_model_test_helper.dart diff --git a/lib/app/account/action/mute/account_action_mute_bloc.dart b/lib/app/account/action/mute/account_action_mute_bloc.dart index bb8f86bd2..10fe3adea 100644 --- a/lib/app/account/action/mute/account_action_mute_bloc.dart +++ b/lib/app/account/action/mute/account_action_mute_bloc.dart @@ -12,7 +12,7 @@ abstract class IAccountActionMuteBloc implements IDisposable { }) => Provider.of(context, listen: listen); - IAccount? get accountForMute; + IAccount get accountForMute; IBoolValueFormFieldBloc get notificationsBoolFieldBloc; IDurationDateTimeValueFormFieldBloc get expireDurationFieldBloc; diff --git a/lib/app/account/action/mute/account_action_mute_bloc_impl.dart b/lib/app/account/action/mute/account_action_mute_bloc_impl.dart index 31943913e..5426334d4 100644 --- a/lib/app/account/action/mute/account_action_mute_bloc_impl.dart +++ b/lib/app/account/action/mute/account_action_mute_bloc_impl.dart @@ -14,7 +14,7 @@ class AccountActionMuteBloc extends DisposableOwner final IAccountBloc accountBloc; @override - IAccount? get accountForMute => accountBloc.account; + IAccount get accountForMute => accountBloc.account; @override final IDurationDateTimeValueFormFieldBloc expireDurationFieldBloc = diff --git a/lib/app/auth/instance/current/context/current_auth_instance_context_bloc_impl.dart b/lib/app/auth/instance/current/context/current_auth_instance_context_bloc_impl.dart index 615d09a22..4d3360b90 100644 --- a/lib/app/auth/instance/current/context/current_auth_instance_context_bloc_impl.dart +++ b/lib/app/auth/instance/current/context/current_auth_instance_context_bloc_impl.dart @@ -10,18 +10,18 @@ import 'package:fedi/app/cache/database/limit/age/database_cache_age_limit_model import 'package:fedi/app/cache/database/limit/entries_count/database_cache_entries_count_limit_model.dart'; import 'package:fedi/app/cache/database/settings/database_cache_settings_bloc.dart'; import 'package:fedi/app/cache/database/settings/database_cache_settings_bloc_impl.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/cache/files/limit/age/files_cache_age_limit_model.dart'; import 'package:fedi/app/cache/files/limit/size_count/files_cache_size_count_limit_model.dart'; import 'package:fedi/app/cache/files/files_cache_service.dart'; import 'package:fedi/app/cache/files/files_cache_service_impl.dart'; import 'package:fedi/app/cache/files/settings/files_cache_settings_bloc.dart'; import 'package:fedi/app/cache/files/settings/files_cache_settings_bloc_impl.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/chat/conversation/conversation_chat_new_messages_handler_bloc.dart'; import 'package:fedi/app/chat/conversation/conversation_chat_new_messages_handler_bloc_impl.dart'; import 'package:fedi/app/chat/conversation/current/conversation_chat_current_bloc.dart'; @@ -55,8 +55,8 @@ import 'package:fedi/app/filter/repository/filter_repository.dart'; import 'package:fedi/app/filter/repository/filter_repository_impl.dart'; import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_bloc.dart'; import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_bloc_impl.dart'; -import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc.dart'; -import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc.dart'; +import 'package:fedi/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc_impl.dart'; import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_model.dart'; import 'package:fedi/app/media/settings/local_preferences/global/global_media_settings_local_preference_bloc.dart'; import 'package:fedi/app/media/settings/local_preferences/instance/instance_media_settings_local_preference_bloc.dart'; @@ -72,8 +72,8 @@ import 'package:fedi/app/pagination/settings/local_preferences/instance/instance import 'package:fedi/app/pagination/settings/local_preferences/instance/instance_pagination_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/pagination/settings/pagination_settings_bloc.dart'; import 'package:fedi/app/pagination/settings/pagination_settings_bloc_impl.dart'; -import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc.dart'; -import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc.dart'; +import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc_impl.dart'; import 'package:fedi/app/push/fcm/fcm_push_permission_checker_bloc.dart'; import 'package:fedi/app/push/fcm/fcm_push_permission_checker_bloc_impl.dart'; import 'package:fedi/app/push/handler/push_handler_bloc.dart'; @@ -104,7 +104,7 @@ import 'package:fedi/app/status/sensitive/settings/local_preferences/instance/in import 'package:fedi/app/status/sensitive/settings/status_sensitive_settings_bloc.dart'; import 'package:fedi/app/status/sensitive/settings/status_sensitive_settings_bloc_impl.dart'; import 'package:fedi/app/timeline/settings/timeline_settings_model.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart'; import 'package:fedi/app/timeline/timeline_model.dart'; import 'package:fedi/app/toast/settings/local_preferences/global/global_toast_settings_local_preference_bloc.dart'; import 'package:fedi/app/toast/settings/local_preferences/instance/instance_toast_settings_local_preference_bloc.dart'; @@ -210,14 +210,14 @@ class CurrentAuthInstanceContextBloc extends ProviderContextBloc var userAtHost = currentInstance.userAtHost; var fcmPushPermissionAskedLocalPreferencesBloc = - FcmPushPermissionAskedLocalPreferencesBloc( + FcmPushPermissionAskedLocalPreferenceBloc( preferencesService, userAtHost: userAtHost, ); addDisposable(disposable: fcmPushPermissionAskedLocalPreferencesBloc); await globalProviderService - .asyncInitAndRegister( + .asyncInitAndRegister( fcmPushPermissionAskedLocalPreferencesBloc, ); @@ -499,13 +499,13 @@ class CurrentAuthInstanceContextBloc extends ProviderContextBloc ); var timelinesHomeTabStorageLocalPreferencesBloc = - TimelinesHomeTabStorageLocalPreferencesBloc( + TimelinesHomeTabStorageLocalPreferenceBloc( preferencesService, userAtHost: userAtHost, ); addDisposable(disposable: timelinesHomeTabStorageLocalPreferencesBloc); await globalProviderService - .asyncInitAndRegister( + .asyncInitAndRegister( timelinesHomeTabStorageLocalPreferencesBloc, ); @@ -636,7 +636,7 @@ class CurrentAuthInstanceContextBloc extends ProviderContextBloc ); for (var timeline in timelines) { - var timelineLocalPreferencesBloc = TimelineLocalPreferencesBloc.byId( + var timelineLocalPreferencesBloc = TimelineLocalPreferenceBloc.byId( preferencesService, userAtHost: currentInstance.userAtHost, timelineId: timeline.id, @@ -747,25 +747,25 @@ class CurrentAuthInstanceContextBloc extends ProviderContextBloc addDisposable(disposable: instancePaginationSettingsLocalPreferencesBloc); var instanceFilesCacheSettingsLocalPreferencesBloc = - InstanceFilesCacheSettingsLocalPreferencesBloc( + InstanceFilesCacheSettingsLocalPreferenceBloc( preferencesService, userAtHost: userAtHost, ); await globalProviderService - .asyncInitAndRegister( + .asyncInitAndRegister( instanceFilesCacheSettingsLocalPreferencesBloc, ); addDisposable(disposable: instanceFilesCacheSettingsLocalPreferencesBloc); var instanceDatabaseCacheSettingsLocalPreferencesBloc = - InstanceDatabaseCacheSettingsLocalPreferencesBloc( + InstanceDatabaseCacheSettingsLocalPreferenceBloc( preferencesService, userAtHost: userAtHost, ); await globalProviderService.asyncInitAndRegister< - IInstanceDatabaseCacheSettingsLocalPreferencesBloc>( + IInstanceDatabaseCacheSettingsLocalPreferenceBloc>( instanceDatabaseCacheSettingsLocalPreferencesBloc, ); addDisposable( @@ -849,7 +849,7 @@ class CurrentAuthInstanceContextBloc extends ProviderContextBloc instanceLocalPreferencesBloc: instanceDatabaseCacheSettingsLocalPreferencesBloc, globalLocalPreferencesBloc: appContextBloc - .get(), + .get(), ); await globalProviderService.asyncInitAndRegister< diff --git a/lib/app/cache/database/settings/database_cache_settings_bloc_impl.dart b/lib/app/cache/database/settings/database_cache_settings_bloc_impl.dart index 7b2b1a8af..76e93a875 100644 --- a/lib/app/cache/database/settings/database_cache_settings_bloc_impl.dart +++ b/lib/app/cache/database/settings/database_cache_settings_bloc_impl.dart @@ -2,16 +2,16 @@ import 'package:fedi/app/cache/database/limit/age/database_cache_age_limit_model import 'package:fedi/app/cache/database/limit/entries_count/database_cache_entries_count_limit_model.dart'; import 'package:fedi/app/cache/database/settings/database_cache_settings_bloc.dart'; import 'package:fedi/app/cache/database/settings/database_cache_settings_model.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc.dart'; +import 'package:fedi/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart'; class DatabaseCacheSettingsBloc - extends GlobalOrInstanceSettingsLocalPreferencesBloc + extends GlobalOrInstanceSettingsLocalPreferenceBloc implements IDatabaseCacheSettingsBloc { DatabaseCacheSettingsBloc({ - required IDatabaseCacheSettingsLocalPreferencesBloc + required IDatabaseCacheSettingsLocalPreferenceBloc globalLocalPreferencesBloc, - required IDatabaseCacheSettingsLocalPreferencesBloc + required IDatabaseCacheSettingsLocalPreferenceBloc instanceLocalPreferencesBloc, }) : super( globalLocalPreferencesBloc: globalLocalPreferencesBloc, diff --git a/lib/app/cache/database/settings/edit/global/edit_global_database_cache_settings_dialog.dart b/lib/app/cache/database/settings/edit/global/edit_global_database_cache_settings_dialog.dart index 853f861a8..a06352dde 100644 --- a/lib/app/cache/database/settings/edit/global/edit_global_database_cache_settings_dialog.dart +++ b/lib/app/cache/database/settings/edit/global/edit_global_database_cache_settings_dialog.dart @@ -3,8 +3,8 @@ import 'package:fedi/app/cache/database/settings/database_cache_settings_bloc_im import 'package:fedi/app/cache/database/settings/edit/edit_database_cache_settings_bloc.dart'; import 'package:fedi/app/cache/database/settings/edit/edit_database_cache_settings_bloc_impl.dart'; import 'package:fedi/app/cache/database/settings/edit/edit_database_cache_settings_widget.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc.dart'; import 'package:fedi/app/settings/global/edit/edit_global_settings_dialog.dart'; import 'package:fedi/app/settings/global_or_instance/global_or_instance_settings_model.dart'; import 'package:fedi/database/database_service.dart'; @@ -22,12 +22,12 @@ void showEditGlobalDatabaseCacheSettingsDialog({ child: DisposableProvider( create: (context) => DatabaseCacheSettingsBloc( instanceLocalPreferencesBloc: - IInstanceDatabaseCacheSettingsLocalPreferencesBloc.of( + IInstanceDatabaseCacheSettingsLocalPreferenceBloc.of( context, listen: false, ), globalLocalPreferencesBloc: - IGlobalDatabaseCacheSettingsLocalPreferencesBloc.of( + IGlobalDatabaseCacheSettingsLocalPreferenceBloc.of( context, listen: false, ), diff --git a/lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc.dart b/lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc.dart similarity index 70% rename from lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc.dart rename to lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc.dart index 34e324a61..478bf383a 100644 --- a/lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc.dart +++ b/lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc.dart @@ -3,13 +3,13 @@ import 'package:fedi/local_preferences/local_preference_bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; -abstract class IDatabaseCacheSettingsLocalPreferencesBloc< +abstract class IDatabaseCacheSettingsLocalPreferenceBloc< T extends DatabaseCacheSettings?> implements ILocalPreferenceBloc { - static IDatabaseCacheSettingsLocalPreferencesBloc of( + static IDatabaseCacheSettingsLocalPreferenceBloc of( BuildContext context, { bool listen = true, }) => - Provider.of( + Provider.of( context, listen: listen, ); diff --git a/lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc_impl.dart b/lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc_impl.dart similarity index 74% rename from lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc_impl.dart rename to lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc_impl.dart index 43381143b..181f52b82 100644 --- a/lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc_impl.dart +++ b/lib/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc_impl.dart @@ -1,12 +1,12 @@ import 'package:fedi/app/cache/database/settings/database_cache_settings_model.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc.dart'; import 'package:fedi/local_preferences/local_preference_bloc_impl.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; -abstract class DatabaseCacheSettingsLocalPreferencesBloc< +abstract class DatabaseCacheSettingsLocalPreferenceBloc< T extends DatabaseCacheSettings?> extends ObjectLocalPreferenceBloc - implements IDatabaseCacheSettingsLocalPreferencesBloc { - DatabaseCacheSettingsLocalPreferencesBloc( + implements IDatabaseCacheSettingsLocalPreferenceBloc { + DatabaseCacheSettingsLocalPreferenceBloc( ILocalPreferencesService preferencesService, String key, ) : super( diff --git a/lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc.dart b/lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc.dart similarity index 50% rename from lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc.dart rename to lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc.dart index fe674db43..520604992 100644 --- a/lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc.dart +++ b/lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc.dart @@ -1,15 +1,15 @@ import 'package:fedi/app/cache/database/settings/database_cache_settings_model.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; -abstract class IGlobalDatabaseCacheSettingsLocalPreferencesBloc - implements IDatabaseCacheSettingsLocalPreferencesBloc { - static IGlobalDatabaseCacheSettingsLocalPreferencesBloc of( +abstract class IGlobalDatabaseCacheSettingsLocalPreferenceBloc + implements IDatabaseCacheSettingsLocalPreferenceBloc { + static IGlobalDatabaseCacheSettingsLocalPreferenceBloc of( BuildContext context, { bool listen = true, }) => - Provider.of( + Provider.of( context, listen: listen, ); diff --git a/lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc_impl.dart b/lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc_impl.dart similarity index 70% rename from lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc_impl.dart rename to lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc_impl.dart index a89cd403d..79b5baa4a 100644 --- a/lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc_impl.dart +++ b/lib/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc_impl.dart @@ -1,20 +1,20 @@ import 'package:fedi/app/cache/database/limit/age/database_cache_age_limit_model.dart'; import 'package:fedi/app/cache/database/limit/entries_count/database_cache_entries_count_limit_model.dart'; import 'package:fedi/app/cache/database/settings/database_cache_settings_model.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc_impl.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc_impl.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; -class GlobalDatabaseCacheSettingsLocalPreferencesBloc - extends DatabaseCacheSettingsLocalPreferencesBloc - implements IGlobalDatabaseCacheSettingsLocalPreferencesBloc { +class GlobalDatabaseCacheSettingsLocalPreferenceBloc + extends DatabaseCacheSettingsLocalPreferenceBloc + implements IGlobalDatabaseCacheSettingsLocalPreferenceBloc { static final defaultValue = DatabaseCacheSettings.fromEnum( entriesCountByTypeLimitType: DatabaseCacheEntriesCountByTypeLimitType.notSet, ageLimitType: DatabaseCacheAgeLimitType.notSet, ); - GlobalDatabaseCacheSettingsLocalPreferencesBloc( + GlobalDatabaseCacheSettingsLocalPreferenceBloc( ILocalPreferencesService preferencesService, ) : super( preferencesService, diff --git a/lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc.dart b/lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc.dart similarity index 50% rename from lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc.dart rename to lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc.dart index 98c84b8a8..69f89ad2e 100644 --- a/lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc.dart +++ b/lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc.dart @@ -1,15 +1,15 @@ import 'package:fedi/app/cache/database/settings/database_cache_settings_model.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; -abstract class IInstanceDatabaseCacheSettingsLocalPreferencesBloc - implements IDatabaseCacheSettingsLocalPreferencesBloc { - static IInstanceDatabaseCacheSettingsLocalPreferencesBloc of( +abstract class IInstanceDatabaseCacheSettingsLocalPreferenceBloc + implements IDatabaseCacheSettingsLocalPreferenceBloc { + static IInstanceDatabaseCacheSettingsLocalPreferenceBloc of( BuildContext context, { bool listen = true, }) => - Provider.of( + Provider.of( context, listen: listen, ); diff --git a/lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc_impl.dart b/lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc_impl.dart similarity index 61% rename from lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc_impl.dart rename to lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc_impl.dart index bfcc6511d..e3fcb9f12 100644 --- a/lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc_impl.dart +++ b/lib/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc_impl.dart @@ -1,12 +1,12 @@ import 'package:fedi/app/cache/database/settings/database_cache_settings_model.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preferences_bloc_impl.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/database_cache_settings_local_preference_bloc_impl.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; -class InstanceDatabaseCacheSettingsLocalPreferencesBloc - extends DatabaseCacheSettingsLocalPreferencesBloc - implements IInstanceDatabaseCacheSettingsLocalPreferencesBloc { - InstanceDatabaseCacheSettingsLocalPreferencesBloc( +class InstanceDatabaseCacheSettingsLocalPreferenceBloc + extends DatabaseCacheSettingsLocalPreferenceBloc + implements IInstanceDatabaseCacheSettingsLocalPreferenceBloc { + InstanceDatabaseCacheSettingsLocalPreferenceBloc( ILocalPreferencesService preferencesService, { required String userAtHost, }) : super( diff --git a/lib/app/cache/files/settings/edit/global/edit_global_files_cache_settings_dialog.dart b/lib/app/cache/files/settings/edit/global/edit_global_files_cache_settings_dialog.dart index 1a22fa317..e20fd27e4 100644 --- a/lib/app/cache/files/settings/edit/global/edit_global_files_cache_settings_dialog.dart +++ b/lib/app/cache/files/settings/edit/global/edit_global_files_cache_settings_dialog.dart @@ -3,8 +3,8 @@ import 'package:fedi/app/cache/files/settings/edit/edit_files_cache_settings_blo import 'package:fedi/app/cache/files/settings/edit/edit_files_cache_settings_widget.dart'; import 'package:fedi/app/cache/files/settings/files_cache_settings_bloc.dart'; import 'package:fedi/app/cache/files/settings/files_cache_settings_bloc_impl.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc.dart'; import 'package:fedi/app/settings/global/edit/edit_global_settings_dialog.dart'; import 'package:fedi/app/settings/global_or_instance/global_or_instance_settings_model.dart'; import 'package:fedi/disposable/disposable_provider.dart'; @@ -21,7 +21,7 @@ void showEditGlobalFilesCacheSettingsDialog({ child: DisposableProvider( create: (context) => FilesCacheSettingsBloc( instanceLocalPreferencesBloc: - IInstanceFilesCacheSettingsLocalPreferencesBloc.of( + IInstanceFilesCacheSettingsLocalPreferenceBloc.of( context, listen: false, ), diff --git a/lib/app/cache/files/settings/files_cache_settings_bloc_impl.dart b/lib/app/cache/files/settings/files_cache_settings_bloc_impl.dart index 7e2d90184..d4aafdcb9 100644 --- a/lib/app/cache/files/settings/files_cache_settings_bloc_impl.dart +++ b/lib/app/cache/files/settings/files_cache_settings_bloc_impl.dart @@ -2,16 +2,16 @@ import 'package:fedi/app/cache/files/limit/age/files_cache_age_limit_model.dart' import 'package:fedi/app/cache/files/limit/size_count/files_cache_size_count_limit_model.dart'; import 'package:fedi/app/cache/files/settings/files_cache_settings_bloc.dart'; import 'package:fedi/app/cache/files/settings/files_cache_settings_model.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc.dart'; +import 'package:fedi/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart'; class FilesCacheSettingsBloc - extends GlobalOrInstanceSettingsLocalPreferencesBloc + extends GlobalOrInstanceSettingsLocalPreferenceBloc implements IFilesCacheSettingsBloc { FilesCacheSettingsBloc({ - required IFilesCacheSettingsLocalPreferencesBloc + required IFilesCacheSettingsLocalPreferenceBloc globalLocalPreferencesBloc, - required IFilesCacheSettingsLocalPreferencesBloc + required IFilesCacheSettingsLocalPreferenceBloc instanceLocalPreferencesBloc, }) : super( globalLocalPreferencesBloc: globalLocalPreferencesBloc, diff --git a/lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc.dart b/lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc.dart similarity index 65% rename from lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc.dart rename to lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc.dart index e9ec08811..c10f16f3f 100644 --- a/lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc.dart +++ b/lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc.dart @@ -3,13 +3,13 @@ import 'package:fedi/local_preferences/local_preference_bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; -abstract class IFilesCacheSettingsLocalPreferencesBloc +abstract class IFilesCacheSettingsLocalPreferenceBloc implements ILocalPreferenceBloc { - static IFilesCacheSettingsLocalPreferencesBloc of( + static IFilesCacheSettingsLocalPreferenceBloc of( BuildContext context, { bool listen = true, }) => - Provider.of( + Provider.of( context, listen: listen, ); diff --git a/lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc_impl.dart b/lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc_impl.dart similarity index 71% rename from lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc_impl.dart rename to lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc_impl.dart index e9c2ab584..c718e7982 100644 --- a/lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc_impl.dart +++ b/lib/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc_impl.dart @@ -1,12 +1,12 @@ import 'package:fedi/app/cache/files/settings/files_cache_settings_model.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc.dart'; import 'package:fedi/local_preferences/local_preference_bloc_impl.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; -abstract class FilesCacheSettingsLocalPreferencesBloc +abstract class FilesCacheSettingsLocalPreferenceBloc extends ObjectLocalPreferenceBloc - implements IFilesCacheSettingsLocalPreferencesBloc { - FilesCacheSettingsLocalPreferencesBloc( + implements IFilesCacheSettingsLocalPreferenceBloc { + FilesCacheSettingsLocalPreferenceBloc( ILocalPreferencesService preferencesService, String key, ) : super( diff --git a/lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc.dart b/lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc.dart similarity index 80% rename from lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc.dart rename to lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc.dart index 3de3a7815..8cde16c36 100644 --- a/lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc.dart +++ b/lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc.dart @@ -1,10 +1,10 @@ import 'package:fedi/app/cache/files/settings/files_cache_settings_model.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; abstract class IGlobalFilesCacheSettingsLocalPreferencesBloc - implements IFilesCacheSettingsLocalPreferencesBloc { + implements IFilesCacheSettingsLocalPreferenceBloc { static IGlobalFilesCacheSettingsLocalPreferencesBloc of( BuildContext context, { bool listen = true, diff --git a/lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc_impl.dart b/lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc_impl.dart similarity index 75% rename from lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc_impl.dart rename to lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc_impl.dart index 84739d1e5..cd3f0e637 100644 --- a/lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc_impl.dart +++ b/lib/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc_impl.dart @@ -1,14 +1,14 @@ import 'package:fedi/app/cache/files/limit/age/files_cache_age_limit_model.dart'; import 'package:fedi/app/cache/files/limit/size_count/files_cache_size_count_limit_model.dart'; import 'package:fedi/app/cache/files/settings/files_cache_settings_model.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc_impl.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc_impl.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; -class GlobalFilesCacheSettingsLocalPreferencesBloc - extends FilesCacheSettingsLocalPreferencesBloc +class GlobalFilesCacheSettingsLocalPreferenceBloc + extends FilesCacheSettingsLocalPreferenceBloc implements IGlobalFilesCacheSettingsLocalPreferencesBloc { - GlobalFilesCacheSettingsLocalPreferencesBloc( + GlobalFilesCacheSettingsLocalPreferenceBloc( ILocalPreferencesService preferencesService, ) : super(preferencesService, "cache.files.settings.global"); diff --git a/lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc.dart b/lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc.dart similarity index 51% rename from lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc.dart rename to lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc.dart index 212cdec9b..f1b78d29b 100644 --- a/lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc.dart +++ b/lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc.dart @@ -1,15 +1,15 @@ import 'package:fedi/app/cache/files/settings/files_cache_settings_model.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; -abstract class IInstanceFilesCacheSettingsLocalPreferencesBloc - implements IFilesCacheSettingsLocalPreferencesBloc { - static IInstanceFilesCacheSettingsLocalPreferencesBloc of( +abstract class IInstanceFilesCacheSettingsLocalPreferenceBloc + implements IFilesCacheSettingsLocalPreferenceBloc { + static IInstanceFilesCacheSettingsLocalPreferenceBloc of( BuildContext context, { bool listen = true, }) => - Provider.of( + Provider.of( context, listen: listen, ); diff --git a/lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc_impl.dart b/lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc_impl.dart similarity index 61% rename from lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc_impl.dart rename to lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc_impl.dart index e2092ed93..f1d19fb7a 100644 --- a/lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc_impl.dart +++ b/lib/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc_impl.dart @@ -1,12 +1,12 @@ import 'package:fedi/app/cache/files/settings/files_cache_settings_model.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preferences_bloc_impl.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/files_cache_settings_local_preference_bloc_impl.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; -class InstanceFilesCacheSettingsLocalPreferencesBloc - extends FilesCacheSettingsLocalPreferencesBloc - implements IInstanceFilesCacheSettingsLocalPreferencesBloc { - InstanceFilesCacheSettingsLocalPreferencesBloc( +class InstanceFilesCacheSettingsLocalPreferenceBloc + extends FilesCacheSettingsLocalPreferenceBloc + implements IInstanceFilesCacheSettingsLocalPreferenceBloc { + InstanceFilesCacheSettingsLocalPreferenceBloc( ILocalPreferencesService preferencesService, { required String userAtHost, }) : super(preferencesService, "cache.files.settings.instance.$userAtHost"); diff --git a/lib/app/chat/settings/chat_settings_bloc_impl.dart b/lib/app/chat/settings/chat_settings_bloc_impl.dart index 8f61529e8..b98748782 100644 --- a/lib/app/chat/settings/chat_settings_bloc_impl.dart +++ b/lib/app/chat/settings/chat_settings_bloc_impl.dart @@ -1,10 +1,10 @@ import 'package:fedi/app/chat/settings/chat_settings_bloc.dart'; import 'package:fedi/app/chat/settings/chat_settings_model.dart'; import 'package:fedi/app/chat/settings/local_preferences/chat_settings_local_preference_bloc.dart'; -import 'package:fedi/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart'; +import 'package:fedi/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart'; class ChatSettingsBloc - extends GlobalOrInstanceSettingsLocalPreferencesBloc + extends GlobalOrInstanceSettingsLocalPreferenceBloc implements IChatSettingsBloc { ChatSettingsBloc({ required IChatSettingsLocalPreferenceBloc diff --git a/lib/app/context/app_context_bloc_impl.dart b/lib/app/context/app_context_bloc_impl.dart index 0c99f6612..8c7c638cb 100644 --- a/lib/app/context/app_context_bloc_impl.dart +++ b/lib/app/context/app_context_bloc_impl.dart @@ -12,10 +12,10 @@ import 'package:fedi/app/auth/instance/list/auth_instance_list_bloc.dart'; import 'package:fedi/app/auth/instance/list/auth_instance_list_bloc_impl.dart'; import 'package:fedi/app/auth/instance/list/local_preferences/auth_instance_list_local_preference_bloc.dart'; import 'package:fedi/app/auth/instance/list/local_preferences/auth_instance_list_local_preference_bloc_impl.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc_impl.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc_impl.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/chat/settings/local_preferences/global/global_chat_settings_local_preference_bloc.dart'; import 'package:fedi/app/chat/settings/local_preferences/global/global_chat_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/context/app_context_bloc.dart'; @@ -23,9 +23,9 @@ import 'package:fedi/app/database/app_database_service_impl.dart'; import 'package:fedi/app/hive/hive_service.dart'; import 'package:fedi/app/hive/hive_service_impl.dart'; import 'package:fedi/app/local_preferences/fedi_local_preferences_service_migration_bloc_impl.dart'; -import 'package:fedi/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc_impl.dart'; -import 'package:fedi/app/localization/settings/local_preference/localization_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc.dart'; +import 'package:fedi/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc_impl.dart'; +import 'package:fedi/app/localization/settings/local_preferences/localization_settings_local_preference_bloc.dart'; import 'package:fedi/app/localization/settings/localization_settings_bloc.dart'; import 'package:fedi/app/localization/settings/localization_settings_bloc_impl.dart'; import 'package:fedi/app/logging/logging_service.dart'; @@ -427,18 +427,18 @@ class AppContextBloc extends ProviderContextBloc implements IAppContextBloc { addDisposable(disposable: globalPaginationSettingsLocalPreferencesBloc); var globalDatabaseCacheSettingsLocalPreferencesBloc = - GlobalDatabaseCacheSettingsLocalPreferencesBloc( + GlobalDatabaseCacheSettingsLocalPreferenceBloc( hiveLocalPreferencesService, ); await globalProviderService - .asyncInitAndRegister( + .asyncInitAndRegister( globalDatabaseCacheSettingsLocalPreferencesBloc, ); addDisposable(disposable: globalDatabaseCacheSettingsLocalPreferencesBloc); var globalFilesCacheSettingsLocalPreferencesBloc = - GlobalFilesCacheSettingsLocalPreferencesBloc( + GlobalFilesCacheSettingsLocalPreferenceBloc( hiveLocalPreferencesService, ); diff --git a/lib/app/custom_list/custom_list_page.dart b/lib/app/custom_list/custom_list_page.dart index ae48df793..1a8692fc1 100644 --- a/lib/app/custom_list/custom_list_page.dart +++ b/lib/app/custom_list/custom_list_page.dart @@ -13,8 +13,8 @@ import 'package:fedi/app/status/pagination/list/status_cached_pagination_list_ti import 'package:fedi/app/status/pagination/list/status_cached_pagination_list_with_new_items_bloc_impl.dart'; import 'package:fedi/app/status/status_model.dart'; import 'package:fedi/app/timeline/status/timeline_status_cached_list_bloc_impl.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart'; import 'package:fedi/app/ui/async/fedi_async_init_loading_widget.dart'; import 'package:fedi/app/ui/page/app_bar/fedi_page_app_bar_text_action_widget.dart'; import 'package:fedi/app/ui/page/app_bar/fedi_page_title_app_bar.dart'; @@ -192,9 +192,9 @@ MaterialPageRoute createCustomListPageRoute({ builder: (context) { return Provider.value( value: customList, - child: DisposableProvider( + child: DisposableProvider( create: (context) { - var bloc = TimelineLocalPreferencesBloc.customList( + var bloc = TimelineLocalPreferenceBloc.customList( ILocalPreferencesService.of(context, listen: false), userAtHost: currentAuthInstanceBloc.currentInstance!.userAtHost, customList: customList, @@ -228,7 +228,7 @@ class _CustomListPageWrapper extends StatelessWidget { var customList = Provider.of(context); return FediAsyncInitLoadingWidget( asyncInitLoadingBloc: - ITimelineLocalPreferencesBloc.of(context, listen: false), + ITimelineLocalPreferenceBloc.of(context, listen: false), loadingFinishedBuilder: (BuildContext context) { return DisposableProvider( create: (BuildContext context) { @@ -236,7 +236,7 @@ class _CustomListPageWrapper extends StatelessWidget { TimelineStatusCachedListBloc.createFromContext( context, webSocketsListenType: WebSocketsListenType.foreground, - timelineLocalPreferencesBloc: ITimelineLocalPreferencesBloc.of( + timelineLocalPreferencesBloc: ITimelineLocalPreferenceBloc.of( context, listen: false, ), diff --git a/lib/app/hashtag/hashtag_page.dart b/lib/app/hashtag/hashtag_page.dart index 050b6c9ba..6fd6a9db3 100644 --- a/lib/app/hashtag/hashtag_page.dart +++ b/lib/app/hashtag/hashtag_page.dart @@ -10,8 +10,8 @@ import 'package:fedi/app/status/pagination/list/status_cached_pagination_list_ti import 'package:fedi/app/status/pagination/list/status_cached_pagination_list_with_new_items_bloc_impl.dart'; import 'package:fedi/app/status/status_model.dart'; import 'package:fedi/app/timeline/status/timeline_status_cached_list_bloc_impl.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart'; import 'package:fedi/app/ui/async/fedi_async_init_loading_widget.dart'; import 'package:fedi/app/ui/button/icon/fedi_icon_button.dart'; import 'package:fedi/app/ui/dialog/actions/fedi_actions_dialog.dart'; @@ -167,10 +167,10 @@ MaterialPageRoute createHashtagPageRoute({ return MaterialPageRoute( builder: (context) { - return DisposableProvider( + return DisposableProvider( create: (context) { var timelineLocalPreferencesBloc = - TimelineLocalPreferencesBloc.hashtag( + TimelineLocalPreferenceBloc.hashtag( ILocalPreferencesService.of(context, listen: false), userAtHost: currentAuthInstanceBloc.currentInstance!.userAtHost, hashtag: hashtag, @@ -196,7 +196,7 @@ class _HashtagPageWrapper extends StatelessWidget { Widget build(BuildContext context) { var hashtag = Provider.of(context); return FediAsyncInitLoadingWidget( - asyncInitLoadingBloc: ITimelineLocalPreferencesBloc.of( + asyncInitLoadingBloc: ITimelineLocalPreferenceBloc.of( context, listen: false, ), @@ -207,7 +207,7 @@ class _HashtagPageWrapper extends StatelessWidget { TimelineStatusCachedListBloc.createFromContext( context, webSocketsListenType: WebSocketsListenType.foreground, - timelineLocalPreferencesBloc: ITimelineLocalPreferencesBloc.of( + timelineLocalPreferencesBloc: ITimelineLocalPreferenceBloc.of( context, listen: false, ), diff --git a/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc.dart b/lib/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc.dart similarity index 69% rename from lib/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc.dart rename to lib/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc.dart index 95d59cff5..6056206a9 100644 --- a/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc.dart +++ b/lib/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc.dart @@ -3,13 +3,13 @@ import 'package:fedi/local_preferences/local_preference_bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; -abstract class ITimelinesHomeTabStorageLocalPreferencesBloc +abstract class ITimelinesHomeTabStorageLocalPreferenceBloc implements ILocalPreferenceBloc { - static ITimelinesHomeTabStorageLocalPreferencesBloc of( + static ITimelinesHomeTabStorageLocalPreferenceBloc of( BuildContext context, { bool listen = true, }) => - Provider.of( + Provider.of( context, listen: listen, ); diff --git a/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc_impl.dart b/lib/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc_impl.dart similarity index 57% rename from lib/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc_impl.dart rename to lib/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc_impl.dart index 7bdd7e843..fe414e5f0 100644 --- a/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc_impl.dart +++ b/lib/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc_impl.dart @@ -1,12 +1,12 @@ -import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc.dart'; +import 'package:fedi/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc.dart'; import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_model.dart'; import 'package:fedi/local_preferences/local_preference_bloc_impl.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; -class TimelinesHomeTabStorageLocalPreferencesBloc +class TimelinesHomeTabStorageLocalPreferenceBloc extends ObjectLocalPreferenceBloc - implements ITimelinesHomeTabStorageLocalPreferencesBloc { - TimelinesHomeTabStorageLocalPreferencesBloc( + implements ITimelinesHomeTabStorageLocalPreferenceBloc { + TimelinesHomeTabStorageLocalPreferenceBloc( ILocalPreferencesService preferencesService, { required String userAtHost, }) : super( @@ -16,8 +16,10 @@ class TimelinesHomeTabStorageLocalPreferencesBloc jsonConverter: (json) => TimelinesHomeTabStorage.fromJson(json), ); + static const TimelinesHomeTabStorage defaultValue = TimelinesHomeTabStorage( + timelineIds: [], + ); + @override - TimelinesHomeTabStorage get defaultPreferenceValue => TimelinesHomeTabStorage( - timelineIds: [], - ); + TimelinesHomeTabStorage get defaultPreferenceValue => defaultValue; } diff --git a/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_bloc_impl.dart b/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_bloc_impl.dart index 175127721..b54a1d8cf 100644 --- a/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_bloc_impl.dart +++ b/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_bloc_impl.dart @@ -1,8 +1,8 @@ import 'package:fedi/app/auth/instance/auth_instance_model.dart'; import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_bloc.dart'; -import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc.dart'; +import 'package:fedi/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc.dart'; import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_model.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart'; import 'package:fedi/app/timeline/timeline_model.dart'; import 'package:fedi/async/loading/init/async_init_loading_bloc_impl.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; @@ -17,7 +17,7 @@ class TimelinesHomeTabStorageBloc extends AsyncInitLoadingBloc implements ITimelinesHomeTabStorageBloc { final ILocalPreferencesService preferencesService; final AuthInstance authInstance; - final ITimelinesHomeTabStorageLocalPreferencesBloc preferences; + final ITimelinesHomeTabStorageLocalPreferenceBloc preferences; final BehaviorSubject uiStateSubject = BehaviorSubject.seeded( @@ -51,7 +51,7 @@ class TimelinesHomeTabStorageBloc extends AsyncInitLoadingBloc Future updateTimelines() async { var timelines = []; for (var timelineId in timelineIds) { - var bloc = TimelineLocalPreferencesBloc.byId( + var bloc = TimelineLocalPreferenceBloc.byId( preferencesService, userAtHost: authInstance.userAtHost, timelineId: timelineId, @@ -132,7 +132,7 @@ class TimelinesHomeTabStorageBloc extends AsyncInitLoadingBloc @override Future add(Timeline timeline) async { - var settingsLocalPreferencesBloc = TimelineLocalPreferencesBloc.byId( + var settingsLocalPreferencesBloc = TimelineLocalPreferenceBloc.byId( preferencesService, userAtHost: authInstance.userAtHost, timelineId: timeline.id, @@ -153,7 +153,7 @@ class TimelinesHomeTabStorageBloc extends AsyncInitLoadingBloc timelines.remove(timeline); await onItemsUpdated(timelines); - var settingsLocalPreferencesBloc = TimelineLocalPreferencesBloc.byId( + var settingsLocalPreferencesBloc = TimelineLocalPreferenceBloc.byId( preferencesService, userAtHost: authInstance.userAtHost, timelineId: timeline.id, diff --git a/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_model.dart b/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_model.dart index d2670fa58..d17fd87f6 100644 --- a/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_model.dart +++ b/lib/app/home/tab/timelines/storage/timelines_home_tab_storage_model.dart @@ -1,5 +1,7 @@ import 'package:fedi/app/timeline/timeline_model.dart'; +import 'package:fedi/collection/collection_hash_utils.dart'; import 'package:fedi/json/json_model.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; import 'package:hive/hive.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -44,7 +46,7 @@ class TimelinesHomeTabStorage implements IJsonObject { @JsonKey(name: "timeline_ids") final List timelineIds; - TimelinesHomeTabStorage({ + const TimelinesHomeTabStorage({ required this.timelineIds, }); @@ -53,10 +55,10 @@ class TimelinesHomeTabStorage implements IJsonObject { identical(this, other) || other is TimelinesHomeTabStorage && runtimeType == other.runtimeType && - timelineIds == other.timelineIds; + listEquals(timelineIds, other.timelineIds); @override - int get hashCode => timelineIds.hashCode; + int get hashCode => listHash(timelineIds); TimelinesHomeTabStorage copyWith({ List? timelineIds, diff --git a/lib/app/home/tab/timelines/timelines_home_tab_page.dart b/lib/app/home/tab/timelines/timelines_home_tab_page.dart index 3af7ea2a3..bb4ce2971 100644 --- a/lib/app/home/tab/timelines/timelines_home_tab_page.dart +++ b/lib/app/home/tab/timelines/timelines_home_tab_page.dart @@ -1,7 +1,7 @@ import 'package:fedi/app/home/home_bloc.dart'; import 'package:fedi/app/home/tab/home_tab_header_bar_widget.dart'; -import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc.dart'; +import 'package:fedi/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc.dart'; import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_model.dart'; import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_page.dart'; import 'package:fedi/app/home/tab/timelines/timelines_home_tab_bloc.dart'; @@ -19,7 +19,7 @@ import 'package:fedi/app/timeline/tab/timeline_tab_list_bloc_impl.dart'; import 'package:fedi/app/timeline/tab/timeline_tab_list_tab_controller_bloc.dart'; import 'package:fedi/app/timeline/tab/timeline_tab_list_tab_controller_bloc_impl.dart'; import 'package:fedi/app/timeline/tab/timeline_tab_list_text_tab_indicator_item_widget.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc.dart'; import 'package:fedi/app/timeline/timeline_widget.dart'; import 'package:fedi/app/ui/async/fedi_async_init_loading_widget.dart'; import 'package:fedi/app/ui/button/icon/fedi_icon_in_circle_blurred_button.dart'; @@ -62,7 +62,7 @@ class TimelinesHomeTabPage extends StatelessWidget { _logger.finest(() => "build"); var timelinesHomeTabStorageLocalPreferencesBloc = - ITimelinesHomeTabStorageLocalPreferencesBloc.of(context); + ITimelinesHomeTabStorageLocalPreferenceBloc.of(context); return StreamBuilder( stream: timelinesHomeTabStorageLocalPreferencesBloc.stream, @@ -225,7 +225,7 @@ class _TimelinesHomeTabPageBodyState extends State<_TimelinesHomeTabPageBody> return Provider.value( value: tabBloc, - child: ProxyProvider( + child: ProxyProvider( update: (context, value, previous) => value.timelineLocalPreferencesBloc, // value: tabBloc.timelineLocalPreferencesBloc, diff --git a/lib/app/local_preferences/fedi_local_preferences_service_migration_bloc_impl.dart b/lib/app/local_preferences/fedi_local_preferences_service_migration_bloc_impl.dart index a7c08b61f..c4dc4b968 100644 --- a/lib/app/local_preferences/fedi_local_preferences_service_migration_bloc_impl.dart +++ b/lib/app/local_preferences/fedi_local_preferences_service_migration_bloc_impl.dart @@ -8,13 +8,13 @@ import 'package:fedi/app/chat/settings/local_preferences/global/global_chat_sett import 'package:fedi/app/chat/settings/local_preferences/instance/instance_chat_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/emoji/picker/category/custom_image_url/local_preferences/emoji_picker_custom_image_url_category_local_preference_bloc_impl.dart'; import 'package:fedi/app/emoji/picker/category/recent/local_preferences/emoji_picker_recent_category_local_preference_bloc_impl.dart'; -import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_local_preferences_bloc_impl.dart'; -import 'package:fedi/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc_impl.dart'; +import 'package:fedi/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/media/settings/local_preferences/global/global_media_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/media/settings/local_preferences/instance/instance_media_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/pagination/settings/local_preferences/global/global_pagination_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/pagination/settings/local_preferences/instance/instance_pagination_settings_local_preference_bloc_impl.dart'; -import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc_impl.dart'; import 'package:fedi/app/push/handler/unhandled/local_preferences/push_handler_unhandled_local_preference_bloc_impl.dart'; import 'package:fedi/app/push/settings/local_preferences/instance/instance_push_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/search/recent/local_preferences/recent_search_local_preference_bloc_impl.dart'; @@ -22,7 +22,7 @@ import 'package:fedi/app/status/post/settings/local_preferences/global/global_po import 'package:fedi/app/status/post/settings/local_preferences/instance/instance_post_status_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/status/sensitive/settings/local_preferences/global/global_status_sensitive_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/status/sensitive/settings/local_preferences/instance/instance_status_sensitive_settings_local_preference_bloc_impl.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart'; import 'package:fedi/app/toast/settings/local_preferences/global/global_toast_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/toast/settings/local_preferences/instance/instance_toast_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/ui/settings/local_preference/global/global_ui_settings_local_preference_bloc_impl.dart'; @@ -67,7 +67,7 @@ class FediLocalPreferencesServiceMigrationBloc .addAll(calculateUserAtHostLocalPreferencesBlocCreators(userAtHost)); var timelinesHomeTabStorageLocalPreferencesBloc = - TimelinesHomeTabStorageLocalPreferencesBloc( + TimelinesHomeTabStorageLocalPreferenceBloc( inputService, userAtHost: userAtHost, ); @@ -75,7 +75,7 @@ class FediLocalPreferencesServiceMigrationBloc authInstancesBlocCreators.addAll( timelinesHomeTabStorageLocalPreferencesBloc.value.timelineIds.map( - (timelineId) => (lps) => TimelineLocalPreferencesBloc.byId( + (timelineId) => (lps) => TimelineLocalPreferenceBloc.byId( lps, userAtHost: userAtHost, timelineId: timelineId, @@ -119,11 +119,11 @@ class FediLocalPreferencesServiceMigrationBloc (lps) => MyAccountLocalPreferenceBloc(lps, userAtHost: userAtHost), (lps) => RecentSearchLocalPreferenceBloc(lps, userAtHost: userAtHost), - (lps) => FcmPushPermissionAskedLocalPreferencesBloc( + (lps) => FcmPushPermissionAskedLocalPreferenceBloc( lps, userAtHost: userAtHost, ), - (lps) => TimelinesHomeTabStorageLocalPreferencesBloc( + (lps) => TimelinesHomeTabStorageLocalPreferenceBloc( lps, userAtHost: userAtHost, ), diff --git a/lib/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc.dart b/lib/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc.dart similarity index 82% rename from lib/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc.dart rename to lib/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc.dart index f723cd91a..83e61b5bf 100644 --- a/lib/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc.dart +++ b/lib/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc.dart @@ -1,4 +1,4 @@ -import 'package:fedi/app/localization/settings/local_preference/localization_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/localization/settings/local_preferences/localization_settings_local_preference_bloc.dart'; import 'package:fedi/app/localization/settings/localization_settings_model.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; diff --git a/lib/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc_impl.dart b/lib/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc_impl.dart similarity index 73% rename from lib/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc_impl.dart rename to lib/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc_impl.dart index 98219696f..2089fb954 100644 --- a/lib/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc_impl.dart +++ b/lib/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc_impl.dart @@ -1,5 +1,5 @@ -import 'package:fedi/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc.dart'; -import 'package:fedi/app/localization/settings/local_preference/localization_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc.dart'; +import 'package:fedi/app/localization/settings/local_preferences/localization_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/localization/settings/localization_settings_model.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; diff --git a/lib/app/localization/settings/local_preference/localization_settings_local_preferences_bloc.dart b/lib/app/localization/settings/local_preferences/localization_settings_local_preference_bloc.dart similarity index 100% rename from lib/app/localization/settings/local_preference/localization_settings_local_preferences_bloc.dart rename to lib/app/localization/settings/local_preferences/localization_settings_local_preference_bloc.dart diff --git a/lib/app/localization/settings/local_preference/localization_settings_local_preferences_bloc_impl.dart b/lib/app/localization/settings/local_preferences/localization_settings_local_preference_bloc_impl.dart similarity index 86% rename from lib/app/localization/settings/local_preference/localization_settings_local_preferences_bloc_impl.dart rename to lib/app/localization/settings/local_preferences/localization_settings_local_preference_bloc_impl.dart index 4b270ff54..31cd2ebc8 100644 --- a/lib/app/localization/settings/local_preference/localization_settings_local_preferences_bloc_impl.dart +++ b/lib/app/localization/settings/local_preferences/localization_settings_local_preference_bloc_impl.dart @@ -1,4 +1,4 @@ -import 'package:fedi/app/localization/settings/local_preference/localization_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/localization/settings/local_preferences/localization_settings_local_preference_bloc.dart'; import 'package:fedi/app/localization/settings/localization_settings_model.dart'; import 'package:fedi/local_preferences/local_preference_bloc_impl.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; diff --git a/lib/app/localization/settings/localization_settings_bloc_impl.dart b/lib/app/localization/settings/localization_settings_bloc_impl.dart index 79b7cf486..cc45019aa 100644 --- a/lib/app/localization/settings/localization_settings_bloc_impl.dart +++ b/lib/app/localization/settings/localization_settings_bloc_impl.dart @@ -1,4 +1,4 @@ -import 'package:fedi/app/localization/settings/local_preference/localization_settings_local_preferences_bloc.dart'; +import 'package:fedi/app/localization/settings/local_preferences/localization_settings_local_preference_bloc.dart'; import 'package:fedi/app/localization/settings/localization_settings_bloc.dart'; import 'package:fedi/app/localization/settings/localization_settings_model.dart'; import 'package:fedi/disposable/disposable_owner.dart'; diff --git a/lib/app/media/settings/media_settings_bloc_impl.dart b/lib/app/media/settings/media_settings_bloc_impl.dart index 9317165f4..bf56da843 100644 --- a/lib/app/media/settings/media_settings_bloc_impl.dart +++ b/lib/app/media/settings/media_settings_bloc_impl.dart @@ -1,10 +1,10 @@ import 'package:fedi/app/media/settings/local_preferences/media_settings_local_preference_bloc.dart'; import 'package:fedi/app/media/settings/media_settings_bloc.dart'; import 'package:fedi/app/media/settings/media_settings_model.dart'; -import 'package:fedi/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart'; +import 'package:fedi/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart'; class MediaSettingsBloc - extends GlobalOrInstanceSettingsLocalPreferencesBloc + extends GlobalOrInstanceSettingsLocalPreferenceBloc implements IMediaSettingsBloc { MediaSettingsBloc({ required IMediaSettingsLocalPreferenceBloc diff --git a/lib/app/pagination/settings/pagination_settings_bloc_impl.dart b/lib/app/pagination/settings/pagination_settings_bloc_impl.dart index 810b93029..9d4fc0976 100644 --- a/lib/app/pagination/settings/pagination_settings_bloc_impl.dart +++ b/lib/app/pagination/settings/pagination_settings_bloc_impl.dart @@ -2,10 +2,10 @@ import 'package:fedi/app/pagination/page_size/pagination_page_size_model.dart'; import 'package:fedi/app/pagination/settings/local_preferences/pagination_settings_local_preference_bloc.dart'; import 'package:fedi/app/pagination/settings/pagination_settings_bloc.dart'; import 'package:fedi/app/pagination/settings/pagination_settings_model.dart'; -import 'package:fedi/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart'; +import 'package:fedi/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart'; class PaginationSettingsBloc - extends GlobalOrInstanceSettingsLocalPreferencesBloc + extends GlobalOrInstanceSettingsLocalPreferenceBloc implements IPaginationSettingsBloc { PaginationSettingsBloc({ required IPaginationSettingsLocalPreferenceBloc diff --git a/lib/app/pending/pending_model.dart b/lib/app/pending/pending_model.dart index 32225252e..08d358277 100644 --- a/lib/app/pending/pending_model.dart +++ b/lib/app/pending/pending_model.dart @@ -1,5 +1,3 @@ -import 'package:json_annotation/json_annotation.dart'; - enum PendingState { notSentYet, published, @@ -60,13 +58,3 @@ extension PendingStateStringExtension on String { return result; } } - -class PendingStateTypeConverter implements JsonConverter { - const PendingStateTypeConverter(); - - @override - PendingState fromJson(String value) => value.toPendingState(); - - @override - String toJson(PendingState value) => value.toJsonValue(); -} diff --git a/lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc.dart b/lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc.dart similarity index 62% rename from lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc.dart rename to lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc.dart index f4a4d784c..aef91a990 100644 --- a/lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc.dart +++ b/lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc.dart @@ -2,13 +2,13 @@ import 'package:fedi/local_preferences/local_preference_bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; -abstract class IFcmPushPermissionAskedLocalPreferencesBloc +abstract class IFcmPushPermissionAskedLocalPreferenceBloc implements ILocalPreferenceBloc { - static IFcmPushPermissionAskedLocalPreferencesBloc of( + static IFcmPushPermissionAskedLocalPreferenceBloc of( BuildContext context, { bool listen = true, }) => - Provider.of( + Provider.of( context, listen: listen, ); diff --git a/lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc_impl.dart b/lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc_impl.dart similarity index 68% rename from lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc_impl.dart rename to lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc_impl.dart index cbcc6d7b6..58f7d3958 100644 --- a/lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc_impl.dart +++ b/lib/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc_impl.dart @@ -1,10 +1,10 @@ -import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc.dart'; +import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc.dart'; import 'package:fedi/local_preferences/local_preference_bloc_impl.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; -class FcmPushPermissionAskedLocalPreferencesBloc extends BoolLocalPreferenceBloc - implements IFcmPushPermissionAskedLocalPreferencesBloc { - FcmPushPermissionAskedLocalPreferencesBloc( +class FcmPushPermissionAskedLocalPreferenceBloc extends BoolLocalPreferenceBloc + implements IFcmPushPermissionAskedLocalPreferenceBloc { + FcmPushPermissionAskedLocalPreferenceBloc( ILocalPreferencesService preferencesService, { required String userAtHost, }) : super( diff --git a/lib/app/push/fcm/fcm_push_permission_checker_bloc_impl.dart b/lib/app/push/fcm/fcm_push_permission_checker_bloc_impl.dart index a49aebf11..40f188e79 100644 --- a/lib/app/push/fcm/fcm_push_permission_checker_bloc_impl.dart +++ b/lib/app/push/fcm/fcm_push_permission_checker_bloc_impl.dart @@ -1,4 +1,4 @@ -import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc.dart'; +import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc.dart'; import 'package:fedi/app/push/fcm/fcm_push_permission_checker_bloc.dart'; import 'package:fedi/app/push/settings/push_settings_bloc.dart'; import 'package:fedi/disposable/disposable_owner.dart'; @@ -11,7 +11,7 @@ final _logger = Logger("fcm_push_permission_checker_bloc_impl.dart"); class FcmPushPermissionCheckerBloc extends DisposableOwner implements IFcmPushPermissionCheckerBloc { final IFcmPushService fcmPushService; - final IFcmPushPermissionAskedLocalPreferencesBloc + final IFcmPushPermissionAskedLocalPreferenceBloc fcmPushPermissionAskedLocalPreferencesBloc; final IPushSettingsBloc pushSettingsBloc; diff --git a/lib/app/search/search_model.dart b/lib/app/search/search_model.dart index d16c90d73..07d73e274 100644 --- a/lib/app/search/search_model.dart +++ b/lib/app/search/search_model.dart @@ -1 +1,6 @@ -enum SearchTab { all, accounts, statuses, hashtags } +enum SearchTab { + all, + accounts, + statuses, + hashtags, +} diff --git a/lib/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart b/lib/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart similarity index 96% rename from lib/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart rename to lib/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart index b08637ec7..8f8a946f9 100644 --- a/lib/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart +++ b/lib/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart @@ -5,12 +5,12 @@ import 'package:fedi/disposable/disposable_owner.dart'; import 'package:fedi/local_preferences/local_preference_bloc.dart'; import 'package:rxdart/rxdart.dart'; -class GlobalOrInstanceSettingsLocalPreferencesBloc +class GlobalOrInstanceSettingsLocalPreferenceBloc extends DisposableOwner implements IGlobalOrInstanceSettingsBloc { final ILocalPreferenceBloc globalLocalPreferencesBloc; final ILocalPreferenceBloc instanceLocalPreferencesBloc; - GlobalOrInstanceSettingsLocalPreferencesBloc({ + GlobalOrInstanceSettingsLocalPreferenceBloc({ required this.globalLocalPreferencesBloc, required this.instanceLocalPreferencesBloc, }); diff --git a/lib/app/status/post/settings/post_status_settings_bloc_impl.dart b/lib/app/status/post/settings/post_status_settings_bloc_impl.dart index 3336d813e..43fb4941e 100644 --- a/lib/app/status/post/settings/post_status_settings_bloc_impl.dart +++ b/lib/app/status/post/settings/post_status_settings_bloc_impl.dart @@ -1,4 +1,4 @@ -import 'package:fedi/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart'; +import 'package:fedi/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart'; import 'package:fedi/app/status/post/settings/local_preferences/post_status_settings_local_preference_bloc.dart'; import 'package:fedi/app/status/post/settings/post_status_settings_bloc.dart'; import 'package:fedi/app/status/post/settings/post_status_settings_model.dart'; @@ -6,7 +6,7 @@ import 'package:fedi/localization/localization_model.dart'; import 'package:fedi/pleroma/api/visibility/pleroma_api_visibility_model.dart'; class PostStatusSettingsBloc - extends GlobalOrInstanceSettingsLocalPreferencesBloc + extends GlobalOrInstanceSettingsLocalPreferenceBloc implements IPostStatusSettingsBloc { PostStatusSettingsBloc({ required IPostStatusSettingsLocalPreferenceBloc diff --git a/lib/app/status/sensitive/settings/status_sensitive_settings_bloc_impl.dart b/lib/app/status/sensitive/settings/status_sensitive_settings_bloc_impl.dart index e2bb68057..20faac549 100644 --- a/lib/app/status/sensitive/settings/status_sensitive_settings_bloc_impl.dart +++ b/lib/app/status/sensitive/settings/status_sensitive_settings_bloc_impl.dart @@ -1,10 +1,10 @@ -import 'package:fedi/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart'; +import 'package:fedi/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart'; import 'package:fedi/app/status/sensitive/settings/local_preferences/status_sensitive_settings_local_preference_bloc.dart'; import 'package:fedi/app/status/sensitive/settings/status_sensitive_settings_bloc.dart'; import 'package:fedi/app/status/sensitive/settings/status_sensitive_settings_model.dart'; class StatusSensitiveSettingsBloc - extends GlobalOrInstanceSettingsLocalPreferencesBloc< + extends GlobalOrInstanceSettingsLocalPreferenceBloc< StatusSensitiveSettings> implements IStatusSensitiveSettingsBloc { StatusSensitiveSettingsBloc({ required IStatusSensitiveSettingsLocalPreferenceBloc< diff --git a/lib/app/timeline/create/create_timeline_bloc_impl.dart b/lib/app/timeline/create/create_timeline_bloc_impl.dart index 3680f3a83..d152f5ee7 100644 --- a/lib/app/timeline/create/create_timeline_bloc_impl.dart +++ b/lib/app/timeline/create/create_timeline_bloc_impl.dart @@ -7,7 +7,7 @@ import 'package:fedi/app/timeline/settings/edit/edit_timeline_settings_bloc_impl import 'package:fedi/app/timeline/settings/timeline_settings_bloc.dart'; import 'package:fedi/app/timeline/settings/timeline_settings_bloc_impl.dart'; import 'package:fedi/app/timeline/settings/timeline_settings_model.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart'; import 'package:fedi/app/timeline/timeline_model.dart'; import 'package:fedi/app/timeline/type/form/timeline_type_single_from_list_value_form_field_bloc.dart'; import 'package:fedi/app/timeline/type/form/timeline_type_single_from_list_value_form_field_bloc_impl.dart'; @@ -41,7 +41,7 @@ class CreateTimelineBloc extends FormBloc implements ICreateTimelineBloc { @override late List currentItems = []; - late TimelineLocalPreferencesBloc timelineLocalPreferencesBloc; + late TimelineLocalPreferenceBloc timelineLocalPreferencesBloc; @override late ITimelineSettingsBloc timelineSettingsBloc; @@ -107,12 +107,12 @@ class CreateTimelineBloc extends FormBloc implements ICreateTimelineBloc { ); } - TimelineLocalPreferencesBloc _createTimelineLocalPreferencesBloc({ + TimelineLocalPreferenceBloc _createTimelineLocalPreferencesBloc({ required ILocalPreferencesService localPreferencesService, required String timelineId, required TimelineType startType, }) { - return TimelineLocalPreferencesBloc.byId( + return TimelineLocalPreferenceBloc.byId( localPreferencesService, userAtHost: authInstance.userAtHost, timelineId: timelineId, diff --git a/lib/app/timeline/timeline_local_preferences_bloc.dart b/lib/app/timeline/local_preferences/timeline_local_preference_bloc.dart similarity index 65% rename from lib/app/timeline/timeline_local_preferences_bloc.dart rename to lib/app/timeline/local_preferences/timeline_local_preference_bloc.dart index 0906d875e..ee1a482ee 100644 --- a/lib/app/timeline/timeline_local_preferences_bloc.dart +++ b/lib/app/timeline/local_preferences/timeline_local_preference_bloc.dart @@ -3,11 +3,11 @@ import 'package:fedi/local_preferences/local_preference_bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; -abstract class ITimelineLocalPreferencesBloc +abstract class ITimelineLocalPreferenceBloc implements ILocalPreferenceBloc { - static ITimelineLocalPreferencesBloc of( + static ITimelineLocalPreferenceBloc of( BuildContext context, { bool listen = true, }) => - Provider.of(context, listen: listen); + Provider.of(context, listen: listen); } diff --git a/lib/app/timeline/timeline_local_preferences_bloc_impl.dart b/lib/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart similarity index 88% rename from lib/app/timeline/timeline_local_preferences_bloc_impl.dart rename to lib/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart index 405e85fcc..7354c2088 100644 --- a/lib/app/timeline/timeline_local_preferences_bloc_impl.dart +++ b/lib/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart @@ -5,22 +5,22 @@ import 'package:fedi/app/account/account_model_adapter.dart'; import 'package:fedi/app/custom_list/custom_list_model.dart'; import 'package:fedi/app/custom_list/custom_list_model_adapter.dart'; import 'package:fedi/app/hashtag/hashtag_model.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc.dart'; import 'package:fedi/app/timeline/settings/timeline_settings_model.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc.dart'; import 'package:fedi/app/timeline/timeline_model.dart'; import 'package:fedi/app/timeline/type/timeline_type_model.dart'; import 'package:fedi/local_preferences/local_preference_bloc_impl.dart'; import 'package:fedi/local_preferences/local_preferences_service.dart'; -class TimelineLocalPreferencesBloc extends ObjectLocalPreferenceBloc - implements ITimelineLocalPreferencesBloc { +class TimelineLocalPreferenceBloc extends ObjectLocalPreferenceBloc + implements ITimelineLocalPreferenceBloc { @override final Timeline? defaultPreferenceValue; - TimelineLocalPreferencesBloc.byId( + TimelineLocalPreferenceBloc.byId( ILocalPreferencesService preferencesService, { required String userAtHost, - required String? timelineId, + required String timelineId, required this.defaultPreferenceValue, }) : super( preferencesService: preferencesService, @@ -29,7 +29,7 @@ class TimelineLocalPreferencesBloc extends ObjectLocalPreferenceBloc jsonConverter: (json) => Timeline.fromJson(json), ); - TimelineLocalPreferencesBloc.customList( + TimelineLocalPreferenceBloc.customList( ILocalPreferencesService preferencesService, { required String userAtHost, required ICustomList customList, @@ -48,7 +48,7 @@ class TimelineLocalPreferencesBloc extends ObjectLocalPreferenceBloc ), ); - TimelineLocalPreferencesBloc.hashtag( + TimelineLocalPreferenceBloc.hashtag( ILocalPreferencesService preferencesService, { required String userAtHost, required IHashtag hashtag, @@ -67,7 +67,7 @@ class TimelineLocalPreferencesBloc extends ObjectLocalPreferenceBloc ), ); - TimelineLocalPreferencesBloc.account( + TimelineLocalPreferenceBloc.account( ILocalPreferencesService preferencesService, { required String userAtHost, required IAccount account, diff --git a/lib/app/timeline/settings/edit/edit_timeline_settings_dialog.dart b/lib/app/timeline/settings/edit/edit_timeline_settings_dialog.dart index c8d4b777d..dacc5e763 100644 --- a/lib/app/timeline/settings/edit/edit_timeline_settings_dialog.dart +++ b/lib/app/timeline/settings/edit/edit_timeline_settings_dialog.dart @@ -6,8 +6,8 @@ import 'package:fedi/app/timeline/settings/edit/edit_timeline_settings_widget.da import 'package:fedi/app/timeline/settings/timeline_settings_bloc.dart'; import 'package:fedi/app/timeline/settings/timeline_settings_bloc_impl.dart'; import 'package:fedi/app/timeline/timeline_label_extension.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart'; import 'package:fedi/app/timeline/timeline_model.dart'; import 'package:fedi/app/ui/async/fedi_async_init_loading_widget.dart'; import 'package:fedi/app/web_sockets/settings/web_sockets_settings_bloc.dart'; @@ -30,16 +30,16 @@ void showEditTimelineSettingsDialog({ ), child: Provider.value( value: timeline, - child: DisposableProxyProvider( + child: DisposableProxyProvider( update: (context, timeline, _) { return _createTimelinePreferencesBloc(context, timeline); }, child: Builder( builder: (context) => FediAsyncInitLoadingWidget( asyncInitLoadingBloc: - ITimelineLocalPreferencesBloc.of(context, listen: false), + ITimelineLocalPreferenceBloc.of(context, listen: false), loadingFinishedBuilder: (context) => DisposableProxyProvider< - ITimelineLocalPreferencesBloc, ITimelineSettingsBloc>( + ITimelineLocalPreferenceBloc, ITimelineSettingsBloc>( update: (context, timelineLocalPreferencesBloc, _) => TimelineSettingsBloc( timelineLocalPreferencesBloc: timelineLocalPreferencesBloc, @@ -73,7 +73,7 @@ void showEditTimelineSettingsDialog({ ); } -TimelineLocalPreferencesBloc _createTimelinePreferencesBloc( +TimelineLocalPreferenceBloc _createTimelinePreferencesBloc( BuildContext context, Timeline timeline, ) { @@ -81,7 +81,7 @@ TimelineLocalPreferencesBloc _createTimelinePreferencesBloc( var currentAuthInstanceBloc = ICurrentAuthInstanceBloc.of(context, listen: false); var currentInstance = currentAuthInstanceBloc.currentInstance!; - return TimelineLocalPreferencesBloc.byId( + return TimelineLocalPreferenceBloc.byId( localPreferencesService, userAtHost: currentInstance.userAtHost, timelineId: timeline.id, diff --git a/lib/app/timeline/settings/timeline_settings_bloc_impl.dart b/lib/app/timeline/settings/timeline_settings_bloc_impl.dart index 66691dd89..95eca1f38 100644 --- a/lib/app/timeline/settings/timeline_settings_bloc_impl.dart +++ b/lib/app/timeline/settings/timeline_settings_bloc_impl.dart @@ -1,11 +1,11 @@ import 'package:fedi/app/timeline/settings/timeline_settings_bloc.dart'; import 'package:fedi/app/timeline/settings/timeline_settings_model.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc.dart'; import 'package:fedi/disposable/disposable_owner.dart'; class TimelineSettingsBloc extends DisposableOwner implements ITimelineSettingsBloc { - final ITimelineLocalPreferencesBloc? timelineLocalPreferencesBloc; + final ITimelineLocalPreferenceBloc? timelineLocalPreferencesBloc; TimelineSettingsBloc({ required this.timelineLocalPreferencesBloc, diff --git a/lib/app/timeline/status/timeline_status_cached_list_bloc_impl.dart b/lib/app/timeline/status/timeline_status_cached_list_bloc_impl.dart index 3b02da6f2..9d776b5db 100644 --- a/lib/app/timeline/status/timeline_status_cached_list_bloc_impl.dart +++ b/lib/app/timeline/status/timeline_status_cached_list_bloc_impl.dart @@ -11,7 +11,7 @@ import 'package:fedi/app/status/list/cached/status_cached_list_bloc.dart'; import 'package:fedi/app/status/repository/status_repository.dart'; import 'package:fedi/app/status/repository/status_repository_model.dart'; import 'package:fedi/app/status/status_model.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc.dart'; import 'package:fedi/app/timeline/timeline_model.dart'; import 'package:fedi/app/timeline/type/timeline_type_model.dart'; import 'package:fedi/app/web_sockets/web_sockets_handler_manager_bloc.dart'; @@ -39,7 +39,7 @@ class TimelineStatusCachedListBloc extends AsyncInitLoadingBloc final IStatusRepository statusRepository; final IFilterRepository filterRepository; final ICurrentAuthInstanceBloc currentInstanceBloc; - final ITimelineLocalPreferencesBloc timelineLocalPreferencesBloc; + final ITimelineLocalPreferenceBloc timelineLocalPreferencesBloc; final IWebSocketsHandlerManagerBloc webSocketsHandlerManagerBloc; final IMyAccountBloc myAccountBloc; @@ -364,7 +364,7 @@ class TimelineStatusCachedListBloc extends AsyncInitLoadingBloc static TimelineStatusCachedListBloc createFromContext( BuildContext context, { required WebSocketsListenType webSocketsListenType, - required ITimelineLocalPreferencesBloc timelineLocalPreferencesBloc, + required ITimelineLocalPreferenceBloc timelineLocalPreferencesBloc, }) => TimelineStatusCachedListBloc( pleromaAccountService: IPleromaApiAccountService.of( diff --git a/lib/app/timeline/tab/timeline_tab_bloc.dart b/lib/app/timeline/tab/timeline_tab_bloc.dart index 2c1d689ca..efe2447b3 100644 --- a/lib/app/timeline/tab/timeline_tab_bloc.dart +++ b/lib/app/timeline/tab/timeline_tab_bloc.dart @@ -1,6 +1,6 @@ import 'package:fedi/app/status/list/cached/status_cached_list_bloc.dart'; import 'package:fedi/app/status/status_model.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc.dart'; import 'package:fedi/app/timeline/timeline_model.dart'; import 'package:fedi/async/loading/init/async_init_loading_bloc.dart'; import 'package:fedi/disposable/disposable.dart'; @@ -16,7 +16,7 @@ abstract class ITimelineTabBloc implements IAsyncInitLoadingBloc, IDisposable { Timeline get timeline; - ITimelineLocalPreferencesBloc get timelineLocalPreferencesBloc; + ITimelineLocalPreferenceBloc get timelineLocalPreferencesBloc; String get timelineId; diff --git a/lib/app/timeline/tab/timeline_tab_bloc_impl.dart b/lib/app/timeline/tab/timeline_tab_bloc_impl.dart index 7aa2c63a5..1d5ec3245 100644 --- a/lib/app/timeline/tab/timeline_tab_bloc_impl.dart +++ b/lib/app/timeline/tab/timeline_tab_bloc_impl.dart @@ -9,8 +9,8 @@ import 'package:fedi/app/status/repository/status_repository.dart'; import 'package:fedi/app/status/status_model.dart'; import 'package:fedi/app/timeline/status/timeline_status_cached_list_bloc_impl.dart'; import 'package:fedi/app/timeline/tab/timeline_tab_bloc.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart'; import 'package:fedi/app/timeline/timeline_model.dart'; import 'package:fedi/app/web_sockets/web_sockets_handler_manager_bloc.dart'; import 'package:fedi/async/loading/init/async_init_loading_bloc_impl.dart'; @@ -32,7 +32,7 @@ class TimelineTabBloc extends AsyncInitLoadingBloc implements ITimelineTabBloc { late TimelineStatusCachedListBloc statusCachedListBloc; late IStatusCachedPaginationBloc statusCachedPaginationBloc; @override - late ITimelineLocalPreferencesBloc timelineLocalPreferencesBloc; + late ITimelineLocalPreferenceBloc timelineLocalPreferencesBloc; @override late ICachedPaginationListWithNewItemsBloc, @@ -68,7 +68,7 @@ class TimelineTabBloc extends AsyncInitLoadingBloc implements ITimelineTabBloc { }) { _logger.finest(() => "TimelineTabBloc timelineId $timelineId"); - timelineLocalPreferencesBloc = TimelineLocalPreferencesBloc.byId( + timelineLocalPreferencesBloc = TimelineLocalPreferenceBloc.byId( preferencesService, userAtHost: currentAuthInstanceBloc.currentInstance!.userAtHost, timelineId: timelineId, diff --git a/lib/app/timeline/timeline_widget.dart b/lib/app/timeline/timeline_widget.dart index b9fec6d1a..daae3cf6f 100644 --- a/lib/app/timeline/timeline_widget.dart +++ b/lib/app/timeline/timeline_widget.dart @@ -1,6 +1,6 @@ import 'package:fedi/app/status/pagination/list/status_cached_pagination_list_media_widget.dart'; import 'package:fedi/app/status/pagination/list/status_cached_pagination_list_timeline_widget.dart'; -import 'package:fedi/app/timeline/timeline_local_preferences_bloc.dart'; +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc.dart'; import 'package:fedi/app/ui/progress/fedi_circular_progress_indicator.dart'; import 'package:fedi/app/ui/theme/fedi_ui_theme_model.dart'; import 'package:fedi/collapsible/owner/collapsible_owner_widget.dart'; @@ -15,7 +15,7 @@ class TimelineWidget extends StatelessWidget { @override Widget build(BuildContext context) { var timelineLocalPreferencesBloc = - ITimelineLocalPreferencesBloc.of(context, listen: false); + ITimelineLocalPreferenceBloc.of(context, listen: false); return Container( color: IFediUiColorTheme.of(context).offWhite, diff --git a/lib/app/toast/settings/toast_settings_bloc_impl.dart b/lib/app/toast/settings/toast_settings_bloc_impl.dart index 83fe4a22f..3c199f7cf 100644 --- a/lib/app/toast/settings/toast_settings_bloc_impl.dart +++ b/lib/app/toast/settings/toast_settings_bloc_impl.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:fedi/app/push/settings/push_settings_model.dart'; -import 'package:fedi/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart'; +import 'package:fedi/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart'; import 'package:fedi/app/toast/handling_type/toast_handling_type_model.dart'; import 'package:fedi/app/toast/settings/local_preferences/toast_settings_local_preference_bloc.dart'; import 'package:fedi/app/toast/settings/toast_settings_bloc.dart'; @@ -12,7 +12,7 @@ import 'package:logging/logging.dart'; final _logger = Logger("toast_settings_bloc_impl.dart"); class ToastSettingsBloc - extends GlobalOrInstanceSettingsLocalPreferencesBloc + extends GlobalOrInstanceSettingsLocalPreferenceBloc implements IToastSettingsBloc { ToastSettingsBloc({ required IToastSettingsLocalPreferenceBloc diff --git a/lib/app/web_sockets/settings/web_sockets_settings_bloc_impl.dart b/lib/app/web_sockets/settings/web_sockets_settings_bloc_impl.dart index e13371610..cffdb6713 100644 --- a/lib/app/web_sockets/settings/web_sockets_settings_bloc_impl.dart +++ b/lib/app/web_sockets/settings/web_sockets_settings_bloc_impl.dart @@ -1,11 +1,11 @@ -import 'package:fedi/app/settings/global_or_instance/global_or_instance_settings_bloc_local_preferences_impl.dart'; +import 'package:fedi/app/settings/global_or_instance/local_preferences/global_or_instance_settings_bloc_local_preference_impl.dart'; import 'package:fedi/app/web_sockets/settings/local_preferences/web_sockets_settings_local_preference_bloc.dart'; import 'package:fedi/app/web_sockets/settings/web_sockets_settings_bloc.dart'; import 'package:fedi/app/web_sockets/settings/web_sockets_settings_model.dart'; import 'package:fedi/web_sockets/handling_type/web_sockets_handling_type_model.dart'; class WebSocketsSettingsBloc - extends GlobalOrInstanceSettingsLocalPreferencesBloc + extends GlobalOrInstanceSettingsLocalPreferenceBloc implements IWebSocketsSettingsBloc { WebSocketsSettingsBloc({ required IWebSocketsSettingsLocalPreferenceBloc diff --git a/test/app/cache/database/settings/database_cache_settings_bloc_impl_test.dart b/test/app/cache/database/settings/database_cache_settings_bloc_impl_test.dart index 298a28fb1..a37732452 100644 --- a/test/app/cache/database/settings/database_cache_settings_bloc_impl_test.dart +++ b/test/app/cache/database/settings/database_cache_settings_bloc_impl_test.dart @@ -4,8 +4,8 @@ import 'package:fedi/app/cache/database/limit/age/database_cache_age_limit_model import 'package:fedi/app/cache/database/limit/entries_count/database_cache_entries_count_limit_model.dart'; import 'package:fedi/app/cache/database/settings/database_cache_settings_bloc_impl.dart'; import 'package:fedi/app/cache/database/settings/database_cache_settings_model.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc_impl.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc_impl.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc_impl.dart'; import 'package:fedi/local_preferences/memory_local_preferences_service_impl.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -14,9 +14,9 @@ import 'database_cache_settings_model_test_helper.dart'; // ignore_for_file: no-magic-number void main() { late MemoryLocalPreferencesService memoryLocalPreferencesService; - late GlobalDatabaseCacheSettingsLocalPreferencesBloc + late GlobalDatabaseCacheSettingsLocalPreferenceBloc globalDatabaseCacheSettingsLocalPreferencesBloc; - late InstanceDatabaseCacheSettingsLocalPreferencesBloc + late InstanceDatabaseCacheSettingsLocalPreferenceBloc instanceDatabaseCacheSettingsLocalPreferencesBloc; late DatabaseCacheSettingsBloc databaseCacheSettingsBloc; @@ -27,14 +27,14 @@ void main() { setUp(() async { memoryLocalPreferencesService = MemoryLocalPreferencesService(); globalDatabaseCacheSettingsLocalPreferencesBloc = - GlobalDatabaseCacheSettingsLocalPreferencesBloc( + GlobalDatabaseCacheSettingsLocalPreferenceBloc( memoryLocalPreferencesService, ); await globalDatabaseCacheSettingsLocalPreferencesBloc.performAsyncInit(); instanceDatabaseCacheSettingsLocalPreferencesBloc = - InstanceDatabaseCacheSettingsLocalPreferencesBloc( + InstanceDatabaseCacheSettingsLocalPreferenceBloc( memoryLocalPreferencesService, userAtHost: 'user@host', ); @@ -74,7 +74,7 @@ void main() { await Future.delayed(Duration(milliseconds: 100)); var defaultValue = - GlobalDatabaseCacheSettingsLocalPreferencesBloc.defaultValue; + GlobalDatabaseCacheSettingsLocalPreferenceBloc.defaultValue; expect( listenedSettingsData?.ageLimitType, @@ -139,7 +139,7 @@ void main() { await Future.delayed(Duration(milliseconds: 100)); var defaultValue = - GlobalDatabaseCacheSettingsLocalPreferencesBloc.defaultValue; + GlobalDatabaseCacheSettingsLocalPreferenceBloc.defaultValue; expect( listenedSettingsData?.entriesCountByTypeLimitType, diff --git a/test/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc_impl_test.dart b/test/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc_impl_test.dart index 86e526646..9798e95cc 100644 --- a/test/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc_impl_test.dart +++ b/test/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc_impl_test.dart @@ -1,5 +1,5 @@ import 'package:fedi/app/cache/database/settings/database_cache_settings_model.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/global/global_database_cache_settings_local_preference_bloc_impl.dart'; import 'package:flutter_test/flutter_test.dart'; import '../../../../../../local_preferences/local_preferences_test_helper.dart'; @@ -10,11 +10,11 @@ import '../../database_cache_settings_model_test_helper.dart'; void main() { test('save & load', () async { await LocalPreferencesTestHelper.testSaveAndLoad( + GlobalDatabaseCacheSettingsLocalPreferenceBloc>( defaultValue: - GlobalDatabaseCacheSettingsLocalPreferencesBloc.defaultValue, + GlobalDatabaseCacheSettingsLocalPreferenceBloc.defaultValue, blocCreator: (localPreferencesService) => - GlobalDatabaseCacheSettingsLocalPreferencesBloc( + GlobalDatabaseCacheSettingsLocalPreferenceBloc( localPreferencesService, ), testObjectCreator: ({required String seed}) => diff --git a/test/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc_impl_test.dart b/test/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc_impl_test.dart index 3269717d4..ec08f2d73 100644 --- a/test/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc_impl_test.dart +++ b/test/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc_impl_test.dart @@ -1,5 +1,5 @@ import 'package:fedi/app/cache/database/settings/database_cache_settings_model.dart'; -import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/cache/database/settings/local_preferences/instance/instance_database_cache_settings_local_preference_bloc_impl.dart'; import 'package:flutter_test/flutter_test.dart'; import '../../../../../../local_preferences/local_preferences_test_helper.dart'; @@ -10,11 +10,11 @@ import '../../database_cache_settings_model_test_helper.dart'; void main() { test('save & load', () async { await LocalPreferencesTestHelper.testSaveAndLoad( + InstanceDatabaseCacheSettingsLocalPreferenceBloc>( defaultValue: - InstanceDatabaseCacheSettingsLocalPreferencesBloc.defaultValue, + InstanceDatabaseCacheSettingsLocalPreferenceBloc.defaultValue, blocCreator: (localPreferencesService) => - InstanceDatabaseCacheSettingsLocalPreferencesBloc( + InstanceDatabaseCacheSettingsLocalPreferenceBloc( localPreferencesService, userAtHost: 'user@host', ), diff --git a/test/app/cache/files/settings/files_cache_settings_bloc_impl_test.dart b/test/app/cache/files/settings/files_cache_settings_bloc_impl_test.dart index daee60478..23b8a8a69 100644 --- a/test/app/cache/files/settings/files_cache_settings_bloc_impl_test.dart +++ b/test/app/cache/files/settings/files_cache_settings_bloc_impl_test.dart @@ -4,8 +4,8 @@ import 'package:fedi/app/cache/files/limit/age/files_cache_age_limit_model.dart' import 'package:fedi/app/cache/files/limit/size_count/files_cache_size_count_limit_model.dart'; import 'package:fedi/app/cache/files/settings/files_cache_settings_bloc_impl.dart'; import 'package:fedi/app/cache/files/settings/files_cache_settings_model.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc_impl.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc_impl.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc_impl.dart'; import 'package:fedi/local_preferences/memory_local_preferences_service_impl.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -14,9 +14,9 @@ import 'files_cache_settings_model_test_helper.dart'; // ignore_for_file: no-magic-number void main() { late MemoryLocalPreferencesService memoryLocalPreferencesService; - late GlobalFilesCacheSettingsLocalPreferencesBloc + late GlobalFilesCacheSettingsLocalPreferenceBloc globalFilesCacheSettingsLocalPreferencesBloc; - late InstanceFilesCacheSettingsLocalPreferencesBloc + late InstanceFilesCacheSettingsLocalPreferenceBloc instanceFilesCacheSettingsLocalPreferencesBloc; late FilesCacheSettingsBloc filesCacheSettingsBloc; @@ -27,14 +27,14 @@ void main() { setUp(() async { memoryLocalPreferencesService = MemoryLocalPreferencesService(); globalFilesCacheSettingsLocalPreferencesBloc = - GlobalFilesCacheSettingsLocalPreferencesBloc( + GlobalFilesCacheSettingsLocalPreferenceBloc( memoryLocalPreferencesService, ); await globalFilesCacheSettingsLocalPreferencesBloc.performAsyncInit(); instanceFilesCacheSettingsLocalPreferencesBloc = - InstanceFilesCacheSettingsLocalPreferencesBloc( + InstanceFilesCacheSettingsLocalPreferenceBloc( memoryLocalPreferencesService, userAtHost: 'user@host', ); @@ -74,7 +74,7 @@ void main() { await Future.delayed(Duration(milliseconds: 100)); var defaultValue = - GlobalFilesCacheSettingsLocalPreferencesBloc.defaultValue; + GlobalFilesCacheSettingsLocalPreferenceBloc.defaultValue; expect( listenedSettingsData?.ageLimitType, @@ -139,7 +139,7 @@ void main() { await Future.delayed(Duration(milliseconds: 100)); var defaultValue = - GlobalFilesCacheSettingsLocalPreferencesBloc.defaultValue; + GlobalFilesCacheSettingsLocalPreferenceBloc.defaultValue; expect( listenedSettingsData?.sizeLimitCountType, diff --git a/test/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc_impl_test.dart b/test/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc_impl_test.dart index 7edaa443c..be6a39ea8 100644 --- a/test/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc_impl_test.dart +++ b/test/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc_impl_test.dart @@ -1,5 +1,5 @@ import 'package:fedi/app/cache/files/settings/files_cache_settings_model.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/global/global_files_cache_settings_local_preference_bloc_impl.dart'; import 'package:flutter_test/flutter_test.dart'; import '../../../../../../local_preferences/local_preferences_test_helper.dart'; @@ -10,10 +10,10 @@ import '../../files_cache_settings_model_test_helper.dart'; void main() { test('save & load', () async { await LocalPreferencesTestHelper.testSaveAndLoad( - defaultValue: GlobalFilesCacheSettingsLocalPreferencesBloc.defaultValue, + GlobalFilesCacheSettingsLocalPreferenceBloc>( + defaultValue: GlobalFilesCacheSettingsLocalPreferenceBloc.defaultValue, blocCreator: (localPreferencesService) => - GlobalFilesCacheSettingsLocalPreferencesBloc( + GlobalFilesCacheSettingsLocalPreferenceBloc( localPreferencesService, ), testObjectCreator: ({required String seed}) => diff --git a/test/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc_impl_test.dart b/test/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc_impl_test.dart index d3982b679..fffbecf77 100644 --- a/test/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc_impl_test.dart +++ b/test/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc_impl_test.dart @@ -1,5 +1,5 @@ import 'package:fedi/app/cache/files/settings/files_cache_settings_model.dart'; -import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/cache/files/settings/local_preferences/instance/instance_files_cache_settings_local_preference_bloc_impl.dart'; import 'package:flutter_test/flutter_test.dart'; import '../../../../../../local_preferences/local_preferences_test_helper.dart'; @@ -10,11 +10,11 @@ import '../../files_cache_settings_model_test_helper.dart'; void main() { test('save & load', () async { await LocalPreferencesTestHelper.testSaveAndLoad( + InstanceFilesCacheSettingsLocalPreferenceBloc>( defaultValue: - InstanceFilesCacheSettingsLocalPreferencesBloc.defaultValue, + InstanceFilesCacheSettingsLocalPreferenceBloc.defaultValue, blocCreator: (localPreferencesService) => - InstanceFilesCacheSettingsLocalPreferencesBloc( + InstanceFilesCacheSettingsLocalPreferenceBloc( localPreferencesService, userAtHost: 'user@host', ), diff --git a/test/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc_impl_test.dart b/test/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc_impl_test.dart new file mode 100644 index 000000000..9d30ed32a --- /dev/null +++ b/test/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc_impl_test.dart @@ -0,0 +1,26 @@ +import 'package:fedi/app/home/tab/timelines/storage/local_preferences/timelines_home_tab_storage_local_preference_bloc_impl.dart'; +import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_model.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../../../../../../local_preferences/local_preferences_test_helper.dart'; +import '../timelines_home_tab_storage_model_test_helper.dart'; + +// ignore_for_file: no-magic-number +void main() { + test('save & load', () async { + await LocalPreferencesTestHelper.testSaveAndLoad( + defaultValue: TimelinesHomeTabStorageLocalPreferenceBloc.defaultValue, + blocCreator: (localPreferencesService) => + TimelinesHomeTabStorageLocalPreferenceBloc( + localPreferencesService, + userAtHost: 'user@host', + ), + testObjectCreator: ({required String seed}) => + TimelinesHomeTabStorageModelTestHelper + .createTestTimelinesHomeTabStorage( + seed: seed, + ), + ); + }); +} diff --git a/test/app/home/tab/timelines/storage/timelines_home_tab_storage_model_test.dart b/test/app/home/tab/timelines/storage/timelines_home_tab_storage_model_test.dart new file mode 100644 index 000000000..a4f5db4da --- /dev/null +++ b/test/app/home/tab/timelines/storage/timelines_home_tab_storage_model_test.dart @@ -0,0 +1,62 @@ +import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_model.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../../../../../hive/hive_test_helper.dart'; +import '../../../../../json/json_test_helper.dart'; +import '../../../../../obj/obj_test_helper.dart'; +import 'timelines_home_tab_storage_model_test_helper.dart'; + +void main() { + test('equal & hashcode & toString', () async { + ObjTestHelper.testEqualsHashcodeToString( + ({required String seed}) => TimelinesHomeTabStorageModelTestHelper + .createTestTimelinesHomeTabStorage( + seed: seed, + ), + ); + }); + + test('toJson & fromJson', () async { + JsonTestHelper.testFromJsonToJson( + ({required String seed}) => TimelinesHomeTabStorageModelTestHelper + .createTestTimelinesHomeTabStorage( + seed: seed, + ), + TimelinesHomeTabStorage.fromJson, + ); + }); + + test('hive save&load', () async { + await HiveTestHelper.testHiveSaveAndLoad( + ({required String seed}) => TimelinesHomeTabStorageModelTestHelper + .createTestTimelinesHomeTabStorage( + seed: seed, + ), + ); + }); + + test('hive adapter', () async { + HiveTestHelper.testAdapter( + () => TimelinesHomeTabStorageAdapter(), + ); + }); + + test('TimelinesHomeTabStorage copyWith', () async { + var obj1 = TimelinesHomeTabStorageModelTestHelper + .createTestTimelinesHomeTabStorage( + seed: "seed1", + ); + var obj2 = TimelinesHomeTabStorageModelTestHelper + .createTestTimelinesHomeTabStorage( + seed: "seed2", + ); + + var obj2Obj1CopyWith = obj1.copyWith( + timelineIds: obj2.timelineIds, + ); + + expect(obj1 == obj2, false); + expect(obj2, obj2Obj1CopyWith); + expect(obj1, obj1.copyWith()); + }); +} diff --git a/test/app/home/tab/timelines/storage/timelines_home_tab_storage_model_test_helper.dart b/test/app/home/tab/timelines/storage/timelines_home_tab_storage_model_test_helper.dart new file mode 100644 index 000000000..d70415d4a --- /dev/null +++ b/test/app/home/tab/timelines/storage/timelines_home_tab_storage_model_test_helper.dart @@ -0,0 +1,12 @@ +import 'package:fedi/app/home/tab/timelines/storage/timelines_home_tab_storage_model.dart'; + +// ignore_for_file: no-magic-number +class TimelinesHomeTabStorageModelTestHelper { + static TimelinesHomeTabStorage createTestTimelinesHomeTabStorage({ + required String seed, + }) => + TimelinesHomeTabStorage(timelineIds: [ + seed + "1", + seed + "2", + ]); +} diff --git a/test/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc_impl_test.dart b/test/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc_impl_test.dart index 341c415d0..b46c4588c 100644 --- a/test/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc_impl_test.dart +++ b/test/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc_impl_test.dart @@ -1,5 +1,5 @@ -import 'package:fedi/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc_impl.dart'; -import 'package:fedi/app/localization/settings/local_preference/localization_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc_impl.dart'; +import 'package:fedi/app/localization/settings/local_preferences/localization_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/localization/settings/localization_settings_model.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/test/app/localization/settings/localization_settings_bloc_impl_test.dart b/test/app/localization/settings/localization_settings_bloc_impl_test.dart index 4393e9e3e..cd989c078 100644 --- a/test/app/localization/settings/localization_settings_bloc_impl_test.dart +++ b/test/app/localization/settings/localization_settings_bloc_impl_test.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:fedi/app/localization/settings/local_preference/global/global_localization_settings_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/localization/settings/local_preferences/global/global_localization_settings_local_preference_bloc_impl.dart'; import 'package:fedi/app/localization/settings/localization_settings_bloc_impl.dart'; import 'package:fedi/app/localization/settings/localization_settings_model.dart'; import 'package:fedi/local_preferences/memory_local_preferences_service_impl.dart'; diff --git a/test/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc_impl_test.dart b/test/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc_impl_test.dart similarity index 69% rename from test/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc_impl_test.dart rename to test/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc_impl_test.dart index d2d9896db..8897bd0b6 100644 --- a/test/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc_impl_test.dart +++ b/test/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc_impl_test.dart @@ -1,4 +1,4 @@ -import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preferences_bloc_impl.dart'; +import 'package:fedi/app/push/fcm/asked/local_preferences/fcm_push_permission_asked_local_preference_bloc_impl.dart'; import 'package:flutter_test/flutter_test.dart'; import '../../../../../local_preferences/local_preferences_test_helper.dart'; @@ -7,10 +7,10 @@ import '../../../../../local_preferences/local_preferences_test_helper.dart'; void main() { test('save & load', () async { await LocalPreferencesTestHelper.testSaveAndLoad( - defaultValue: FcmPushPermissionAskedLocalPreferencesBloc.defaultValue, + FcmPushPermissionAskedLocalPreferenceBloc>( + defaultValue: FcmPushPermissionAskedLocalPreferenceBloc.defaultValue, blocCreator: (localPreferencesService) => - FcmPushPermissionAskedLocalPreferencesBloc( + FcmPushPermissionAskedLocalPreferenceBloc( localPreferencesService, userAtHost: 'user@host', ), diff --git a/test/app/push/settings/local_preferences/instance/instance_push_settings_local_preferences_bloc_impl_test.dart b/test/app/push/settings/local_preferences/instance/instance_push_settings_local_preference_bloc_impl_test.dart similarity index 100% rename from test/app/push/settings/local_preferences/instance/instance_push_settings_local_preferences_bloc_impl_test.dart rename to test/app/push/settings/local_preferences/instance/instance_push_settings_local_preference_bloc_impl_test.dart diff --git a/test/app/timeline/local_preferences/timeline_local_preference_bloc_impl_test.dart b/test/app/timeline/local_preferences/timeline_local_preference_bloc_impl_test.dart new file mode 100644 index 000000000..30e34840e --- /dev/null +++ b/test/app/timeline/local_preferences/timeline_local_preference_bloc_impl_test.dart @@ -0,0 +1,38 @@ +import 'package:fedi/app/timeline/local_preferences/timeline_local_preference_bloc_impl.dart'; +import 'package:fedi/app/timeline/settings/timeline_settings_model.dart'; +import 'package:fedi/app/timeline/timeline_model.dart'; +import 'package:fedi/app/timeline/type/timeline_type_model.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../../../local_preferences/local_preferences_test_helper.dart'; +import '../timeline_model_test_helper.dart'; + +// ignore_for_file: no-magic-number + +void main() { + test('save & load', () async { + var timelineId = "timelineId"; + var defaultPreferenceValue = Timeline( + typeString: TimelineType.public.toJsonValue(), + settings: TimelineSettings.createDefaultHomeSettings(), + id: timelineId, + label: 'label', + isPossibleToDelete: false, + ); + await LocalPreferencesTestHelper.testSaveAndLoad( + defaultValue: defaultPreferenceValue, + blocCreator: (localPreferencesService) => + TimelineLocalPreferenceBloc.byId( + localPreferencesService, + userAtHost: 'user@host', + defaultPreferenceValue: defaultPreferenceValue, + timelineId: timelineId, + ), + testObjectCreator: ({required String seed}) => + TimelineModelTestHelper.createTestTimeline( + seed: seed, + ), + ); + }); +} diff --git a/test/app/timeline/settings/timeline_settings_model_test.dart b/test/app/timeline/settings/timeline_settings_model_test.dart new file mode 100644 index 000000000..bd06fa59a --- /dev/null +++ b/test/app/timeline/settings/timeline_settings_model_test.dart @@ -0,0 +1,43 @@ +import 'package:fedi/app/timeline/settings/timeline_settings_model.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../../../hive/hive_test_helper.dart'; +import '../../../json/json_test_helper.dart'; +import '../../../obj/obj_test_helper.dart'; +import 'timeline_settings_model_test_helper.dart'; + +void main() { + test('equal & hashcode & toString', () async { + ObjTestHelper.testEqualsHashcodeToString( + ({required String seed}) => + TimelineSettingsModelTestHelper.createTestTimelineSettings( + seed: seed, + ), + ); + }); + + test('toJson & fromJson', () async { + JsonTestHelper.testFromJsonToJson( + ({required String seed}) => + TimelineSettingsModelTestHelper.createTestTimelineSettings( + seed: seed, + ), + TimelineSettings.fromJson, + ); + }); + + test('hive save&load', () async { + await HiveTestHelper.testHiveSaveAndLoad( + ({required String seed}) => + TimelineSettingsModelTestHelper.createTestTimelineSettings( + seed: seed, + ), + ); + }); + + test('hive adapter', () async { + HiveTestHelper.testAdapter( + () => TimelineSettingsAdapter(), + ); + }); +} diff --git a/test/app/timeline/settings/timeline_settings_model_test_helper.dart b/test/app/timeline/settings/timeline_settings_model_test_helper.dart new file mode 100644 index 000000000..3d17d3e2b --- /dev/null +++ b/test/app/timeline/settings/timeline_settings_model_test_helper.dart @@ -0,0 +1,43 @@ +import 'package:fedi/app/timeline/settings/timeline_settings_model.dart'; +import 'package:fedi/pleroma/api/timeline/pleroma_api_timeline_model.dart'; + +import '../../../enum/enum_test_helper.dart'; +import '../../../pleroma/api/account/pleroma_api_account_test_helper.dart'; +import '../../../pleroma/api/list/pleroma_api_list_test_helper.dart'; + +// ignore_for_file: no-magic-number +class TimelineSettingsModelTestHelper { + static TimelineSettings createTestTimelineSettings({ + required String seed, + }) => + TimelineSettings( + onlyWithMedia: seed.hashCode % 2 == 0, + excludeReplies: seed.hashCode % 2 == 1, + excludeNsfwSensitive: seed.hashCode % 2 == 0, + onlyRemote: seed.hashCode % 2 == 1, + onlyLocal: seed.hashCode % 2 == 0, + withMuted: seed.hashCode % 2 == 1, + excludeVisibilitiesStrings: [ + EnumTestHelper.createTestEnum( + seed: seed + "1", + values: PleromaApiReplyVisibilityFilter.values) + .toJsonValue(), + EnumTestHelper.createTestEnum( + seed: seed + "2", + values: PleromaApiReplyVisibilityFilter.values) + .toJsonValue(), + ], + onlyInRemoteList: + PleromaApiListTestHelper.createTestPleromaApiList(seed: seed), + withRemoteHashtag: seed + "withRemoteHashtag", + replyVisibilityFilterString: EnumTestHelper.createTestEnum( + seed: seed, values: PleromaApiReplyVisibilityFilter.values) + .toJsonValue(), + onlyFromRemoteAccount: + PleromaApiAccountTestHelper.createTestPleromaApiAccount(seed: seed), + onlyPinned: seed.hashCode % 2 == 0, + excludeReblogs: seed.hashCode % 2 == 1, + webSocketsUpdates: seed.hashCode % 2 == 0, + onlyFromInstance: seed + "onlyFromInstance", + ); +} diff --git a/test/app/timeline/timeline_model_test.dart b/test/app/timeline/timeline_model_test.dart new file mode 100644 index 000000000..3015c3ead --- /dev/null +++ b/test/app/timeline/timeline_model_test.dart @@ -0,0 +1,40 @@ +import 'package:fedi/app/timeline/timeline_model.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../../hive/hive_test_helper.dart'; +import '../../json/json_test_helper.dart'; +import '../../obj/obj_test_helper.dart'; +import 'timeline_model_test_helper.dart'; + +void main() { + test('equal & hashcode & toString', () async { + ObjTestHelper.testEqualsHashcodeToString( + ({required String seed}) => TimelineModelTestHelper.createTestTimeline( + seed: seed, + ), + ); + }); + + test('toJson & fromJson', () async { + JsonTestHelper.testFromJsonToJson( + ({required String seed}) => TimelineModelTestHelper.createTestTimeline( + seed: seed, + ), + Timeline.fromJson, + ); + }); + + test('hive save&load', () async { + await HiveTestHelper.testHiveSaveAndLoad( + ({required String seed}) => TimelineModelTestHelper.createTestTimeline( + seed: seed, + ), + ); + }); + + test('hive adapter', () async { + HiveTestHelper.testAdapter( + () => TimelineAdapter(), + ); + }); +} diff --git a/test/app/timeline/timeline_model_test_helper.dart b/test/app/timeline/timeline_model_test_helper.dart new file mode 100644 index 000000000..52e473cc2 --- /dev/null +++ b/test/app/timeline/timeline_model_test_helper.dart @@ -0,0 +1,22 @@ +import 'package:fedi/app/timeline/timeline_model.dart'; +import 'package:fedi/app/timeline/type/timeline_type_model.dart'; + +import '../../enum/enum_test_helper.dart'; +import 'settings/timeline_settings_model_test_helper.dart'; + +// ignore_for_file: no-magic-number +class TimelineModelTestHelper { + + static Timeline createTestTimeline({ + required String seed, + }) => + Timeline( + id: seed + "id", + typeString: EnumTestHelper.createTestEnum( + seed: seed, values: TimelineType.values) + .toJsonValue(), + settings: TimelineSettingsModelTestHelper.createTestTimelineSettings(seed: seed), + label: seed + "label", + isPossibleToDelete: seed.hashCode % 2 == 0, + ); +}