Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile] Start iOS background engine before registering worker handler

laurenspriemf628c0311e31
diff --git a/mobile/apps/photos/plugins/ente_background_manager/ios/Classes/BackgroundRuntime.swift b/mobile/apps/photos/plugins/ente_background_manager/ios/Classes/BackgroundRuntime.swift
index d6db889ff2..8590be37c3 100644
--- a/mobile/apps/photos/plugins/ente_background_manager/ios/Classes/BackgroundRuntime.swift
+++ b/mobile/apps/photos/plugins/ente_background_manager/ios/Classes/BackgroundRuntime.swift
@@ -263,6 +263,12 @@ final class BackgroundRuntime: NSObject {
let engine = FlutterEngine(
name: "ente-background-\(run.invocation)", project: nil, allowHeadlessExecution: true)
run.engine = engine
+ guard
+ engine.run(withEntrypoint: callback.callbackName, libraryURI: callback.callbackLibraryPath)
+ else {
+ retire(run, outcome: "failed", reason: "bootstrap", error: "Flutter engine failed to start")
+ return
+ }
let channel = FlutterMethodChannel(
name: "io.ente.background/worker", binaryMessenger: engine.binaryMessenger)
run.channel = channel
@@ -304,12 +310,6 @@ final class BackgroundRuntime: NSObject {
result(FlutterMethodNotImplemented)
}
}
- guard
- engine.run(withEntrypoint: callback.callbackName, libraryURI: callback.callbackLibraryPath)
- else {
- retire(run, outcome: "failed", reason: "bootstrap", error: "Flutter engine failed to start")
- return
- }
registrant(engine)
}