Browse Source

refactor(neon,neon_files,neon_news,neon_notes): make bloc state/events interfaces

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/742/head
Nikolas Rimikis 1 year ago
parent
commit
d4fe3ce3c6
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 4
      packages/neon/neon/lib/src/blocs/apps.dart
  2. 4
      packages/neon/neon/lib/src/blocs/capabilities.dart
  3. 4
      packages/neon/neon/lib/src/blocs/first_launch.dart
  4. 4
      packages/neon/neon/lib/src/blocs/login_flow.dart
  5. 4
      packages/neon/neon/lib/src/blocs/next_push.dart
  6. 4
      packages/neon/neon/lib/src/blocs/push_notifications.dart
  7. 4
      packages/neon/neon/lib/src/blocs/timer.dart
  8. 4
      packages/neon/neon/lib/src/blocs/user_details.dart
  9. 4
      packages/neon/neon/lib/src/blocs/user_statuses.dart
  10. 4
      packages/neon/neon_files/lib/blocs/browser.dart
  11. 4
      packages/neon/neon_files/lib/blocs/files.dart
  12. 4
      packages/neon/neon_news/lib/blocs/article.dart
  13. 4
      packages/neon/neon_news/lib/blocs/articles.dart
  14. 4
      packages/neon/neon_news/lib/blocs/news.dart
  15. 4
      packages/neon/neon_notes/lib/blocs/note.dart
  16. 4
      packages/neon/neon_notes/lib/blocs/notes.dart

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

