mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 15:00:40 +00:00
Compare commits
3 commits
bc6d01f87c
...
77578f4286
Author | SHA1 | Date | |
---|---|---|---|
|
77578f4286 | ||
|
d6fb50e63b | ||
|
98523055aa |
15 changed files with 44 additions and 55 deletions
10
.github/workflows/build_apk.yml
vendored
10
.github/workflows/build_apk.yml
vendored
|
@ -67,12 +67,10 @@ jobs:
|
|||
cp $GOOGLE_SERVICES_JSON_ANDROID_PATH ./android/app
|
||||
|
||||
- name: Restore firebase_options.dart
|
||||
env:
|
||||
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
|
||||
run: |
|
||||
FIREBASE_OPTIONS_PATH=$RUNNER_TEMP/firebase_options.dart
|
||||
echo -n "$FIREBASE_OPTIONS" | base64 --decode --output $FIREBASE_OPTIONS_PATH
|
||||
cp $FIREBASE_OPTIONS_PATH ./lib
|
||||
run: bash .github/scripts/restore_from_base64.sh "${{ secrets.FIREBASE_OPTIONS }}" "lib/firebase_options.dart"
|
||||
|
||||
- name: Restore constants.dart
|
||||
run: bash .github/scripts/restore_from_base64.sh "${{ secrets.CONSTANTS }}" "lib/constants.dart"
|
||||
|
||||
- name: Install Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
|
|
3
.github/workflows/build_ipa.yml
vendored
3
.github/workflows/build_ipa.yml
vendored
|
@ -66,6 +66,9 @@ jobs:
|
|||
- name: Restore firebase_options.dart
|
||||
run: bash .github/scripts/restore_from_base64.sh "${{ secrets.FIREBASE_OPTIONS }}" "lib/firebase_options.dart"
|
||||
|
||||
- name: Restore constants.dart
|
||||
run: bash .github/scripts/restore_from_base64.sh "${{ secrets.CONSTANTS }}" "lib/constants.dart"
|
||||
|
||||
- name: Install Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
|
|
10
.github/workflows/create_release.yml
vendored
10
.github/workflows/create_release.yml
vendored
|
@ -86,12 +86,10 @@ jobs:
|
|||
cp $GOOGLE_SERVICES_JSON_ANDROID_PATH ./android/app
|
||||
|
||||
- name: Restore firebase_options.dart
|
||||
env:
|
||||
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
|
||||
run: |
|
||||
FIREBASE_OPTIONS_PATH=$RUNNER_TEMP/firebase_options.dart
|
||||
echo -n "$FIREBASE_OPTIONS" | base64 --decode --output $FIREBASE_OPTIONS_PATH
|
||||
cp $FIREBASE_OPTIONS_PATH ./lib
|
||||
run: bash .github/scripts/restore_from_base64.sh "${{ secrets.FIREBASE_OPTIONS }}" "lib/firebase_options.dart"
|
||||
|
||||
- name: Restore constants.dart
|
||||
run: bash .github/scripts/restore_from_base64.sh "${{ secrets.CONSTANTS }}" "lib/constants.dart"
|
||||
|
||||
# This step makes sense when Github release is enabled because this release increments the build number.
|
||||
# Therefore here we have to increment it as well to build an apk with the same build number.
|
||||
|
|
3
.github/workflows/pr_check.yml
vendored
3
.github/workflows/pr_check.yml
vendored
|
@ -36,6 +36,9 @@ jobs:
|
|||
if: steps.fetch-iap.conclusion != 'success'
|
||||
run: bash ./.github/scripts/stub_iap.sh
|
||||
|
||||
- name: Restore constants.dart
|
||||
run: bash .github/scripts/restore_from_base64.sh "${{ secrets.CONSTANTS }}" "lib/constants.dart"
|
||||
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: "stable"
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -58,6 +58,7 @@ android/app/google-services.json
|
|||
ios/firebase_app_id_file.json
|
||||
ios/Runner/GoogleService-Info.plist
|
||||
/lib/firebase_options.dart
|
||||
/lib/constants.dart
|
||||
|
||||
coverage/
|
||||
test/coverage_helper_test.dart
|
||||
|
|
15
.vscode/launch.json
vendored
15
.vscode/launch.json
vendored
|
@ -61,20 +61,5 @@
|
|||
],
|
||||
"program": "${workspaceFolder}/lib/main_dev.dart",
|
||||
},
|
||||
{
|
||||
"name": "dev-simulator",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "debug",
|
||||
"args": [
|
||||
"--flavor",
|
||||
"dev",
|
||||
"--dart-define",
|
||||
"cameraPreviewAspectRatio=240/320",
|
||||
"--dart-define",
|
||||
"cameraStubImage=assets/camera_stub_image.jpg"
|
||||
],
|
||||
"program": "${workspaceFolder}/lib/main_dev.dart",
|
||||
},
|
||||
],
|
||||
}
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -16,7 +16,7 @@
|
|||
"editor.suggest.snippetsPreventQuickSuggestions": false,
|
||||
"editor.suggestSelection": "first",
|
||||
"editor.tabCompletion": "onlySnippets",
|
||||
"editor.wordBasedSuggestions": false
|
||||
"editor.wordBasedSuggestions": "off"
|
||||
},
|
||||
"dart.doNotFormat": [
|
||||
"**/generated/**",
|
||||
|
|
13
README.md
13
README.md
|
@ -38,6 +38,19 @@ To build this app you need to install Flutter 3.10.0 stable. [How to install](ht
|
|||
|
||||
### 2. Project setup
|
||||
|
||||
#### Restore _constants.dart_ file
|
||||
|
||||
Create a file _lib/constants.dart_ and paste the following content:
|
||||
|
||||
```dart
|
||||
const String contactEmail = '';
|
||||
const String iapServerUrl = '';
|
||||
const String issuesReportUrl = '';
|
||||
const String sourceCodeUrl = '';
|
||||
```
|
||||
|
||||
#### Stub IAP package
|
||||
|
||||
As part of the app's functionallity is in the private repo, you have to replace these lines in _pubspec.yaml_:
|
||||
|
||||
```yaml
|
||||
|
|
|
@ -2,9 +2,10 @@ import 'package:flutter/material.dart';
|
|||
import 'package:m3_lightmeter_iap/src/data/models/iap_product.dart';
|
||||
|
||||
class IAPProductsProvider extends StatefulWidget {
|
||||
final String apiUrl;
|
||||
final Widget child;
|
||||
|
||||
const IAPProductsProvider({required this.child, super.key});
|
||||
const IAPProductsProvider({required this.apiUrl, required this.child, super.key});
|
||||
|
||||
static IAPProductsProviderState of(BuildContext context) => IAPProductsProvider.maybeOf(context)!;
|
||||
|
||||
|
|
|
@ -2,39 +2,23 @@ enum BuildType { dev, prod }
|
|||
|
||||
class Environment {
|
||||
final BuildType buildType;
|
||||
final String sourceCodeUrl;
|
||||
final String issuesReportUrl;
|
||||
final String contactEmail;
|
||||
|
||||
final bool hasLightSensor;
|
||||
|
||||
const Environment({
|
||||
required this.buildType,
|
||||
required this.sourceCodeUrl,
|
||||
required this.issuesReportUrl,
|
||||
required this.contactEmail,
|
||||
this.hasLightSensor = false,
|
||||
});
|
||||
|
||||
const Environment.dev()
|
||||
: buildType = BuildType.dev,
|
||||
sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter',
|
||||
issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues/new/choose',
|
||||
contactEmail = 'contact.vodemn@gmail.com',
|
||||
hasLightSensor = false;
|
||||
|
||||
const Environment.prod()
|
||||
: buildType = BuildType.prod,
|
||||
sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter',
|
||||
issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues/new/choose',
|
||||
contactEmail = 'contact.vodemn@gmail.com',
|
||||
hasLightSensor = false;
|
||||
|
||||
Environment copyWith({bool? hasLightSensor}) => Environment(
|
||||
buildType: buildType,
|
||||
sourceCodeUrl: sourceCodeUrl,
|
||||
issuesReportUrl: issuesReportUrl,
|
||||
contactEmail: contactEmail,
|
||||
hasLightSensor: hasLightSensor ?? this.hasLightSensor,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:firebase_core/firebase_core.dart';
|
|||
import 'package:flutter/widgets.dart';
|
||||
import 'package:lightmeter/application.dart';
|
||||
import 'package:lightmeter/application_wrapper.dart';
|
||||
import 'package:lightmeter/constants.dart';
|
||||
import 'package:lightmeter/data/analytics/analytics.dart';
|
||||
import 'package:lightmeter/data/analytics/api/analytics_firebase.dart';
|
||||
import 'package:lightmeter/environment.dart';
|
||||
|
@ -27,7 +28,10 @@ Future<void> runLightmeterApp(Environment env) async {
|
|||
products: [IAPProduct(storeId: IAPProductType.paidFeatures.storeId)],
|
||||
child: application,
|
||||
)
|
||||
: IAPProductsProvider(child: application),
|
||||
: IAPProductsProvider(
|
||||
apiUrl: iapServerUrl,
|
||||
child: application,
|
||||
),
|
||||
);
|
||||
},
|
||||
_errorsLogger.logCrash,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/constants.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/providers/services_provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class ReportIssueListTile extends StatelessWidget {
|
||||
|
@ -13,7 +13,7 @@ class ReportIssueListTile extends StatelessWidget {
|
|||
title: Text(S.of(context).reportIssue),
|
||||
onTap: () {
|
||||
launchUrl(
|
||||
Uri.parse(ServicesProvider.of(context).environment.issuesReportUrl),
|
||||
Uri.parse(issuesReportUrl),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/constants.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/providers/services_provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class SourceCodeListTile extends StatelessWidget {
|
||||
|
@ -13,7 +13,7 @@ class SourceCodeListTile extends StatelessWidget {
|
|||
title: Text(S.of(context).sourceCode),
|
||||
onTap: () {
|
||||
launchUrl(
|
||||
Uri.parse(ServicesProvider.of(context).environment.sourceCodeUrl),
|
||||
Uri.parse(sourceCodeUrl),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:clipboard/clipboard.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/constants.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/providers/services_provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class WriteEmailListTile extends StatelessWidget {
|
||||
|
@ -13,8 +13,7 @@ class WriteEmailListTile extends StatelessWidget {
|
|||
leading: const Icon(Icons.email),
|
||||
title: Text(S.of(context).writeEmail),
|
||||
onTap: () {
|
||||
final email = ServicesProvider.of(context).environment.contactEmail;
|
||||
final mailToUrl = Uri.parse('mailto:$email?subject=M3 Lightmeter');
|
||||
final mailToUrl = Uri.parse('mailto:$contactEmail?subject=M3 Lightmeter');
|
||||
canLaunchUrl(mailToUrl).then((canLaunch) {
|
||||
if (canLaunch) {
|
||||
launchUrl(
|
||||
|
@ -29,7 +28,7 @@ class WriteEmailListTile extends StatelessWidget {
|
|||
action: SnackBarAction(
|
||||
label: S.of(context).copyEmail,
|
||||
onPressed: () {
|
||||
FlutterClipboard.copy(email).then((_) {
|
||||
FlutterClipboard.copy(contactEmail).then((_) {
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
});
|
||||
},
|
||||
|
|
|
@ -28,7 +28,7 @@ dependencies:
|
|||
m3_lightmeter_iap:
|
||||
git:
|
||||
url: "https://github.com/vodemn/m3_lightmeter_iap"
|
||||
ref: v0.8.0
|
||||
ref: v0.8.1
|
||||
m3_lightmeter_resources:
|
||||
git:
|
||||
url: "https://github.com/vodemn/m3_lightmeter_resources"
|
||||
|
|
Loading…
Reference in a new issue