Browse Source

Merge pull request #638 from nextcloud/refactor/neon/app_implementation

refactor(neon): refine visibility of some AppImplementation attributes
pull/643/head
Nikolas Rimikis 1 year ago committed by GitHub
parent
commit
76a5e8f004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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