App Rejection Due to Permission mOdule

  1. i am facing issue regarding your sdk react native permission module… while opening camera or gallery the modal open like this and ask user to go to setting directly
    Because of this my app got rejected in app store it should not ask directly to user’s settings
    I have already added the usage permission to my info.plist please give me a reference so i can resolved this issue!!

code for module is here

export const platformServices = {
  clipboard: createNativeClipboardService(Clipboard),
  notification: createNativeNotificationService({
    messagingModule: RNFBMessaging,
    permissionModule: Permissions,
  }),
  file: createNativeFileService({
    imagePickerModule: ImagePicker,
    documentPickerModule: DocumentPicker,
    permissionModule: Permissions,
    fsModule: FileAccess,
    mediaLibraryModule: CameraRoll,
  }),
  media: createNativeMediaService({
    VideoComponent: Video,
    thumbnailModule: CreateThumbnail,
    imageResizerModule: ImageResizer,
  }),
};

here is ss

Hi @Vidhi_Tomar,

Im facing the same issue from apple but solved it with a custom implementation from the FileServiceInterface.

Here is what I end up doing.

class MyFileService implements FileServiceInterface {
  async openCamera(_options?: OpenCameraOptions): Promise<FilePickerResponse> {
      const devicePermission = Platform.OS === 'ios' ? Permissions.PERMISSIONS.IOS.CAMERA : Permissions.PERMISSIONS.ANDROID.CAMERA;
      const permission = await request(devicePermission);

      if (permission === Permissions.RESULTS.GRANTED) {
          return await _fileService.openCamera(_options);
      } else {
          console.log('Camera Permission Denied');
          return Promise.reject(SBUError.PERMISSIONS_DENIED);
      }
  }

  async openMediaLibrary(_options: OpenMediaLibraryOptions): Promise<null | FilePickerResponse[]> {
    const devicePermission = Platform.OS === 'ios' ? Permissions.PERMISSIONS.IOS.MEDIA_LIBRARY : Permissions.PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE;
    const permission = await request(devicePermission);

    if (permission === Permissions.RESULTS.GRANTED) {
      return await _fileService.openMediaLibrary(_options);
    } else {
        console.log('Camera Permission Denied');
        return Promise.reject(SBUError.PERMISSIONS_DENIED);
    }
      
  }

  async openDocument(options?: OpenDocumentOptions): Promise<FilePickerResponse> {
    const devicePermission = Platform.OS === 'ios' ? Permissions.PERMISSIONS.IOS.MEDIA_LIBRARY : Permissions.PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE;
    const permission = await request(devicePermission);

    if (permission === Permissions.RESULTS.GRANTED) {
      return await _fileService.openDocument(options);
    } else {
        console.log('Camera Permission Denied');
        return Promise.reject(SBUError.PERMISSIONS_DENIED);
    }
  }

  async save(options: SaveOptions): Promise<string | null> {
    const devicePermission = Platform.OS === 'ios' ? Permissions.PERMISSIONS.IOS.MEDIA_LIBRARY : Permissions.PERMISSIONS.ANDROID.WRITE_EXTERNAL_STORAGE;
    const permission = await request(devicePermission);

    if (permission === Permissions.RESULTS.GRANTED) {
      return await _fileService.save(options);
    } else {
        console.log('Camera Permission Denied');
        return Promise.reject(SBUError.PERMISSIONS_DENIED);
    }
      
  }
}

const _fileService = createNativeFileService({
    fsModule: FileAccess,
    permissionModule: Permissions,
    imagePickerModule: ImagePicker,
    mediaLibraryModule: CameraRoll,
    documentPickerModule: DocumentPicker,
  });

This works fine and dont display the Modal to go to the AppSettings. Unfortunate I facing now the issue when I change the permission for Camera it isnt Updated in Sendbird and even when the Camera permission is set the Modal from Sendbird pops up. Do you have the same issues? How did you solved your rejection?

Best Tom