diff --git a/android/Gutenberg/src/main/java/org/wordpress/gutenberg/services/EditorService.kt b/android/Gutenberg/src/main/java/org/wordpress/gutenberg/services/EditorService.kt index 8d652b5a..759f09aa 100644 --- a/android/Gutenberg/src/main/java/org/wordpress/gutenberg/services/EditorService.kt +++ b/android/Gutenberg/src/main/java/org/wordpress/gutenberg/services/EditorService.kt @@ -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 @@ -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) { diff --git a/ios/Sources/GutenbergKit/Sources/Services/EditorService.swift b/ios/Sources/GutenbergKit/Sources/Services/EditorService.swift index 8fd3138a..4dbe329e 100644 --- a/ios/Sources/GutenbergKit/Sources/Services/EditorService.swift +++ b/ios/Sources/GutenbergKit/Sources/Services/EditorService.swift @@ -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 @@ -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)