From 25ad3c45b7411029bf93859fb2d65e3a51d742de Mon Sep 17 00:00:00 2001 From: Kenneth Date: Sun, 29 Sep 2024 12:02:41 +0100 Subject: [PATCH] fix: ask for granular permission --- app.json | 84 ++++++++++++++++++++++++----------------------- app/wallpaper.tsx | 4 ++- 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/app.json b/app.json index 8e29120..0347141 100644 --- a/app.json +++ b/app.json @@ -1,43 +1,45 @@ { - "expo": { - "name": "Doors Wallpaper", - "slug": "doors", - "version": "1.0.0", - "orientation": "portrait", - "icon": "./assets/images/icon.png", - "scheme": "doors", - "userInterfaceStyle": "automatic", - "splash": { - "image": "./assets/images/splash.png", - "resizeMode": "contain", - "backgroundColor": "#010101" - }, - "ios": { - "supportsTablet": true, - "bundleIdentifier": "art.doorsapp.ios" - }, - "android": { - "adaptiveIcon": { - "foregroundImage": "./assets/images/adaptive-icon.png", - "backgroundColor": "#ffffff" - }, - "package": "art.doorsapp.android" - }, - "web": { - "bundler": "metro", - "output": "static", - "favicon": "./assets/images/favicon.png" - }, - "plugins": [ - "expo-router" - ], - "experiments": { - "typedRoutes": true - }, - "extra": { - "eas": { - "projectId": "c4413242-8603-45ad-a172-2258cd06190f" - } - } - } + "expo": { + "name": "Doors Wallpaper", + "slug": "doors", + "version": "1.0.0", + "orientation": "portrait", + "icon": "./assets/images/icon.png", + "scheme": "doors", + "userInterfaceStyle": "automatic", + "splash": { + "image": "./assets/images/splash.png", + "resizeMode": "contain", + "backgroundColor": "#010101" + }, + "ios": { + "supportsTablet": true, + "bundleIdentifier": "art.doorsapp.ios" + }, + "android": { + "adaptiveIcon": { + "foregroundImage": "./assets/images/adaptive-icon.png", + "backgroundColor": "#ffffff" + }, + "package": "art.doorsapp.android", + "blockedPermissions": [ + "android.permission.READ_MEDIA_IMAGES", + "android.permission.READ_MEDIA_VIDEO" + ] + }, + "web": { + "bundler": "metro", + "output": "static", + "favicon": "./assets/images/favicon.png" + }, + "plugins": ["expo-router"], + "experiments": { + "typedRoutes": true + }, + "extra": { + "eas": { + "projectId": "c4413242-8603-45ad-a172-2258cd06190f" + } + } + } } diff --git a/app/wallpaper.tsx b/app/wallpaper.tsx index 34ec088..71ec90d 100644 --- a/app/wallpaper.tsx +++ b/app/wallpaper.tsx @@ -27,7 +27,9 @@ export default function WallpaperPage() { setIsDownloading(true); try { - const permStatus = await MediaLibrary.requestPermissionsAsync(); + const permStatus = await MediaLibrary.requestPermissionsAsync(true, [ + "photo", + ]); if (permStatus.status != MediaLibrary.PermissionStatus.GRANTED) { Alert.alert( "Media library access required",