Route SonarPen tools action through platform services
This commit is contained in:
@@ -187,6 +187,8 @@ public:
|
||||
[[nodiscard]] bool uses_prepared_file_writes() const;
|
||||
[[nodiscard]] bool uses_work_directory_document_export_collections() const;
|
||||
[[nodiscard]] bool disables_network_tls_verification() const;
|
||||
[[nodiscard]] bool platform_supports_sonarpen() const;
|
||||
void start_platform_sonarpen();
|
||||
void pick_dir(std::function<void(std::string path)> callback);
|
||||
void display_file(std::string path);
|
||||
void share_file(std::string path);
|
||||
|
||||
@@ -196,6 +196,16 @@ bool App::disables_network_tls_verification() const
|
||||
return active_platform_services().disables_network_tls_verification();
|
||||
}
|
||||
|
||||
bool App::platform_supports_sonarpen() const
|
||||
{
|
||||
return active_platform_services().supports_sonarpen();
|
||||
}
|
||||
|
||||
void App::start_platform_sonarpen()
|
||||
{
|
||||
active_platform_services().start_sonarpen();
|
||||
}
|
||||
|
||||
void App::pick_dir(std::function<void(std::string path)> callback)
|
||||
{
|
||||
redraw = true;
|
||||
|
||||
@@ -1265,17 +1265,20 @@ void App::init_menu_tools()
|
||||
};
|
||||
*/
|
||||
|
||||
#if __IOS__
|
||||
popup_exp->find<NodeButtonCustom>("sonarpen")->on_click = [this, popup_exp](Node*) {
|
||||
const auto plan = pp::app::plan_tools_menu_command(pp::app::ToolsMenuCommand::sonarpen, true);
|
||||
execute_tools_menu_plan(*this, plan);
|
||||
if (plan.closes_root_popup)
|
||||
{
|
||||
popup_exp->mouse_release();
|
||||
popup_exp->destroy();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
if (platform_supports_sonarpen())
|
||||
{
|
||||
popup_exp->find<NodeButtonCustom>("sonarpen")->on_click = [this, popup_exp](Node*) {
|
||||
const auto plan = pp::app::plan_tools_menu_command(
|
||||
pp::app::ToolsMenuCommand::sonarpen,
|
||||
platform_supports_sonarpen());
|
||||
execute_tools_menu_plan(*this, plan);
|
||||
if (plan.closes_root_popup)
|
||||
{
|
||||
popup_exp->mouse_release();
|
||||
popup_exp->destroy();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,9 +315,7 @@ public:
|
||||
|
||||
void start_sonarpen() override
|
||||
{
|
||||
#if __IOS__
|
||||
[app_.ios_app sonarpen_start];
|
||||
#endif
|
||||
app_.start_platform_sonarpen();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -66,6 +66,8 @@ public:
|
||||
[[nodiscard]] virtual bool uses_prepared_file_writes() = 0;
|
||||
[[nodiscard]] virtual bool uses_work_directory_document_export_collections() = 0;
|
||||
[[nodiscard]] virtual bool disables_network_tls_verification() = 0;
|
||||
[[nodiscard]] virtual bool supports_sonarpen() = 0;
|
||||
virtual void start_sonarpen() = 0;
|
||||
[[nodiscard]] virtual PreparedFileTarget prepare_writable_file(
|
||||
std::string_view type,
|
||||
std::string_view default_name,
|
||||
|
||||
@@ -458,6 +458,22 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
[[nodiscard]] bool supports_sonarpen() override
|
||||
{
|
||||
#if __IOS__
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void start_sonarpen() override
|
||||
{
|
||||
#if __IOS__
|
||||
[App::I->ios_app sonarpen_start];
|
||||
#endif
|
||||
}
|
||||
|
||||
[[nodiscard]] pp::platform::PreparedFileTarget prepare_writable_file(
|
||||
std::string_view type,
|
||||
std::string_view default_name,
|
||||
|
||||
@@ -463,6 +463,15 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool supports_sonarpen() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void start_sonarpen() override
|
||||
{
|
||||
}
|
||||
|
||||
[[nodiscard]] pp::platform::PreparedFileTarget prepare_writable_file(
|
||||
std::string_view type,
|
||||
std::string_view default_name,
|
||||
|
||||
Reference in New Issue
Block a user