Merge branch 'main' of https://github.com/vodemn/m3_lightmeter into feature/iap

This commit is contained in:
Vadim 2023-07-30 10:15:11 +02:00
commit 2e0811a357
10 changed files with 202 additions and 27 deletions

View file

@ -68,6 +68,7 @@ jobs:
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2
with: with:
channel: "stable" channel: "stable"
flutter-version: '3.10.0'
- name: Prepare flutter project - name: Prepare flutter project
run: | run: |

View file

@ -70,6 +70,7 @@ jobs:
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2
with: with:
channel: "stable" channel: "stable"
flutter-version: '3.10.0'
- name: Prepare flutter project - name: Prepare flutter project
run: | run: |

View file

@ -12,15 +12,12 @@ on:
branches: ["main"] branches: ["main"]
jobs: jobs:
build: analyze_and_test:
name: Analyze & test
runs-on: macos-11 runs-on: macos-11
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }}
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: recursive submodules: recursive
@ -28,23 +25,13 @@ jobs:
- uses: subosito/flutter-action@v2 - uses: subosito/flutter-action@v2
with: with:
channel: "stable" channel: "stable"
flutter-version: '3.10.0'
- name: Check flutter version - name: Prepare flutter project
run: flutter --version
- name: Install dependencies
run: flutter pub get
- name: Generate intl
run: flutter pub run intl_utils:generate
- name: Restore firebase_options.dart
env:
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
run: | run: |
FIREBASE_OPTIONS_PATH=$RUNNER_TEMP/firebase_options.dart flutter --version
echo -n "$FIREBASE_OPTIONS" | base64 --decode --output $FIREBASE_OPTIONS_PATH flutter pub get
cp $FIREBASE_OPTIONS_PATH ./lib flutter pub run intl_utils:generate
- name: Analyze project source - name: Analyze project source
run: flutter analyze lib --fatal-infos run: flutter analyze lib --fatal-infos

View file

