Browse Source

neon: Move blocs to the library they belong to

pull/153/head
jld3103 2 years ago
parent
commit
3805c4ea19
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 3
      packages/neon/integration_test/screenshot_test.dart
  2. 2
      packages/neon/lib/main.dart
  3. 9
      packages/neon/lib/src/apps/files/app.dart
  4. 8
      packages/neon/lib/src/apps/files/blocs/browser.dart
  5. 14
      packages/neon/lib/src/apps/files/blocs/files.dart
  6. 9
      packages/neon/lib/src/apps/news/app.dart
  7. 7
      packages/neon/lib/src/apps/news/blocs/article.dart
  8. 31
      packages/neon/lib/src/apps/news/blocs/articles.dart
  9. 13
      packages/neon/lib/src/apps/news/blocs/news.dart
  10. 8
      packages/neon/lib/src/apps/notes/app.dart
  11. 10
      packages/neon/lib/src/apps/notes/blocs/note.dart
  12. 8
      packages/neon/lib/src/apps/notes/blocs/notes.dart
  13. 7
      packages/neon/lib/src/apps/notifications/app.dart
  14. 8
      packages/neon/lib/src/apps/notifications/blocs/notifications.dart
  15. 12
      packages/neon/lib/src/blocs/accounts.dart
  16. 10
      packages/neon/lib/src/blocs/apps.dart
  17. 7
      packages/neon/lib/src/blocs/capabilities.dart
  18. 9
      packages/neon/lib/src/blocs/login.dart
  19. 10
      packages/neon/lib/src/blocs/push_notifications.dart
  20. 7
      packages/neon/lib/src/blocs/user_details.dart
  21. 8
      packages/neon/lib/src/blocs/user_status.dart
  22. 15
      packages/neon/lib/src/neon.dart

3
packages/neon/integration_test/screenshot_test.dart

@ -7,9 +7,6 @@ import 'package:integration_test/integration_test.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:neon/l10n/localizations.dart';
import 'package:neon/src/apps/files/app.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/blocs/capabilities.dart';
import 'package:neon/src/blocs/push_notifications.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:package_info_plus/package_info_plus.dart';

2
packages/neon/lib/main.dart

@ -2,8 +2,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/blocs/push_notifications.dart';
import 'package:neon/src/neon.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:provider/provider.dart';

9
packages/neon/lib/src/apps/files/app.dart

@ -14,17 +14,18 @@ import 'package:image_picker/image_picker.dart';
import 'package:intersperse/intersperse.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:neon/l10n/localizations.dart';
import 'package:neon/src/apps/files/blocs/browser.dart';
import 'package:neon/src/apps/files/blocs/files.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/blocs/apps.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:open_file/open_file.dart';
import 'package:path/path.dart' as p;
import 'package:provider/provider.dart';
import 'package:queue/queue.dart';
import 'package:rxdart/rxdart.dart';
import 'package:settings/settings.dart';
part 'blocs/browser.dart';
part 'blocs/files.dart';
part 'dialogs/choose_create.dart';
part 'dialogs/choose_folder.dart';
part 'dialogs/create_folder.dart';

8
packages/neon/lib/src/apps/files/blocs/browser.dart

