From d3a0446a8b9064a70887e1e761d6db5b644a030d Mon Sep 17 00:00:00 2001 From: Zafir Sk Heerah Date: Thu, 20 Jun 2024 14:48:28 +0400 Subject: [PATCH 1/3] Fixes --- plugin.xml | 3 ++- src/ios/CDVRoomPlan.swift | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin.xml b/plugin.xml index 7c780cf..c4df11d 100644 --- a/plugin.xml +++ b/plugin.xml @@ -14,6 +14,7 @@ - + + \ No newline at end of file diff --git a/src/ios/CDVRoomPlan.swift b/src/ios/CDVRoomPlan.swift index e079d14..2cf02f8 100644 --- a/src/ios/CDVRoomPlan.swift +++ b/src/ios/CDVRoomPlan.swift @@ -72,7 +72,6 @@ class CDVRoomPlan: CDVPlugin, RoomCaptureSessionDelegate, RoomCaptureViewDelegat self.activityIndicator?.stopAnimating() } - // Action for the 'Done' button @objc func doneScanning(_ sender: UIButton) { if state == "scanning" { stopSession() @@ -106,7 +105,7 @@ class CDVRoomPlan: CDVPlugin, RoomCaptureSessionDelegate, RoomCaptureViewDelegat try finalResults?.export(to: usdzFile, exportOptions: .parametric) if finalResults != nil { let result = ["usdz": usdzFile.absoluteString, "json": jsonFile.absoluteString, "message": "Scanning completed successfully"] - let pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: usdzFile.absoluteString) + let pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: result) pluginResult?.keepCallback = true self.commandDelegate.send(pluginResult, callbackId: self.command.callbackId) } From 4ff225155cc207db9dd9377066bdded0cdc1e0f5 Mon Sep 17 00:00:00 2001 From: Zafir Sk Heerah Date: Thu, 20 Jun 2024 15:09:29 +0400 Subject: [PATCH 2/3] Fix --- src/ios/CDVRoomPlan.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ios/CDVRoomPlan.swift b/src/ios/CDVRoomPlan.swift index 2cf02f8..844a304 100644 --- a/src/ios/CDVRoomPlan.swift +++ b/src/ios/CDVRoomPlan.swift @@ -103,7 +103,7 @@ class CDVRoomPlan: CDVPlugin, RoomCaptureSessionDelegate, RoomCaptureViewDelegat let jsonData = try jsonEncoder.encode(finalResults) try jsonData.write(to: jsonFile) try finalResults?.export(to: usdzFile, exportOptions: .parametric) - if finalResults != nil { + if (finalResults != nil) && isCapturedRoomNil(capturedRoom: finalResults!) { let result = ["usdz": usdzFile.absoluteString, "json": jsonFile.absoluteString, "message": "Scanning completed successfully"] let pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: result) pluginResult?.keepCallback = true @@ -153,4 +153,12 @@ class CDVRoomPlan: CDVPlugin, RoomCaptureSessionDelegate, RoomCaptureViewDelegat button.translatesAutoresizingMaskIntoConstraints = false return button } + + func isCapturedRoomNil(capturedRoom: CapturedRoom) -> Bool { + if #available(iOS 17.0, *) { + return capturedRoom.walls.count != 0 || capturedRoom.doors.count != 0 || capturedRoom.windows.count != 0 || capturedRoom.sections.count != 0 || capturedRoom.floors.count != 0 || capturedRoom.objects.count != 0 || capturedRoom.openings.count != 0 + } else { + return false + } + } } From ee77042a377715cfe8629fc8a50046afde38f376 Mon Sep 17 00:00:00 2001 From: Zafir Sk Heerah Date: Thu, 20 Jun 2024 15:10:48 +0400 Subject: [PATCH 3/3] Beta 3 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 08e5651..b698f2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@spoonconsulting/cordova-plugin-roomplan", - "version": "1.0.0-beta2", + "version": "1.0.0-beta3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@spoonconsulting/cordova-plugin-roomplan", - "version": "1.0.0-beta2", + "version": "1.0.0-beta3", "license": "ISC" } } diff --git a/package.json b/package.json index 204cb2e..04129a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@spoonconsulting/cordova-plugin-roomplan", - "version": "1.0.0-beta2", + "version": "1.0.0-beta3", "description": "", "main": "index.js", "scripts": {