From b61a40fd04bad00adacdeccaed47b856efc0e449 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:58:28 +0200 Subject: [PATCH] sync iap stub with iap changes --- .github/workflows/pr_check.yml | 9 ++++++++- iap/lib/m3_lightmeter_iap.dart | 1 + iap/lib/src/providers/films_provider.dart | 16 +++++++++++++++- iap/lib/src/providers/selectable_provider.dart | 16 ---------------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml index 70e6fa4..ac420da 100644 --- a/.github/workflows/pr_check.yml +++ b/.github/workflows/pr_check.yml @@ -15,7 +15,7 @@ jobs: analyze_and_test: name: Analyze & test runs-on: macos-11 - timeout-minutes: 10 + timeout-minutes: 5 steps: - uses: actions/checkout@v3 with: @@ -47,3 +47,10 @@ jobs: - name: Run tests run: flutter test + + - name: Analyze project source with stub + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + run: | + bash ./.github/scripts/stub_iap.sh + flutter pub get + flutter analyze lib --fatal-infos diff --git a/iap/lib/m3_lightmeter_iap.dart b/iap/lib/m3_lightmeter_iap.dart index 2f5d26b..171fe47 100644 --- a/iap/lib/m3_lightmeter_iap.dart +++ b/iap/lib/m3_lightmeter_iap.dart @@ -8,6 +8,7 @@ import 'package:m3_lightmeter_iap/src/providers/iap_products_provider.dart'; export 'src/data/models/iap_product.dart'; export 'src/providers/equipment_profile_provider.dart'; +export 'src/providers/films_provider.dart'; export 'src/providers/iap_products_provider.dart'; class IAPProviders extends StatelessWidget { diff --git a/iap/lib/src/providers/films_provider.dart b/iap/lib/src/providers/films_provider.dart index 461af39..e75ccd3 100644 --- a/iap/lib/src/providers/films_provider.dart +++ b/iap/lib/src/providers/films_provider.dart @@ -23,6 +23,7 @@ class FilmsProviderState extends State { Widget build(BuildContext context) { return Films( values: const [Film.other()], + filmsInUse: const [Film.other()], selected: const Film.other(), child: widget.child, ); @@ -34,15 +35,28 @@ class FilmsProviderState extends State { } class Films extends SelectableInheritedModel { + final List filmsInUse; + const Films({ super.key, required super.values, + required this.filmsInUse, required super.selected, required super.child, }); + /// [Film.other()] + all the custom fields with actual reciprocity formulas static List of(BuildContext context) { - return InheritedModel.inheritFrom(context, aspect: SelectableAspect.list)!.values; + return InheritedModel.inheritFrom(context)!.values; + } + + /// [Film.other()] + films in use selected by user + static List inUseOf(BuildContext context) { + return InheritedModel.inheritFrom( + context, + aspect: SelectableAspect.list, + )! + .filmsInUse; } static Film selectedOf(BuildContext context) { diff --git a/iap/lib/src/providers/selectable_provider.dart b/iap/lib/src/providers/selectable_provider.dart index c4168d3..c18f998 100644 --- a/iap/lib/src/providers/selectable_provider.dart +++ b/iap/lib/src/providers/selectable_provider.dart @@ -13,22 +13,6 @@ class SelectableInheritedModel extends InheritedModel { final List values; final T selected; - static List of(BuildContext context) { - return InheritedModel.inheritFrom>( - context, - aspect: SelectableAspect.list, - )! - .values; - } - - static T selectedOf(BuildContext context) { - return InheritedModel.inheritFrom( - context, - aspect: SelectableAspect.selected, - )! - .selected; - } - @override bool updateShouldNotify(SelectableInheritedModel oldWidget) => true;