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