mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
RuntimePermissions: Allow requesting the POST_NOTIFICATIONS permission at runtime on Android
This commit is contained in:
parent
5878adaecd
commit
0329635ed2
2 changed files with 12 additions and 3 deletions
|
|
@ -113,7 +113,13 @@ public:
|
|||
/** Permission to read video files that your app didn't create.
|
||||
Has the same effect as readExternalStorage on iOS and Android versions before 33.
|
||||
*/
|
||||
readMediaVideo = 8
|
||||
readMediaVideo = 8,
|
||||
|
||||
/** Permission to post notifications.
|
||||
|
||||
@see PushNotifications::requestPermissionsWithSettings
|
||||
*/
|
||||
postNotification = 9
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@ static StringArray jucePermissionToAndroidPermissions (RuntimePermissions::Permi
|
|||
|
||||
case RuntimePermissions::readMediaVideo:
|
||||
return { externalStorageOrMedia ("android.permission.READ_MEDIA_VIDEO") };
|
||||
|
||||
case RuntimePermissions::postNotification:
|
||||
return { "android.permission.POST_NOTIFICATIONS" };
|
||||
}
|
||||
|
||||
// invalid permission
|
||||
|
|
@ -101,6 +104,7 @@ static RuntimePermissions::PermissionID androidPermissionToJucePermission (const
|
|||
{ "android.permission.READ_MEDIA_IMAGES", RuntimePermissions::readMediaImages },
|
||||
{ "android.permission.READ_MEDIA_VIDEO", RuntimePermissions::readMediaVideo },
|
||||
{ "android.permission.BLUETOOTH_SCAN", RuntimePermissions::bluetoothMidi },
|
||||
{ "android.permission.POST_NOTIFICATIONS", RuntimePermissions::postNotification },
|
||||
};
|
||||
|
||||
const auto iter = map.find (permission);
|
||||
|
|
@ -118,8 +122,7 @@ struct PermissionsRequest
|
|||
//==============================================================================
|
||||
struct PermissionsOverlay final : public FragmentOverlay
|
||||
{
|
||||
PermissionsOverlay (CriticalSection& cs) : overlayGuard (cs) {}
|
||||
~PermissionsOverlay() override = default;
|
||||
explicit PermissionsOverlay (CriticalSection& cs) : overlayGuard (cs) {}
|
||||
|
||||
struct PermissionResult
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue