diff --git a/README.md b/README.md index 0b4dae8..5d059b5 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,20 @@ Without further delay behold my new Lightmeter app inspired by Material You (a.k # Build -As part of this project is private, you will be able to run this app from the _main_dev.dart_ file (i.e. --flavor dev). Also to avoid fatal errors the _main_prod.dart_ file is excluded from analysis. +As part of the app's functionallity is in the private repo, you have to replace this lines in _pubspec.yaml_: + +```yaml +m3_lightmeter_iap: + git: + url: "https://github.com/vodemn/m3_lightmeter_iap" + ref: main +``` +to this: +```yaml +m3_lightmeter_iap: + path: iap +``` +After that run `flutter pub get` as usual. # Contribution @@ -42,7 +55,9 @@ In case you want to help develop this project you need to follow this [style gui A list of features, that Android version of the app has and that iOS does not. ## Incident light metering + Apple does not provide API for reading Lux stream form the ambient light sensor. Lux can be calculated based on front camera image stream, but this would be a reflected light. So there is no way incident light metering can be implemented on iOS. ## Volume buttons action -This can be [implemented](https://stackoverflow.com/questions/70161271/ios-override-hardware-volume-buttons-same-as-zello) but the app will be rejected due to [2.5.9](https://developer.apple.com/app-store/review/guidelines/#software-requirements) \ No newline at end of file + +This can be [implemented](https://stackoverflow.com/questions/70161271/ios-override-hardware-volume-buttons-same-as-zello) but the app will be rejected due to [2.5.9](https://developer.apple.com/app-store/review/guidelines/#software-requirements) diff --git a/iap/.gitignore b/iap/.gitignore new file mode 100644 index 0000000..205884d --- /dev/null +++ b/iap/.gitignore @@ -0,0 +1,36 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +.packages +build/ + +.fvm/ +*.properties +ios/Flutter/ +.flutter-plugins +.flutter-plugins-dependencies \ No newline at end of file diff --git a/iap/.metadata b/iap/.metadata new file mode 100644 index 0000000..acbef51 --- /dev/null +++ b/iap/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 9944297138845a94256f1cf37beb88ff9a8e811a + channel: stable + +project_type: package diff --git a/iap/LICENSE b/iap/LICENSE new file mode 100644 index 0000000..ba75c69 --- /dev/null +++ b/iap/LICENSE @@ -0,0 +1 @@ +TODO: Add your license here. diff --git a/iap/analysis_options.yaml b/iap/analysis_options.yaml new file mode 100644 index 0000000..a5744c1 --- /dev/null +++ b/iap/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/iap/lib/m3_lightmeter_iap.dart b/iap/lib/m3_lightmeter_iap.dart new file mode 100644 index 0000000..74fd60b --- /dev/null +++ b/iap/lib/m3_lightmeter_iap.dart @@ -0,0 +1,6 @@ +library m3_lightmeter_iap; + +export 'src/data/models/iap_product.dart'; + +export 'src/providers/iap_products_provider.dart'; +export 'src/utils/equipment_profiles_storage.dart'; \ No newline at end of file diff --git a/iap/lib/src/data/models/iap_product.dart b/iap/lib/src/data/models/iap_product.dart new file mode 100644 index 0000000..706e3f1 --- /dev/null +++ b/iap/lib/src/data/models/iap_product.dart @@ -0,0 +1,5 @@ +enum IAPProductType { paidFeatures } + +class IAPProduct { + IAPProduct(); +} diff --git a/iap/lib/src/providers/iap_products_provider.dart b/iap/lib/src/providers/iap_products_provider.dart new file mode 100644 index 0000000..4ea3c98 --- /dev/null +++ b/iap/lib/src/providers/iap_products_provider.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:m3_lightmeter_iap/src/data/models/iap_product.dart'; + +class IAPProductsProvider extends StatefulWidget { + final Widget child; + + const IAPProductsProvider({required this.child, super.key}); + + static IAPProductsProviderState of(BuildContext context) { + return context.findAncestorStateOfType()!; + } + + @override + State createState() => IAPProductsProviderState(); +} + +class IAPProductsProviderState extends State { + @override + Widget build(BuildContext context) { + return IAPProducts( + products: const [], + child: widget.child, + ); + } + + Future buy(IAPProductType type) async {} +} + +class IAPProducts extends InheritedModel { + final List products; + + const IAPProducts({ + required this.products, + required super.child, + super.key, + }); + + static IAPProduct? of(BuildContext context, IAPProductType type) => null; + + static bool isPurchased(BuildContext context, IAPProductType type) => false; + + @override + bool updateShouldNotify(IAPProducts oldWidget) => false; + + @override + bool updateShouldNotifyDependent(covariant IAPProducts oldWidget, Set dependencies) => false; +} diff --git a/iap/lib/src/utils/equipment_profiles_storage.dart b/iap/lib/src/utils/equipment_profiles_storage.dart new file mode 100644 index 0000000..7ceff9a --- /dev/null +++ b/iap/lib/src/utils/equipment_profiles_storage.dart @@ -0,0 +1,10 @@ +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +extension EquipmentProfilesStorage on SharedPreferences { + String get selectedEquipmentProfileId => ''; + set selectedEquipmentProfileId(String id) {} + + List get equipmentProfiles => []; + set equipmentProfiles(List profiles) {} +} diff --git a/iap/pubspec.yaml b/iap/pubspec.yaml new file mode 100644 index 0000000..c72466f --- /dev/null +++ b/iap/pubspec.yaml @@ -0,0 +1,26 @@ +name: m3_lightmeter_iap +description: IAP stubs for the M3 Lightmeter app. +version: 0.2.0 +publish_to: 'none' + +environment: + sdk: '>=2.19.2 <3.0.0' + flutter: ">=1.17.0" + +dependencies: + flutter: + sdk: flutter + m3_lightmeter_resources: + git: + url: "https://github.com/vodemn/m3_lightmeter_resources" + ref: main + shared_preferences: 2.2.0 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 + +flutter: + uses-material-design: true +