@ -1,10 +1,4 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:neon/src/apps/files/app.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
part of '../app.dart';
abstract class FilesBrowserBlocEvents {
void setPath(final List<String> path);

14
packages/neon/lib/src/apps/files/blocs/files.dart

@ -1,16 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:neon/src/apps/files/app.dart';
import 'package:neon/src/apps/files/blocs/browser.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:open_file/open_file.dart';
import 'package:path/path.dart' as p;
import 'package:queue/queue.dart';
import 'package:rxdart/rxdart.dart';
part of '../app.dart';
abstract class FilesBlocEvents {
void uploadFile(final List<String> path, final String localPath);

9
packages/neon/lib/src/apps/news/app.dart

@ -9,11 +9,7 @@ import 'package:html/dom.dart' as html_dom;
import 'package:html/parser.dart' as html_parser;
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:neon/l10n/localizations.dart';
import 'package:neon/src/apps/news/blocs/article.dart';
import 'package:neon/src/apps/news/blocs/articles.dart';
import 'package:neon/src/apps/news/blocs/news.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/blocs/apps.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:provider/provider.dart';
@ -25,6 +21,9 @@ import 'package:url_launcher/url_launcher_string.dart';
import 'package:wakelock/wakelock.dart';
import 'package:webview_flutter/webview_flutter.dart';
part 'blocs/article.dart';
part 'blocs/articles.dart';
part 'blocs/news.dart';
part 'dialogs/add_feed.dart';
part 'dialogs/create_folder.dart';
part 'dialogs/feed_show_url.dart';

7
packages/neon/lib/src/apps/news/blocs/article.dart

@ -1,9 +1,4 @@
import 'dart:async';
import 'package:neon/src/apps/news/blocs/articles.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
part of '../app.dart';
abstract class NewsArticleBlocEvents {
void markArticleAsRead();

31
packages/neon/lib/src/apps/news/blocs/articles.dart

@ -1,11 +1,4 @@
import 'dart:async';
import 'package:neon/src/apps/news/app.dart';
import 'package:neon/src/apps/news/blocs/news.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
part of '../app.dart';
enum FilterType {
all,
@ -49,8 +42,8 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents
NewsArticlesBloc(
this._newsBloc,
this.options,
this._requestManager,
this._client, {
this.requestManager,
this.client, {
this.id,
this.listType,
}) {
@ -66,8 +59,8 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents
final NewsBloc _newsBloc;
final NewsAppSpecificOptions options;
final RequestManager _requestManager;
final NextcloudClient _client;
final RequestManager requestManager;
final NextcloudClient client;
final int? id;
final ListType? listType;
@ -132,11 +125,11 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents
break;
}
await _requestManager.wrapNextcloud<List<NewsArticle>, NewsListArticles>(
_client.id,
await requestManager.wrapNextcloud<List<NewsArticle>, NewsListArticles>(
client.id,
'news-articles-${type.code}-$id-$getRead',
articles,
() async => _client.news.listArticles(
() async => client.news.listArticles(
type: type.code,
id: id ?? 0,
getRead: getRead ?? true ? 1 : 0,
@ -147,12 +140,12 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents
@override
void markArticleAsRead(final NewsArticle article) {
wrapAction(() async => _client.news.markArticleAsRead(itemId: article.id));
wrapAction(() async => client.news.markArticleAsRead(itemId: article.id));
}
@override
void markArticleAsUnread(final NewsArticle article) {
wrapAction(() async => _client.news.markArticleAsUnread(itemId: article.id));
wrapAction(() async => client.news.markArticleAsUnread(itemId: article.id));
}
@override
@ -162,11 +155,11 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents
@override
void starArticle(final NewsArticle article) {
wrapAction(() async => _client.news.starArticle(itemId: article.id));
wrapAction(() async => client.news.starArticle(itemId: article.id));
}
@override
void unstarArticle(final NewsArticle article) {
wrapAction(() async => _client.news.unstarArticle(itemId: article.id));
wrapAction(() async => client.news.unstarArticle(itemId: article.id));
}
}

13
packages/neon/lib/src/apps/news/blocs/news.dart

@ -1,11 +1,4 @@
import 'dart:async';
import 'package:neon/src/apps/news/app.dart';
import 'package:neon/src/apps/news/blocs/articles.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
part of '../app.dart';
abstract class NewsBlocEvents {
void addFeed(final String url, final int? folderId);
@ -51,9 +44,13 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates
unawaited(mainArticlesBloc.refresh());
}
@override
NewsBloc get _newsBloc => this;
@override
final NewsAppSpecificOptions options;
@override
final RequestManager requestManager;
@override
final NextcloudClient client;
late final mainArticlesBloc = NewsMainArticlesBloc(
this,

8
packages/neon/lib/src/apps/notes/app.dart

@ -8,19 +8,19 @@ import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:neon/l10n/localizations.dart';
import 'package:neon/src/apps/notes/blocs/note.dart';
import 'package:neon/src/apps/notes/blocs/notes.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/blocs/apps.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:provider/provider.dart';
import 'package:queue/queue.dart';
import 'package:rxdart/rxdart.dart';
import 'package:settings/settings.dart';
import 'package:sort_box/sort_box.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:wakelock/wakelock.dart';
part 'blocs/note.dart';
part 'blocs/notes.dart';
part 'dialogs/create_note.dart';
part 'dialogs/select_category.dart';
part 'options.dart';

10
packages/neon/lib/src/apps/notes/blocs/note.dart

@ -1,12 +1,4 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:neon/src/apps/notes/app.dart';
import 'package:neon/src/apps/notes/blocs/notes.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:queue/queue.dart';
import 'package:rxdart/rxdart.dart';
part of '../app.dart';
abstract class NotesNoteBlocEvents {
void updateContent(final String content);

8
packages/neon/lib/src/apps/notes/blocs/notes.dart

@ -1,10 +1,4 @@
import 'dart:async';
import 'package:neon/src/apps/notes/app.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
part of '../app.dart';
abstract class NotesBlocEvents {
void createNote({

7
packages/neon/lib/src/apps/notifications/app.dart

@ -1,16 +1,17 @@
library notifications;
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:neon/l10n/localizations.dart';
import 'package:neon/src/apps/notifications/blocs/notifications.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/blocs/apps.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:provider/provider.dart';
import 'package:rxdart/rxdart.dart';
part 'blocs/notifications.dart';
part 'options.dart';
part 'pages/main.dart';

8
packages/neon/lib/src/apps/notifications/blocs/notifications.dart

@ -1,10 +1,4 @@
import 'dart:async';
import 'package:neon/src/apps/notifications/app.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
part of '../app.dart';
abstract class NotificationsBlocEvents {
void deleteNotification(final int id);

12
packages/neon/lib/src/blocs/accounts.dart

@ -1,14 +1,4 @@
import 'dart:async';
import 'dart:convert';
import 'package:neon/src/blocs/apps.dart';
import 'package:neon/src/blocs/capabilities.dart';
import 'package:neon/src/blocs/user_details.dart';
import 'package:neon/src/blocs/user_status.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:rxdart/rxdart.dart';
import 'package:shared_preferences/shared_preferences.dart';
part of '../neon.dart';
abstract class AccountsBlocEvents {
void addAccount(final Account account);

10
packages/neon/lib/src/blocs/apps.dart

@ -1,12 +1,4 @@
import 'dart:async';
import 'package:neon/src/apps/notifications/app.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/blocs/capabilities.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
part of '../neon.dart';
typedef NextcloudApp = CoreNavigationApps_Ocs_Data;

7
packages/neon/lib/src/blocs/capabilities.dart

@ -1,9 +1,4 @@
import 'dart:async';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
part of '../neon.dart';
typedef Capabilities = CoreServerCapabilities_Ocs_Data;
typedef NextcloudTheme = CoreServerCapabilities_Ocs_Data_Capabilities_Theming;

9
packages/neon/lib/src/blocs/login.dart

@ -1,11 +1,4 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:rxdart/rxdart.dart';
part of '../neon.dart';
abstract class LoginBlocEvents {
void setServerURL(final String? url);

10
packages/neon/lib/src/blocs/push_notifications.dart

@ -1,12 +1,4 @@
import 'dart:async';
import 'package:flutter/widgets.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:unifiedpush/unifiedpush.dart';
part of '../neon.dart';
abstract class PushNotificationsBlocEvents {}

7
packages/neon/lib/src/blocs/user_details.dart

@ -1,9 +1,4 @@
import 'dart:async';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
part of '../neon.dart';
abstract class UserDetailsBlocEvents {}

8
packages/neon/lib/src/blocs/user_status.dart

@ -1,10 +1,4 @@
import 'dart:async';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/neon.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';
import 'package:window_manager/window_manager.dart';
part of '../neon.dart';
abstract class UserStatusBlocEvents {}

15
packages/neon/lib/src/neon.dart

@ -24,13 +24,6 @@ import 'package:neon/src/apps/files/app.dart';
import 'package:neon/src/apps/news/app.dart';
import 'package:neon/src/apps/notes/app.dart';
import 'package:neon/src/apps/notifications/app.dart';
import 'package:neon/src/apps/notifications/blocs/notifications.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/blocs/apps.dart';
import 'package:neon/src/blocs/capabilities.dart';
import 'package:neon/src/blocs/login.dart';
import 'package:neon/src/blocs/user_details.dart';
import 'package:neon/src/blocs/user_status.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/models/push_notification_with_account.dart';
import 'package:nextcloud/nextcloud.dart';
@ -47,12 +40,20 @@ import 'package:sort_box/sort_box.dart';
import 'package:sqflite/sqflite.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:tray_manager/tray_manager.dart' as tray;
import 'package:unifiedpush/unifiedpush.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:window_manager/window_manager.dart';
import 'package:xdg_directories/xdg_directories.dart' as xdg;
part 'app.dart';
part 'blocs/accounts.dart';
part 'blocs/apps.dart';
part 'blocs/capabilities.dart';
part 'blocs/login.dart';
part 'blocs/push_notifications.dart';
part 'blocs/user_details.dart';
part 'blocs/user_status.dart';
part 'pages/account_settings.dart';
part 'pages/home.dart';
part 'pages/login.dart';

Loading…
Cancel
Save