@ -5,7 +5,7 @@
- [Table of contents](#table-of-contents) - [Table of contents](#table-of-contents)
- [Backstory](#backstory) - [Backstory](#backstory)
- [Screenshots](#screenshots) - [Screenshots](#screenshots)
- [Build](#build) - [Development](#development)
- [Contribution](#contribution) - [Contribution](#contribution)
- [iOS Limitations](#ios-limitations) - [iOS Limitations](#ios-limitations)
@ -27,7 +27,7 @@ Without further delay behold my new Lightmeter app inspired by Material You (a.k
<img src="https://lh3.googleusercontent.com/15g_SPV8knDLFbz1_-wGNJFsJeyVWZ_y--TGHpk75MaaIdMDyTXY2_TL-Aw8bpOhpw" width="18.8%" /> <img src="https://lh3.googleusercontent.com/15g_SPV8knDLFbz1_-wGNJFsJeyVWZ_y--TGHpk75MaaIdMDyTXY2_TL-Aw8bpOhpw" width="18.8%" />
</p> </p>
# Build # Development
## Available flavors ## Available flavors
Building with prod flavor requires `DefaultFirebaseOptions` to be present in the _lib/firebase_options.dart_ If you don't want to create your own firebase app, you end up with only dev flavor. Building with prod flavor requires `DefaultFirebaseOptions` to be present in the _lib/firebase_options.dart_ If you don't want to create your own firebase app, you end up with only dev flavor.
@ -49,12 +49,35 @@ m3_lightmeter_iap:
After that run `flutter pub get` as usual. After that run `flutter pub get` as usual.
For the first run it will be necessary to open _iap/_ folder and run `flutter pub get` from there. For the first run it will be necessary to open _iap/_ folder and run `flutter pub get` from there.
### 1. Install Flutter
To build this app you need to install Flutter 3.10.0 stable. [How to install](https://docs.flutter.dev/get-started/install).
### 2. (Optional) Install Firebase
Out of the box Firebase Crashlytics won't work. If you want to add Crashlytics to your local build please follow [this guide](https://firebase.google.com/docs/flutter/setup).
### 3. Get packages
Fetch all the neccessary dependencies and generate translation files by running the following commands:
```console
flutter pub get
flutter pub run intl_utils:generate
```
### 4. Build
You can build an apk by running the following command from the root of the repository:
```console
flutter build apk --release --flavor $FLAVOR --dart-define cameraPreviewAspectRatio=2/3 -t lib/main_$FLAVOR.dart
```
Just replace `$FLAVOR` with `dev` or `prod`.
# Contribution # Contribution
To report a bug or suggest a new feature open a new [issue](https://github.com/vodemn/m3_lightmeter/issues). To report a bug or suggest a new feature open a new [issue](https://github.com/vodemn/m3_lightmeter/issues).
In case you want to help develop this project you need to follow this [style guide](doc/style_guide.md). In case you want to help develop this project feel free to open a Pull Request, but you need to follow this [style guide](doc/style_guide.md).
# iOS Limitations # iOS Limitations

View file

@ -1,4 +1,4 @@
enum SupportedLocale { en, fr, ru } enum SupportedLocale { en, fr, ru, zh }
extension SupportedLocaleExtension on SupportedLocale { extension SupportedLocaleExtension on SupportedLocale {
String get intlName => toString().replaceAll("SupportedLocale.", ""); String get intlName => toString().replaceAll("SupportedLocale.", "");
@ -11,6 +11,8 @@ extension SupportedLocaleExtension on SupportedLocale {
return 'Français'; return 'Français';
case SupportedLocale.ru: case SupportedLocale.ru:
return 'Русский'; return 'Русский';
case SupportedLocale.zh:
return '简体中文';
} }
} }
} }

68
lib/firebase_options.dart Normal file
View file

@ -0,0 +1,68 @@
// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform;
/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}
static const FirebaseOptions android = FirebaseOptions(
apiKey: '',
appId: '',
messagingSenderId: '',
projectId: '',
storageBucket: '',
);
static const FirebaseOptions ios = FirebaseOptions(
apiKey: '',
appId: '',
messagingSenderId: '',
projectId: '',
storageBucket: '',
iosClientId: '',
iosBundleId: '',
);
}

88
lib/l10n/intl_zh.arb Normal file
View file

@ -0,0 +1,88 @@
{
"@@locale": "zh",
"fastestExposurePair": "最快曝光组合",
"slowestExposurePair": "最慢曝光组合",
"ev": "EV",
"evValue": "{value} EV",
"@evValue": {
"placeholders": {
"value": {
"type": "String"
}
}
},
"iso": "ISO",
"filmSpeed": "胶片感光度",
"nd": "ND",
"ndFilterFactor": "ND 滤镜系数",
"noExposurePairs": "所选设置没有曝光配对",
"noCamerasDetected": "您的设备似乎没有连接到任何摄像头",
"noCameraPermission": "未获得摄像头权限",
"otherCameraError": "连接摄像头时发生错误",
"none": "无",
"cancel": "取消",
"select": "选择",
"save": "保存",
"settings": "设置",
"metering": "测量",
"fractionalStops": "EV 步进值",
"showFractionalStops": "显示 EV 步进值",
"halfStops": "1/2",
"thirdStops": "1/3",
"calibration": "校准",
"calibrationMessage": "此应用测量读数的准确性完全取决于设备的硬件。因此,请考虑测试此应用并手动设置 EV 校准,以获得准确的测量结果。",
"calibrationMessageCameraOnly": "此应用程序测量读数的准确性完全取决于设备的后置摄像头。因此,请考虑测试此应用并手动设置 EV 校准,以获得准确的测量结果。",
"camera": "摄像头",
"lightSensor": "光传感器",
"meteringScreenLayout": "布局",
"meteringScreenLayoutHint": "隐藏不需要的元素,以免浪费曝光列表空间",
"meteringScreenFeatureExtremeExposurePairs": "最快 & 最慢曝光组合",
"meteringScreenFeatureFilmPicker": "胶片选择",
"film": "胶片",
"equipment": "设备",
"equipmentProfileName": "设备配置名称",
"equipmentProfileNameHint": "Praktica MTL5B",
"equipmentProfileAllValues": "全部",
"apertureValues": "光圈值",
"apertureValuesFilterDescription": "选择要显示的光圈值范围。这通常由您使用的镜头决定。",
"ndFilters": "ND 滤镜",
"ndFiltersFilterDescription": "选择要显示的 ND 滤镜系数。这些可能是您最常用的 ND 滤镜,也可能是适合您镜头的滤光镜。",
"shutterSpeedValues": "快门速度",
"shutterSpeedValuesFilterDescription": "选择要显示的快门速度范围。这通常由您使用的相机机身决定。",
"isoValues": "ISO",
"isoValuesFilterDescription": "选择要显示的 ISO。这些值可能是您最常用的值也可能是相机支持的值。",
"equipmentProfile": "设备配置",
"equipmentProfiles": "设备配置",
"general": "通用",
"keepScreenOn": "保持屏幕常亮",
"haptics": "震动",
"volumeKeysAction": "音量键快门",
"language": "语言",
"chooseLanguage": "选择语言",
"theme": "主题",
"chooseTheme": "选择主题",
"themeLight": "亮色",
"themeDark": "暗色",
"themeSystemDefault": "跟随系统",
"dynamicColor": "动态颜色",
"primaryColor": "主题颜色",
"choosePrimaryColor": "选择主题颜色",
"about": "关于",
"sourceCode": "源代码",
"reportIssue": "报告问题",
"writeEmail": "Email",
"youDontHaveMailApp": "您没有安装任何邮件App。",
"copyEmail": "复制电子邮件",
"version": "Version",
"versionNumber": "{version} ({buildNumber})",
"@versionNumber": {
"placeholders": {
"version": {
"type": "String"
},
"buildNumber": {
"type": "String"
}
}
}
}

View file

@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/application.dart'; import 'package:lightmeter/application.dart';
import 'package:lightmeter/environment.dart'; import 'package:lightmeter/environment.dart';
@ -5,6 +7,10 @@ import 'package:lightmeter/firebase.dart';
Future<void> main() async { Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
await initializeFirebase(); try {
await initializeFirebase();
} catch (e) {
log(e.toString());
}
runApp(const Application(Environment.prod())); runApp(const Application(Environment.prod()));
} }

View file

@ -7,7 +7,6 @@ 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/environment.dart'; import 'package:lightmeter/environment.dart';
import 'package:lightmeter/providers/ev_source_type_provider.dart'; import 'package:lightmeter/providers/ev_source_type_provider.dart';
import 'package:lightmeter/screens/metering/bloc_metering.dart'; import 'package:lightmeter/screens/metering/bloc_metering.dart';
import 'package:lightmeter/screens/metering/components/bottom_controls/provider_bottom_controls.dart'; import 'package:lightmeter/screens/metering/components/bottom_controls/provider_bottom_controls.dart';

View file

@ -1,7 +1,7 @@
name: lightmeter name: lightmeter
description: Lightmeter app inspired by Material 3 design system. description: Lightmeter app inspired by Material 3 design system.
publish_to: "none" publish_to: "none"
version: 0.12.0+31 version: 0.12.2+33
environment: environment:
sdk: ">=3.0.0 <4.0.0" sdk: ">=3.0.0 <4.0.0"