|
@@ -40,8 +40,8 @@ class PermissionEngine {
|
|
Log.d("相册无授权,去设置");
|
|
Log.d("相册无授权,去设置");
|
|
DialogEngine.show(
|
|
DialogEngine.show(
|
|
widget: AppDefaultDialog(
|
|
widget: AppDefaultDialog(
|
|
- title: "提示",
|
|
|
|
- message: '无相册权限,前往设置',
|
|
|
|
|
|
+ title: "Alert",
|
|
|
|
+ message: 'No album permission, go to settings?',
|
|
confirmAction: () {
|
|
confirmAction: () {
|
|
PhotoManager.openSetting();
|
|
PhotoManager.openSetting();
|
|
},
|
|
},
|
|
@@ -60,7 +60,7 @@ class PermissionEngine {
|
|
var permissionRequestFuture = PhotoManager.requestPermissionExtend();
|
|
var permissionRequestFuture = PhotoManager.requestPermissionExtend();
|
|
|
|
|
|
// 延迟500毫秒的Future
|
|
// 延迟500毫秒的Future
|
|
- var delayFuture = Future.delayed(Duration(milliseconds: 500), () => 'delay');
|
|
|
|
|
|
+ var delayFuture = Future.delayed(const Duration(milliseconds: 500), () => 'delay');
|
|
|
|
|
|
// 使用Future.any等待上述两个Future中的任何一个完成
|
|
// 使用Future.any等待上述两个Future中的任何一个完成
|
|
var firstCompleted = await Future.any([permissionRequestFuture, delayFuture]);
|
|
var firstCompleted = await Future.any([permissionRequestFuture, delayFuture]);
|
|
@@ -69,7 +69,7 @@ class PermissionEngine {
|
|
if (firstCompleted == 'delay') {
|
|
if (firstCompleted == 'delay') {
|
|
Log.d("判断响应结果:1");
|
|
Log.d("判断响应结果:1");
|
|
// 如果是延迟Future完成了,表示500毫秒内没有获得权限响应,显示对话框
|
|
// 如果是延迟Future完成了,表示500毫秒内没有获得权限响应,显示对话框
|
|
- _showPermissionDialog("“YYBusiness”想访问你的多媒体相册 用于图片上传,图片保存等功能,请允许我获取您的权限");
|
|
|
|
|
|
+ _showPermissionDialog("“YYHome” would like to access your multimedia album for functions such as image uploading and saving. Please allow me to obtain your permission");
|
|
// 再次等待权限请求结果
|
|
// 再次等待权限请求结果
|
|
ps = await permissionRequestFuture;
|
|
ps = await permissionRequestFuture;
|
|
DialogEngine.dismiss(tag: "permission");
|
|
DialogEngine.dismiss(tag: "permission");
|
|
@@ -87,8 +87,8 @@ class PermissionEngine {
|
|
// 权限被拒绝
|
|
// 权限被拒绝
|
|
await DialogEngine.show(
|
|
await DialogEngine.show(
|
|
widget: AppDefaultDialog(
|
|
widget: AppDefaultDialog(
|
|
- message: "请到您的手机设置打开相册的权限",
|
|
|
|
- title: "提醒",
|
|
|
|
|
|
+ message: "Please set the permission to open the photo album on your phone",
|
|
|
|
+ title: "Alert",
|
|
confirmAction: () {
|
|
confirmAction: () {
|
|
openAppSettings();
|
|
openAppSettings();
|
|
}),
|
|
}),
|
|
@@ -110,7 +110,7 @@ class PermissionEngine {
|
|
var permissionRequestFuture = Permission.camera.request();
|
|
var permissionRequestFuture = Permission.camera.request();
|
|
|
|
|
|
// 延迟500毫秒的Future
|
|
// 延迟500毫秒的Future
|
|
- var delayFuture = Future.delayed(Duration(milliseconds: 500), () => 'delay');
|
|
|
|
|
|
+ var delayFuture = Future.delayed(const Duration(milliseconds: 500), () => 'delay');
|
|
|
|
|
|
// 使用Future.any等待上述两个Future中的任何一个完成
|
|
// 使用Future.any等待上述两个Future中的任何一个完成
|
|
var firstCompleted = await Future.any([permissionRequestFuture, delayFuture]);
|
|
var firstCompleted = await Future.any([permissionRequestFuture, delayFuture]);
|
|
@@ -118,7 +118,7 @@ class PermissionEngine {
|
|
// 判断响应结果
|
|
// 判断响应结果
|
|
if (firstCompleted == 'delay') {
|
|
if (firstCompleted == 'delay') {
|
|
// 如果是延迟Future完成了,表示500毫秒内没有获得权限响应,显示对话框
|
|
// 如果是延迟Future完成了,表示500毫秒内没有获得权限响应,显示对话框
|
|
- _showPermissionDialog("“YYBusiness”申请调用您的相机权限 用于使用拍摄头像,图片上传保存等功能,请允许我获取您的权限");
|
|
|
|
|
|
+ _showPermissionDialog("“YYHome” requests to use your camera permission for functions such as taking avatars, uploading and saving images. Please allow me to obtain your permission");
|
|
// 再次等待权限请求结果
|
|
// 再次等待权限请求结果
|
|
status = await permissionRequestFuture;
|
|
status = await permissionRequestFuture;
|
|
DialogEngine.dismiss(tag: "permission");
|
|
DialogEngine.dismiss(tag: "permission");
|
|
@@ -135,8 +135,8 @@ class PermissionEngine {
|
|
// 权限被拒绝
|
|
// 权限被拒绝
|
|
await DialogEngine.show(
|
|
await DialogEngine.show(
|
|
widget: AppDefaultDialog(
|
|
widget: AppDefaultDialog(
|
|
- message: "请到您的手机设置打开相机的权限",
|
|
|
|
- title: "提醒",
|
|
|
|
|
|
+ message: "Please set the permission to open the camera on your phone",
|
|
|
|
+ title: "Alert",
|
|
confirmAction: () {
|
|
confirmAction: () {
|
|
openAppSettings();
|
|
openAppSettings();
|
|
}),
|
|
}),
|
|
@@ -157,7 +157,7 @@ class PermissionEngine {
|
|
var permissionRequestFuture = Permission.location.request();
|
|
var permissionRequestFuture = Permission.location.request();
|
|
|
|
|
|
// 延迟500毫秒的Future
|
|
// 延迟500毫秒的Future
|
|
- var delayFuture = Future.delayed(Duration(milliseconds: 500), () => 'delay');
|
|
|
|
|
|
+ var delayFuture = Future.delayed(const Duration(milliseconds: 500), () => 'delay');
|
|
|
|
|
|
// 使用Future.any等待上述两个Future中的任何一个完成
|
|
// 使用Future.any等待上述两个Future中的任何一个完成
|
|
var firstCompleted = await Future.any([permissionRequestFuture, delayFuture]);
|
|
var firstCompleted = await Future.any([permissionRequestFuture, delayFuture]);
|
|
@@ -165,7 +165,7 @@ class PermissionEngine {
|
|
// 判断响应结果
|
|
// 判断响应结果
|
|
if (firstCompleted == 'delay') {
|
|
if (firstCompleted == 'delay') {
|
|
// 如果是延迟Future完成了,表示500毫秒内没有获得权限响应,显示对话框
|
|
// 如果是延迟Future完成了,表示500毫秒内没有获得权限响应,显示对话框
|
|
- _showPermissionDialog("“YYBusiness”想访问您的定位权限获取您的位置来推荐附近的工作");
|
|
|
|
|
|
+ _showPermissionDialog("“YYHome” want to access your location permission to obtain your location and recommend nearby information");
|
|
// 再次等待权限请求结果
|
|
// 再次等待权限请求结果
|
|
status = await permissionRequestFuture;
|
|
status = await permissionRequestFuture;
|
|
DialogEngine.dismiss(tag: "permission");
|
|
DialogEngine.dismiss(tag: "permission");
|
|
@@ -183,8 +183,8 @@ class PermissionEngine {
|
|
// 权限被拒绝
|
|
// 权限被拒绝
|
|
await DialogEngine.show(
|
|
await DialogEngine.show(
|
|
widget: AppDefaultDialog(
|
|
widget: AppDefaultDialog(
|
|
- message: "请到您的手机设置打开定位的权限",
|
|
|
|
- title: "提醒",
|
|
|
|
|
|
+ message: "Please go to your phone settings to enable location permission",
|
|
|
|
+ title: "Alert",
|
|
confirmAction: () {
|
|
confirmAction: () {
|
|
openAppSettings();
|
|
openAppSettings();
|
|
}),
|
|
}),
|