Skip to content

Commit e72eb28

Browse files
authored
Merge pull request #519 from PlayerData/fix-cancel
fix(android): Correct cancel function
2 parents 92a1603 + 1c46f8d commit e72eb28

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

react-native-mcu-manager/android/src/main/java/uk/co/playerdata/reactnativemcumanager/ReactNativeMcuManagerModule.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ class ReactNativeMcuManagerModule() : Module() {
148148
upgrade.startUpgrade(promise)
149149
}
150150

151-
AsyncFunction("cancelUpgrade") { id: String, promise: Promise ->
151+
Function("cancelUpgrade") { id: String ->
152152
val upgrade = upgrades[id]
153153

154154
if (upgrade == null) {
155-
promise.reject(CodedException("UPGRADE_ID_MISSING", "Upgrade ID $id not present", null))
156-
return@AsyncFunction
155+
Log.w(TAG, "Can't cancel update ID ($id} not present")
156+
return@Function
157157
}
158158

159-
upgrade.startUpgrade(promise)
159+
upgrade.cancel()
160160
}
161161

162162
Function("destroyUpgrade") { id: String ->

0 commit comments

Comments
 (0)