mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
ImageDemo: Fix permissions on mobile devices
Co-authored-by: MajorMurphy <major@murphyindustries.net>
This commit is contained in:
parent
26b817b7a4
commit
c2398791be
2 changed files with 19 additions and 3 deletions
|
|
@ -56,8 +56,6 @@ public:
|
|||
ImagesDemo()
|
||||
{
|
||||
setOpaque (true);
|
||||
imageList.setDirectory (File::getSpecialLocation (File::userPicturesDirectory), true, true);
|
||||
directoryThread.startThread (Thread::Priority::background);
|
||||
|
||||
fileTree.setTitle ("Files");
|
||||
fileTree.addListener (this);
|
||||
|
|
@ -81,6 +79,24 @@ public:
|
|||
-0.7); // and its preferred size is 70% of the total available space
|
||||
|
||||
setSize (500, 500);
|
||||
|
||||
RuntimePermissions::request (RuntimePermissions::readMediaImages, [self = SafePointer { this }] (bool granted)
|
||||
{
|
||||
if (self == nullptr)
|
||||
return;
|
||||
|
||||
if (! granted)
|
||||
{
|
||||
AlertWindow::showMessageBoxAsync (MessageBoxIconType::WarningIcon,
|
||||
"Permissions warning",
|
||||
"External storage access permission not granted, some files"
|
||||
" may be inaccessible.");
|
||||
return;
|
||||
}
|
||||
|
||||
self->imageList.setDirectory (File::getSpecialLocation (File::userPicturesDirectory), true, true);
|
||||
self->directoryThread.startThread (Thread::Priority::background);
|
||||
});
|
||||
}
|
||||
|
||||
~ImagesDemo() override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue