You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
48 lines
1.1 KiB
part of '../neon.dart'; |
|
|
|
class AccountSpecificOptions { |
|
AccountSpecificOptions( |
|
this._storage, |
|
this._appsBloc, |
|
) { |
|
_appsBloc.appImplementations.listen((final result) { |
|
if (result.data != null) { |
|
_appIDsSubject.add({ |
|
null: (final context) => AppLocalizations.of(context).accountOptionsAutomatic, |
|
for (final app in result.data!) ...{ |
|
app.id: app.name, |
|
}, |
|
}); |
|
} |
|
}); |
|
} |
|
|
|
final AppStorage _storage; |
|
final AppsBloc _appsBloc; |
|
final _appIDsSubject = BehaviorSubject<Map<String?, LabelBuilder>>(); |
|
|
|
late final List<Option> options = [ |
|
initialApp, |
|
]; |
|
|
|
Future reset() async { |
|
for (final option in options) { |
|
await option.reset(); |
|
} |
|
} |
|
|
|
void dispose() { |
|
unawaited(_appIDsSubject.close()); |
|
for (final option in options) { |
|
option.dispose(); |
|
} |
|
} |
|
|
|
late final initialApp = SelectOption<String?>( |
|
storage: _storage, |
|
key: 'initial-app', |
|
label: (final context) => AppLocalizations.of(context).accountOptionsInitialApp, |
|
defaultValue: BehaviorSubject.seeded(null), |
|
values: _appIDsSubject, |
|
); |
|
}
|
|
|