Skip to content

Commit 04e4101

Browse files
committed
fix(runtime,extension): fix buld for ios
1 parent 7e6d730 commit 04e4101

File tree

5 files changed

+18
-33
lines changed

5 files changed

+18
-33
lines changed

src/extension/process.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#include "extension.hh"
22

3+
#if !SOCKET_RUNTIME_PLATFORM_IOS
34
using ssc::runtime::process::exec;
5+
#endif
6+
47
using ssc::runtime::string::trim;
58

69
const sapi_process_exec_t* sapi_process_exec (

src/runtime/app.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace ssc::runtime::app {
5151
willContinueUserActivityWithType: (NSString*) userActivityType;
5252
#endif
5353

54-
@property (nonatomic, assign) ssc::runtime::app::App* app;
54+
@property (nonatomic, assign) ssc::runtime::SharedPointer<ssc::runtime::app::App> app;
5555
@end
5656
#endif
5757

src/runtime/app/apple.mm

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#include "../app.hh"
22

33
using namespace ssc::runtime;
4+
using namespace ssc::runtime::app;
5+
using ssc::runtime::window::Window;
6+
using ssc::runtime::config::isDebugEnabled;
47
using ssc::runtime::config::getUserConfig;
8+
using ssc::runtime::config::getDevHost;
9+
using ssc::runtime::config::getDevPort;
510
using ssc::runtime::string::parseStringList;
611
using ssc::runtime::string::split;
12+
using ssc::runtime::string::trim;
713

814
static dispatch_queue_attr_t qos = dispatch_queue_attr_make_with_qos_class(
915
DISPATCH_QUEUE_CONCURRENT,
@@ -198,7 +204,7 @@ - (BOOL) application: (UIApplication*) application
198204
argv.push_back("'" + trim(arg) + "'");
199205
}
200206

201-
auto windowManagerOptions = WindowManagerOptions {};
207+
auto windowManagerOptions = window::ManagerOptions {};
202208

203209
for (const auto& arg : split(self.app->runtime.userConfig["ssc_argv"], ',')) {
204210
if (arg.find("--test") == 0) {
@@ -216,37 +222,10 @@ - (BOOL) application: (UIApplication*) application
216222
static const auto port = getDevPort();
217223
static const auto host = getDevHost();
218224

219-
if (
220-
self.app->runtime.userConfig["webview_service_worker_mode"] != "hybrid" &&
221-
self.app->runtime.userConfig["permissions_allow_service_worker"] != "false"
222-
) {
223-
auto serviceWorkerWindowOptions = Window::Options {};
224-
auto serviceWorkerUserConfig = self.app->runtime.userConfig;
225-
226-
serviceWorkerUserConfig["webview_watch_reload"] = "false";
227-
serviceWorkerWindowOptions.shouldExitApplicationOnClose = false;
228-
serviceWorkerWindowOptions.index = SOCKET_RUNTIME_SERVICE_WORKER_CONTAINER_WINDOW_INDEX;
229-
serviceWorkerWindowOptions.headless = Env::get("SOCKET_RUNTIME_SERVICE_WORKER_DEBUG").size() == 0;
230-
serviceWorkerWindowOptions.userConfig = serviceWorkerUserConfig;
231-
serviceWorkerWindowOptions.features.useGlobalCommonJS = false;
232-
serviceWorkerWindowOptions.features.useGlobalNodeJS = false;
233-
234-
auto serviceWorkerWindow = self.app->runtime.windowManager.createWindow(serviceWorkerWindowOptions);
235-
self.app->serviceWorkerContainer.init(&serviceWorkerWindow->bridge);
236-
237-
serviceWorkerWindow->navigate(
238-
"socket://" + self.app->runtime.userConfig["meta_bundle_identifier"] + "/socket/service-worker/index.html"
239-
);
240-
}
241-
242225
auto defaultWindow = self.app->runtime.windowManager.createDefaultWindow(Window::Options {
243226
.shouldExitApplicationOnClose = true
244227
});
245228

246-
if (self.app->runtime.userConfig["webview_service_worker_mode"] == "hybrid") {
247-
self.app->serviceWorkerContainer.init(&defaultWindow->bridge);
248-
}
249-
250229
defaultWindow->setTitle(self.app->runtime.userConfig["meta_title"]);
251230

252231
if (isDebugEnabled() && port > 0 && host.size() > 0) {

src/runtime/core/services/platform.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
#include "platform.hh"
66

77
using ssc::runtime::url::decodeURIComponent;
8+
9+
#if !SOCKET_RUNTIME_PLATFORM_IOS
810
using ssc::runtime::process::exec;
11+
#endif
912

1013
namespace ssc::runtime::core::services {
1114
void Platform::event (

src/runtime/window/apple.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ - (void) userContentController: (WKUserContentController*) userContentController
8888
const auto uri = String(string.UTF8String);
8989

9090
#if SOCKET_RUNTIME_PLATFORM_IOS
91-
const auto msg = IPC::Message(uri);
91+
const auto msg = ipc::Message(uri);
9292
if (msg.name == "application.exit" || msg.name == "process.exit") {
9393
const auto code = std::stoi(msg.get("value", "0"));
9494

9595
if (code > 0) {
96-
CLI::notify(SIGTERM);
96+
ssc::cli::notify(SIGTERM);
9797
} else {
98-
CLI::notify(SIGUSR2);
98+
ssc::cli::notify(SIGUSR2);
9999
}
100100
}
101101
#endif
@@ -431,7 +431,7 @@ - (void) scrollViewDidScroll: (UIScrollView*) scrollView {
431431
processInfo.operatingSystemVersion.majorVersion,
432432
processInfo.operatingSystemVersion.minorVersion,
433433
processInfo.operatingSystemVersion.patchVersion,
434-
SSC::VERSION_STRING.c_str()
434+
ssc::runtime::VERSION_STRING.c_str()
435435
];
436436
#endif
437437

0 commit comments

Comments
 (0)