Browse Source

Merge pull request #795 from nextcloud/refactor/neon/app_implementation_equality

feat(neon): add AppImplementation equality
pull/809/head
Nikolas Rimikis 1 year ago committed by GitHub
parent
commit
d4899f0e77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      packages/app/lib/apps.dart
  2. 2
      packages/neon/neon/lib/neon.dart
  3. 6
      packages/neon/neon/lib/src/models/app_implementation.dart
  4. 2
      packages/neon/neon/test/app_implementation_test.dart
  5. 4
      packages/neon/neon_notifications/lib/neon_notifications.dart

4
packages/app/lib/apps.dart

@ -4,9 +4,9 @@ import 'package:neon_news/neon_news.dart';
import 'package:neon_notes/neon_notes.dart';
import 'package:neon_notifications/neon_notifications.dart';
final List<AppImplementation> appImplementations = [
final Set<AppImplementation> appImplementations = {
FilesApp(),
NewsApp(),
NotesApp(),
NotificationsApp(),
];
};

2
packages/neon/neon/lib/neon.dart

@ -21,7 +21,7 @@ import 'package:package_info_plus/package_info_plus.dart';
import 'package:provider/provider.dart';
Future<void> runNeon({
required final Iterable<AppImplementation> appImplementations,
required final Set<AppImplementation> appImplementations,
required final NeonTheme theme,
@visibleForTesting final WidgetsBinding? bindingOverride,
@visibleForTesting final Account? account,

6
packages/neon/neon/lib/src/models/app_implementation.dart

@ -124,6 +124,12 @@ abstract class AppImplementation<T extends Bloc, R extends NextcloudAppOptions>
///
/// You can later access it through `Theme.of(context).extension<ThemeName>()`.
final ThemeExtension? theme = null;
@override
bool operator ==(final Object other) => other is AppImplementation && other.id == id;
@override
int get hashCode => id.hashCode;
}
extension AppImplementationFind on Iterable<AppImplementation> {

2
packages/neon/neon/test/app_implementation_test.dart

@ -1,3 +1,5 @@
// ignore_for_file: avoid_implementing_value_types
import 'package:mocktail/mocktail.dart';
import 'package:neon/src/models/app_implementation.dart';
import 'package:test/test.dart';

4
packages/neon/neon_notifications/lib/neon_notifications.dart

@ -21,7 +21,9 @@ part 'options.dart';
part 'pages/main.dart';
class NotificationsApp extends AppImplementation<NotificationsBloc, NotificationsAppSpecificOptions>
implements NotificationsAppInterface<NotificationsBloc, NotificationsAppSpecificOptions> {
implements
// ignore: avoid_implementing_value_types
NotificationsAppInterface<NotificationsBloc, NotificationsAppSpecificOptions> {
NotificationsApp();
@override

Loading…
Cancel
Save