added equipment profiles to layout config

This commit is contained in:
Vadim 2023-04-17 12:16:46 +03:00
parent b13acedebd
commit 0fc3f512f3
12 changed files with 56 additions and 44 deletions

2
.vscode/launch.json vendored
View file

@ -31,6 +31,7 @@
{ {
"name": "prod (android)", "name": "prod (android)",
"request": "launch", "request": "launch",
//"flutterMode": "release",
"type": "dart", "type": "dart",
"args": [ "args": [
"--flavor", "--flavor",
@ -43,6 +44,7 @@
{ {
"name": "prod (ios)", "name": "prod (ios)",
"request": "launch", "request": "launch",
//"flutterMode": "release",
"type": "dart", "type": "dart",
"args": [ "args": [
"--flavor", "--flavor",

View file

@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 51; objectVersion = 54;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
@ -237,6 +237,7 @@
}; };
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -268,6 +269,7 @@
}; };
9740EEB61CF901F6004384FC /* Run Script */ = { 9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -371,7 +373,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 74JQ9DBXY6; DEVELOPMENT_TEAM = 489Z6UQMGN;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -500,7 +502,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 74JQ9DBXY6; DEVELOPMENT_TEAM = 489Z6UQMGN;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -523,7 +525,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 74JQ9DBXY6; DEVELOPMENT_TEAM = 489Z6UQMGN;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -600,7 +602,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 74JQ9DBXY6; DEVELOPMENT_TEAM = 489Z6UQMGN;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -675,7 +677,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 74JQ9DBXY6; DEVELOPMENT_TEAM = 489Z6UQMGN;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -747,7 +749,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 74JQ9DBXY6; DEVELOPMENT_TEAM = 489Z6UQMGN;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (

View file

@ -1,4 +1,4 @@
enum MeteringScreenLayoutFeature { extremeExposurePairs, filmPicker } enum MeteringScreenLayoutFeature { equipmentProfiles, extremeExposurePairs, filmPicker }
typedef MeteringScreenLayoutConfig = Map<MeteringScreenLayoutFeature, bool>; typedef MeteringScreenLayoutConfig = Map<MeteringScreenLayoutFeature, bool>;

View file

@ -95,6 +95,7 @@ class UserPreferencesService {
); );
} else { } else {
return { return {
MeteringScreenLayoutFeature.equipmentProfiles: true,
MeteringScreenLayoutFeature.extremeExposurePairs: true, MeteringScreenLayoutFeature.extremeExposurePairs: true,
MeteringScreenLayoutFeature.filmPicker: true, MeteringScreenLayoutFeature.filmPicker: true,
}; };

View file

@ -1,3 +0,0 @@
class FeaturesConfig {
static const bool equipmentProfilesEnabled = false;
}

View file

@ -31,28 +31,30 @@ class LightmeterProviders extends StatelessWidget {
]), ]),
builder: (_, snapshot) { builder: (_, snapshot) {
if (snapshot.data != null) { if (snapshot.data != null) {
return InheritedWidgetBase<Environment>( return IAPProductsProvider(
data: env.copyWith(hasLightSensor: snapshot.data![1] as bool), child: InheritedWidgetBase<Environment>(
child: InheritedWidgetBase<UserPreferencesService>( data: env.copyWith(hasLightSensor: snapshot.data![1] as bool),
data: UserPreferencesService(snapshot.data![0] as SharedPreferences), child: InheritedWidgetBase<UserPreferencesService>(
child: InheritedWidgetBase<LightSensorService>( data: UserPreferencesService(snapshot.data![0] as SharedPreferences),
data: const LightSensorService(LocalPlatform()), child: InheritedWidgetBase<LightSensorService>(
child: InheritedWidgetBase<CaffeineService>( data: const LightSensorService(LocalPlatform()),
data: const CaffeineService(), child: InheritedWidgetBase<CaffeineService>(
child: InheritedWidgetBase<HapticsService>( data: const CaffeineService(),
data: const HapticsService(), child: InheritedWidgetBase<HapticsService>(
child: InheritedWidgetBase<VolumeEventsService>( data: const HapticsService(),
data: const VolumeEventsService(LocalPlatform()), child: InheritedWidgetBase<VolumeEventsService>(
child: InheritedWidgetBase<PermissionsService>( data: const VolumeEventsService(LocalPlatform()),
data: const PermissionsService(), child: InheritedWidgetBase<PermissionsService>(
child: MeteringScreenLayoutProvider( data: const PermissionsService(),
child: StopTypeProvider( child: MeteringScreenLayoutProvider(
child: EquipmentProfileProvider( child: StopTypeProvider(
child: EvSourceTypeProvider( child: EquipmentProfileProvider(
child: SupportedLocaleProvider( child: EvSourceTypeProvider(
child: ThemeProvider( child: SupportedLocaleProvider(
child: Builder( child: ThemeProvider(
builder: (context) => builder(context, true), child: Builder(
builder: (context) => builder(context, true),
),
), ),
), ),
), ),

View file

@ -3,7 +3,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/models/exposure_pair.dart'; import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/data/models/film.dart'; import 'package:lightmeter/data/models/film.dart';
import 'package:lightmeter/data/models/metering_screen_layout_config.dart'; import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
import 'package:lightmeter/features.dart';
import 'package:lightmeter/platform_config.dart'; import 'package:lightmeter/platform_config.dart';
import 'package:lightmeter/providers/metering_screen_layout_provider.dart'; import 'package:lightmeter/providers/metering_screen_layout_provider.dart';
import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/res/dimens.dart';
@ -18,6 +17,7 @@ import 'package:lightmeter/screens/metering/components/camera_container/state_co
import 'package:lightmeter/screens/metering/components/shared/exposure_pairs_list/widget_list_exposure_pairs.dart'; import 'package:lightmeter/screens/metering/components/shared/exposure_pairs_list/widget_list_exposure_pairs.dart';
import 'package:lightmeter/screens/metering/components/shared/metering_top_bar/widget_top_bar_metering.dart'; import 'package:lightmeter/screens/metering/components/shared/metering_top_bar/widget_top_bar_metering.dart';
import 'package:lightmeter/screens/metering/components/shared/readings_container/widget_container_readings.dart'; import 'package:lightmeter/screens/metering/components/shared/readings_container/widget_container_readings.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
class CameraContainer extends StatelessWidget { class CameraContainer extends StatelessWidget {
@ -52,7 +52,7 @@ class CameraContainer extends StatelessWidget {
double topBarOverflow = Dimens.readingContainerSingleValueHeight + // ISO & ND double topBarOverflow = Dimens.readingContainerSingleValueHeight + // ISO & ND
-cameraViewHeight; -cameraViewHeight;
if (FeaturesConfig.equipmentProfilesEnabled) { if (IAPProducts.isPurchased(context, IAPProductType.equipment)) {
topBarOverflow += Dimens.readingContainerSingleValueHeight; topBarOverflow += Dimens.readingContainerSingleValueHeight;
topBarOverflow += Dimens.paddingS; topBarOverflow += Dimens.paddingS;
} }

View file

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/exposure_pair.dart'; import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/data/models/film.dart'; import 'package:lightmeter/data/models/film.dart';
import 'package:lightmeter/data/models/metering_screen_layout_config.dart'; import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
import 'package:lightmeter/features.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/equipment_profile_provider.dart'; import 'package:lightmeter/providers/equipment_profile_provider.dart';
import 'package:lightmeter/providers/metering_screen_layout_provider.dart'; import 'package:lightmeter/providers/metering_screen_layout_provider.dart';
@ -10,6 +9,7 @@ import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/animated_dialog_picker/widget_picker_dialog_animated.dart'; import 'package:lightmeter/screens/metering/components/shared/readings_container/components/animated_dialog_picker/widget_picker_dialog_animated.dart';
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/reading_value_container/widget_container_reading_value.dart'; import 'package:lightmeter/screens/metering/components/shared/readings_container/components/reading_value_container/widget_container_reading_value.dart';
import 'package:lightmeter/utils/inherited_generics.dart'; import 'package:lightmeter/utils/inherited_generics.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
class ReadingsContainer extends StatelessWidget { class ReadingsContainer extends StatelessWidget {
@ -36,10 +36,12 @@ class ReadingsContainer extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final layout = MeteringScreenLayout.of(context);
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
if (FeaturesConfig.equipmentProfilesEnabled) ...[ if (IAPProducts.isPurchased(context, IAPProductType.equipment) &&
layout[MeteringScreenLayoutFeature.equipmentProfiles]!) ...[
const _EquipmentProfilePicker(), const _EquipmentProfilePicker(),
const _InnerPadding(), const _InnerPadding(),
], ],

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart'; import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
class EquipmentProfilesListTile extends StatelessWidget { class EquipmentProfilesListTile extends StatelessWidget {
@ -12,9 +13,13 @@ class EquipmentProfilesListTile extends StatelessWidget {
leading: const Icon(Icons.camera), leading: const Icon(Icons.camera),
title: Text(S.of(context).equipmentProfiles), title: Text(S.of(context).equipmentProfiles),
onTap: () { onTap: () {
Navigator.of(context).push<EquipmentProfileData>( if (IAPProducts.isPurchased(context, IAPProductType.equipment)) {
MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()), Navigator.of(context).push<EquipmentProfileData>(
); MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()),
);
} else {
IAPProductsProvider.of(context).buy(IAPProductType.equipment);
}
}, },
); );
} }

View file

@ -67,6 +67,8 @@ class _MeteringScreenLayoutFeaturesDialogState extends State<MeteringScreenLayou
String _toStringLocalized(BuildContext context, MeteringScreenLayoutFeature feature) { String _toStringLocalized(BuildContext context, MeteringScreenLayoutFeature feature) {
switch (feature) { switch (feature) {
case MeteringScreenLayoutFeature.equipmentProfiles:
return S.of(context).equipmentProfiles;
case MeteringScreenLayoutFeature.extremeExposurePairs: case MeteringScreenLayoutFeature.extremeExposurePairs:
return S.of(context).meteringScreenFeatureExtremeExposurePairs; return S.of(context).meteringScreenFeatureExtremeExposurePairs;
case MeteringScreenLayoutFeature.filmPicker: case MeteringScreenLayoutFeature.filmPicker:

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/features.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/metering/components/calibration/widget_list_tile_calibration.dart'; import 'package:lightmeter/screens/settings/components/metering/components/calibration/widget_list_tile_calibration.dart';
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/widget_list_tile_equipment_profiles.dart'; import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/widget_list_tile_equipment_profiles.dart';
@ -18,7 +17,7 @@ class MeteringSettingsSection extends StatelessWidget {
StopTypeListTile(), StopTypeListTile(),
CalibrationListTile(), CalibrationListTile(),
MeteringScreenLayoutListTile(), MeteringScreenLayoutListTile(),
if (FeaturesConfig.equipmentProfilesEnabled) EquipmentProfilesListTile(), EquipmentProfilesListTile(),
], ],
); );
} }

View file

@ -13,7 +13,7 @@ dependencies:
clipboard: 0.1.3 clipboard: 0.1.3
dynamic_color: 1.6.5 dynamic_color: 1.6.5
exif: 3.1.4 exif: 3.1.4
firebase_core: 2.13.0 firebase_core: 2.14.0
firebase_crashlytics: 3.3.1 firebase_crashlytics: 3.3.1
flutter: flutter:
sdk: flutter sdk: flutter
@ -31,7 +31,7 @@ dependencies:
package_info_plus: 4.0.1 package_info_plus: 4.0.1
permission_handler: 10.2.0 permission_handler: 10.2.0
platform: 3.1.0 platform: 3.1.0
shared_preferences: 2.1.1 shared_preferences: 2.2.0
url_launcher: 6.1.11 url_launcher: 6.1.11
uuid: 3.0.7 uuid: 3.0.7
vibration: 1.7.7 vibration: 1.7.7