Browse Source

fix(neon_news): NewsAppSpecificOptions.articleViewTypeOption persistence

Force loading wasn't an option as the generic is not a String
pull/524/head
Nikolas Rimikis 1 year ago
parent
commit
6cde7748a3
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 23
      packages/neon/neon_news/lib/options.dart

23
packages/neon/neon_news/lib/options.dart

@ -1,7 +1,7 @@
part of 'neon_news.dart'; part of 'neon_news.dart';
class NewsAppSpecificOptions extends NextcloudAppOptions { class NewsAppSpecificOptions extends NextcloudAppOptions {
NewsAppSpecificOptions(super.storage, final NeonPlatform platform) { NewsAppSpecificOptions(super.storage, this._platform) {
super.categories = [ super.categories = [
generalCategory, generalCategory,
articlesCategory, articlesCategory,
@ -21,18 +21,10 @@ class NewsAppSpecificOptions extends NextcloudAppOptions {
feedsSortPropertyOption, feedsSortPropertyOption,
feedsSortBoxOrderOption, 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( final generalCategory = OptionsCategory(
name: (final context) => AppLocalizations.of(context).general, name: (final context) => AppLocalizations.of(context).general,
); );
@ -68,7 +60,14 @@ class NewsAppSpecificOptions extends NextcloudAppOptions {
key: 'article-view-type', key: 'article-view-type',
label: (final context) => AppLocalizations.of(context).optionsArticleViewType, label: (final context) => AppLocalizations.of(context).optionsArticleViewType,
defaultValue: ArticleViewType.direct, 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( late final articleDisableMarkAsReadTimeoutOption = ToggleOption(

Loading…
Cancel
Save