diff --git a/packages/neon/neon_news/lib/options.dart b/packages/neon/neon_news/lib/options.dart index f8ee290e..03cb1fb0 100644 --- a/packages/neon/neon_news/lib/options.dart +++ b/packages/neon/neon_news/lib/options.dart @@ -1,7 +1,7 @@ part of 'neon_news.dart'; class NewsAppSpecificOptions extends NextcloudAppOptions { - NewsAppSpecificOptions(super.storage, final NeonPlatform platform) { + NewsAppSpecificOptions(super.storage, this._platform) { super.categories = [ generalCategory, articlesCategory, @@ -21,18 +21,10 @@ class NewsAppSpecificOptions extends NextcloudAppOptions { feedsSortPropertyOption, feedsSortBoxOrderOption, ]; - - articleViewTypeOption.values = { - ArticleViewType.direct: (final context) => AppLocalizations.of(context).optionsArticleViewTypeDirect, - if (platform.canUseWebView) ...{ - ArticleViewType.internalBrowser: (final context) => - AppLocalizations.of(context).optionsArticleViewTypeInternalBrowser, - }, - ArticleViewType.externalBrowser: (final context) => - AppLocalizations.of(context).optionsArticleViewTypeExternalBrowser, - }; } + final NeonPlatform _platform; + final generalCategory = OptionsCategory( name: (final context) => AppLocalizations.of(context).general, ); @@ -68,7 +60,14 @@ class NewsAppSpecificOptions extends NextcloudAppOptions { key: 'article-view-type', label: (final context) => AppLocalizations.of(context).optionsArticleViewType, defaultValue: ArticleViewType.direct, - values: {}, + values: { + ArticleViewType.direct: (final context) => AppLocalizations.of(context).optionsArticleViewTypeDirect, + if (_platform.canUseWebView) + ArticleViewType.internalBrowser: (final context) => + AppLocalizations.of(context).optionsArticleViewTypeInternalBrowser, + ArticleViewType.externalBrowser: (final context) => + AppLocalizations.of(context).optionsArticleViewTypeExternalBrowser, + }, ); late final articleDisableMarkAsReadTimeoutOption = ToggleOption(