Browse Source

refactor(neon): remove unused SharedPreferences references

Signed-off-by: Nikolas Rimikis <rimikis.nikolas@gmail.com>
pull/654/head
Nikolas Rimikis 1 year ago
parent
commit
6f7958e979
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 6
      packages/neon/neon/lib/neon.dart
  2. 3
      packages/neon/neon/lib/src/blocs/accounts.dart
  3. 3
      packages/neon/neon/lib/src/blocs/push_notifications.dart
  4. 3
      packages/neon/neon/lib/src/utils/global_options.dart
  5. 1
      packages/neon/neon/lib/src/utils/push_utils.dart

6
packages/neon/neon/lib/neon.dart

@ -42,12 +42,10 @@ Future runNeon({
buildUserAgent(packageInfo); buildUserAgent(packageInfo);
final globalOptions = GlobalOptions( final globalOptions = GlobalOptions(
sharedPreferences,
packageInfo, packageInfo,
); );
final accountsBloc = AccountsBloc( final accountsBloc = AccountsBloc(
sharedPreferences,
globalOptions, globalOptions,
allAppImplementations, allAppImplementations,
); );
@ -58,7 +56,6 @@ Future runNeon({
} }
final pushNotificationsBloc = PushNotificationsBloc( final pushNotificationsBloc = PushNotificationsBloc(
accountsBloc, accountsBloc,
sharedPreferences,
globalOptions, globalOptions,
); );
final firstLaunchBloc = FirstLaunchBloc( final firstLaunchBloc = FirstLaunchBloc(
@ -73,9 +70,6 @@ Future runNeon({
runApp( runApp(
MultiProvider( MultiProvider(
providers: [ providers: [
Provider<SharedPreferences>(
create: (final _) => sharedPreferences,
),
Provider<GlobalOptions>( Provider<GlobalOptions>(
create: (final _) => globalOptions, create: (final _) => globalOptions,
), ),

3
packages/neon/neon/lib/src/blocs/accounts.dart

@ -14,7 +14,6 @@ import 'package:neon/src/settings/models/storage.dart';
import 'package:neon/src/utils/account_options.dart'; import 'package:neon/src/utils/account_options.dart';
import 'package:neon/src/utils/global_options.dart'; import 'package:neon/src/utils/global_options.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
import 'package:shared_preferences/shared_preferences.dart';
const _keyAccounts = 'accounts'; const _keyAccounts = 'accounts';
@ -56,7 +55,6 @@ abstract interface class AccountsBlocStates {
class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocStates { class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocStates {
AccountsBloc( AccountsBloc(
this._sharedPreferences,
this._globalOptions, this._globalOptions,
this._allAppImplementations, this._allAppImplementations,
) { ) {
@ -97,7 +95,6 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState
} }
late final AppStorage _storage = AppStorage('accounts'); late final AppStorage _storage = AppStorage('accounts');
final SharedPreferences _sharedPreferences;
final GlobalOptions _globalOptions; final GlobalOptions _globalOptions;
final Iterable<AppImplementation> _allAppImplementations; final Iterable<AppImplementation> _allAppImplementations;
final _keyLastUsedAccount = 'last-used-account'; final _keyLastUsedAccount = 'last-used-account';

3
packages/neon/neon/lib/src/blocs/push_notifications.dart

@ -13,7 +13,6 @@ import 'package:neon/src/settings/models/storage.dart';
import 'package:neon/src/utils/global_options.dart'; import 'package:neon/src/utils/global_options.dart';
import 'package:neon/src/utils/push_utils.dart'; import 'package:neon/src/utils/push_utils.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unifiedpush/unifiedpush.dart'; import 'package:unifiedpush/unifiedpush.dart';
abstract class PushNotificationsBlocEvents {} abstract class PushNotificationsBlocEvents {}
@ -26,7 +25,6 @@ abstract class PushNotificationsBlocStates {
class PushNotificationsBloc extends Bloc implements PushNotificationsBlocEvents, PushNotificationsBlocStates { class PushNotificationsBloc extends Bloc implements PushNotificationsBlocEvents, PushNotificationsBlocStates {
PushNotificationsBloc( PushNotificationsBloc(
this._accountsBloc, this._accountsBloc,
this._sharedPreferences,
this._globalOptions, this._globalOptions,
) { ) {
if (NeonPlatform.instance.canUsePushNotifications) { if (NeonPlatform.instance.canUsePushNotifications) {
@ -39,7 +37,6 @@ class PushNotificationsBloc extends Bloc implements PushNotificationsBlocEvents,
} }
final AccountsBloc _accountsBloc; final AccountsBloc _accountsBloc;
final SharedPreferences _sharedPreferences;
late final _storage = AppStorage(AppIDs.notifications); late final _storage = AppStorage(AppIDs.notifications);
final GlobalOptions _globalOptions; final GlobalOptions _globalOptions;

3
packages/neon/neon/lib/src/utils/global_options.dart

@ -11,7 +11,6 @@ import 'package:neon/src/settings/models/storage.dart';
import 'package:neon/src/settings/models/toggle_option.dart'; import 'package:neon/src/settings/models/toggle_option.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart';
const unifiedPushNextPushID = 'org.unifiedpush.distributor.nextpush'; const unifiedPushNextPushID = 'org.unifiedpush.distributor.nextpush';
@ -19,7 +18,6 @@ const unifiedPushNextPushID = 'org.unifiedpush.distributor.nextpush';
@immutable @immutable
class GlobalOptions { class GlobalOptions {
GlobalOptions( GlobalOptions(
this._sharedPreferences,
this._packageInfo, this._packageInfo,
) { ) {
pushNotificationsEnabled.addListener(_pushNotificationsEnabledListener); pushNotificationsEnabled.addListener(_pushNotificationsEnabledListener);
@ -51,7 +49,6 @@ class GlobalOptions {
} }
} }
final SharedPreferences _sharedPreferences;
late final AppStorage _storage = AppStorage('global'); late final AppStorage _storage = AppStorage('global');
final PackageInfo _packageInfo; final PackageInfo _packageInfo;

1
packages/neon/neon/lib/src/utils/push_utils.dart

@ -18,7 +18,6 @@ import 'package:neon/src/theme/colors.dart';
import 'package:neon/src/utils/global.dart'; import 'package:neon/src/utils/global.dart';
import 'package:neon/src/utils/localizations.dart'; import 'package:neon/src/utils/localizations.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
import 'package:shared_preferences/shared_preferences.dart';
@internal @internal
@immutable @immutable

Loading…
Cancel
Save