zoontek / react-native-permissions

An unified permissions API for React Native on iOS, Android and Windows.
MIT License
4.04k stars 828 forks source link

After user change setting permission to None. Check permission PERMISSIONS.IOS.PHOTO_LIBRARY / MEDIA_LIBRARY got UNAVAILABLE not DENIED #851

Closed chubo274 closed 6 months ago

chubo274 commented 7 months ago

Before submitting a new issue

Bug summary

I have faced with issue about request permission PERMISSIONS.IOS.PHOTO_LIBRARY and PERMISSIONS.IOS.MEDIA_LIBRARY. Let me explain

Is there any way to help me distinguish them? Thank you very much,

that image setting about 2 step above, IMG_2799

====== i'm using xcode 15, build on iphone 8 (OS 16.4), iphone 11 prm (OS 17.2.1), iphone 14 prm (OS 17.3.1)

Library version

3.9.3

Environment info

System:
    OS: macOS 14.1
    CPU: (8) arm64 Apple M1
    Memory: 74.91 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
    Yarn: 1.22.21 - ~/Work/ssm-mobile-app-parent/node_modules/.bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
    Watchman: 2023.12.04.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.14.3 - /Users/chubo/.rvm/gems/ruby-2.7.4/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2023.1 AI-231.9392.1.2311.11255304
    Xcode: 15.0/15A240d - /usr/bin/xcodebuild
  Languages:
    Java: 21.0.2 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.12 => 0.70.12 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

Reproducible sample code

export const checkPermissionAccessAlbum = async (t: any) => {
    const result = await check(Platform.OS == 'android' ? PERMISSIONS.ANDROID.READ_MEDIA_IMAGES : PERMISSIONS.IOS.PHOTO_LIBRARY)

    switch (result) {
        case RESULTS.BLOCKED:
        case RESULTS.DENIED:
            Alert.alert(t('allowPhotoAccess'),
                t('noPermissionAlbum'),
                [
                    { text: t('gotoSetting'), onPress: () => Linking.openSettings() },
                    { text: t('rejected') },
                ]
            )
            return false;
        case RESULTS.UNAVAILABLE:
        case RESULTS.GRANTED:
        case RESULTS.LIMITED:
        default:
            return true
    }
}
zoontek commented 7 months ago

First, update the library to the latest version. Secondly, provides a reproduction that actually reproduce the issue (maybe with 2 buttons for requests?)

zoontek commented 6 months ago

Closed, no answers provided (might be solved in the latest version?)