Skip to content

Commit

Permalink
Async fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zfir committed Jun 26, 2024
1 parent 7b40734 commit a6a3149
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/ios/CDVRoomPlan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,26 @@ class CDVRoomPlan: CDVPlugin, RoomCaptureSessionDelegate, RoomCaptureViewDelegat
self.activityIndicator?.stopAnimating()
}

func dismissCaptureView() {
self.activityIndicator?.stopAnimating()
stopSession()
roomCaptureView.removeFromSuperview()
NotificationCenter.default.removeObserver(self)
}

@objc func doneScanning(_ sender: UIButton) {
if state == "scanning" {
stopSession()
self.activityIndicator?.startAnimating()
} else if state == "done" {
exportResults()
cancelScanning(sender)
dismissCaptureView()
}
}

@objc func cancelScanning(_ sender: UIButton) {
self.activityIndicator?.stopAnimating()
stopSession()
roomCaptureView.removeFromSuperview()
NotificationCenter.default.removeObserver(self)
let result = ["cancelled": true, "message": "Scanning cancelled"]
dismissCaptureView()
let result = ["message": "Scanning cancelled"]
let pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: result)
pluginResult?.keepCallback = true
self.commandDelegate.send(pluginResult, callbackId: self.command.callbackId)
Expand Down

0 comments on commit a6a3149

Please sign in to comment.