Bind Apple platform services explicitly
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#include "keymap.h"
|
#include "keymap.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "platform_apple/apple_platform_services.h"
|
#include "platform_apple/apple_platform_services.h"
|
||||||
|
#include "platform_legacy/legacy_platform_services.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
@@ -23,6 +24,8 @@
|
|||||||
@import AppCenterAnalytics;
|
@import AppCenterAnalytics;
|
||||||
@import AppCenterCrashes;
|
@import AppCenterCrashes;
|
||||||
|
|
||||||
|
static std::unique_ptr<pp::platform::PlatformServices> g_platform_services;
|
||||||
|
|
||||||
NSString* keyCodeToString(NSUInteger keyCode, NSUInteger mods)
|
NSString* keyCodeToString(NSUInteger keyCode, NSUInteger mods)
|
||||||
{
|
{
|
||||||
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
|
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
|
||||||
@@ -522,6 +525,12 @@ NSString* keyCodeToString(NSUInteger keyCode, NSUInteger mods)
|
|||||||
[MSCrashes class]
|
[MSCrashes class]
|
||||||
]];
|
]];
|
||||||
|
|
||||||
|
g_platform_services = pp::platform::legacy::create_platform_services({
|
||||||
|
.apple_document_services = []() -> pp::platform::apple::AppleDocumentPlatformServices& {
|
||||||
|
return pp::platform::apple::active_legacy_apple_document_platform_services();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
App::I->set_platform_services(g_platform_services.get());
|
||||||
App::I->initLog();
|
App::I->initLog();
|
||||||
App::I->create();
|
App::I->create();
|
||||||
NSRect r = NSMakeRect(0, 0, App::I->width, App::I->height);
|
NSRect r = NSMakeRect(0, 0, App::I->width, App::I->height);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#import "GameViewController.h"
|
#import "GameViewController.h"
|
||||||
#import <OpenGLES/ES3/glext.h>
|
#import <OpenGLES/ES3/glext.h>
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
#include "platform_legacy/legacy_platform_services.h"
|
||||||
#include "platform_apple/apple_platform_services.h"
|
#include "platform_apple/apple_platform_services.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#import "objc_utils.h"
|
#import "objc_utils.h"
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
|
|
||||||
std::mutex render_mutex;
|
std::mutex render_mutex;
|
||||||
std::condition_variable render_cv;
|
std::condition_variable render_cv;
|
||||||
|
static std::unique_ptr<pp::platform::PlatformServices> g_platform_services;
|
||||||
|
|
||||||
@interface GameImagePicker : UIImagePickerController
|
@interface GameImagePicker : UIImagePickerController
|
||||||
{
|
{
|
||||||
@@ -580,6 +582,12 @@ bool is_tap = true;
|
|||||||
pp::platform::apple::set_legacy_apple_state(
|
pp::platform::apple::set_legacy_apple_state(
|
||||||
self,
|
self,
|
||||||
(AppDelegate*)[[UIApplication sharedApplication] delegate]);
|
(AppDelegate*)[[UIApplication sharedApplication] delegate]);
|
||||||
|
g_platform_services = pp::platform::legacy::create_platform_services({
|
||||||
|
.apple_document_services = []() -> pp::platform::apple::AppleDocumentPlatformServices& {
|
||||||
|
return pp::platform::apple::active_legacy_apple_document_platform_services();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
App::I->set_platform_services(g_platform_services.get());
|
||||||
App::I->initLog();
|
App::I->initLog();
|
||||||
|
|
||||||
//self.preferredFramesPerSecond = 60;
|
//self.preferredFramesPerSecond = 60;
|
||||||
|
|||||||
@@ -18,6 +18,13 @@ agent or engineer to remove them without reconstructing context from chat.
|
|||||||
|
|
||||||
## Reductions
|
## Reductions
|
||||||
|
|
||||||
|
- 2026-06-17: `DEBT-0016`/`DEBT-0017`/`DEBT-0051`/`DEBT-0052`/`DEBT-0053`
|
||||||
|
were narrowed again. `PanoPainter-OSX/main.cpp` and
|
||||||
|
`PanoPainter/GameViewController.m` now bind owned legacy
|
||||||
|
`PlatformServices` instances into `App`, and
|
||||||
|
`src/platform_legacy/legacy_platform_services.*` now takes an injected Apple
|
||||||
|
document-service provider instead of hardcoding direct calls to
|
||||||
|
`active_legacy_apple_document_platform_services()` in the touched path.
|
||||||
- 2026-06-17: `DEBT-0016`/`DEBT-0017` were narrowed again.
|
- 2026-06-17: `DEBT-0016`/`DEBT-0017` were narrowed again.
|
||||||
`src/platform_legacy/legacy_platform_services.*` now takes an explicit
|
`src/platform_legacy/legacy_platform_services.*` now takes an explicit
|
||||||
Android bridge through `create_platform_services(...)`, and
|
Android bridge through `create_platform_services(...)`, and
|
||||||
|
|||||||
@@ -70,6 +70,16 @@ What is already real:
|
|||||||
- `pp_app_core`
|
- `pp_app_core`
|
||||||
|
|
||||||
Latest slice:
|
Latest slice:
|
||||||
|
- `PanoPainter-OSX/main.cpp` and `PanoPainter/GameViewController.m` now bind
|
||||||
|
owned legacy `PlatformServices` instances into `App` explicitly at the Apple
|
||||||
|
entrypoints.
|
||||||
|
- `src/platform_legacy/legacy_platform_services.*` now takes an injected Apple
|
||||||
|
document-service provider through `create_platform_services(...)` instead of
|
||||||
|
hardcoding direct calls to
|
||||||
|
`active_legacy_apple_document_platform_services()` in the touched path.
|
||||||
|
- The touched Apple clipboard, keyboard visibility, render-context,
|
||||||
|
document-picker, display/share, save-ui-state, app-close, SonarPen, and
|
||||||
|
prepared-file execution now route through that injected Apple-owned provider.
|
||||||
- `src/platform_legacy/legacy_platform_services.*` now takes an explicit
|
- `src/platform_legacy/legacy_platform_services.*` now takes an explicit
|
||||||
Android bridge through `create_platform_services(...)` instead of declaring
|
Android bridge through `create_platform_services(...)` instead of declaring
|
||||||
Android JNI/EGL/clipboard/file-picker hooks directly inside the legacy
|
Android JNI/EGL/clipboard/file-picker hooks directly inside the legacy
|
||||||
|
|||||||
@@ -78,6 +78,16 @@ Completed, blocked, and superseded task history moved to
|
|||||||
the queue is now ordered by code movement instead.
|
the queue is now ordered by code movement instead.
|
||||||
|
|
||||||
Current slice:
|
Current slice:
|
||||||
|
- `PanoPainter-OSX/main.cpp` and `PanoPainter/GameViewController.m` now bind
|
||||||
|
owned legacy `PlatformServices` instances into `App` explicitly at the Apple
|
||||||
|
entrypoints.
|
||||||
|
- `src/platform_legacy/legacy_platform_services.*` now takes an injected Apple
|
||||||
|
document-service provider through `create_platform_services(...)` instead of
|
||||||
|
hardcoding direct calls to
|
||||||
|
`active_legacy_apple_document_platform_services()` in the touched path.
|
||||||
|
- The touched Apple clipboard, keyboard visibility, render-context,
|
||||||
|
document-picker, display/share, save-ui-state, app-close, SonarPen, and
|
||||||
|
prepared-file execution now route through that injected Apple-owned provider.
|
||||||
- `src/platform_legacy/legacy_platform_services.*` now takes an explicit
|
- `src/platform_legacy/legacy_platform_services.*` now takes an explicit
|
||||||
Android bridge through `create_platform_services(...)` instead of declaring
|
Android bridge through `create_platform_services(...)` instead of declaring
|
||||||
Android JNI/EGL/clipboard/file-picker hooks directly inside the legacy
|
Android JNI/EGL/clipboard/file-picker hooks directly inside the legacy
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public:
|
|||||||
, android_storage_paths_(std::move(config.android_storage_paths))
|
, android_storage_paths_(std::move(config.android_storage_paths))
|
||||||
#endif
|
#endif
|
||||||
, web_platform_services_(config.web_platform_services)
|
, web_platform_services_(config.web_platform_services)
|
||||||
|
, apple_document_services_(std::move(config.apple_document_services))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,9 +102,9 @@ public:
|
|||||||
void trigger_crash_test() override
|
void trigger_crash_test() override
|
||||||
{
|
{
|
||||||
#ifdef __IOS__
|
#ifdef __IOS__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().trigger_crash_test();
|
active_apple_document_platform_services().trigger_crash_test();
|
||||||
#elif __OSX__
|
#elif __OSX__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().trigger_crash_test();
|
active_apple_document_platform_services().trigger_crash_test();
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
int *x = nullptr; *x = 42;
|
int *x = nullptr; *x = 42;
|
||||||
LOG("%d", *x);
|
LOG("%d", *x);
|
||||||
@@ -115,7 +116,7 @@ public:
|
|||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
const auto family = pp::platform::current_platform_family();
|
const auto family = pp::platform::current_platform_family();
|
||||||
if (family == pp::platform::PlatformFamily::ios || family == pp::platform::PlatformFamily::macos)
|
if (family == pp::platform::PlatformFamily::ios || family == pp::platform::PlatformFamily::macos)
|
||||||
return pp::platform::apple::active_legacy_apple_document_platform_services().clipboard_text();
|
return active_apple_document_platform_services().clipboard_text();
|
||||||
#endif
|
#endif
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
if (android_bridge_.clipboard_text)
|
if (android_bridge_.clipboard_text)
|
||||||
@@ -131,7 +132,7 @@ public:
|
|||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
const auto family = pp::platform::current_platform_family();
|
const auto family = pp::platform::current_platform_family();
|
||||||
if (family == pp::platform::PlatformFamily::ios || family == pp::platform::PlatformFamily::macos)
|
if (family == pp::platform::PlatformFamily::ios || family == pp::platform::PlatformFamily::macos)
|
||||||
return pp::platform::apple::active_legacy_apple_document_platform_services().set_clipboard_text(text);
|
return active_apple_document_platform_services().set_clipboard_text(text);
|
||||||
#endif
|
#endif
|
||||||
const std::string value(text);
|
const std::string value(text);
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
@@ -147,7 +148,7 @@ public:
|
|||||||
void set_cursor_visible(bool visible) override
|
void set_cursor_visible(bool visible) override
|
||||||
{
|
{
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().set_cursor_visible(visible);
|
active_apple_document_platform_services().set_cursor_visible(visible);
|
||||||
#else
|
#else
|
||||||
(void)visible;
|
(void)visible;
|
||||||
#endif
|
#endif
|
||||||
@@ -156,7 +157,7 @@ public:
|
|||||||
void set_virtual_keyboard_visible(bool visible) override
|
void set_virtual_keyboard_visible(bool visible) override
|
||||||
{
|
{
|
||||||
#ifdef __IOS__
|
#ifdef __IOS__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().set_virtual_keyboard_visible(visible);
|
active_apple_document_platform_services().set_virtual_keyboard_visible(visible);
|
||||||
#elif __ANDROID__
|
#elif __ANDROID__
|
||||||
if (android_bridge_.set_virtual_keyboard_visible)
|
if (android_bridge_.set_virtual_keyboard_visible)
|
||||||
android_bridge_.set_virtual_keyboard_visible(visible);
|
android_bridge_.set_virtual_keyboard_visible(visible);
|
||||||
@@ -184,7 +185,7 @@ public:
|
|||||||
void acquire_render_context() override
|
void acquire_render_context() override
|
||||||
{
|
{
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().acquire_render_context();
|
active_apple_document_platform_services().acquire_render_context();
|
||||||
#elif __ANDROID__
|
#elif __ANDROID__
|
||||||
if (android_bridge_.acquire_render_context)
|
if (android_bridge_.acquire_render_context)
|
||||||
android_bridge_.acquire_render_context();
|
android_bridge_.acquire_render_context();
|
||||||
@@ -196,7 +197,7 @@ public:
|
|||||||
void release_render_context() override
|
void release_render_context() override
|
||||||
{
|
{
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().release_render_context();
|
active_apple_document_platform_services().release_render_context();
|
||||||
#elif __ANDROID__
|
#elif __ANDROID__
|
||||||
if (android_bridge_.release_render_context)
|
if (android_bridge_.release_render_context)
|
||||||
android_bridge_.release_render_context();
|
android_bridge_.release_render_context();
|
||||||
@@ -206,7 +207,7 @@ public:
|
|||||||
void present_render_context() override
|
void present_render_context() override
|
||||||
{
|
{
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().present_render_context();
|
active_apple_document_platform_services().present_render_context();
|
||||||
#elif __ANDROID__
|
#elif __ANDROID__
|
||||||
if (android_bridge_.present_render_context)
|
if (android_bridge_.present_render_context)
|
||||||
android_bridge_.present_render_context();
|
android_bridge_.present_render_context();
|
||||||
@@ -225,7 +226,7 @@ public:
|
|||||||
void bind_main_render_target() override
|
void bind_main_render_target() override
|
||||||
{
|
{
|
||||||
#if __IOS__
|
#if __IOS__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().bind_main_render_target();
|
active_apple_document_platform_services().bind_main_render_target();
|
||||||
#else
|
#else
|
||||||
bind_default_render_target();
|
bind_default_render_target();
|
||||||
#endif
|
#endif
|
||||||
@@ -307,7 +308,7 @@ public:
|
|||||||
std::string_view data_path) override
|
std::string_view data_path) override
|
||||||
{
|
{
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
return pp::platform::apple::active_legacy_apple_document_platform_services().document_browse_roots(work_path, data_path);
|
return active_apple_document_platform_services().document_browse_roots(work_path, data_path);
|
||||||
#else
|
#else
|
||||||
return pp::platform::platform_document_browse_roots(
|
return pp::platform::platform_document_browse_roots(
|
||||||
pp::platform::current_platform_family(),
|
pp::platform::current_platform_family(),
|
||||||
@@ -321,7 +322,7 @@ public:
|
|||||||
if (!pp::platform::platform_saves_native_ui_state(pp::platform::current_platform_family()))
|
if (!pp::platform::platform_saves_native_ui_state(pp::platform::current_platform_family()))
|
||||||
return;
|
return;
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().save_ui_state();
|
active_apple_document_platform_services().save_ui_state();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,9 +349,9 @@ public:
|
|||||||
void pick_image(pp::platform::PickedPathCallback callback) override
|
void pick_image(pp::platform::PickedPathCallback callback) override
|
||||||
{
|
{
|
||||||
#ifdef __IOS__
|
#ifdef __IOS__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().pick_image(std::move(callback));
|
active_apple_document_platform_services().pick_image(std::move(callback));
|
||||||
#elif __OSX__
|
#elif __OSX__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().pick_image(std::move(callback));
|
active_apple_document_platform_services().pick_image(std::move(callback));
|
||||||
#elif __ANDROID__
|
#elif __ANDROID__
|
||||||
if (android_bridge_.pick_file)
|
if (android_bridge_.pick_file)
|
||||||
android_bridge_.pick_file(std::move(callback));
|
android_bridge_.pick_file(std::move(callback));
|
||||||
@@ -367,9 +368,9 @@ public:
|
|||||||
void pick_file(std::vector<std::string> file_types, pp::platform::PickedPathCallback callback) override
|
void pick_file(std::vector<std::string> file_types, pp::platform::PickedPathCallback callback) override
|
||||||
{
|
{
|
||||||
#ifdef __IOS__
|
#ifdef __IOS__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().pick_file(std::move(file_types), std::move(callback));
|
active_apple_document_platform_services().pick_file(std::move(file_types), std::move(callback));
|
||||||
#elif __OSX__
|
#elif __OSX__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().pick_file(std::move(file_types), std::move(callback));
|
active_apple_document_platform_services().pick_file(std::move(file_types), std::move(callback));
|
||||||
#elif __ANDROID__
|
#elif __ANDROID__
|
||||||
if (android_bridge_.pick_file)
|
if (android_bridge_.pick_file)
|
||||||
android_bridge_.pick_file(std::move(callback));
|
android_bridge_.pick_file(std::move(callback));
|
||||||
@@ -387,7 +388,7 @@ public:
|
|||||||
void pick_save_file(std::vector<std::string> file_types, pp::platform::PickedPathCallback callback) override
|
void pick_save_file(std::vector<std::string> file_types, pp::platform::PickedPathCallback callback) override
|
||||||
{
|
{
|
||||||
#if __OSX__
|
#if __OSX__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().pick_save_file(std::move(file_types), std::move(callback));
|
active_apple_document_platform_services().pick_save_file(std::move(file_types), std::move(callback));
|
||||||
#elif __ANDROID__
|
#elif __ANDROID__
|
||||||
if (android_bridge_.pick_save_file)
|
if (android_bridge_.pick_save_file)
|
||||||
android_bridge_.pick_save_file(std::move(callback));
|
android_bridge_.pick_save_file(std::move(callback));
|
||||||
@@ -402,7 +403,7 @@ public:
|
|||||||
#ifdef __IOS__
|
#ifdef __IOS__
|
||||||
(void)callback;
|
(void)callback;
|
||||||
#elif __OSX__
|
#elif __OSX__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().pick_directory(std::move(callback));
|
active_apple_document_platform_services().pick_directory(std::move(callback));
|
||||||
#elif __ANDROID__
|
#elif __ANDROID__
|
||||||
(void)callback;
|
(void)callback;
|
||||||
#else
|
#else
|
||||||
@@ -413,7 +414,7 @@ public:
|
|||||||
[[nodiscard]] bool supports_working_directory_picker() override
|
[[nodiscard]] bool supports_working_directory_picker() override
|
||||||
{
|
{
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
return pp::platform::apple::active_legacy_apple_document_platform_services().supports_working_directory_picker();
|
return active_apple_document_platform_services().supports_working_directory_picker();
|
||||||
#else
|
#else
|
||||||
return pp::platform::platform_supports_working_directory_picker(
|
return pp::platform::platform_supports_working_directory_picker(
|
||||||
pp::platform::current_platform_family());
|
pp::platform::current_platform_family());
|
||||||
@@ -423,7 +424,7 @@ public:
|
|||||||
[[nodiscard]] std::string format_working_directory_path(std::string_view path) override
|
[[nodiscard]] std::string format_working_directory_path(std::string_view path) override
|
||||||
{
|
{
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
return pp::platform::apple::active_legacy_apple_document_platform_services().format_working_directory_path(path);
|
return active_apple_document_platform_services().format_working_directory_path(path);
|
||||||
#endif
|
#endif
|
||||||
return std::string(path);
|
return std::string(path);
|
||||||
}
|
}
|
||||||
@@ -459,7 +460,7 @@ public:
|
|||||||
void start_sonarpen() override
|
void start_sonarpen() override
|
||||||
{
|
{
|
||||||
#if __IOS__
|
#if __IOS__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().start_sonarpen();
|
active_apple_document_platform_services().start_sonarpen();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,7 +506,7 @@ public:
|
|||||||
void display_file(std::string_view path) override
|
void display_file(std::string_view path) override
|
||||||
{
|
{
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().display_file(path);
|
active_apple_document_platform_services().display_file(path);
|
||||||
#else
|
#else
|
||||||
(void)path;
|
(void)path;
|
||||||
#endif
|
#endif
|
||||||
@@ -514,7 +515,7 @@ public:
|
|||||||
void share_file(std::string_view path) override
|
void share_file(std::string_view path) override
|
||||||
{
|
{
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().share_file(path);
|
active_apple_document_platform_services().share_file(path);
|
||||||
#else
|
#else
|
||||||
(void)path;
|
(void)path;
|
||||||
#endif
|
#endif
|
||||||
@@ -523,7 +524,7 @@ public:
|
|||||||
void request_app_close() override
|
void request_app_close() override
|
||||||
{
|
{
|
||||||
#ifdef __OSX__
|
#ifdef __OSX__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().request_app_close();
|
active_apple_document_platform_services().request_app_close();
|
||||||
#elif __LINUX__
|
#elif __LINUX__
|
||||||
invoke_legacy_glfw_shell_callback(glfw_shell_.request_app_close);
|
invoke_legacy_glfw_shell_callback(glfw_shell_.request_app_close);
|
||||||
#endif
|
#endif
|
||||||
@@ -556,7 +557,7 @@ public:
|
|||||||
const std::string value(path);
|
const std::string value(path);
|
||||||
const std::string name(suggested_name);
|
const std::string name(suggested_name);
|
||||||
#ifdef __IOS__
|
#ifdef __IOS__
|
||||||
pp::platform::apple::active_legacy_apple_document_platform_services().save_prepared_file(
|
active_apple_document_platform_services().save_prepared_file(
|
||||||
value,
|
value,
|
||||||
name,
|
name,
|
||||||
std::move(callback));
|
std::move(callback));
|
||||||
@@ -567,6 +568,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
[[nodiscard]] pp::platform::apple::AppleDocumentPlatformServices& active_apple_document_platform_services() const noexcept
|
||||||
|
{
|
||||||
|
if (apple_document_services_)
|
||||||
|
return apple_document_services_();
|
||||||
|
return pp::platform::apple::active_legacy_apple_document_platform_services();
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] pp::platform::WebPlatformServices& active_web_platform_services() const noexcept
|
[[nodiscard]] pp::platform::WebPlatformServices& active_web_platform_services() const noexcept
|
||||||
{
|
{
|
||||||
if (web_platform_services_)
|
if (web_platform_services_)
|
||||||
@@ -586,6 +594,7 @@ private:
|
|||||||
std::shared_ptr<pp::platform::PlatformStoragePaths> android_storage_paths_;
|
std::shared_ptr<pp::platform::PlatformStoragePaths> android_storage_paths_;
|
||||||
#endif
|
#endif
|
||||||
pp::platform::WebPlatformServices* web_platform_services_ = nullptr;
|
pp::platform::WebPlatformServices* web_platform_services_ = nullptr;
|
||||||
|
std::function<pp::platform::apple::AppleDocumentPlatformServices&()> apple_document_services_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,10 @@
|
|||||||
|
|
||||||
#include "platform_api/platform_services.h"
|
#include "platform_api/platform_services.h"
|
||||||
|
|
||||||
|
namespace pp::platform::apple {
|
||||||
|
class AppleDocumentPlatformServices;
|
||||||
|
}
|
||||||
|
|
||||||
namespace pp::platform::legacy {
|
namespace pp::platform::legacy {
|
||||||
|
|
||||||
struct LegacyGlfwPlatformShell {
|
struct LegacyGlfwPlatformShell {
|
||||||
@@ -31,6 +35,7 @@ struct LegacyPlatformServicesConfig {
|
|||||||
LegacyAndroidPlatformBridge android_bridge;
|
LegacyAndroidPlatformBridge android_bridge;
|
||||||
std::shared_ptr<pp::platform::PlatformStoragePaths> android_storage_paths;
|
std::shared_ptr<pp::platform::PlatformStoragePaths> android_storage_paths;
|
||||||
pp::platform::WebPlatformServices* web_platform_services = nullptr;
|
pp::platform::WebPlatformServices* web_platform_services = nullptr;
|
||||||
|
std::function<pp::platform::apple::AppleDocumentPlatformServices&()> apple_document_services;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] std::unique_ptr<PlatformServices> create_platform_services(
|
[[nodiscard]] std::unique_ptr<PlatformServices> create_platform_services(
|
||||||
|
|||||||
Reference in New Issue
Block a user