A framework for building convergent cross-platform Nextcloud clients using Flutter.
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.

209 lines
7.0 KiB

part of 'neon_news.dart';
2 years ago
class NewsAppSpecificOptions extends NextcloudAppOptions {
NewsAppSpecificOptions(super.storage, this._platform) {
2 years ago
super.categories = [
generalCategory,
articlesCategory,
foldersCategory,
feedsCategory,
];
super.options = [
defaultCategoryOption,
articleViewTypeOption,
articleDisableMarkAsReadTimeoutOption,
2 years ago
defaultArticlesFilterOption,
articlesSortPropertyOption,
articlesSortBoxOrderOption,
foldersSortPropertyOption,
foldersSortBoxOrderOption,
defaultFolderViewTypeOption,
feedsSortPropertyOption,
feedsSortBoxOrderOption,
];
}
final NeonPlatform _platform;
2 years ago
final generalCategory = OptionsCategory(
name: (final context) => AppLocalizations.of(context).general,
2 years ago
);
final articlesCategory = OptionsCategory(
name: (final context) => AppLocalizations.of(context).articles,
2 years ago
);
final foldersCategory = OptionsCategory(
name: (final context) => AppLocalizations.of(context).folders,
2 years ago
);
final feedsCategory = OptionsCategory(
name: (final context) => AppLocalizations.of(context).feeds,
2 years ago
);
late final defaultCategoryOption = SelectOption<DefaultCategory>(
storage: super.storage,
category: generalCategory,
key: 'default-category',
label: (final context) => AppLocalizations.of(context).optionsDefaultCategory,
defaultValue: DefaultCategory.articles,
values: {
DefaultCategory.articles: (final context) => AppLocalizations.of(context).articles,
DefaultCategory.folders: (final context) => AppLocalizations.of(context).folders,
DefaultCategory.feeds: (final context) => AppLocalizations.of(context).feeds,
},
2 years ago
);
late final articleViewTypeOption = SelectOption<ArticleViewType>(
storage: super.storage,
category: articlesCategory,
key: 'article-view-type',
label: (final context) => AppLocalizations.of(context).optionsArticleViewType,
defaultValue: ArticleViewType.direct,
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,
},
2 years ago
);
late final articleDisableMarkAsReadTimeoutOption = ToggleOption(
storage: super.storage,
category: articlesCategory,
key: 'article-disable-mark-as-read-timeout',
label: (final context) => AppLocalizations.of(context).optionsArticleDisableMarkAsReadTimeout,
defaultValue: false,
);
2 years ago
late final defaultArticlesFilterOption = SelectOption<FilterType>(
storage: super.storage,
category: articlesCategory,
key: 'default-articles-filter',
label: (final context) => AppLocalizations.of(context).optionsDefaultArticlesFilter,
defaultValue: FilterType.unread,
values: {
FilterType.all: (final context) => AppLocalizations.of(context).articlesFilterAll,
FilterType.unread: (final context) => AppLocalizations.of(context).articlesFilterUnread,
FilterType.starred: (final context) => AppLocalizations.of(context).articlesFilterStarred,
},
2 years ago
);
late final articlesSortPropertyOption = SelectOption<ArticlesSortProperty>(
storage: super.storage,
category: articlesCategory,
key: 'articles-sort-property',
label: (final context) => AppLocalizations.of(context).optionsArticlesSortProperty,
defaultValue: ArticlesSortProperty.publishDate,
values: {
2 years ago
ArticlesSortProperty.publishDate: (final context) =>
AppLocalizations.of(context).optionsArticlesSortPropertyPublishDate,
2 years ago
ArticlesSortProperty.alphabetical: (final context) =>
AppLocalizations.of(context).optionsArticlesSortPropertyAlphabetical,
ArticlesSortProperty.byFeed: (final context) => AppLocalizations.of(context).optionsArticlesSortPropertyFeed,
},
2 years ago
);
late final articlesSortBoxOrderOption = SelectOption<SortBoxOrder>(
storage: super.storage,
category: articlesCategory,
key: 'articles-sort-box-order',
label: (final context) => AppLocalizations.of(context).optionsArticlesSortOrder,
defaultValue: SortBoxOrder.descending,
values: sortBoxOrderOptionValues,
2 years ago
);
late final foldersSortPropertyOption = SelectOption<FoldersSortProperty>(
storage: super.storage,
category: foldersCategory,
key: 'folders-sort-property',
label: (final context) => AppLocalizations.of(context).optionsFoldersSortProperty,
defaultValue: FoldersSortProperty.alphabetical,
values: {
2 years ago
FoldersSortProperty.alphabetical: (final context) =>
AppLocalizations.of(context).optionsFoldersSortPropertyAlphabetical,
2 years ago
FoldersSortProperty.unreadCount: (final context) =>
AppLocalizations.of(context).optionsFoldersSortPropertyUnreadCount,
},
2 years ago
);
late final foldersSortBoxOrderOption = SelectOption<SortBoxOrder>(
storage: super.storage,
category: foldersCategory,
key: 'folders-sort-box-order',
label: (final context) => AppLocalizations.of(context).optionsFoldersSortOrder,
defaultValue: SortBoxOrder.ascending,
values: sortBoxOrderOptionValues,
2 years ago
);
late final defaultFolderViewTypeOption = SelectOption<DefaultFolderViewType>(
storage: super.storage,
category: foldersCategory,
key: 'default-folder-view-type',
label: (final context) => AppLocalizations.of(context).optionsDefaultFolderViewType,
defaultValue: DefaultFolderViewType.articles,
values: {
DefaultFolderViewType.articles: (final context) => AppLocalizations.of(context).articles,
DefaultFolderViewType.feeds: (final context) => AppLocalizations.of(context).feeds,
},
2 years ago
);
late final feedsSortPropertyOption = SelectOption<FeedsSortProperty>(
storage: super.storage,
category: feedsCategory,
key: 'feeds-sort-property',
label: (final context) => AppLocalizations.of(context).optionsFeedsSortProperty,
defaultValue: FeedsSortProperty.alphabetical,
values: {
2 years ago
FeedsSortProperty.alphabetical: (final context) =>
AppLocalizations.of(context).optionsFeedsSortPropertyAlphabetical,
2 years ago
FeedsSortProperty.unreadCount: (final context) =>
AppLocalizations.of(context).optionsFeedsSortPropertyUnreadCount,
},
2 years ago
);
late final feedsSortBoxOrderOption = SelectOption<SortBoxOrder>(
storage: super.storage,
category: feedsCategory,
key: 'feeds-sort-box-order',
label: (final context) => AppLocalizations.of(context).optionsFeedsSortOrder,
defaultValue: SortBoxOrder.ascending,
values: sortBoxOrderOptionValues,
2 years ago
);
}
enum DefaultCategory {
articles,
folders,
feeds,
}
enum ArticleViewType {
direct,
internalBrowser,
externalBrowser,
}
enum ArticlesSortProperty {
publishDate,
alphabetical,
byFeed,
}
enum FoldersSortProperty {
alphabetical,
unreadCount,
}
enum DefaultFolderViewType {
articles,
feeds,
}
enum FeedsSortProperty {
alphabetical,
unreadCount,
}