mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added JUCE_CONTENT_SHARING define to conditionally compile the native content sharer code
This commit is contained in:
parent
814f317346
commit
18df1b0937
12 changed files with 109 additions and 76 deletions
|
|
@ -348,7 +348,7 @@ private:
|
|||
{
|
||||
recorder.stop();
|
||||
|
||||
#if (JUCE_ANDROID || JUCE_IOS)
|
||||
#if JUCE_CONTENT_SHARING
|
||||
SafePointer<AudioRecordingDemo> safeThis (this);
|
||||
File fileToShare = lastRecording;
|
||||
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ private:
|
|||
snapshotButton.setEnabled (true);
|
||||
#endif
|
||||
|
||||
#if JUCE_ANDROID || JUCE_IOS
|
||||
#if JUCE_CONTENT_SHARING
|
||||
URL url (recordingFile);
|
||||
|
||||
snapshotButton .setEnabled (false);
|
||||
|
|
@ -337,7 +337,7 @@ private:
|
|||
|
||||
lastSnapshot.setImage (image);
|
||||
|
||||
#if JUCE_ANDROID || JUCE_IOS
|
||||
#if JUCE_CONTENT_SHARING
|
||||
auto imageFile = File::getSpecialLocation (File::tempDirectory).getNonexistentChildFile ("JuceCameraPhotoDemo", ".jpg");
|
||||
|
||||
FileOutputStream stream (imageFile);
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public:
|
|||
StringArray windowNames { "Plain Alert Window", "Alert Window With Warning Icon", "Alert Window With Info Icon", "Alert Window With Question Icon",
|
||||
"OK Cancel Alert Window", "Alert Window With Extra Components", "CalloutBox", "Thread With Progress Window",
|
||||
"'Load' File Browser", "'Load' File Browser With Image Preview", "'Choose Directory' File Browser", "'Save' File Browser",
|
||||
"Share Text", "Share Files", "Share Images" };
|
||||
"Share Text", "Share Files", "Share Images" };
|
||||
|
||||
// warn in case we add any windows
|
||||
jassert (windowNames.size() == numDialogs);
|
||||
|
|
|
|||
|
|
@ -1442,6 +1442,9 @@ private:
|
|||
if (isInAppBillingEnabled())
|
||||
defines.set ("JUCE_IN_APP_PURCHASES", "1");
|
||||
|
||||
if (isContentSharingEnabled())
|
||||
defines.set ("JUCE_CONTENT_SHARING", "1");
|
||||
|
||||
if (supportsGLv3())
|
||||
defines.set ("JUCE_ANDROID_GL_ES_VERSION_3_0", "1");
|
||||
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ public:
|
|||
uiStatusBarHiddenValue (settings, Ids::UIStatusBarHidden, getUndoManager()),
|
||||
documentExtensionsValue (settings, Ids::documentExtensions, getUndoManager()),
|
||||
iosInAppPurchasesValue (settings, Ids::iosInAppPurchases, getUndoManager()),
|
||||
iosContentSharingValue (settings, Ids::iosContentSharing, getUndoManager(), true),
|
||||
iosBackgroundAudioValue (settings, Ids::iosBackgroundAudio, getUndoManager()),
|
||||
iosBackgroundBleValue (settings, Ids::iosBackgroundBle, getUndoManager()),
|
||||
iosPushNotificationsValue (settings, Ids::iosPushNotifications, getUndoManager()),
|
||||
|
|
@ -197,6 +198,7 @@ public:
|
|||
String getSendAppleEventsPermissionTextString() const { return sendAppleEventsPermissionTextValue.get(); }
|
||||
|
||||
bool isInAppPurchasesEnabled() const { return iosInAppPurchasesValue.get(); }
|
||||
bool isContentSharingEnabled() const { return iosContentSharingValue.get(); }
|
||||
bool isBackgroundAudioEnabled() const { return iosBackgroundAudioValue.get(); }
|
||||
bool isBackgroundBleEnabled() const { return iosBackgroundBleValue.get(); }
|
||||
bool isPushNotificationsEnabled() const { return iosPushNotificationsValue.get(); }
|
||||
|
|
@ -465,6 +467,9 @@ public:
|
|||
|
||||
if (iOS)
|
||||
{
|
||||
props.add (new ChoicePropertyComponent (iosContentSharingValue, "Content Sharing"),
|
||||
"Enable this to allow your app to share content with other apps.");
|
||||
|
||||
props.add (new ChoicePropertyComponent (iosBackgroundAudioValue, "Audio Background Capability"),
|
||||
"Enable this to grant your app the capability to access audio when in background mode. "
|
||||
"This permission is required if your app creates a MIDI input or output device.");
|
||||
|
|
@ -1460,6 +1465,9 @@ public:
|
|||
if (owner.isInAppPurchasesEnabled())
|
||||
defines.set ("JUCE_IN_APP_PURCHASES", "1");
|
||||
|
||||
if (owner.iOS && owner.isContentSharingEnabled())
|
||||
defines.set ("JUCE_CONTENT_SHARING", "1");
|
||||
|
||||
if (owner.isPushNotificationsEnabled())
|
||||
defines.set ("JUCE_PUSH_NOTIFICATIONS", "1");
|
||||
|
||||
|
|
@ -2023,7 +2031,7 @@ private:
|
|||
iosBluetoothPermissionNeededValue, iosBluetoothPermissionTextValue,
|
||||
sendAppleEventsPermissionNeededValue, sendAppleEventsPermissionTextValue,
|
||||
uiFileSharingEnabledValue, uiSupportsDocumentBrowserValue, uiStatusBarHiddenValue, documentExtensionsValue, iosInAppPurchasesValue,
|
||||
iosBackgroundAudioValue, iosBackgroundBleValue, iosPushNotificationsValue, iosAppGroupsValue, iCloudPermissionsValue,
|
||||
iosContentSharingValue, iosBackgroundAudioValue, iosBackgroundBleValue, iosPushNotificationsValue, iosAppGroupsValue, iCloudPermissionsValue,
|
||||
iosDevelopmentTeamIDValue, iosAppGroupsIDValue, keepCustomXcodeSchemesValue, useHeaderMapValue, customLaunchStoryboardValue,
|
||||
exporterBundleIdentifierValue;
|
||||
|
||||
|
|
|
|||
|
|
@ -248,6 +248,7 @@ namespace Ids
|
|||
DECLARE_ID (iPadScreenOrientation);
|
||||
DECLARE_ID (iosScreenOrientation);
|
||||
DECLARE_ID (iosInAppPurchases);
|
||||
DECLARE_ID (iosContentSharing);
|
||||
DECLARE_ID (iosBackgroundAudio);
|
||||
DECLARE_ID (iosBackgroundBle);
|
||||
DECLARE_ID (iosPushNotifications);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
namespace juce
|
||||
{
|
||||
|
||||
#if JUCE_IOS || JUCE_ANDROID
|
||||
#if JUCE_CONTENT_SHARING
|
||||
//==============================================================================
|
||||
class ContentSharer::PrepareImagesThread : private Thread
|
||||
{
|
||||
|
|
@ -154,7 +154,7 @@ ContentSharer::~ContentSharer() { clearSingletonInstance(); }
|
|||
void ContentSharer::shareFiles (const Array<URL>& files,
|
||||
std::function<void(bool, const String&)> callbackToUse)
|
||||
{
|
||||
#if JUCE_IOS || JUCE_ANDROID
|
||||
#if JUCE_CONTENT_SHARING
|
||||
startNewShare (callbackToUse);
|
||||
pimpl->shareFiles (files);
|
||||
#else
|
||||
|
|
@ -168,7 +168,7 @@ void ContentSharer::shareFiles (const Array<URL>& files,
|
|||
#endif
|
||||
}
|
||||
|
||||
#if JUCE_IOS || JUCE_ANDROID
|
||||
#if JUCE_CONTENT_SHARING
|
||||
void ContentSharer::startNewShare (std::function<void(bool, const String&)> callbackToUse)
|
||||
{
|
||||
// You should not start another sharing operation before the previous one is finished.
|
||||
|
|
@ -192,7 +192,7 @@ void ContentSharer::startNewShare (std::function<void(bool, const String&)> call
|
|||
void ContentSharer::shareText (const String& text,
|
||||
std::function<void(bool, const String&)> callbackToUse)
|
||||
{
|
||||
#if JUCE_IOS || JUCE_ANDROID
|
||||
#if JUCE_CONTENT_SHARING
|
||||
startNewShare (callbackToUse);
|
||||
pimpl->shareText (text);
|
||||
#else
|
||||
|
|
@ -210,7 +210,7 @@ void ContentSharer::shareImages (const Array<Image>& images,
|
|||
std::function<void(bool, const String&)> callbackToUse,
|
||||
ImageFileFormat* imageFileFormatToUse)
|
||||
{
|
||||
#if JUCE_IOS || JUCE_ANDROID
|
||||
#if JUCE_CONTENT_SHARING
|
||||
startNewShare (callbackToUse);
|
||||
prepareImagesThread.reset (new PrepareImagesThread (*this, images, imageFileFormatToUse));
|
||||
#else
|
||||
|
|
@ -224,7 +224,7 @@ void ContentSharer::shareImages (const Array<Image>& images,
|
|||
#endif
|
||||
}
|
||||
|
||||
#if JUCE_IOS || JUCE_ANDROID
|
||||
#if JUCE_CONTENT_SHARING
|
||||
void ContentSharer::filesToSharePrepared()
|
||||
{
|
||||
Array<URL> urls;
|
||||
|
|
@ -242,7 +242,7 @@ void ContentSharer::filesToSharePrepared()
|
|||
void ContentSharer::shareData (const MemoryBlock& mb,
|
||||
std::function<void(bool, const String&)> callbackToUse)
|
||||
{
|
||||
#if JUCE_IOS || JUCE_ANDROID
|
||||
#if JUCE_CONTENT_SHARING
|
||||
startNewShare (callbackToUse);
|
||||
prepareDataThread.reset (new PrepareDataThread (*this, mb));
|
||||
#else
|
||||
|
|
@ -262,7 +262,7 @@ void ContentSharer::sharingFinished (bool succeeded, const String& errorDescript
|
|||
|
||||
String error (errorDescription);
|
||||
|
||||
#if JUCE_IOS || JUCE_ANDROID
|
||||
#if JUCE_CONTENT_SHARING
|
||||
pimpl.reset();
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ private:
|
|||
|
||||
std::function<void(bool, String)> callback;
|
||||
|
||||
#if JUCE_IOS || JUCE_ANDROID
|
||||
#if JUCE_CONTENT_SHARING
|
||||
struct Pimpl
|
||||
{
|
||||
virtual ~Pimpl() {}
|
||||
|
|
|
|||
|
|
@ -281,7 +281,11 @@ namespace juce
|
|||
#include "native/juce_ios_UIViewComponentPeer.mm"
|
||||
#include "native/juce_ios_Windowing.mm"
|
||||
#include "native/juce_ios_FileChooser.mm"
|
||||
#include "native/juce_ios_ContentSharer.cpp"
|
||||
|
||||
#if JUCE_CONTENT_SHARING
|
||||
#include "native/juce_ios_ContentSharer.cpp"
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include "native/juce_mac_NSViewComponentPeer.mm"
|
||||
#include "native/juce_mac_Windowing.mm"
|
||||
|
|
@ -321,6 +325,9 @@ namespace juce
|
|||
#include "native/juce_android_Windowing.cpp"
|
||||
#include "native/juce_common_MimeTypes.cpp"
|
||||
#include "native/juce_android_FileChooser.cpp"
|
||||
#include "native/juce_android_ContentSharer.cpp"
|
||||
|
||||
#if JUCE_CONTENT_SHARING
|
||||
#include "native/juce_android_ContentSharer.cpp"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,26 +30,42 @@ namespace juce
|
|||
// This byte-code is generated from native/java/app/com/roli/juce/JuceContentProviderCursor.java with min sdk version 16
|
||||
// See juce_core/native/java/README.txt on how to generate this byte-code.
|
||||
static const uint8 javaJuceContentProviderCursor[] =
|
||||
{ 31,139,8,8,138,122,94,94,0,3,74,117,99,101,67,111,110,116,101,110,116,80,114,111,118,105,100,101,114,67,117,114,115,111,114,46,100,101,120,0,117,147,177,111,211,64,20,198,223,157,157,148,150,52,184,144,1,6,32,160,46,29,138,43,209,178,132,34,80,144,42,
|
||||
89,6,85,10,164,82,59,93,109,211,184,77,124,145,237,68,17,98,0,4,91,6,6,38,38,64,133,153,255,0,33,133,255,131,137,149,133,177,3,223,229,206,37,18,194,210,207,247,222,229,189,239,157,206,95,194,104,180,176,118,115,131,142,7,95,175,127,216,250,229,236,28,
|
||||
61,169,85,222,124,219,126,234,140,155,159,157,142,184,107,17,245,137,104,212,94,63,79,230,121,207,137,28,210,251,37,240,5,216,96,2,24,248,109,246,79,76,190,140,215,9,184,15,222,129,143,224,19,248,14,126,130,37,232,213,192,69,112,25,92,3,183,192,38,240,
|
||||
64,4,142,192,144,107,61,203,204,83,51,230,205,106,153,179,149,77,252,10,133,115,38,30,35,62,99,226,183,136,33,67,139,211,179,233,46,165,185,64,106,159,79,115,126,154,51,170,152,124,201,212,21,191,171,103,108,130,18,78,163,194,103,92,207,239,215,137,238,
|
||||
209,46,238,171,138,9,122,202,107,174,207,42,29,134,218,22,42,250,107,232,98,213,127,116,237,105,110,83,249,118,156,196,249,29,98,30,93,241,6,65,212,148,73,30,37,249,118,42,135,113,24,165,205,65,154,201,244,198,161,24,10,186,234,139,36,76,101,28,186,161,
|
||||
200,197,190,200,34,247,129,200,211,120,164,139,26,180,226,7,178,231,166,178,27,187,135,144,114,255,171,215,32,214,38,222,246,200,106,123,62,2,159,46,236,249,106,134,219,21,201,129,219,130,104,114,208,160,82,208,149,89,68,103,3,217,29,244,146,135,162,
|
||||
23,101,116,41,208,130,173,142,72,11,185,166,42,11,201,238,200,44,167,121,245,126,36,31,163,209,206,59,113,70,21,126,174,50,87,221,92,165,26,97,217,197,69,112,92,14,127,241,220,158,112,254,146,147,197,126,240,69,115,55,108,102,45,188,199,103,252,87,120,
|
||||
98,98,214,89,31,22,94,44,207,248,145,213,117,191,242,36,115,254,122,134,215,181,190,242,169,101,106,212,119,165,186,238,157,126,115,71,199,234,127,240,7,124,122,243,207,64,3,0,0,0,0 };
|
||||
{ 31,139,8,8,138,122,94,94,0,3,74,117,99,101,67,111,110,116,101,110,116,80,114,111,118,105,100,101,114,67,117,114,115,111,114,
|
||||
46,100,101,120,0,117,147,177,111,211,64,20,198,223,157,157,148,150,52,184,144,1,6,32,160,46,29,138,43,209,178,132,34,80,144,42,
|
||||
89,6,85,10,164,82,59,93,109,211,184,77,124,145,237,68,17,98,0,4,91,6,6,38,38,64,133,153,255,0,33,133,255,131,137,149,133,177,3,
|
||||
223,229,206,37,18,194,210,207,247,222,229,189,239,157,206,95,194,104,180,176,118,115,131,142,7,95,175,127,216,250,229,236,28,
|
||||
61,169,85,222,124,219,126,234,140,155,159,157,142,184,107,17,245,137,104,212,94,63,79,230,121,207,137,28,210,251,37,240,5,216,
|
||||
96,2,24,248,109,246,79,76,190,140,215,9,184,15,222,129,143,224,19,248,14,126,130,37,232,213,192,69,112,25,92,3,183,192,38,240,
|
||||
64,4,142,192,144,107,61,203,204,83,51,230,205,106,153,179,149,77,252,10,133,115,38,30,35,62,99,226,183,136,33,67,139,211,179,
|
||||
233,46,165,185,64,106,159,79,115,126,154,51,170,152,124,201,212,21,191,171,103,108,130,18,78,163,194,103,92,207,239,215,137,238,
|
||||
209,46,238,171,138,9,122,202,107,174,207,42,29,134,218,22,42,250,107,232,98,213,127,116,237,105,110,83,249,118,156,196,249,29,
|
||||
98,30,93,241,6,65,212,148,73,30,37,249,118,42,135,113,24,165,205,65,154,201,244,198,161,24,10,186,234,139,36,76,101,28,186,161,
|
||||
200,197,190,200,34,247,129,200,211,120,164,139,26,180,226,7,178,231,166,178,27,187,135,144,114,255,171,215,32,214,38,222,246,
|
||||
200,106,123,62,2,159,46,236,249,106,134,219,21,201,129,219,130,104,114,208,160,82,208,149,89,68,103,3,217,29,244,146,135,162,
|
||||
23,101,116,41,208,130,173,142,72,11,185,166,42,11,201,238,200,44,167,121,245,126,36,31,163,209,206,59,113,70,21,126,174,50,87,
|
||||
221,92,165,26,97,217,197,69,112,92,14,127,241,220,158,112,254,146,147,197,126,240,69,115,55,108,102,45,188,199,103,252,87,120,
|
||||
98,98,214,89,31,22,94,44,207,248,145,213,117,191,242,36,115,254,122,134,215,181,190,242,169,101,106,212,119,165,186,238,157,126,
|
||||
115,71,199,234,127,240,7,124,122,243,207,64,3,0,0,0,0 };
|
||||
|
||||
// This byte-code is generated from native/java/app/com/roli/juce/JuceContentProviderFileObserver.java with min sdk version 16
|
||||
// See juce_core/native/java/README.txt on how to generate this byte-code.
|
||||
static const uint8 javaJuceContentProviderFileObserver[] =
|
||||
{ 31,139,8,8,123,122,94,94,0,3,74,117,99,101,67,111,110,116,101,110,116,80,114,111,118,105,100,101,114,70,105,108,101,79,98,115,101,114,118,101,114,46,100,101,120,0,133,147,205,107,19,65,24,198,223,249,72,98,91,93,210,84,4,17,36,130,130,32,186,145,218,
|
||||
131,196,10,197,47,18,22,44,166,6,41,120,216,38,75,119,107,186,19,118,215,144,131,5,45,61,148,158,188,244,164,71,65,241,212,163,40,138,136,224,213,91,253,3,60,250,7,120,211,103,118,166,116,61,25,248,205,251,206,251,206,60,59,59,251,164,31,140,39,27,179,
|
||||
115,116,110,243,212,238,147,208,189,112,245,227,236,183,157,19,103,216,220,215,223,91,251,175,247,249,88,16,13,137,104,220,189,82,35,251,251,193,137,142,147,169,151,193,103,32,117,29,48,112,132,153,121,149,153,121,3,195,121,236,89,68,220,3,239,192,7,
|
||||
240,9,252,4,127,64,3,253,155,224,14,240,192,61,240,0,60,4,27,96,11,236,128,93,240,2,188,2,111,185,209,231,246,249,37,123,158,138,62,131,157,111,99,193,132,205,159,35,159,180,249,75,228,83,54,127,131,92,64,201,201,181,68,254,142,34,87,53,245,163,121,36,
|
||||
154,46,68,110,239,66,216,248,197,22,202,80,212,181,61,110,206,50,108,16,45,148,150,113,119,78,222,209,207,123,111,123,157,58,250,75,156,248,101,199,234,201,124,47,179,239,99,114,153,119,14,222,177,124,45,138,163,236,58,177,22,177,54,157,109,63,238,5,
|
||||
55,84,156,5,113,182,152,168,81,212,15,146,219,209,32,184,187,146,6,201,40,72,46,173,249,35,159,78,122,126,220,79,84,212,119,85,234,22,219,77,114,189,158,90,119,19,53,136,220,53,72,185,255,209,107,82,205,211,146,238,192,143,87,221,78,150,68,241,106,147,
|
||||
88,151,68,183,229,145,236,182,205,232,181,80,192,112,186,103,164,58,161,159,252,43,116,107,132,50,149,130,60,200,80,165,25,77,232,113,73,221,79,3,146,235,126,250,136,42,42,54,203,228,208,207,66,146,89,24,165,52,37,170,51,211,21,103,254,34,213,184,51,
|
||||
83,113,150,113,69,156,17,103,207,158,202,239,156,109,226,251,177,95,184,172,99,246,187,176,66,60,240,44,47,248,86,20,188,43,11,254,45,209,161,135,203,116,232,99,86,55,251,181,151,89,213,172,209,30,227,117,163,175,253,45,236,26,237,1,170,155,189,185,63,
|
||||
{ 31,139,8,8,123,122,94,94,0,3,74,117,99,101,67,111,110,116,101,110,116,80,114,111,118,105,100,101,114,70,105,108,101,79,98,115,
|
||||
101,114,118,101,114,46,100,101,120,0,133,147,205,107,19,65,24,198,223,249,72,98,91,93,210,84,4,17,36,130,130,32,186,145,218,
|
||||
131,196,10,197,47,18,22,44,166,6,41,120,216,38,75,119,107,186,19,118,215,144,131,5,45,61,148,158,188,244,164,71,65,241,212,163,
|
||||
40,138,136,224,213,91,253,3,60,250,7,120,211,103,118,166,116,61,25,248,205,251,206,251,206,60,59,59,251,164,31,140,39,27,179,
|
||||
115,116,110,243,212,238,147,208,189,112,245,227,236,183,157,19,103,216,220,215,223,91,251,175,247,249,88,16,13,137,104,220,189,
|
||||
82,35,251,251,193,137,142,147,169,151,193,103,32,117,29,48,112,132,153,121,149,153,121,3,195,121,236,89,68,220,3,239,192,7,
|
||||
240,9,252,4,127,64,3,253,155,224,14,240,192,61,240,0,60,4,27,96,11,236,128,93,240,2,188,2,111,185,209,231,246,249,37,123,158,138,
|
||||
62,131,157,111,99,193,132,205,159,35,159,180,249,75,228,83,54,127,131,92,64,201,201,181,68,254,142,34,87,53,245,163,121,36,
|
||||
154,46,68,110,239,66,216,248,197,22,202,80,212,181,61,110,206,50,108,16,45,148,150,113,119,78,222,209,207,123,111,123,157,58,
|
||||
250,75,156,248,101,199,234,201,124,47,179,239,99,114,153,119,14,222,177,124,45,138,163,236,58,177,22,177,54,157,109,63,238,5,
|
||||
55,84,156,5,113,182,152,168,81,212,15,146,219,209,32,184,187,146,6,201,40,72,46,173,249,35,159,78,122,126,220,79,84,212,119,85,
|
||||
234,22,219,77,114,189,158,90,119,19,53,136,220,53,72,185,255,209,107,82,205,211,146,238,192,143,87,221,78,150,68,241,106,147,
|
||||
88,151,68,183,229,145,236,182,205,232,181,80,192,112,186,103,164,58,161,159,252,43,116,107,132,50,149,130,60,200,80,165,25,77,
|
||||
232,113,73,221,79,3,146,235,126,250,136,42,42,54,203,228,208,207,66,146,89,24,165,52,37,170,51,211,21,103,254,34,213,184,51,
|
||||
83,113,150,113,69,156,17,103,207,158,202,239,156,109,226,251,177,95,184,172,99,246,187,176,66,60,240,44,47,248,86,20,188,43,11,
|
||||
254,45,209,161,135,203,116,232,99,86,55,251,181,151,89,213,172,209,30,227,117,163,175,253,45,236,26,237,1,170,155,189,185,63,
|
||||
170,38,215,255,159,191,29,121,169,41,120,3,0,0,0,0 };
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -769,6 +785,48 @@ private:
|
|||
return assetFileDescriptors.getReference (assetFileDescriptors.size() - 1).get();
|
||||
}
|
||||
|
||||
StringArray filterMimeTypes (const StringArray& mimeTypes, const String& filter)
|
||||
{
|
||||
String filterToUse (filter.removeCharacters ("*"));
|
||||
|
||||
if (filterToUse.isEmpty() || filterToUse == "/")
|
||||
return mimeTypes;
|
||||
|
||||
StringArray result;
|
||||
|
||||
for (const auto& type : mimeTypes)
|
||||
if (String (type).contains (filterToUse))
|
||||
result.add (type);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
String getCommonMimeType (const StringArray& mimeTypes)
|
||||
{
|
||||
if (mimeTypes.isEmpty())
|
||||
return "*/*";
|
||||
|
||||
auto commonMime = mimeTypes[0];
|
||||
bool lookForCommonGroup = false;
|
||||
|
||||
for (int i = 1; i < mimeTypes.size(); ++i)
|
||||
{
|
||||
if (mimeTypes[i] == commonMime)
|
||||
continue;
|
||||
|
||||
if (! lookForCommonGroup)
|
||||
{
|
||||
lookForCommonGroup = true;
|
||||
commonMime = commonMime.upToFirstOccurrenceOf ("/", true, false);
|
||||
}
|
||||
|
||||
if (! mimeTypes[i].startsWith (commonMime))
|
||||
return "*/*";
|
||||
}
|
||||
|
||||
return lookForCommonGroup ? commonMime + "*" : commonMime;
|
||||
}
|
||||
|
||||
ContentSharer& owner;
|
||||
String packageName;
|
||||
String uriBase;
|
||||
|
|
|
|||
|
|
@ -196,8 +196,6 @@ static const uint8 javaComponentPeerView[] =
|
|||
extern void juce_firebaseRemoteMessageSendError (void*, void*);
|
||||
#endif
|
||||
|
||||
extern void juce_contentSharingCompleted (int);
|
||||
|
||||
//==============================================================================
|
||||
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
|
||||
METHOD (create, "<init>", "(II)V")
|
||||
|
|
|
|||
|
|
@ -45,48 +45,6 @@ static StringArray getMimeTypesForFileExtension (const String& fileExtension)
|
|||
return result;
|
||||
}
|
||||
|
||||
static StringArray filterMimeTypes (const StringArray& mimeTypes, const String& filter)
|
||||
{
|
||||
String filterToUse (filter.removeCharacters ("*"));
|
||||
|
||||
if (filterToUse.isEmpty() || filterToUse == "/")
|
||||
return mimeTypes;
|
||||
|
||||
StringArray result;
|
||||
|
||||
for (const auto& type : mimeTypes)
|
||||
if (String (type).contains (filterToUse))
|
||||
result.add (type);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static String getCommonMimeType (const StringArray& mimeTypes)
|
||||
{
|
||||
if (mimeTypes.isEmpty())
|
||||
return "*/*";
|
||||
|
||||
auto commonMime = mimeTypes[0];
|
||||
bool lookForCommonGroup = false;
|
||||
|
||||
for (int i = 1; i < mimeTypes.size(); ++i)
|
||||
{
|
||||
if (mimeTypes[i] == commonMime)
|
||||
continue;
|
||||
|
||||
if (! lookForCommonGroup)
|
||||
{
|
||||
lookForCommonGroup = true;
|
||||
commonMime = commonMime.upToFirstOccurrenceOf ("/", true, false);
|
||||
}
|
||||
|
||||
if (! mimeTypes[i].startsWith (commonMime))
|
||||
return "*/*";
|
||||
}
|
||||
|
||||
return lookForCommonGroup ? commonMime + "*" : commonMime;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
MimeTypeTableEntry MimeTypeTableEntry::table[641] =
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue