修改权限申请文案

This commit is contained in:
Fson 2024-08-19 13:53:06 +08:00
parent 4072fe7c8d
commit 4092c0b235
7 changed files with 226 additions and 221 deletions

View File

@ -399,7 +399,7 @@
CODE_SIGN_IDENTITY = "Apple Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 6;
CURRENT_PROJECT_VERSION = 8;
DART_OBFUSCATION = true;
DEVELOPMENT_TEAM = TW3K3253KL;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;
@ -545,7 +545,7 @@
CODE_SIGN_IDENTITY = "Apple Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 6;
CURRENT_PROJECT_VERSION = 8;
DART_OBFUSCATION = true;
DEVELOPMENT_TEAM = TW3K3253KL;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;
@ -581,7 +581,7 @@
CODE_SIGN_IDENTITY = "Apple Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 6;
CURRENT_PROJECT_VERSION = 8;
DART_OBFUSCATION = true;
DEVELOPMENT_TEAM = TW3K3253KL;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;

View File

@ -32,11 +32,11 @@
<true/>
</dict>
<key>NSCameraUsageDescription</key>
<string>TThis enables you to take and upload photos to your private space. Please grant camera access.</string>
<string>Visual Wallpaper needs access to your camera to take photos for creating custom wallpapers. The photos you take will only be used to make personalized wallpapers within the app.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>We need access to your photo album so you can save wallpapers from the app to your album.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This enables you to upload photos and save wallpapers. Please grant photo library access.</string>
<string>This enables you to upload photos and save wallpapers.</string>
<key>NSUserTrackingUsageDescription</key>
<string>We need your permission to access the advertising identifier to provide better ad services.</string>
<key>CFBundleURLTypes</key>

View File

@ -58,9 +58,10 @@ class _PinCodeVerificationScreenState extends State<PinCodeVerificationScreen> {
backgroundColor: Colors.black,
key: scaffoldKey,
body: SafeArea(
child: SingleChildScrollView(
child: Container(
margin: EdgeInsets.only(top: 94.w),
height: MediaQuery.of(context).size.height,
margin: EdgeInsets.only(top: 94.h),
height: MediaQuery.of(context).size.height - MediaQuery.of(context).padding.top - kBottomNavigationBarHeight - 94.h,
width: MediaQuery.of(context).size.width,
child: Column(
children: [
@ -250,6 +251,7 @@ class _PinCodeVerificationScreenState extends State<PinCodeVerificationScreen> {
),
),
),
),
);
}
}

View File

