mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-24 00:10:47 +00:00
ML-65 [Android] Exception on mailto
intent (#66)
* added error toast * lints
This commit is contained in:
parent
0d3641f618
commit
4f8a415503
6 changed files with 41 additions and 4 deletions
|
@ -35,6 +35,14 @@
|
||||||
android:value="2" />
|
android:value="2" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
<queries>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.SEND" />
|
||||||
|
<data android:scheme="mailto" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent>
|
||||||
|
</queries>
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
<uses-feature android:name="android.hardware.camera" android:required="true" />
|
<uses-feature android:name="android.hardware.camera" android:required="true" />
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,8 @@
|
||||||
"sourceCode": "Source code",
|
"sourceCode": "Source code",
|
||||||
"reportIssue": "Report an issue",
|
"reportIssue": "Report an issue",
|
||||||
"writeEmail": "Write an email",
|
"writeEmail": "Write an email",
|
||||||
|
"youDontHaveMailApp": "You don't have any mail app installed.",
|
||||||
|
"copyEmail": "Copy email",
|
||||||
"version": "Version",
|
"version": "Version",
|
||||||
"versionNumber": "{version} ({buildNumber})",
|
"versionNumber": "{version} ({buildNumber})",
|
||||||
"@versionNumber": {
|
"@versionNumber": {
|
||||||
|
|
|
@ -70,6 +70,8 @@
|
||||||
"sourceCode": "Code source",
|
"sourceCode": "Code source",
|
||||||
"reportIssue": "Rapporter un problème",
|
"reportIssue": "Rapporter un problème",
|
||||||
"writeEmail": "Écrire un email",
|
"writeEmail": "Écrire un email",
|
||||||
|
"youDontHaveMailApp": "Vous n'avez installé aucune application de messagerie.",
|
||||||
|
"copyEmail": "Copier un e-mail",
|
||||||
"version": "Version",
|
"version": "Version",
|
||||||
"versionNumber": "{version} ({buildNumber})",
|
"versionNumber": "{version} ({buildNumber})",
|
||||||
"@versionNumber": {
|
"@versionNumber": {
|
||||||
|
|
|
@ -70,6 +70,8 @@
|
||||||
"sourceCode": "Исходный код",
|
"sourceCode": "Исходный код",
|
||||||
"reportIssue": "Сообщить о проблеме",
|
"reportIssue": "Сообщить о проблеме",
|
||||||
"writeEmail": "Написать на почту",
|
"writeEmail": "Написать на почту",
|
||||||
|
"youDontHaveMailApp": "У вас не установлено почтовое приложение.",
|
||||||
|
"copyEmail": "Скопировать адрес",
|
||||||
"version": "Версия",
|
"version": "Версия",
|
||||||
"versionNumber": "{version} ({buildNumber})",
|
"versionNumber": "{version} ({buildNumber})",
|
||||||
"@versionNumber": {
|
"@versionNumber": {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:clipboard/clipboard.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:lightmeter/environment.dart';
|
import 'package:lightmeter/environment.dart';
|
||||||
import 'package:lightmeter/generated/l10n.dart';
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
|
@ -13,10 +14,31 @@ 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 email = context.read<Environment>().contactEmail;
|
||||||
|
final mailToUrl = Uri.parse('mailto:$email?subject=M3 Lightmeter');
|
||||||
|
canLaunchUrl(mailToUrl).then((canLaunch) {
|
||||||
|
if (canLaunch) {
|
||||||
launchUrl(
|
launchUrl(
|
||||||
Uri.parse('mailto:${context.read<Environment>().contactEmail}?subject=M3 Lightmeter'),
|
mailToUrl,
|
||||||
mode: LaunchMode.externalApplication,
|
mode: LaunchMode.externalApplication,
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(S.of(context).youDontHaveMailApp),
|
||||||
|
behavior: SnackBarBehavior.floating,
|
||||||
|
action: SnackBarAction(
|
||||||
|
label: S.of(context).copyEmail,
|
||||||
|
onPressed: () {
|
||||||
|
FlutterClipboard.copy(email).then((_) {
|
||||||
|
ScaffoldMessenger.of(context).clearSnackBars();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ environment:
|
||||||
dependencies:
|
dependencies:
|
||||||
app_settings: 4.2.0
|
app_settings: 4.2.0
|
||||||
camera: 0.10.0+4
|
camera: 0.10.0+4
|
||||||
|
clipboard: 0.1.3
|
||||||
exif: 3.1.2
|
exif: 3.1.2
|
||||||
dynamic_color: 1.5.4
|
dynamic_color: 1.5.4
|
||||||
firebase_core: 2.11.0
|
firebase_core: 2.11.0
|
||||||
|
|
Loading…
Reference in a new issue