Skip to content

Commit

Permalink
Merge pull request #524 from Leptopoda/fix/news_option_persistence
Browse files Browse the repository at this point in the history
fix(neon_news): NewsAppSpecificOptions.articleViewTypeOption persistence
  • Loading branch information
Leptopoda authored Aug 4, 2023
2 parents 185f749 + 6cde774 commit 706a0ba
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions packages/neon/neon_news/lib/options.dart
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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,
);
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 706a0ba

Please sign in to comment.