@ -16,7 +16,7 @@ import 'package:nextcloud/nextcloud.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
abstract class AppsBlocEvents { abstract interface class AppsBlocEvents {
/// Sets the active app using the [appID]. /// Sets the active app using the [appID].
/// ///
/// If the app is already the active app nothing will happen. /// If the app is already the active app nothing will happen.
@ -24,7 +24,7 @@ abstract class AppsBlocEvents {
void setActiveApp(final String appID, {final bool skipAlreadySet = false}); void setActiveApp(final String appID, {final bool skipAlreadySet = false});
} }
abstract class AppsBlocStates { abstract interface class AppsBlocStates {
BehaviorSubject<Result<List<CoreNavigationEntry>>> get apps; BehaviorSubject<Result<List<CoreNavigationEntry>>> get apps;
BehaviorSubject<Result<Iterable<AppImplementation>>> get appImplementations; BehaviorSubject<Result<Iterable<AppImplementation>>> get appImplementations;

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

@ -8,9 +8,9 @@ import 'package:neon/src/utils/request_manager.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
abstract class CapabilitiesBlocEvents {} abstract interface class CapabilitiesBlocEvents {}
abstract class CapabilitiesBlocStates { abstract interface class CapabilitiesBlocStates {
BehaviorSubject<Result<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data>> get capabilities; BehaviorSubject<Result<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data>> get capabilities;
} }

4
packages/neon/neon/lib/src/blocs/first_launch.dart

@ -5,9 +5,9 @@ import 'package:neon/src/bloc/bloc.dart';
import 'package:neon/src/settings/models/storage.dart'; import 'package:neon/src/settings/models/storage.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
abstract class FirstLaunchBlocEvents {} abstract interface class FirstLaunchBlocEvents {}
abstract class FirstLaunchBlocStates { abstract interface class FirstLaunchBlocStates {
BehaviorSubject<void> get onFirstLaunch; BehaviorSubject<void> get onFirstLaunch;
} }

4
packages/neon/neon/lib/src/blocs/login_flow.dart

@ -7,9 +7,9 @@ import 'package:neon/src/utils/user_agent.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
abstract class LoginFlowBlocEvents {} abstract interface class LoginFlowBlocEvents {}
abstract class LoginFlowBlocStates { abstract interface class LoginFlowBlocStates {
BehaviorSubject<Result<CoreLoginFlowV2>> get init; BehaviorSubject<Result<CoreLoginFlowV2>> get init;
Stream<CoreLoginFlowV2Credentials> get result; Stream<CoreLoginFlowV2Credentials> get result;

4
packages/neon/neon/lib/src/blocs/next_push.dart

@ -8,9 +8,9 @@ import 'package:neon/src/models/account.dart';
import 'package:neon/src/utils/global_options.dart'; import 'package:neon/src/utils/global_options.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
abstract class NextPushBlocEvents {} abstract interface class NextPushBlocEvents {}
abstract class NextPushBlocStates { abstract interface class NextPushBlocStates {
BehaviorSubject<void> get onNextPushSupported; BehaviorSubject<void> get onNextPushSupported;
} }

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

@ -14,9 +14,9 @@ import 'package:neon/src/utils/push_utils.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
import 'package:unifiedpush/unifiedpush.dart'; import 'package:unifiedpush/unifiedpush.dart';
abstract class PushNotificationsBlocEvents {} abstract interface class PushNotificationsBlocEvents {}
abstract class PushNotificationsBlocStates { abstract interface class PushNotificationsBlocStates {
Stream<PushNotification> get notifications; Stream<PushNotification> get notifications;
} }

4
packages/neon/neon/lib/src/blocs/timer.dart

@ -4,7 +4,7 @@ import 'dart:ui';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:neon/src/bloc/bloc.dart'; import 'package:neon/src/bloc/bloc.dart';
abstract class TimerBlocEvents { abstract interface class TimerBlocEvents {
/// Register a [callback] that will be called periodically. /// Register a [callback] that will be called periodically.
/// The time between the executions is defined by the [duration]. /// The time between the executions is defined by the [duration].
NeonTimer registerTimer(final Duration duration, final VoidCallback callback); NeonTimer registerTimer(final Duration duration, final VoidCallback callback);
@ -14,7 +14,7 @@ abstract class TimerBlocEvents {
void unregisterTimer(final NeonTimer timer); void unregisterTimer(final NeonTimer timer);
} }
abstract class TimerBlocStates {} abstract interface class TimerBlocStates {}
/// Execute callbacks at defined periodic intervals. /// Execute callbacks at defined periodic intervals.
/// Components can register their callbacks and everything with the same periodicity will be executed at the same time. /// Components can register their callbacks and everything with the same periodicity will be executed at the same time.

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

@ -8,9 +8,9 @@ import 'package:neon/src/utils/request_manager.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
abstract class UserDetailsBlocEvents {} abstract interface class UserDetailsBlocEvents {}
abstract class UserDetailsBlocStates { abstract interface class UserDetailsBlocStates {
BehaviorSubject<Result<ProvisioningApiUserDetails>> get userDetails; BehaviorSubject<Result<ProvisioningApiUserDetails>> get userDetails;
} }

4
packages/neon/neon/lib/src/blocs/user_statuses.dart

@ -11,11 +11,11 @@ import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
import 'package:window_manager/window_manager.dart'; import 'package:window_manager/window_manager.dart';
abstract class UserStatusesBlocEvents { abstract interface class UserStatusesBlocEvents {
void load(final String username, {final bool force = false}); void load(final String username, {final bool force = false});
} }
abstract class UserStatusesBlocStates { abstract interface class UserStatusesBlocStates {
BehaviorSubject<Map<String, Result<UserStatusPublicInterface?>>> get statuses; BehaviorSubject<Map<String, Result<UserStatusPublicInterface?>>> get statuses;
} }

4
packages/neon/neon_files/lib/blocs/browser.dart

@ -1,12 +1,12 @@
part of '../neon_files.dart'; part of '../neon_files.dart';
abstract class FilesBrowserBlocEvents { abstract interface class FilesBrowserBlocEvents {
void setPath(final List<String> path); void setPath(final List<String> path);
void createFolder(final List<String> path); void createFolder(final List<String> path);
} }
abstract class FilesBrowserBlocStates { abstract interface class FilesBrowserBlocStates {
BehaviorSubject<Result<List<WebDavFile>>> get files; BehaviorSubject<Result<List<WebDavFile>>> get files;
BehaviorSubject<List<String>> get path; BehaviorSubject<List<String>> get path;

4
packages/neon/neon_files/lib/blocs/files.dart

@ -1,6 +1,6 @@
part of '../neon_files.dart'; part of '../neon_files.dart';
abstract class FilesBlocEvents { abstract interface class FilesBlocEvents {
void uploadFile(final List<String> path, final String localPath); void uploadFile(final List<String> path, final String localPath);
void syncFile(final List<String> path); void syncFile(final List<String> path);
@ -20,7 +20,7 @@ abstract class FilesBlocEvents {
void removeFavorite(final List<String> path); void removeFavorite(final List<String> path);
} }
abstract class FilesBlocStates { abstract interface class FilesBlocStates {
BehaviorSubject<List<FilesTask>> get tasks; BehaviorSubject<List<FilesTask>> get tasks;
} }

4
packages/neon/neon_news/lib/blocs/article.dart

@ -1,6 +1,6 @@
part of '../neon_news.dart'; part of '../neon_news.dart';
abstract class NewsArticleBlocEvents { abstract interface class NewsArticleBlocEvents {
void markArticleAsRead(); void markArticleAsRead();
void markArticleAsUnread(); void markArticleAsUnread();
@ -10,7 +10,7 @@ abstract class NewsArticleBlocEvents {
void unstarArticle(); void unstarArticle();
} }
abstract class NewsArticleBlocStates { abstract interface class NewsArticleBlocStates {
BehaviorSubject<bool> get unread; BehaviorSubject<bool> get unread;
BehaviorSubject<bool> get starred; BehaviorSubject<bool> get starred;

4
packages/neon/neon_news/lib/blocs/articles.dart

@ -11,7 +11,7 @@ enum ListType {
folder, folder,
} }
abstract class NewsArticlesBlocEvents { abstract interface class NewsArticlesBlocEvents {
void setFilterType(final FilterType type); void setFilterType(final FilterType type);
void markArticleAsRead(final NewsArticle article); void markArticleAsRead(final NewsArticle article);
@ -23,7 +23,7 @@ abstract class NewsArticlesBlocEvents {
void unstarArticle(final NewsArticle article); void unstarArticle(final NewsArticle article);
} }
abstract class NewsArticlesBlocStates { abstract interface class NewsArticlesBlocStates {
BehaviorSubject<Result<List<NewsArticle>>> get articles; BehaviorSubject<Result<List<NewsArticle>>> get articles;
BehaviorSubject<FilterType> get filterType; BehaviorSubject<FilterType> get filterType;

4
packages/neon/neon_news/lib/blocs/news.dart

@ -1,6 +1,6 @@
part of '../neon_news.dart'; part of '../neon_news.dart';
abstract class NewsBlocEvents { abstract interface class NewsBlocEvents {
void addFeed(final String url, final int? folderId); void addFeed(final String url, final int? folderId);
void removeFeed(final int feedId); void removeFeed(final int feedId);
@ -20,7 +20,7 @@ abstract class NewsBlocEvents {
void markFolderAsRead(final int folderId); void markFolderAsRead(final int folderId);
} }
abstract class NewsBlocStates { abstract interface class NewsBlocStates {
BehaviorSubject<Result<List<NewsFolder>>> get folders; BehaviorSubject<Result<List<NewsFolder>>> get folders;
BehaviorSubject<Result<List<NewsFeed>>> get feeds; BehaviorSubject<Result<List<NewsFeed>>> get feeds;

4
packages/neon/neon_notes/lib/blocs/note.dart

@ -1,6 +1,6 @@
part of '../neon_notes.dart'; part of '../neon_notes.dart';
abstract class NotesNoteBlocEvents { abstract interface class NotesNoteBlocEvents {
void updateContent(final String content); void updateContent(final String content);
void updateTitle(final String title); void updateTitle(final String title);
@ -8,7 +8,7 @@ abstract class NotesNoteBlocEvents {
void updateCategory(final String category); void updateCategory(final String category);
} }
abstract class NotesNoteBlocStates { abstract interface class NotesNoteBlocStates {
BehaviorSubject<String> get category; BehaviorSubject<String> get category;
} }

4
packages/neon/neon_notes/lib/blocs/notes.dart

@ -1,6 +1,6 @@
part of '../neon_notes.dart'; part of '../neon_notes.dart';
abstract class NotesBlocEvents { abstract interface class NotesBlocEvents {
void createNote({ void createNote({
final String title = '', final String title = '',
final String category = '', final String category = '',
@ -18,7 +18,7 @@ abstract class NotesBlocEvents {
void deleteNote(final int id); void deleteNote(final int id);
} }
abstract class NotesBlocStates { abstract interface class NotesBlocStates {
BehaviorSubject<Result<List<NotesNote>>> get notes; BehaviorSubject<Result<List<NotesNote>>> get notes;
} }

Loading…
Cancel
Save