Browse Source

neon: Move storage initialization to blocs

pull/256/head
jld3103 2 years ago
parent
commit
6bca60ca97
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 3
      packages/neon/neon/lib/neon.dart
  2. 3
      packages/neon/neon/lib/src/blocs/accounts.dart
  3. 5
      packages/neon/neon/lib/src/utils/global_options.dart

3
packages/neon/neon/lib/neon.dart

@ -130,14 +130,13 @@ Future runNeon({
final packageInfo = await PackageInfo.fromPlatform();
final globalOptions = GlobalOptions(
AppStorage('global', sharedPreferences),
sharedPreferences,
packageInfo,
);
final accountsBloc = AccountsBloc(
requestManager,
platform,
AppStorage('accounts', sharedPreferences),
sharedPreferences,
globalOptions,
allAppImplementations,

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

@ -16,7 +16,6 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState
AccountsBloc(
this._requestManager,
this._platform,
this._storage,
this._sharedPreferences,
this._globalOptions,
this._allAppImplementations,
@ -53,7 +52,7 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState
final RequestManager _requestManager;
final NeonPlatform _platform;
final AppStorage _storage;
late final AppStorage _storage = AppStorage('accounts', _sharedPreferences);
final SharedPreferences _sharedPreferences;
final GlobalOptions _globalOptions;
final List<AppImplementation> _allAppImplementations;

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

@ -4,7 +4,7 @@ const unifiedPushNextPushID = 'org.unifiedpush.distributor.nextpush';
class GlobalOptions {
GlobalOptions(
this._storage,
this._sharedPreferences,
this._packageInfo,
) {
themeMode.stream.listen((final value) {
@ -47,7 +47,8 @@ class GlobalOptions {
});
}
final AppStorage _storage;
final SharedPreferences _sharedPreferences;
late final AppStorage _storage = AppStorage('global', _sharedPreferences);
final PackageInfo _packageInfo;
final _themeOLEDAsDarkEnabledSubject = BehaviorSubject<bool>();
final _pushNotificationsEnabledEnabledSubject = BehaviorSubject<bool>();

Loading…
Cancel
Save