Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class EditorService(

return coroutineScope {
val settingsDeferred = async { prepareEditorSettings() }
val assetBundleDeferred = async { prepareAssetBundle() }
val assetBundleDeferred = async { prepareAssetBundleIfEnabled() }
val preloadListDeferred = async { preparePreloadList() }

// Automatically clean up old asset bundles
Expand Down Expand Up @@ -269,6 +269,15 @@ class EditorService(
return settings
}

private suspend fun prepareAssetBundleIfEnabled(): EditorAssetBundle {
if (!configuration.plugins) {
incrementProgress(DependencyWeights.ASSET_BUNDLE)
return EditorAssetBundle.empty
}

return prepareAssetBundle()
}

private suspend fun prepareAssetBundle(): EditorAssetBundle {
val latestAssetBundle = assetLibrary.readAssetBundles().firstOrNull()
if (latestAssetBundle != null) {
Expand Down
11 changes: 10 additions & 1 deletion ios/Sources/GutenbergKit/Sources/Services/EditorService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public actor EditorService {
self.progressCallback = progress

async let settings = try prepareEditorSettings()
async let assetBundle = try self.prepareAssetBundle()
async let assetBundle = try self.prepareAssetBundleIfEnabled()
async let preloadList = try preparePreloadList()

// Automatically clean up old asset bundles
Expand Down Expand Up @@ -174,6 +174,15 @@ public actor EditorService {
return settings
}

private func prepareAssetBundleIfEnabled() async throws -> EditorAssetBundle {
guard configuration.shouldUsePlugins else {
await self.incrementProgress(for: .assetBundle)
return .empty
}

return try await prepareAssetBundle()
}

private func prepareAssetBundle() async throws -> EditorAssetBundle {
if let latestAssetBundle = try await self.assetLibrary.readAssetBundles().first {
await self.incrementProgress(for: .assetBundle)
Expand Down
Loading