mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
NativeMessageBox (iOS): Delay lookup of focused peer
Before 2c5b1fbb6f, we only queried
currentlyFocusedPeer during runAsync(), instead of reading it
immediately. The behaviour after that commit prevented message boxes
from showing if showMessageBoxAsync() was called before any peer had
been created.
This commit is contained in:
parent
2cbcbc8882
commit
b272f968aa
1 changed files with 9 additions and 9 deletions
|
|
@ -44,6 +44,15 @@ std::unique_ptr<ScopedMessageBoxInterface> ScopedMessageBoxInterface::create (co
|
|||
|
||||
void runAsync (std::function<void (int)> recipient) override
|
||||
{
|
||||
auto* peerToUse = std::invoke ([&]() -> UIViewComponentPeer*
|
||||
{
|
||||
if (auto* comp = options.getAssociatedComponent())
|
||||
if (auto* peer = comp->getPeer())
|
||||
return static_cast<UIViewComponentPeer*> (peer);
|
||||
|
||||
return iOSGlobals::currentlyFocusedPeer;
|
||||
});
|
||||
|
||||
if (peerToUse == nullptr)
|
||||
{
|
||||
// Since iOS8, alert windows need to be associated with a window, so you need to
|
||||
|
|
@ -109,15 +118,6 @@ std::unique_ptr<ScopedMessageBoxInterface> ScopedMessageBoxInterface::create (co
|
|||
|
||||
private:
|
||||
const MessageBoxOptions options;
|
||||
UIViewComponentPeer* peerToUse = std::invoke ([&]() -> UIViewComponentPeer*
|
||||
{
|
||||
if (auto* comp = options.getAssociatedComponent())
|
||||
if (auto* peer = comp->getPeer())
|
||||
return static_cast<UIViewComponentPeer*> (peer);
|
||||
|
||||
return iOSGlobals::currentlyFocusedPeer;
|
||||
});
|
||||
|
||||
NSUniquePtr<UIAlertController> alert;
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MessageBox)
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue