Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions ios/Demo-iOS/Sources/Views/AppRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct AppRootView: View {
let canUsePlugins = apiRoot.hasRoute(route: "/wpcom/v2/editor-assets")
let canUseEditorStyles = apiRoot.hasRoute(route: "/wp-block-editor/v1/settings")

var updatedConfiguration = EditorConfigurationBuilder()
self.activeEditorConfiguration = EditorConfigurationBuilder()
.setShouldUseThemeStyles(canUseEditorStyles)
.setShouldUsePlugins(canUsePlugins)
.setSiteUrl(config.siteUrl)
Expand All @@ -86,21 +86,6 @@ struct AppRootView: View {
.setLogLevel(.debug)
.setEnableNetworkLogging(true)
.build()

if let baseURL = URL(string: config.siteApiRoot) {
let service = EditorService(
siteURL: config.siteUrl,
networkSession: URLSession.shared
)

do {
try await service.setup(&updatedConfiguration)
Copy link
Contributor Author

@kean kean Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done by EditorViewController:

dependencies = await service.dependencies(for: configuration, isWarmup: isWarmupMode)
.

} catch {
print("Failed to setup editor environment, confinuing with the default or cached configuration:", error)
}
}

self.activeEditorConfiguration = updatedConfiguration
} catch {
self.hasError = true
self.error = AppError(errorDescription: error.localizedDescription)
Expand Down
19 changes: 0 additions & 19 deletions ios/Sources/GutenbergKit/Sources/Service/EditorService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,25 +197,6 @@ public actor EditorService {
log(.info, "Editor refresh completed in \(String(format: "%.2f", totalTime))s")
}

/// Set up the editor for the given site.
///
/// - warning: The request make take a significant amount of time the first
/// time you open the editor.
public func setup(_ configuration: inout EditorConfiguration) async throws {
var builder = configuration.toBuilder()

if !isEditorLoaded {
try await refresh(configuration: configuration)
}

if let data = try? Data(contentsOf: editorSettingsFileURL),
let settings = String(data: data, encoding: .utf8) {
builder = builder.setEditorSettings(settings)
}

return configuration = builder.build()
}

// MARK: – Editor Settings

/// Fetches block editor settings from the WordPress REST API
Expand Down