| @@ -1657,6 +1657,17 @@ JuceAudioUnitv3Base* JuceAudioUnitv3Base::create (AUAudioUnit* audioUnit, AudioC | |||||
| return new JuceAudioUnitv3 (audioUnit, descr, options, error); | return new JuceAudioUnitv3 (audioUnit, descr, options, error); | ||||
| } | } | ||||
| #if JUCE_IOS | |||||
| namespace juce | |||||
| { | |||||
| struct UIViewPeerControllerReceiver | |||||
| { | |||||
| virtual ~UIViewPeerControllerReceiver(); | |||||
| virtual void setViewController (UIViewController*) = 0; | |||||
| }; | |||||
| } | |||||
| #endif | |||||
| //============================================================================== | //============================================================================== | ||||
| class JuceAUViewController | class JuceAUViewController | ||||
| { | { | ||||
| @@ -1708,6 +1719,9 @@ public: | |||||
| #if JUCE_IOS | #if JUCE_IOS | ||||
| if (JUCE_IOS_MAC_VIEW* peerView = [[[myself view] subviews] objectAtIndex: 0]) | if (JUCE_IOS_MAC_VIEW* peerView = [[[myself view] subviews] objectAtIndex: 0]) | ||||
| [peerView setContentMode: UIViewContentModeTop]; | [peerView setContentMode: UIViewContentModeTop]; | ||||
| if (auto* peer = dynamic_cast<UIViewPeerControllerReceiver*> (editor->getPeer())) | |||||
| peer->setViewController (myself); | |||||
| #endif | #endif | ||||
| } | } | ||||
| } | } | ||||
| @@ -85,11 +85,27 @@ public: | |||||
| setOpaque (false); | setOpaque (false); | ||||
| auto chooserBounds = Desktop::getInstance().getDisplays().getMainDisplay().userArea; | |||||
| setBounds (chooserBounds); | |||||
| if (SystemStats::isRunningInAppExtensionSandbox()) | |||||
| { | |||||
| [controller.get() setModalPresentationStyle:UIModalPresentationFullScreen]; | |||||
| if (auto* editorPeer = ComponentPeer::getPeer (0)) | |||||
| { | |||||
| auto chooserBounds = editorPeer->getComponent().getLocalBounds(); | |||||
| setBounds (chooserBounds); | |||||
| setAlwaysOnTop (true); | |||||
| addToDesktop (0); | |||||
| setAlwaysOnTop (true); | |||||
| editorPeer->getComponent().addAndMakeVisible (this); | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| auto chooserBounds = Desktop::getInstance().getDisplays().getMainDisplay().userArea; | |||||
| setBounds (chooserBounds); | |||||
| setAlwaysOnTop (true); | |||||
| addToDesktop (0); | |||||
| } | |||||
| } | } | ||||
| ~Native() | ~Native() | ||||
| @@ -308,7 +324,7 @@ bool FileChooser::isPlatformDialogAvailable() | |||||
| #if JUCE_DISABLE_NATIVE_FILECHOOSERS | #if JUCE_DISABLE_NATIVE_FILECHOOSERS | ||||
| return false; | return false; | ||||
| #else | #else | ||||
| return [[NSFileManager defaultManager] ubiquityIdentityToken] != nil; | |||||
| return true; | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -163,8 +163,17 @@ using namespace juce; | |||||
| namespace juce | namespace juce | ||||
| { | { | ||||
| struct UIViewPeerControllerReceiver | |||||
| { | |||||
| virtual ~UIViewPeerControllerReceiver(); | |||||
| virtual void setViewController (UIViewController*) = 0; | |||||
| }; | |||||
| UIViewPeerControllerReceiver::~UIViewPeerControllerReceiver() {} | |||||
| class UIViewComponentPeer : public ComponentPeer, | class UIViewComponentPeer : public ComponentPeer, | ||||
| public FocusChangeListener | |||||
| public FocusChangeListener, | |||||
| public UIViewPeerControllerReceiver | |||||
| { | { | ||||
| public: | public: | ||||
| UIViewComponentPeer (Component&, int windowStyleFlags, UIView* viewToAttachTo); | UIViewComponentPeer (Component&, int windowStyleFlags, UIView* viewToAttachTo); | ||||
| @@ -176,6 +185,12 @@ public: | |||||
| void setTitle (const String& title) override; | void setTitle (const String& title) override; | ||||
| void setBounds (const Rectangle<int>&, bool isNowFullScreen) override; | void setBounds (const Rectangle<int>&, bool isNowFullScreen) override; | ||||
| void setViewController (UIViewController* newController) override | |||||
| { | |||||
| jassert (controller == nullptr); | |||||
| controller = [newController retain]; | |||||
| } | |||||
| Rectangle<int> getBounds() const override { return getBounds (! isSharedWindow); } | Rectangle<int> getBounds() const override { return getBounds (! isSharedWindow); } | ||||
| Rectangle<int> getBounds (bool global) const; | Rectangle<int> getBounds (bool global) const; | ||||
| Point<float> localToGlobal (Point<float> relativePosition) override; | Point<float> localToGlobal (Point<float> relativePosition) override; | ||||
| @@ -218,7 +233,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| UIWindow* window; | UIWindow* window; | ||||
| JuceUIView* view; | JuceUIView* view; | ||||
| JuceUIViewController* controller; | |||||
| UIViewController* controller; | |||||
| bool isSharedWindow, fullScreen, insideDrawRect, isAppex; | bool isSharedWindow, fullScreen, insideDrawRect, isAppex; | ||||
| static int64 getMouseTime (UIEvent* e) noexcept | static int64 getMouseTime (UIEvent* e) noexcept | ||||