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

feat(neon_framework): Allow additional matching app IDs #1655

Merged
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
9 changes: 7 additions & 2 deletions packages/neon_framework/lib/src/blocs/apps.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';

import 'package:built_collection/built_collection.dart';
import 'package:collection/collection.dart';
import 'package:flutter/foundation.dart';
import 'package:meta/meta.dart';
import 'package:neon_framework/src/bloc/bloc.dart';
Expand Down Expand Up @@ -212,8 +213,12 @@ class _AppsBloc extends InteractiveBloc implements AppsBloc {
return null;
}

BuiltSet<AppImplementation> filteredAppImplementations(Iterable<String> appIds) =>
BuiltSet(allAppImplementations.where((a) => appIds.contains(a.id)));
BuiltSet<AppImplementation> filteredAppImplementations(Iterable<String> appIds) => BuiltSet(
allAppImplementations.where(
(a) =>
appIds.contains(a.id) || a.additionalMatchingIDs?.firstWhereOrNull((id) => appIds.contains(id)) != null,
),
);

final CapabilitiesBloc capabilitiesBloc;
final AccountsBloc accountsBloc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';

import 'package:built_collection/built_collection.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:meta/meta.dart';
Expand All @@ -11,7 +12,6 @@ import 'package:neon_framework/src/models/account_cache.dart';
import 'package:neon_framework/src/models/disposable.dart';
import 'package:neon_framework/src/settings/models/options_collection.dart';
import 'package:neon_framework/src/storage/keys.dart';

import 'package:neon_framework/src/utils/findable.dart';
import 'package:neon_framework/src/utils/provider.dart';
import 'package:neon_framework/src/widgets/drawer_destination.dart';
Expand All @@ -34,6 +34,12 @@ abstract class AppImplementation<T extends Bloc, R extends AppImplementationOpti
@override
String get id;

/// A set of IDs that will match the server apps in addition to [id].
///
/// This should only be used when the implementation ID does not match the app ID on the server
/// or the implementation supports multiple apps on the server.
BuiltSet<String>? get additionalMatchingIDs => null;

/// {@macro flutter.widgets.widgetsApp.localizationsDelegates}
LocalizationsDelegate<Object> get localizationsDelegate;

Expand Down