@ -1,11 +1,18 @@
// Author: fengshengxiong
// Date: 2024/5/10
// Description:
import 'dart:io';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:wallpaperx/common/components/dialog/remind_dialog.dart';
import 'package:wallpaperx/global/app_config.dart';
class PermissionUtil {
///
/// [permissionList]
static Future<bool> checkPermission(List<Permission> permissionList) async {
static Future<bool> checkPermission(List<Permission> permissionList, {bool showDialog = true}) async {
//
List<Permission> newPermissionList = [];
//
@ -23,17 +30,17 @@ class PermissionUtil {
switch (permissionStatus) {
//
case PermissionStatus.denied:
showFailedDialog(newPermissionList);
if (showDialog) _showFailedDialog(newPermissionList);
return false;
//
case PermissionStatus.granted:
case PermissionStatus.limited:
case PermissionStatus.provisional:
return true;
//
//
case PermissionStatus.provisional:
case PermissionStatus.restricted:
case PermissionStatus.permanentlyDenied:
showFailedDialog(newPermissionList, isPermanentlyDenied: true);
if (showDialog) _showFailedDialog(newPermissionList, isPermanentlyDenied: true);
break;
}
} else {
@ -55,58 +62,53 @@ class PermissionUtil {
return currentPermissionStatus;
}
///
static Future<bool> checkLocationAlways() async {
//
// Android没有这一步 ios会先访问这个再访问其他的
PermissionStatus status = PermissionStatus.granted;
status = await _checkSinglePermission(Permission.locationWhenInUse);
PermissionStatus status1 = PermissionStatus.granted;
status1 = await _checkSinglePermission(Permission.locationWhenInUse);
//
PermissionStatus status2 = PermissionStatus.denied;
//
if (status.isGranted) {
if (status1.isGranted) {
status2 = await _checkSinglePermission(Permission.locationAlways);
}
//
if (status.isGranted && status2.isGranted) {
if (status1.isGranted && status2.isGranted) {
return true;
//
} else if (status.isDenied || status2.isDenied) {
showFailedDialog(
[Permission.locationWhenInUse, Permission.locationAlways]);
} else {
showFailedDialog(
[Permission.locationWhenInUse, Permission.locationAlways],
isPermanentlyDenied: true,
//
_showFailedDialog([Permission.locationWhenInUse, Permission.locationAlways],
isPermanentlyDenied: Platform.isIOS ? true : false,
);
}
return false;
}
///
static _checkSinglePermission(Permission permission) async {
//
PermissionStatus status = await permission.status;
PermissionStatus currentPermissionStatus = PermissionStatus.granted;
//
if (!status.isGranted) {
currentPermissionStatus = await _requestPermission([permission]);
}
//
return currentPermissionStatus;
}
///
static showFailedDialog(List<Permission> permissionList, {bool isPermanentlyDenied = false}) async {
static _showFailedDialog(List<Permission> permissionList, {bool isPermanentlyDenied = false}) async {
Get.dialog(
barrierDismissible: false,
RemindDialog(
content: await _getInstructions(permissionList),
confirmText: isPermanentlyDenied ? 'Go Settings' : 'Confirm',
content: await _getDescription(permissionList),
confirmText: isPermanentlyDenied ? 'Go open' : 'Confirm',
confirmOnTap: () {
if (isPermanentlyDenied) {
openAppSettings();
@ -118,24 +120,26 @@ class PermissionUtil {
);
}
/// 使
static Future<String> _getInstructions(List<Permission> permissionList) async {
///
static Future<String> _getDescription(List<Permission> permissionList) async {
late Permission failedPermission;
//
for (Permission permission in permissionList) {
PermissionStatus status = await permission.status;
//
if (!status.isGranted || !status.isLimited) {
if (!await permission.status.isGranted) {
failedPermission = permission;
break;
}
}
String explain = '';
if (failedPermission == Permission.storage || failedPermission == Permission.photosAddOnly) {
explain = 'We need access to your photo album so you can save wallpapers from the app to your album';
String description = '';
if (failedPermission == Permission.storage) {
description = '$appName needs access to your camera to take photos for creating custom wallpapers. The photos you take will only be used to make personalized wallpapers within the app.';
} else if (failedPermission == Permission.camera) {
description = 'This app can take photos and upload them to a private space.';
} else if (failedPermission == Permission.photos) {
description = 'This enables you to upload photos and save wallpapers.';
} else if (failedPermission == Permission.appTrackingTransparency) {
description = 'We need your permission to access the advertising identifier to provide better ad services.';
}
return explain;
return description;
}
}

View File

@ -4,7 +4,7 @@ const appName = 'Visual Wallpaper';
/// +3广
DateTime getGuaranteedDate () {
DateTime? commitDate = DateUtils.getDateTime('2024-08-15 18:30:00');
DateTime? commitDate = DateUtils.getDateTime('2024-08-16 09:30:00');
if (commitDate != null) {
return commitDate.add(const Duration(days: 3));
} else {

View File

@ -1,7 +1,6 @@
import 'dart:typed_data';
import 'package:flip_card/flip_card.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';

View File

@ -2,7 +2,7 @@ name: wallpaperx
description: "A new Flutter project."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.2.0+6
version: 1.2.0+8
environment:
sdk: '>=3.4.1 <4.0.0'