Skip to content

Commit

Permalink
fix: remove unused ios media library permission
Browse files Browse the repository at this point in the history
  • Loading branch information
bang9 committed Apr 1, 2024
1 parent e0b5c51 commit 0a65f4f
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 24 deletions.
1 change: 0 additions & 1 deletion packages/uikit-react-native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ Add the following permission usage descriptions to your `info.plist` file.
| Key | Type | Value |
| --------------------------------------------------- | ------ | --------------------------------------------------------------- |
| Privacy - Camera Usage Description | string | $(PRODUCT_NAME) would like to use your camera |
| Privacy - Media Library Usage Description | string | $(PRODUCT_NAME) would like access to your photo library |
| Privacy - Photo Library Usage Description | string | $(PRODUCT_NAME) would like access to your photo library |
| Privacy - Photo Library Additions Usage Description | string | $(PRODUCT_NAME) would like to save photos to your photo library |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ const createExpoFileService = ({
return expoPermissionGranted([res]);
}
async hasMediaLibraryPermission(type: 'write' | 'read'): Promise<boolean> {
const perms = (await mediaLibraryModule.getPermissionsAsync(
const perms = (await imagePickerModule.getMediaLibraryPermissionsAsync(
type === 'write',
)) as ExpoMediaLibraryPermissionResponse;
return expoPermissionGranted([perms]);
}
async requestMediaLibraryPermission(type: 'write' | 'read'): Promise<boolean> {
const perms = (await mediaLibraryModule.requestPermissionsAsync(
const perms = (await imagePickerModule.requestMediaLibraryPermissionsAsync(
type === 'write',
)) as ExpoMediaLibraryPermissionResponse;
return expoPermissionGranted([perms]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const createNativeFileService = ({
default: [],
});
const mediaLibraryPermissions: Permission[] = Platform.select({
ios: [permissionModule.PERMISSIONS.IOS.MEDIA_LIBRARY, permissionModule.PERMISSIONS.IOS.PHOTO_LIBRARY],
ios: [permissionModule.PERMISSIONS.IOS.PHOTO_LIBRARY, permissionModule.PERMISSIONS.IOS.PHOTO_LIBRARY_ADD_ONLY],
android: getAndroidStoragePermissionsByAPILevel(permissionModule),
default: [],
});
Expand All @@ -83,14 +83,6 @@ const createNativeFileService = ({
}
async hasMediaLibraryPermission(): Promise<boolean> {
const status = await permissionModule.checkMultiple(mediaLibraryPermissions);
if (
__DEV__ &&
Platform.OS === 'ios' &&
status['ios.permission.MEDIA_LIBRARY'] === 'unavailable' &&
status['ios.permission.PHOTO_LIBRARY'] === 'granted'
) {
return true;
}
return nativePermissionGranted(status);
}
async requestMediaLibraryPermission(): Promise<boolean> {
Expand Down
3 changes: 1 addition & 2 deletions sample/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ target 'SendbirdUIKitSample' do
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary"
pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly"

# Enables Flipper.
Expand All @@ -30,7 +29,7 @@ target 'SendbirdUIKitSample' do
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)

installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ''
Expand Down
8 changes: 1 addition & 7 deletions sample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ PODS:
- OpenSSL-Universal (1.1.180)
- Permission-Camera (3.8.0):
- RNPermissions
- Permission-MediaLibrary (3.8.0):
- RNPermissions
- Permission-Microphone (3.8.0):
- RNPermissions
- Permission-PhotoLibrary (3.8.0):
Expand Down Expand Up @@ -507,7 +505,6 @@ DEPENDENCIES:
- glog (from `../../node_modules/react-native/third-party-podspecs/glog.podspec`)
- OpenSSL-Universal (= 1.1.180)
- Permission-Camera (from `../../node_modules/react-native-permissions/ios/Camera`)
- Permission-MediaLibrary (from `../../node_modules/react-native-permissions/ios/MediaLibrary`)
- Permission-Microphone (from `../../node_modules/react-native-permissions/ios/Microphone`)
- Permission-PhotoLibrary (from `../../node_modules/react-native-permissions/ios/PhotoLibrary`)
- Permission-PhotoLibraryAddOnly (from `../../node_modules/react-native-permissions/ios/PhotoLibraryAddOnly`)
Expand Down Expand Up @@ -604,8 +601,6 @@ EXTERNAL SOURCES:
:podspec: "../../node_modules/react-native/third-party-podspecs/glog.podspec"
Permission-Camera:
:path: "../../node_modules/react-native-permissions/ios/Camera"
Permission-MediaLibrary:
:path: "../../node_modules/react-native-permissions/ios/MediaLibrary"
Permission-Microphone:
:path: "../../node_modules/react-native-permissions/ios/Microphone"
Permission-PhotoLibrary:
Expand Down Expand Up @@ -736,7 +731,6 @@ SPEC CHECKSUMS:
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
Permission-Camera: e6d142d7d8b714afe0a83e5e6ae17eb949f1e3e9
Permission-MediaLibrary: 6a5888dd77669b568716bea80c21340aaab74c51
Permission-Microphone: 644b1de8bcc2afcaf934e09a22bee507a95796a7
Permission-PhotoLibrary: 31787bbe77d0d3ae6a5267b8435e4a2e9ef78f1d
Permission-PhotoLibraryAddOnly: 16c92ad62b802514f3f788e00b298080be996337
Expand Down Expand Up @@ -793,6 +787,6 @@ SPEC CHECKSUMS:
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
ZIPFoundation: b1f0de4eed33e74a676f76e12559ab6b75990197

PODFILE CHECKSUM: 7326d70ef2ded7c9137457434d401f2de40cb420
PODFILE CHECKSUM: e4c7896172c786f630076d08be27f2516caf1825

COCOAPODS: 1.14.2
2 changes: 1 addition & 1 deletion sample/ios/SendbirdUIKitSample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\nexport NODE_OPTIONS=--openssl-legacy-provider\nexport ENTRY_FILE=$(pwd)/../index.js\nexport NODE_BINARY=node\n../../node_modules/react-native/scripts/react-native-xcode.sh\n";
shellScript = "set -e\nexport ENTRY_FILE=$(pwd)/../index.js\nexport NODE_BINARY=node\n../../node_modules/react-native/scripts/react-native-xcode.sh\n";
};
0BA84524D24E532E3D2F7E25 /* [CP-User] [RNFB] Core Configuration */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
2 changes: 0 additions & 2 deletions sample/ios/SendbirdUIKitSample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
<string>Permission request for Camera usage</string>
<key>NSMicrophoneUsageDescription</key>
<string>Permission request for Microphone usage</string>
<key>NSAppleMusicUsageDescription</key>
<string>Permission request for MediaLibrary usage</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Permission request for PhotoLibrary usage</string>
<key>NSPhotoLibraryAddUsageDescription</key>
Expand Down

0 comments on commit 0a65f4f

Please sign in to comment.