Extract platform policy catalog
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "app_core/document_platform_io.h"
|
||||
#include "log.h"
|
||||
#include "platform_api/network_tls_policy.h"
|
||||
#include "platform_api/platform_policy.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
@@ -288,11 +289,8 @@ public:
|
||||
|
||||
[[nodiscard]] bool deletes_recorded_files_on_clear() override
|
||||
{
|
||||
#if defined(__IOS__) || defined(__OSX__)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return pp::platform::platform_deletes_recorded_files_on_clear(
|
||||
pp::platform::current_platform_family());
|
||||
}
|
||||
|
||||
void clear_recorded_files(std::string_view recording_path) override
|
||||
@@ -306,6 +304,11 @@ public:
|
||||
|
||||
void publish_exported_image(std::string_view path) override
|
||||
{
|
||||
if (!pp::platform::platform_publishes_exported_images(pp::platform::current_platform_family()))
|
||||
{
|
||||
(void)path;
|
||||
return;
|
||||
}
|
||||
#ifdef __IOS__
|
||||
save_image_library(std::string(path));
|
||||
#else
|
||||
@@ -315,6 +318,8 @@ public:
|
||||
|
||||
void flush_persistent_storage() override
|
||||
{
|
||||
if (!pp::platform::platform_flushes_persistent_storage(pp::platform::current_platform_family()))
|
||||
return;
|
||||
#ifdef __WEB__
|
||||
webgl_sync();
|
||||
#endif
|
||||
@@ -324,15 +329,10 @@ public:
|
||||
std::string_view work_path,
|
||||
std::string_view data_path) override
|
||||
{
|
||||
#ifdef __IOS__
|
||||
return {
|
||||
std::string(work_path),
|
||||
std::string(data_path) + "/Inbox",
|
||||
};
|
||||
#else
|
||||
(void)data_path;
|
||||
return { std::string(work_path) };
|
||||
#endif
|
||||
return pp::platform::platform_document_browse_roots(
|
||||
pp::platform::current_platform_family(),
|
||||
work_path,
|
||||
data_path);
|
||||
}
|
||||
|
||||
void save_ui_state() override
|
||||
@@ -344,11 +344,8 @@ public:
|
||||
|
||||
[[nodiscard]] bool enables_live_asset_reloading() override
|
||||
{
|
||||
#if defined(__OSX__)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return pp::platform::platform_enables_live_asset_reloading(
|
||||
pp::platform::current_platform_family());
|
||||
}
|
||||
|
||||
void update_platform_frame(float delta_time_seconds) override
|
||||
@@ -455,11 +452,8 @@ public:
|
||||
|
||||
[[nodiscard]] bool supports_working_directory_picker() override
|
||||
{
|
||||
#if defined(__OSX__)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return pp::platform::platform_supports_working_directory_picker(
|
||||
pp::platform::current_platform_family());
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string format_working_directory_path(std::string_view path) override
|
||||
@@ -474,20 +468,14 @@ public:
|
||||
|
||||
[[nodiscard]] bool uses_prepared_file_writes() override
|
||||
{
|
||||
#if __IOS__ || __WEB__
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return pp::platform::platform_uses_prepared_file_writes(
|
||||
pp::platform::current_platform_family());
|
||||
}
|
||||
|
||||
[[nodiscard]] bool uses_work_directory_document_export_collections() override
|
||||
{
|
||||
#if __IOS__
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return pp::platform::platform_uses_work_directory_document_export_collections(
|
||||
pp::platform::current_platform_family());
|
||||
}
|
||||
|
||||
[[nodiscard]] bool disables_network_tls_verification() override
|
||||
@@ -497,20 +485,13 @@ public:
|
||||
|
||||
[[nodiscard]] bool uses_ppbr_export_data_directory_override() override
|
||||
{
|
||||
#if defined(__OSX__)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return pp::platform::platform_uses_ppbr_export_data_directory_override(
|
||||
pp::platform::current_platform_family());
|
||||
}
|
||||
|
||||
[[nodiscard]] bool supports_sonarpen() override
|
||||
{
|
||||
#if __IOS__
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return pp::platform::platform_supports_sonarpen(pp::platform::current_platform_family());
|
||||
}
|
||||
|
||||
void start_sonarpen() override
|
||||
@@ -522,11 +503,8 @@ public:
|
||||
|
||||
[[nodiscard]] int default_canvas_resolution() override
|
||||
{
|
||||
#if __WEB__
|
||||
return 512;
|
||||
#else
|
||||
return 1536;
|
||||
#endif
|
||||
return pp::platform::platform_default_canvas_resolution(
|
||||
pp::platform::current_platform_family());
|
||||
}
|
||||
|
||||
[[nodiscard]] bool draws_canvas_tip_for_pointer(
|
||||
@@ -534,13 +512,11 @@ public:
|
||||
bool is_stylus,
|
||||
bool is_left_button_release) override
|
||||
{
|
||||
#if defined(__IOS__)
|
||||
(void)is_stylus;
|
||||
return is_mouse && !is_left_button_release;
|
||||
#else
|
||||
(void)is_left_button_release;
|
||||
return is_mouse || is_stylus;
|
||||
#endif
|
||||
return pp::platform::platform_draws_canvas_tip_for_pointer(
|
||||
pp::platform::current_platform_family(),
|
||||
is_mouse,
|
||||
is_stylus,
|
||||
is_left_button_release);
|
||||
}
|
||||
|
||||
[[nodiscard]] float adjust_canvas_input_pressure(float pressure) override
|
||||
@@ -554,26 +530,12 @@ public:
|
||||
std::string_view data_path,
|
||||
std::string_view temporary_path) override
|
||||
{
|
||||
const std::string name = std::string(default_name) + "." + std::string(type);
|
||||
#ifdef __IOS__
|
||||
(void)data_path;
|
||||
return {
|
||||
std::string(temporary_path) + "/" + name,
|
||||
name,
|
||||
true,
|
||||
};
|
||||
#elif __WEB__
|
||||
(void)temporary_path;
|
||||
return {
|
||||
std::string(data_path) + "/" + name,
|
||||
name,
|
||||
false,
|
||||
};
|
||||
#else
|
||||
(void)data_path;
|
||||
(void)temporary_path;
|
||||
return {};
|
||||
#endif
|
||||
return pp::platform::plan_platform_writable_file(
|
||||
pp::platform::current_platform_family(),
|
||||
type,
|
||||
default_name,
|
||||
data_path,
|
||||
temporary_path);
|
||||
}
|
||||
|
||||
void display_file(std::string_view path) override
|
||||
|
||||
Reference in New Issue
Block a user