Skip to content

Commit

Permalink
more local preferences tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xal committed May 2, 2021
1 parent 1f30503 commit 41f4cab
Show file tree
Hide file tree
Showing 73 changed files with 547 additions and 264 deletions.
2 changes: 1 addition & 1 deletion lib/app/account/action/mute/account_action_mute_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract class IAccountActionMuteBloc implements IDisposable {
}) =>
Provider.of<IAccountActionMuteBloc>(context, listen: listen);

IAccount? get accountForMute;
IAccount get accountForMute;

IBoolValueFormFieldBloc get notificationsBoolFieldBloc;
IDurationDateTimeValueFormFieldBloc get expireDurationFieldBloc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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<IFcmPushPermissionAskedLocalPreferencesBloc>(
.asyncInitAndRegister<IFcmPushPermissionAskedLocalPreferenceBloc>(
fcmPushPermissionAskedLocalPreferencesBloc,
);

Expand Down Expand Up @@ -499,13 +499,13 @@ class CurrentAuthInstanceContextBloc extends ProviderContextBloc
);

var timelinesHomeTabStorageLocalPreferencesBloc =
TimelinesHomeTabStorageLocalPreferencesBloc(
TimelinesHomeTabStorageLocalPreferenceBloc(
preferencesService,
userAtHost: userAtHost,
);
addDisposable(disposable: timelinesHomeTabStorageLocalPreferencesBloc);
await globalProviderService
.asyncInitAndRegister<ITimelinesHomeTabStorageLocalPreferencesBloc>(
.asyncInitAndRegister<ITimelinesHomeTabStorageLocalPreferenceBloc>(
timelinesHomeTabStorageLocalPreferencesBloc,
);

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -747,25 +747,25 @@ class CurrentAuthInstanceContextBloc extends ProviderContextBloc
addDisposable(disposable: instancePaginationSettingsLocalPreferencesBloc);

var instanceFilesCacheSettingsLocalPreferencesBloc =
InstanceFilesCacheSettingsLocalPreferencesBloc(
InstanceFilesCacheSettingsLocalPreferenceBloc(
preferencesService,
userAtHost: userAtHost,
);

await globalProviderService
.asyncInitAndRegister<IInstanceFilesCacheSettingsLocalPreferencesBloc>(
.asyncInitAndRegister<IInstanceFilesCacheSettingsLocalPreferenceBloc>(
instanceFilesCacheSettingsLocalPreferencesBloc,
);
addDisposable(disposable: instanceFilesCacheSettingsLocalPreferencesBloc);

var instanceDatabaseCacheSettingsLocalPreferencesBloc =
InstanceDatabaseCacheSettingsLocalPreferencesBloc(
InstanceDatabaseCacheSettingsLocalPreferenceBloc(
preferencesService,
userAtHost: userAtHost,
);

await globalProviderService.asyncInitAndRegister<
IInstanceDatabaseCacheSettingsLocalPreferencesBloc>(
IInstanceDatabaseCacheSettingsLocalPreferenceBloc>(
instanceDatabaseCacheSettingsLocalPreferencesBloc,
);
addDisposable(
Expand Down Expand Up @@ -849,7 +849,7 @@ class CurrentAuthInstanceContextBloc extends ProviderContextBloc
instanceLocalPreferencesBloc:
instanceDatabaseCacheSettingsLocalPreferencesBloc,
globalLocalPreferencesBloc: appContextBloc
.get<IGlobalDatabaseCacheSettingsLocalPreferencesBloc>(),
.get<IGlobalDatabaseCacheSettingsLocalPreferenceBloc>(),
);

await globalProviderService.asyncInitAndRegister<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<DatabaseCacheSettings>
extends GlobalOrInstanceSettingsLocalPreferenceBloc<DatabaseCacheSettings>
implements IDatabaseCacheSettingsBloc {
DatabaseCacheSettingsBloc({
required IDatabaseCacheSettingsLocalPreferencesBloc<DatabaseCacheSettings>
required IDatabaseCacheSettingsLocalPreferenceBloc<DatabaseCacheSettings>
globalLocalPreferencesBloc,
required IDatabaseCacheSettingsLocalPreferencesBloc<DatabaseCacheSettings?>
required IDatabaseCacheSettingsLocalPreferenceBloc<DatabaseCacheSettings?>
instanceLocalPreferencesBloc,
}) : super(
globalLocalPreferencesBloc: globalLocalPreferencesBloc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -22,12 +22,12 @@ void showEditGlobalDatabaseCacheSettingsDialog({
child: DisposableProvider<IDatabaseCacheSettingsBloc>(
create: (context) => DatabaseCacheSettingsBloc(
instanceLocalPreferencesBloc:
IInstanceDatabaseCacheSettingsLocalPreferencesBloc.of(
IInstanceDatabaseCacheSettingsLocalPreferenceBloc.of(
context,
listen: false,
),
globalLocalPreferencesBloc:
IGlobalDatabaseCacheSettingsLocalPreferencesBloc.of(
IGlobalDatabaseCacheSettingsLocalPreferenceBloc.of(
context,
listen: false,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> {
static IDatabaseCacheSettingsLocalPreferencesBloc of(
static IDatabaseCacheSettingsLocalPreferenceBloc of(
BuildContext context, {
bool listen = true,
}) =>
Provider.of<IDatabaseCacheSettingsLocalPreferencesBloc>(
Provider.of<IDatabaseCacheSettingsLocalPreferenceBloc>(
context,
listen: listen,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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<T>
implements IDatabaseCacheSettingsLocalPreferencesBloc<T> {
DatabaseCacheSettingsLocalPreferencesBloc(
implements IDatabaseCacheSettingsLocalPreferenceBloc<T> {
DatabaseCacheSettingsLocalPreferenceBloc(
ILocalPreferencesService preferencesService,
String key,
) : super(
Expand Down
Original file line number Diff line number Diff line change
@@ -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<DatabaseCacheSettings> {
static IGlobalDatabaseCacheSettingsLocalPreferencesBloc of(
abstract class IGlobalDatabaseCacheSettingsLocalPreferenceBloc
implements IDatabaseCacheSettingsLocalPreferenceBloc<DatabaseCacheSettings> {
static IGlobalDatabaseCacheSettingsLocalPreferenceBloc of(
BuildContext context, {
bool listen = true,
}) =>
Provider.of<IGlobalDatabaseCacheSettingsLocalPreferencesBloc>(
Provider.of<IGlobalDatabaseCacheSettingsLocalPreferenceBloc>(
context,
listen: listen,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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<DatabaseCacheSettings>
implements IGlobalDatabaseCacheSettingsLocalPreferencesBloc {
class GlobalDatabaseCacheSettingsLocalPreferenceBloc
extends DatabaseCacheSettingsLocalPreferenceBloc<DatabaseCacheSettings>
implements IGlobalDatabaseCacheSettingsLocalPreferenceBloc {
static final defaultValue = DatabaseCacheSettings.fromEnum(
entriesCountByTypeLimitType:
DatabaseCacheEntriesCountByTypeLimitType.notSet,
ageLimitType: DatabaseCacheAgeLimitType.notSet,
);

GlobalDatabaseCacheSettingsLocalPreferencesBloc(
GlobalDatabaseCacheSettingsLocalPreferenceBloc(
ILocalPreferencesService preferencesService,
) : super(
preferencesService,
Expand Down
Original file line number Diff line number Diff line change
@@ -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<DatabaseCacheSettings?> {
static IInstanceDatabaseCacheSettingsLocalPreferencesBloc of(
abstract class IInstanceDatabaseCacheSettingsLocalPreferenceBloc
implements IDatabaseCacheSettingsLocalPreferenceBloc<DatabaseCacheSettings?> {
static IInstanceDatabaseCacheSettingsLocalPreferenceBloc of(
BuildContext context, {
bool listen = true,
}) =>
Provider.of<IInstanceDatabaseCacheSettingsLocalPreferencesBloc>(
Provider.of<IInstanceDatabaseCacheSettingsLocalPreferenceBloc>(
context,
listen: listen,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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<DatabaseCacheSettings?>
implements IInstanceDatabaseCacheSettingsLocalPreferencesBloc {
InstanceDatabaseCacheSettingsLocalPreferencesBloc(
class InstanceDatabaseCacheSettingsLocalPreferenceBloc
extends DatabaseCacheSettingsLocalPreferenceBloc<DatabaseCacheSettings?>
implements IInstanceDatabaseCacheSettingsLocalPreferenceBloc {
InstanceDatabaseCacheSettingsLocalPreferenceBloc(
ILocalPreferencesService preferencesService, {
required String userAtHost,
}) : super(
Expand Down
Loading

0 comments on commit 41f4cab

Please sign in to comment.