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.
 
 

113 lines
3.2 KiB

/// The Neon client for the news app.
///
/// Add `NewsApp()` to your runNeon command to execute this app.
///
/// A basic implementation could look like:
///```dart
///Future<void> main() async {
/// await runNeon(
/// appImplementations: {
/// NewsApp()
/// },
/// theme: NeonTheme(
/// branding: Branding(
/// name: 'News',
/// logo: VectorGraphic(
/// loader: AssetBytesLoader(
/// 'assets/logo.svg.vec',
/// ),
/// ),
/// ),
/// ),
/// );
/// }
///```
library news;
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
import 'package:go_router/go_router.dart';
import 'package:html/dom.dart' as html_dom;
import 'package:html/parser.dart' as html_parser;
import 'package:neon/blocs.dart';
import 'package:neon/models.dart';
import 'package:neon/platform.dart';
import 'package:neon/settings.dart';
import 'package:neon/sort_box.dart';
import 'package:neon/theme.dart';
import 'package:neon/utils.dart';
import 'package:neon/widgets.dart';
import 'package:neon_news/l10n/localizations.dart';
import 'package:neon_news/routes.dart';
import 'package:neon_news/utils/dialog.dart';
import 'package:neon_news/widgets/dialog.dart';
import 'package:nextcloud/core.dart' as core;
import 'package:nextcloud/news.dart' as news;
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
import 'package:share_plus/share_plus.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
import 'package:webview_flutter/webview_flutter.dart';
part 'blocs/article.dart';
part 'blocs/articles.dart';
part 'blocs/news.dart';
part 'options.dart';
part 'pages/article.dart';
part 'pages/feed.dart';
part 'pages/folder.dart';
part 'pages/main.dart';
part 'sort/articles.dart';
part 'sort/feeds.dart';
part 'sort/folders.dart';
part 'widgets/articles_view.dart';
part 'widgets/feed_floating_action_button.dart';
part 'widgets/feed_icon.dart';
part 'widgets/feeds_view.dart';
part 'widgets/folder_floating_action_button.dart';
part 'widgets/folder_select.dart';
part 'widgets/folder_view.dart';
part 'widgets/folders_view.dart';
class NewsApp extends AppImplementation<NewsBloc, NewsAppSpecificOptions> {
NewsApp();
@override
final String id = AppIDs.news;
@override
final LocalizationsDelegate<NewsLocalizations> localizationsDelegate = NewsLocalizations.delegate;
@override
final List<Locale> supportedLocales = NewsLocalizations.supportedLocales;
@override
late final NewsAppSpecificOptions options = NewsAppSpecificOptions(storage);
@override
NewsBloc buildBloc(final Account account) => NewsBloc(
options,
account,
);
@override
final Widget page = const NewsMainPage();
@override
final RouteBase route = $newsAppRoute;
@override
BehaviorSubject<int> getUnreadCounter(final NewsBloc bloc) => bloc.unreadCounter;
@override
Future<VersionSupported<String>> isSupported(
final Account account,
final core.OcsGetCapabilitiesResponseApplicationJson_Ocs_Data capabilities,
) =>
account.client.news.isSupported();
}