Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(neon_framework): Cleanup settings and options related class names #1317

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/neon/neon_dashboard/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:neon_framework/models.dart';
import 'package:nextcloud/nextcloud.dart';

/// Implementation of the server `dashboard` app.
class DashboardApp extends AppImplementation<DashboardBloc, DashboardAppSpecificOptions> {
class DashboardApp extends AppImplementation<DashboardBloc, DashboardOptions> {
/// Creates a new Dashboard app implementation instance.
DashboardApp();

Expand All @@ -23,7 +23,7 @@ class DashboardApp extends AppImplementation<DashboardBloc, DashboardAppSpecific
final List<Locale> supportedLocales = DashboardLocalizations.supportedLocales;

@override
late final DashboardAppSpecificOptions options = DashboardAppSpecificOptions(storage);
late final DashboardOptions options = DashboardOptions(storage);

@override
DashboardBloc buildBloc(final Account account) => DashboardBloc(account);
Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon_dashboard/lib/src/options.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:neon_framework/settings.dart';

/// Settings options specific to the dashboard app.
class DashboardAppSpecificOptions extends NextcloudAppOptions {
class DashboardOptions extends AppImplementationOptions {
/// Creates a new dashboard options instance.
DashboardAppSpecificOptions(super.storage) {
DashboardOptions(super.storage) {
super.categories = [];
super.options = [];
}
Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon_files/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:neon_files/src/routes.dart';
import 'package:neon_framework/models.dart';
import 'package:nextcloud/nextcloud.dart';

class FilesApp extends AppImplementation<FilesBloc, FilesAppSpecificOptions> {
class FilesApp extends AppImplementation<FilesBloc, FilesOptions> {
FilesApp();

@override
Expand All @@ -21,7 +21,7 @@ class FilesApp extends AppImplementation<FilesBloc, FilesAppSpecificOptions> {
final List<Locale> supportedLocales = FilesLocalizations.supportedLocales;

@override
late final FilesAppSpecificOptions options = FilesAppSpecificOptions(storage);
late final FilesOptions options = FilesOptions(storage);

@override
FilesBloc buildBloc(final Account account) => FilesBloc(
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_files/lib/src/blocs/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FilesBrowserBloc extends InteractiveBloc implements FilesBrowserBlocEvents
unawaited(refresh());
}

final FilesAppSpecificOptions options;
final FilesOptions options;
final Account account;

@override
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_files/lib/src/blocs/files.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta
options.downloadQueueParallelism.addListener(_downloadParallelismListener);
}

final FilesAppSpecificOptions options;
final FilesOptions options;
final Account account;
late final browser = getNewFilesBrowserBloc();

Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon_files/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'package:neon_files/l10n/localizations.dart';
import 'package:neon_framework/settings.dart';
import 'package:neon_framework/sort_box.dart';

class FilesAppSpecificOptions extends NextcloudAppOptions {
FilesAppSpecificOptions(super.storage) {
class FilesOptions extends AppImplementationOptions {
FilesOptions(super.storage) {
super.categories = [
generalCategory,
];
Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon_news/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:nextcloud/news.dart' as news;
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';

class NewsApp extends AppImplementation<NewsBloc, NewsAppSpecificOptions> {
class NewsApp extends AppImplementation<NewsBloc, NewsOptions> {
NewsApp();

@override
Expand All @@ -26,7 +26,7 @@ class NewsApp extends AppImplementation<NewsBloc, NewsAppSpecificOptions> {
final List<Locale> supportedLocales = NewsLocalizations.supportedLocales;

@override
late final NewsAppSpecificOptions options = NewsAppSpecificOptions(storage);
late final NewsOptions options = NewsOptions(storage);

@override
NewsBloc buildBloc(final Account account) => NewsBloc(
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_news/lib/src/blocs/articles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents
}

final NewsBloc _newsBloc;
final NewsAppSpecificOptions options;
final NewsOptions options;
final Account account;
final int? id;
final ListType? listType;
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_news/lib/src/blocs/news.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates
}

@override
final NewsAppSpecificOptions options;
final NewsOptions options;
@override
@override
final Account account;
Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon_news/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:neon_framework/sort_box.dart';
import 'package:neon_news/l10n/localizations.dart';
import 'package:neon_news/src/blocs/articles.dart';

class NewsAppSpecificOptions extends NextcloudAppOptions {
NewsAppSpecificOptions(super.storage) {
class NewsOptions extends AppImplementationOptions {
NewsOptions(super.storage) {
super.categories = [
generalCategory,
articlesCategory,
Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon_notes/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:nextcloud/core.dart' as core;
import 'package:nextcloud/nextcloud.dart';
import 'package:nextcloud/notes.dart' as notes;

class NotesApp extends AppImplementation<NotesBloc, NotesAppSpecificOptions> {
class NotesApp extends AppImplementation<NotesBloc, NotesOptions> {
NotesApp();

@override
Expand All @@ -23,7 +23,7 @@ class NotesApp extends AppImplementation<NotesBloc, NotesAppSpecificOptions> {
final LocalizationsDelegate<NotesLocalizations> localizationsDelegate = NotesLocalizations.delegate;

@override
late final NotesAppSpecificOptions options = NotesAppSpecificOptions(storage);
late final NotesOptions options = NotesOptions(storage);

@override
NotesBloc buildBloc(final Account account) => NotesBloc(
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_notes/lib/src/blocs/note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class NotesNoteBloc extends InteractiveBloc implements NotesNoteBlocEvents, Note
});
}

late final NotesAppSpecificOptions options = _notesBloc.options;
late final NotesOptions options = _notesBloc.options;
final NotesBloc _notesBloc;
final _updateQueue = Queue();

Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_notes/lib/src/blocs/notes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class NotesBloc extends InteractiveBloc implements NotesBlocEvents, NotesBlocSta
unawaited(refresh());
}

final NotesAppSpecificOptions options;
final NotesOptions options;
final Account account;

@override
Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon_notes/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'package:neon_framework/settings.dart';
import 'package:neon_framework/sort_box.dart';
import 'package:neon_notes/l10n/localizations.dart';

class NotesAppSpecificOptions extends NextcloudAppOptions {
NotesAppSpecificOptions(super.storage) {
class NotesOptions extends AppImplementationOptions {
NotesOptions(super.storage) {
super.categories = [
generalCategory,
notesCategory,
Expand Down
6 changes: 3 additions & 3 deletions packages/neon/neon_notifications/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import 'package:neon_notifications/src/routes.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:rxdart/rxdart.dart';

class NotificationsApp extends AppImplementation<NotificationsBloc, NotificationsAppSpecificOptions>
class NotificationsApp extends AppImplementation<NotificationsBloc, NotificationsOptions>
implements
// ignore: avoid_implementing_value_types
NotificationsAppInterface<NotificationsBloc, NotificationsAppSpecificOptions> {
NotificationsAppInterface<NotificationsBloc, NotificationsOptions> {
NotificationsApp();

@override
Expand All @@ -25,7 +25,7 @@ class NotificationsApp extends AppImplementation<NotificationsBloc, Notification
final List<Locale> supportedLocales = NotificationsLocalizations.supportedLocales;

@override
late final NotificationsAppSpecificOptions options = NotificationsAppSpecificOptions(storage);
late final NotificationsOptions options = NotificationsOptions(storage);

@override
NotificationsBloc buildBloc(final Account account) => NotificationsBloc(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class NotificationsBloc extends InteractiveBloc
}

@override
final NotificationsAppSpecificOptions options;
final NotificationsOptions options;
final Account _account;
late final NeonTimer _timer;

Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon_notifications/lib/src/options.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:neon_framework/models.dart';
import 'package:neon_framework/settings.dart';

class NotificationsAppSpecificOptions extends NextcloudAppOptions implements NotificationsOptionsInterface {
NotificationsAppSpecificOptions(super.storage) {
class NotificationsOptions extends AppImplementationOptions implements NotificationsOptionsInterface {
NotificationsOptions(super.storage) {
super.categories = [];
super.options = [];
}
Expand Down
6 changes: 3 additions & 3 deletions packages/neon_framework/lib/src/blocs/accounts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState
final GlobalOptions _globalOptions;
final Iterable<AppImplementation> _allAppImplementations;

final _accountsOptions = AccountCache<AccountSpecificOptions>();
final _accountsOptions = AccountCache<AccountOptions>();
final _appsBlocs = AccountCache<AppsBloc>();
final _capabilitiesBlocs = AccountCache<CapabilitiesBloc>();
final _userDetailsBlocs = AccountCache<UserDetailsBloc>();
Expand Down Expand Up @@ -228,12 +228,12 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState
/// The options for the [activeAccount].
///
/// Convenience method for [getOptionsFor] with the currently active account.
AccountSpecificOptions get activeOptions => getOptionsFor(aa);
AccountOptions get activeOptions => getOptionsFor(aa);

/// The options for the specified [account].
///
/// Use [activeOptions] to get them for the [activeAccount].
AccountSpecificOptions getOptionsFor(final Account account) => _accountsOptions[account] ??= AccountSpecificOptions(
AccountOptions getOptionsFor(final Account account) => _accountsOptions[account] ??= AccountOptions(
AppStorage(StorageKeys.accounts, account.id),
getAppsBlocFor(account),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/neon_framework/lib/src/blocs/apps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates
BehaviorSubject<AppImplementation> activeApp = BehaviorSubject();

@override
BehaviorSubject<Result<Iterable<AppImplementation<Bloc, NextcloudAppOptions>>>> appImplementations =
BehaviorSubject<Result<Iterable<AppImplementation<Bloc, AppImplementationOptions>>>> appImplementations =
BehaviorSubject();

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import 'package:vector_graphics/vector_graphics.dart';
/// It is mandatory to provide a precompiled SVG under `assets/app.svg.vec`.
/// SVGs can be precompiled with `https://pub.dev/packages/vector_graphics_compiler`
@immutable
abstract class AppImplementation<T extends Bloc, R extends NextcloudAppOptions> implements Disposable, Findable {
abstract class AppImplementation<T extends Bloc, R extends AppImplementationOptions> implements Disposable, Findable {
/// The unique id of an app.
///
/// It is common to specify them in `AppIDs`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ abstract interface class NotificationsBlocInterface extends InteractiveBloc {
}

/// The interface of the app options used by the notifications client.
abstract interface class NotificationsOptionsInterface extends NextcloudAppOptions {
abstract interface class NotificationsOptionsInterface extends AppImplementationOptions {
/// Creates the nextcloud app options for the notifications client.
NotificationsOptionsInterface(super.storage);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import 'package:neon_framework/src/theme/dialog.dart';
import 'package:neon_framework/src/utils/confirmation_dialog.dart';

@internal
class NextcloudAppSettingsPage extends StatelessWidget {
const NextcloudAppSettingsPage({
class AppImplementationSettingsPage extends StatelessWidget {
const AppImplementationSettingsPage({
required this.appImplementation,
super.key,
});
Expand Down
6 changes: 3 additions & 3 deletions packages/neon_framework/lib/src/pages/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import 'package:url_launcher/url_launcher_string.dart';
/// the settings page.
@internal
enum SettingsCategories {
/// `NextcloudAppOptions` category.
/// `AppImplementationOptions` category.
///
/// Each activated `AppImplementation` has an entry if it has any options specified.
apps,
Expand All @@ -56,7 +56,7 @@ enum SettingsCategories {

/// Account management category.
///
/// Also includes the `AccountSpecificOptions`.
/// Also includes the `AccountOptions`.
accounts,

/// Other category.
Expand Down Expand Up @@ -127,7 +127,7 @@ class _SettingsPageState extends State<SettingsPage> {
leading: appImplementation.buildIcon(),
title: Text(appImplementation.name(context)),
onTap: () {
NextcloudAppSettingsRoute(appid: appImplementation.id).go(context);
AppImplementationSettingsRoute(appid: appImplementation.id).go(context);
},
),
],
Expand Down
18 changes: 9 additions & 9 deletions packages/neon_framework/lib/src/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import 'package:neon_framework/src/blocs/accounts.dart';
import 'package:neon_framework/src/models/account.dart';
import 'package:neon_framework/src/models/app_implementation.dart';
import 'package:neon_framework/src/pages/account_settings.dart';
import 'package:neon_framework/src/pages/app_implementation_settings.dart';
import 'package:neon_framework/src/pages/home.dart';
import 'package:neon_framework/src/pages/login.dart';
import 'package:neon_framework/src/pages/login_check_account.dart';
import 'package:neon_framework/src/pages/login_check_server_status.dart';
import 'package:neon_framework/src/pages/login_flow.dart';
import 'package:neon_framework/src/pages/login_qr_code.dart';
import 'package:neon_framework/src/pages/nextcloud_app_settings.dart';
import 'package:neon_framework/src/pages/route_not_found.dart';
import 'package:neon_framework/src/pages/settings.dart';
import 'package:neon_framework/src/utils/findable.dart';
Expand Down Expand Up @@ -109,9 +109,9 @@ class AccountSettingsRoute extends GoRouteData {
path: 'settings',
name: 'Settings',
routes: [
TypedGoRoute<NextcloudAppSettingsRoute>(
TypedGoRoute<AppImplementationSettingsRoute>(
path: 'apps/:appid',
name: 'NextcloudAppSettings',
name: 'AppImplementationSettings',
),
TypedGoRoute<_AddAccountRoute>(
path: 'account/add',
Expand Down Expand Up @@ -440,13 +440,13 @@ class _AddAccountCheckAccountRoute extends LoginCheckAccountRoute {
String get password => super.password;
}

/// {@template AppRoutes.NextcloudAppSettingsRoute}
/// Route for the the [NextcloudAppSettingsPage].
/// {@template AppRoutes.AppImplementationSettingsRoute}
/// Route for the the [AppImplementationSettingsPage].
/// {@endtemplate}
@immutable
class NextcloudAppSettingsRoute extends GoRouteData {
/// {@macro AppRoutes.NextcloudAppSettingsRoute}
const NextcloudAppSettingsRoute({
class AppImplementationSettingsRoute extends GoRouteData {
/// {@macro AppRoutes.AppImplementationSettingsRoute}
const AppImplementationSettingsRoute({
required this.appid,
});

Expand All @@ -458,7 +458,7 @@ class NextcloudAppSettingsRoute extends GoRouteData {
final appImplementations = NeonProvider.of<Iterable<AppImplementation>>(context);
final appImplementation = appImplementations.tryFind(appid)!;

return NextcloudAppSettingsPage(appImplementation: appImplementation);
return AppImplementationSettingsPage(appImplementation: appImplementation);
}
}

Expand Down
8 changes: 4 additions & 4 deletions packages/neon_framework/lib/src/router.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ abstract class OptionsCollection implements Exportable, Disposable {
}

/// OptionsCollection primarily used by `AppImplementation`s.
abstract class NextcloudAppOptions extends OptionsCollection {
/// Creates a new Nextcloud options collection.
NextcloudAppOptions(super.storage);
abstract class AppImplementationOptions extends OptionsCollection {
/// Creates a new options collection.
AppImplementationOptions(super.storage);

/// Collection of categories to display the options in the settings.
late final Iterable<OptionsCategory> categories;
Expand Down
Loading