Compare commits

...

2 Commits

Author SHA1 Message Date
1147192855@qq.com f917b73964 no message 2024-09-24 20:33:08 +08:00
1147192855@qq.com 09c0b0db46 no message 2024-09-21 15:17:32 +08:00
2 changed files with 8 additions and 4 deletions

View File

@ -54,5 +54,9 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>NSPhotoLibraryUsageDescription</key>
<string>为了更好的服务需要开启储存权限,用于保存批阅图</string>
<key>NSFileProviderDomain</key>
<string>为了更好的服务需要开启储存权限,用于保存批阅图</string>
</dict> </dict>
</plist> </plist>

View File

@ -40,7 +40,7 @@ class _StartPageState extends State<StartPage> with RequestToolMixin {
void getStoragePermission() async { void getStoragePermission() async {
_timerPermission?.cancel(); _timerPermission?.cancel();
_timerPermission = null; _timerPermission = null;
var status = await Permission.storage.status; var status = await Permission.storage.request();
if (status != PermissionStatus.granted) { if (status != PermissionStatus.granted) {
print(status); print(status);
if (status == PermissionStatus.denied) { if (status == PermissionStatus.denied) {
@ -49,8 +49,8 @@ class _StartPageState extends State<StartPage> with RequestToolMixin {
barrierDismissible: false, barrierDismissible: false,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: Text("权限拒绝"), title: const Text("储存权限拒绝"),
content: Text("权限被永久拒绝,请前往权限设置页面通过权限"), content: const Text("为了提供更好的服务,需要获取到存储权限用于保存批阅笔记"),
actions: [ actions: [
ElevatedButton( ElevatedButton(
onPressed: () async { onPressed: () async {
@ -58,7 +58,7 @@ class _StartPageState extends State<StartPage> with RequestToolMixin {
Navigator.of(context).pop(); Navigator.of(context).pop();
_timerPermission = Timer.periodic(const Duration(seconds: 30), (_) => getStoragePermission()); _timerPermission = Timer.periodic(const Duration(seconds: 30), (_) => getStoragePermission());
}, },
child: Text('前往'), child: const Text('前往APP权限设置'),
) )
], ],
); );