@@ -145,7 +145,7 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
145145 func setHTML( _ html: String ) { }
146146 func getHTML( ) -> String { post. content ?? " " }
147147
148- private let blockEditorSettingsService : RawBlockEditorSettingsService
148+ private let blockEditorSettingsService : RawBlockEditorSettingsService ?
149149
150150 // MARK: - Initializers
151151 required convenience init (
@@ -183,7 +183,12 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
183183 let editorConfiguration = EditorConfiguration ( blog: post. blog)
184184 self . editorViewController = GutenbergKit . EditorViewController ( configuration: editorConfiguration)
185185
186- self . blockEditorSettingsService = RawBlockEditorSettingsService ( blog: post. blog)
186+ if let dotOrgRestAPI = WordPressOrgRestApi ( blog: post. blog) {
187+ self . blockEditorSettingsService = RawBlockEditorSettingsService ( dotOrgRestAPI: dotOrgRestAPI, blog: post. blog)
188+ . prefetchSettings ( )
189+ } else {
190+ self . blockEditorSettingsService = nil
191+ }
187192
188193 super. init ( nibName: nil , bundle: nil )
189194
@@ -475,11 +480,13 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
475480 // MARK: - Editor Setup
476481 private func fetchEditorDependencies( ) async throws -> EditorDependencies {
477482 let settings : String ?
478- do {
479- settings = try await blockEditorSettingsService. getSettingsString ( allowingCachedResponse: true )
480- } catch {
481- DDLogError ( " Failed to fetch editor settings: \( error) " )
482- settings = nil
483+ if let blockEditorSettingsService {
484+ do {
485+ settings = try await blockEditorSettingsService. getSettingsString ( allowingCachedResponse: true )
486+ } catch {
487+ DDLogError ( " Failed to fetch editor settings: \( error) " )
488+ settings = nil
489+ }
483490 }
484491
485492 let loaded = await loadAuthenticationCookiesAsync ( )
0 commit comments