Browse Source

refactor(neon): refine visibility of some AppImplementation attributes

Signed-off-by: Nikolas Rimikis <rimikis.nikolas@gmail.com>
pull/639/head
Nikolas Rimikis 1 year ago
parent
commit
af548313ee
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 4
      packages/neon/neon/lib/src/blocs/apps.dart
  2. 10
      packages/neon/neon/lib/src/models/app_implementation.dart

4
packages/neon/neon/lib/src/blocs/apps.dart

@ -165,9 +165,7 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates
unawaited(appVersions.close());
for (final app in _allAppImplementations) {
for (final bloc in app.blocs.values) {
bloc.dispose();
}
app.dispose();
}
}

10
packages/neon/neon/lib/src/models/app_implementation.dart

@ -29,12 +29,15 @@ abstract class AppImplementation<T extends Bloc, R extends NextcloudAppOptions>
String name(final BuildContext context) => nameFromLocalization(AppLocalizations.of(context));
late final R options;
@protected
R buildOptions(final AppStorage storage);
final Map<String, T> blocs = {};
final Map<String, T> _blocs = {};
T getBloc(final Account account) => blocs[account.id] ??= buildBloc(account);
T getBloc(final Account account) => _blocs[account.id] ??= buildBloc(account);
@protected
T buildBloc(final Account account);
Provider<T> get blocProvider => Provider<T>(
@ -107,6 +110,9 @@ abstract class AppImplementation<T extends Bloc, R extends NextcloudAppOptions>
void dispose() {
options.dispose();
for (final bloc in _blocs.values) {
bloc.dispose();
}
}
/// A custom theme that will be injected into the widget tree.

Loading…
Cancel
Save