Plan keyboard visibility in app core
This commit is contained in:
@@ -19,6 +19,14 @@ void invoke_picked_path_if_selected(
|
||||
callback(path);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool should_dispatch_keyboard_visibility(bool visible) noexcept
|
||||
{
|
||||
const auto action = pp::app::plan_virtual_keyboard(visible);
|
||||
return visible
|
||||
? action == pp::app::VirtualKeyboardAction::show_keyboard
|
||||
: action == pp::app::VirtualKeyboardAction::hide_keyboard;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
@@ -132,6 +140,8 @@ void App::showKeyboard()
|
||||
{
|
||||
LOG("show keyboard");
|
||||
redraw = true;
|
||||
if (!should_dispatch_keyboard_visibility(true))
|
||||
return;
|
||||
#ifdef __IOS__
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[ios_view show_keyboard];
|
||||
@@ -145,6 +155,8 @@ void App::hideKeyboard()
|
||||
{
|
||||
LOG("hide keyboard");
|
||||
redraw = true;
|
||||
if (!should_dispatch_keyboard_visibility(false))
|
||||
return;
|
||||
#ifdef __IOS__
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[ios_view hide_keyboard];
|
||||
|
||||
Reference in New Issue
Block a user