1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

ContentSharer: Update interface to return safer ScopedMessageBox instances

This commit is contained in:
reuk 2023-03-20 20:55:26 +00:00
parent 557d690ff4
commit 9d1a6a3b28
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
22 changed files with 1304 additions and 1033 deletions

View file

@ -54,6 +54,7 @@ target_sources(DemoRunner PRIVATE
target_compile_definitions(DemoRunner PRIVATE
PIP_JUCE_EXAMPLES_DIRECTORY_STRING="${JUCE_SOURCE_DIR}/examples"
JUCE_ALLOW_STATIC_NULL_VARIABLES=0
JUCE_CONTENT_SHARING=1
JUCE_DEMO_RUNNER=1
JUCE_PLUGINHOST_LV2=1
JUCE_PLUGINHOST_VST3=1

View file

@ -314,12 +314,11 @@ private:
SafePointer<CameraDemo> safeThis (this);
juce::ContentSharer::getInstance()->shareFiles ({url},
[safeThis] (bool success, const String&) mutable
{
if (safeThis)
safeThis->sharingFinished (success, false);
});
messageBox = ContentSharer::shareFilesScoped ({ url }, [safeThis] (bool success, const String&)
{
if (safeThis)
safeThis->sharingFinished (success, false);
});
#endif
}
}
@ -355,12 +354,11 @@ private:
SafePointer<CameraDemo> safeThis (this);
juce::ContentSharer::getInstance()->shareFiles ({url},
[safeThis] (bool success, const String&) mutable
{
if (safeThis)
safeThis->sharingFinished (success, true);
});
messageBox = ContentSharer::shareFilesScoped ({ url }, [safeThis] (bool success, const String&)
{
if (safeThis)
safeThis->sharingFinished (success, true);
});
}
#endif
}

View file

@ -462,7 +462,7 @@ private:
}
else if (type == shareText)
{
ContentSharer::getInstance()->shareText ("I love JUCE!", [ptr = Component::SafePointer (this)] (bool success, const String& error)
messageBox = ContentSharer::shareTextScoped ("I love JUCE!", [ptr = Component::SafePointer (this)] (bool success, const String& error)
{
if (ptr == nullptr)
return;
@ -489,7 +489,7 @@ private:
Array<URL> urls;
urls.add (URL (fileToSave));
ContentSharer::getInstance()->shareFiles (urls, [ptr = Component::SafePointer (this)] (bool success, const String& error)
messageBox = ContentSharer::shareFilesScoped (urls, [ptr = Component::SafePointer (this)] (bool success, const String& error)
{
if (ptr == nullptr)
return;
@ -519,7 +519,7 @@ private:
Array<Image> images { myImage, myImage2 };
ContentSharer::getInstance()->shareImages (images, [ptr = Component::SafePointer (this)] (bool success, const String& error)
messageBox = ContentSharer::shareImagesScoped (images, nullptr, [ptr = Component::SafePointer (this)] (bool success, const String& error)
{
if (ptr == nullptr)
return;