diff --git a/src/extension/process.cc b/src/extension/process.cc index a1cc0daa1..39e9f0ef8 100644 --- a/src/extension/process.cc +++ b/src/extension/process.cc @@ -1,6 +1,9 @@ #include "extension.hh" +#if !SOCKET_RUNTIME_PLATFORM_IOS using ssc::runtime::process::exec; +#endif + using ssc::runtime::string::trim; const sapi_process_exec_t* sapi_process_exec ( diff --git a/src/runtime/app.hh b/src/runtime/app.hh index d1ce5891e..4bd035567 100644 --- a/src/runtime/app.hh +++ b/src/runtime/app.hh @@ -51,7 +51,7 @@ namespace ssc::runtime::app { willContinueUserActivityWithType: (NSString*) userActivityType; #endif -@property (nonatomic, assign) ssc::runtime::app::App* app; +@property (nonatomic, assign) ssc::runtime::SharedPointer app; @end #endif diff --git a/src/runtime/app/apple.mm b/src/runtime/app/apple.mm index a5463f406..b7a6e6627 100644 --- a/src/runtime/app/apple.mm +++ b/src/runtime/app/apple.mm @@ -1,9 +1,15 @@ #include "../app.hh" using namespace ssc::runtime; +using namespace ssc::runtime::app; +using ssc::runtime::window::Window; +using ssc::runtime::config::isDebugEnabled; using ssc::runtime::config::getUserConfig; +using ssc::runtime::config::getDevHost; +using ssc::runtime::config::getDevPort; using ssc::runtime::string::parseStringList; using ssc::runtime::string::split; +using ssc::runtime::string::trim; static dispatch_queue_attr_t qos = dispatch_queue_attr_make_with_qos_class( DISPATCH_QUEUE_CONCURRENT, @@ -198,7 +204,7 @@ - (BOOL) application: (UIApplication*) application argv.push_back("'" + trim(arg) + "'"); } - auto windowManagerOptions = WindowManagerOptions {}; + auto windowManagerOptions = window::ManagerOptions {}; for (const auto& arg : split(self.app->runtime.userConfig["ssc_argv"], ',')) { if (arg.find("--test") == 0) { @@ -216,37 +222,10 @@ - (BOOL) application: (UIApplication*) application static const auto port = getDevPort(); static const auto host = getDevHost(); - if ( - self.app->runtime.userConfig["webview_service_worker_mode"] != "hybrid" && - self.app->runtime.userConfig["permissions_allow_service_worker"] != "false" - ) { - auto serviceWorkerWindowOptions = Window::Options {}; - auto serviceWorkerUserConfig = self.app->runtime.userConfig; - - serviceWorkerUserConfig["webview_watch_reload"] = "false"; - serviceWorkerWindowOptions.shouldExitApplicationOnClose = false; - serviceWorkerWindowOptions.index = SOCKET_RUNTIME_SERVICE_WORKER_CONTAINER_WINDOW_INDEX; - serviceWorkerWindowOptions.headless = Env::get("SOCKET_RUNTIME_SERVICE_WORKER_DEBUG").size() == 0; - serviceWorkerWindowOptions.userConfig = serviceWorkerUserConfig; - serviceWorkerWindowOptions.features.useGlobalCommonJS = false; - serviceWorkerWindowOptions.features.useGlobalNodeJS = false; - - auto serviceWorkerWindow = self.app->runtime.windowManager.createWindow(serviceWorkerWindowOptions); - self.app->serviceWorkerContainer.init(&serviceWorkerWindow->bridge); - - serviceWorkerWindow->navigate( - "socket://" + self.app->runtime.userConfig["meta_bundle_identifier"] + "/socket/service-worker/index.html" - ); - } - auto defaultWindow = self.app->runtime.windowManager.createDefaultWindow(Window::Options { .shouldExitApplicationOnClose = true }); - if (self.app->runtime.userConfig["webview_service_worker_mode"] == "hybrid") { - self.app->serviceWorkerContainer.init(&defaultWindow->bridge); - } - defaultWindow->setTitle(self.app->runtime.userConfig["meta_title"]); if (isDebugEnabled() && port > 0 && host.size() > 0) { diff --git a/src/runtime/core/services/platform.cc b/src/runtime/core/services/platform.cc index 2a080ba8c..7b8a5638c 100644 --- a/src/runtime/core/services/platform.cc +++ b/src/runtime/core/services/platform.cc @@ -5,7 +5,10 @@ #include "platform.hh" using ssc::runtime::url::decodeURIComponent; + +#if !SOCKET_RUNTIME_PLATFORM_IOS using ssc::runtime::process::exec; +#endif namespace ssc::runtime::core::services { void Platform::event ( diff --git a/src/runtime/window/apple.mm b/src/runtime/window/apple.mm index 09edc0181..f12ff67d0 100644 --- a/src/runtime/window/apple.mm +++ b/src/runtime/window/apple.mm @@ -88,14 +88,14 @@ - (void) userContentController: (WKUserContentController*) userContentController const auto uri = String(string.UTF8String); #if SOCKET_RUNTIME_PLATFORM_IOS - const auto msg = IPC::Message(uri); + const auto msg = ipc::Message(uri); if (msg.name == "application.exit" || msg.name == "process.exit") { const auto code = std::stoi(msg.get("value", "0")); if (code > 0) { - CLI::notify(SIGTERM); + ssc::cli::notify(SIGTERM); } else { - CLI::notify(SIGUSR2); + ssc::cli::notify(SIGUSR2); } } #endif @@ -431,7 +431,7 @@ - (void) scrollViewDidScroll: (UIScrollView*) scrollView { processInfo.operatingSystemVersion.majorVersion, processInfo.operatingSystemVersion.minorVersion, processInfo.operatingSystemVersion.patchVersion, - SSC::VERSION_STRING.c_str() + ssc::runtime::VERSION_STRING.c_str() ]; #endif