[Enhancement proposal]: Add phone and storage macros so users can choose to include or not
Please check the following before submitting a new issue.
- [X] I have searched the existing issues.
- [X] I have carefully read the documentation and verified I have added the required platform specific configuration.
Please select affected platform(s)
- [ ] Android
- [X] iOS
- [ ] Windows
Proposal
Currently on iOS, no enum values exist for phone and storage permission strategies in PermissionHandlerEnums.h. However, enum values exist for all other permission strategies (camera, microphone, etc).
Other permission strategies are executed only if their enum values are defined. For example, for bluetooth, the enum value PERMISSION_BLUETOOTH is defined in PermissionHandlerEnums.h. Then, in BluetoothPermissionStrategy.h, bluetooth permission is only implemented if its enum value is defined:
#if PERMISSION_BLUETOOTH
...
#else
#import "UnknownPermissionStrategy.h"
...
#endif
Currently, this if...else block doesn't exist in PhonePermissionStrategy.h or StoragePermissionStrategy.h:
NS_ASSUME_NONNULL_BEGIN
@interface StoragePermissionStrategy : NSObject <PermissionStrategy>
@end
NS_ASSUME_NONNULL_END
This means phone and storage permission strategies are always added, including dependencies like CoreTelephony needed for phone permissions strategy.
Instead, we can add macros PERMISSION_STORAGE and PERMISSION_PHONE to PermissionHandlerEnums.h, and add an if...else block in phone and storage permission strategy header files, as follows:
#if PERMISSION_STORAGE
...
#else
#import "UnknownPermissionStrategy.h"
...
#endif
Pitch
This will allow users to specify if they want phone and storage permissions in their Podfiles.
For phone permission strategy, this would mean users who don't need phone permissions can leave out the CoreTelephony framework from their applications.