Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
zfir committed Jun 25, 2024
1 parent 693b3b6 commit 96f8e43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-roomplan</name>
<js-module name="CDVRoomPlan" src="www/CDVRoomPlan.js">
<clobbers target="cordova.plugins.CDVRoomPlan" />
<clobbers target="CDVRoomPlan" />
</js-module>
<platform name="ios">
<config-file parent="/*" target="config.xml">
Expand Down
6 changes: 3 additions & 3 deletions src/ios/CDVRoomPlan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ class CDVRoomPlan: CDVPlugin, RoomCaptureSessionDelegate, RoomCaptureViewDelegat
func exportResults() {
let documentsDirectory = FileManager.default.temporaryDirectory.appendingPathComponent("cordova-room-plan")
let uuid = NSUUID().uuidString
let usdzFile = documentsDirectory.appendingPathComponent(uuid + ".usdz")
let modelFile = documentsDirectory.appendingPathComponent(uuid + ".usdz")
let jsonFile = documentsDirectory.appendingPathComponent(uuid + ".json")
do {
try FileManager.default.createDirectory(at: documentsDirectory, withIntermediateDirectories: true, attributes: nil)
let jsonEncoder = JSONEncoder()
let jsonData = try jsonEncoder.encode(self.processedResult)
try jsonData.write(to: jsonFile)
try self.processedResult?.export(to: usdzFile, exportOptions: .parametric)
try self.processedResult?.export(to: modelFile, exportOptions: .parametric)
if (self.processedResult != nil) && isCapturedRoomNil(capturedRoom: self.processedResult!) {
let result = ["usdz": usdzFile.absoluteString, "json": jsonFile.absoluteString, "message": "Scanning completed successfully"]
let result = ["model": modelFile.absoluteString, "json": jsonFile.absoluteString, "message": "Scanning completed successfully"]
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 96f8e43

Please sign in to comment.