From 0f0d0c0628ad9bcbaa7951818897a0f8cfb6ee92 Mon Sep 17 00:00:00 2001 From: Madeline Pace Date: Wed, 5 Apr 2023 13:49:05 -0400 Subject: [PATCH] Change PRM to MoonrakerSocketManager, project update --- Soyuz.xcodeproj/project.pbxproj | 16 +++---- .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../xcshareddata/swiftpm/Package.resolved | 0 .../xcschemes/xcschememanagement.plist | 14 ++++++ .../xcdebugger/Breakpoints_v2.xcbkptlist | 48 +++++++++++++++++++ .../xcschemes/xcschememanagement.plist | 0 .../AccentColor.colorset/Contents.json | 0 .../AppIcon.appiconset/Contents.json | 0 Soyuz/Assets.xcassets/Contents.json | 0 Soyuz/Info.plist | 0 .../KlipperMon.xcdatamodeld/.xccurrentversion | 0 .../KlipperMon.xcdatamodel/contents | 0 Soyuz/Persistence.swift | 0 .../Preview Assets.xcassets/Contents.json | 0 Soyuz/Soyuz.entitlements | 0 Soyuz/SoyuzApp.swift | 2 +- Soyuz/ViewModels/BonjourBrowser.swift | 0 ...ger.swift => MoonrakerSocketManager.swift} | 2 +- Soyuz/ViewModels/PrinterObjectsQuery.swift | 0 Soyuz/Views/PrinterConfigView.swift | 4 +- Soyuz/Views/SoyuzMenuBarExtraView.swift | 5 +- SoyuzTests/BonjourBrowserTests.swift | 2 +- ...sts.swift => MoonrakerSocketManager.swift} | 31 +++++++++++- SoyuzTests/SoyuzScratchTests.swift | 0 SoyuzTests/SoyuzTests.swift | 0 SoyuzUITests/SoyuzUITests.swift | 0 SoyuzUITests/SoyuzUITestsLaunchTests.swift | 0 28 files changed, 107 insertions(+), 17 deletions(-) mode change 100644 => 100755 Soyuz.xcodeproj/project.pbxproj mode change 100644 => 100755 Soyuz.xcodeproj/project.xcworkspace/contents.xcworkspacedata mode change 100644 => 100755 Soyuz.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist mode change 100644 => 100755 Soyuz.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 Soyuz.xcodeproj/xcuserdata/madeline.xcuserdatad/xcschemes/xcschememanagement.plist mode change 100644 => 100755 Soyuz.xcodeproj/xcuserdata/madelinecr.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist mode change 100644 => 100755 Soyuz.xcodeproj/xcuserdata/madelinecr.xcuserdatad/xcschemes/xcschememanagement.plist mode change 100644 => 100755 Soyuz/Assets.xcassets/AccentColor.colorset/Contents.json mode change 100644 => 100755 Soyuz/Assets.xcassets/AppIcon.appiconset/Contents.json mode change 100644 => 100755 Soyuz/Assets.xcassets/Contents.json mode change 100644 => 100755 Soyuz/Info.plist mode change 100644 => 100755 Soyuz/KlipperMon.xcdatamodeld/.xccurrentversion mode change 100644 => 100755 Soyuz/KlipperMon.xcdatamodeld/KlipperMon.xcdatamodel/contents mode change 100644 => 100755 Soyuz/Persistence.swift mode change 100644 => 100755 Soyuz/Preview Content/Preview Assets.xcassets/Contents.json mode change 100644 => 100755 Soyuz/Soyuz.entitlements mode change 100644 => 100755 Soyuz/SoyuzApp.swift mode change 100644 => 100755 Soyuz/ViewModels/BonjourBrowser.swift rename Soyuz/ViewModels/{PrinterRequestManager.swift => MoonrakerSocketManager.swift} (99%) mode change 100644 => 100755 mode change 100644 => 100755 Soyuz/ViewModels/PrinterObjectsQuery.swift mode change 100644 => 100755 Soyuz/Views/PrinterConfigView.swift mode change 100644 => 100755 Soyuz/Views/SoyuzMenuBarExtraView.swift mode change 100644 => 100755 SoyuzTests/BonjourBrowserTests.swift rename SoyuzTests/{PrinterRequestManagerTests.swift => MoonrakerSocketManager.swift} (52%) mode change 100644 => 100755 mode change 100644 => 100755 SoyuzTests/SoyuzScratchTests.swift mode change 100644 => 100755 SoyuzTests/SoyuzTests.swift mode change 100644 => 100755 SoyuzUITests/SoyuzUITests.swift mode change 100644 => 100755 SoyuzUITests/SoyuzUITestsLaunchTests.swift diff --git a/Soyuz.xcodeproj/project.pbxproj b/Soyuz.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 83c819a..2686359 --- a/Soyuz.xcodeproj/project.pbxproj +++ b/Soyuz.xcodeproj/project.pbxproj @@ -9,7 +9,7 @@ /* Begin PBXBuildFile section */ E124B9D929941A4D00C0D2D2 /* PrinterConfigView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E124B9D829941A4D00C0D2D2 /* PrinterConfigView.swift */; }; E16378B229A43CE1002F05E9 /* SoyuzScratchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E16378B129A43CE1002F05E9 /* SoyuzScratchTests.swift */; }; - E16378B429A491E6002F05E9 /* PrinterRequestManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E16378B329A491E6002F05E9 /* PrinterRequestManagerTests.swift */; }; + E16378B429A491E6002F05E9 /* MoonrakerSocketManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E16378B329A491E6002F05E9 /* MoonrakerSocketManager.swift */; }; E180B5E92992CD9100425DB0 /* SoyuzApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B5E82992CD9100425DB0 /* SoyuzApp.swift */; }; E180B5ED2992CD9200425DB0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E180B5EC2992CD9200425DB0 /* Assets.xcassets */; }; E180B5F02992CD9200425DB0 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E180B5EF2992CD9200425DB0 /* Preview Assets.xcassets */; }; @@ -20,7 +20,7 @@ E180B60C2992CD9300425DB0 /* SoyuzUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B60B2992CD9300425DB0 /* SoyuzUITestsLaunchTests.swift */; }; E180B61D2992D53700425DB0 /* PrinterObjectsQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B61C2992D53700425DB0 /* PrinterObjectsQuery.swift */; }; E180B61F2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B61E2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift */; }; - E180B6222993256E00425DB0 /* PrinterRequestManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B6212993256E00425DB0 /* PrinterRequestManager.swift */; }; + E180B6222993256E00425DB0 /* MoonrakerSocketManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E180B6212993256E00425DB0 /* MoonrakerSocketManager.swift */; }; E1A93C6729C932E200BAE750 /* BonjourBrowser.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1A93C6629C932E200BAE750 /* BonjourBrowser.swift */; }; E1A93C6929CD627100BAE750 /* BonjourBrowserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1A93C6829CD627100BAE750 /* BonjourBrowserTests.swift */; }; E1E8B07729949E2700BABE4B /* Starscream in Frameworks */ = {isa = PBXBuildFile; productRef = E1E8B07629949E2700BABE4B /* Starscream */; }; @@ -47,7 +47,7 @@ E124B9D72993FE5500C0D2D2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; E124B9D829941A4D00C0D2D2 /* PrinterConfigView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrinterConfigView.swift; sourceTree = ""; }; E16378B129A43CE1002F05E9 /* SoyuzScratchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoyuzScratchTests.swift; sourceTree = ""; }; - E16378B329A491E6002F05E9 /* PrinterRequestManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrinterRequestManagerTests.swift; sourceTree = ""; }; + E16378B329A491E6002F05E9 /* MoonrakerSocketManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoonrakerSocketManager.swift; sourceTree = ""; }; E180B5E52992CD9100425DB0 /* Soyuz.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Soyuz.app; sourceTree = BUILT_PRODUCTS_DIR; }; E180B5E82992CD9100425DB0 /* SoyuzApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoyuzApp.swift; sourceTree = ""; }; E180B5EC2992CD9200425DB0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -62,7 +62,7 @@ E180B60B2992CD9300425DB0 /* SoyuzUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoyuzUITestsLaunchTests.swift; sourceTree = ""; }; E180B61C2992D53700425DB0 /* PrinterObjectsQuery.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrinterObjectsQuery.swift; sourceTree = ""; }; E180B61E2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoyuzMenuBarExtraView.swift; sourceTree = ""; }; - E180B6212993256E00425DB0 /* PrinterRequestManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrinterRequestManager.swift; sourceTree = ""; }; + E180B6212993256E00425DB0 /* MoonrakerSocketManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoonrakerSocketManager.swift; sourceTree = ""; }; E1A93C6629C932E200BAE750 /* BonjourBrowser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BonjourBrowser.swift; sourceTree = ""; }; E1A93C6829CD627100BAE750 /* BonjourBrowserTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = BonjourBrowserTests.swift; path = SoyuzTests/BonjourBrowserTests.swift; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ @@ -143,7 +143,7 @@ E180B5FF2992CD9300425DB0 /* SoyuzTests.swift */, E16378B129A43CE1002F05E9 /* SoyuzScratchTests.swift */, E1A93C6829CD627100BAE750 /* BonjourBrowserTests.swift */, - E16378B329A491E6002F05E9 /* PrinterRequestManagerTests.swift */, + E16378B329A491E6002F05E9 /* MoonrakerSocketManager.swift */, ); path = SoyuzTests; sourceTree = ""; @@ -170,7 +170,7 @@ isa = PBXGroup; children = ( E180B61C2992D53700425DB0 /* PrinterObjectsQuery.swift */, - E180B6212993256E00425DB0 /* PrinterRequestManager.swift */, + E180B6212993256E00425DB0 /* MoonrakerSocketManager.swift */, E1A93C6629C932E200BAE750 /* BonjourBrowser.swift */, ); path = ViewModels; @@ -318,7 +318,7 @@ E180B5F22992CD9200425DB0 /* Persistence.swift in Sources */, E1A93C6729C932E200BAE750 /* BonjourBrowser.swift in Sources */, E180B5E92992CD9100425DB0 /* SoyuzApp.swift in Sources */, - E180B6222993256E00425DB0 /* PrinterRequestManager.swift in Sources */, + E180B6222993256E00425DB0 /* MoonrakerSocketManager.swift in Sources */, E180B61F2992DBB000425DB0 /* SoyuzMenuBarExtraView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -328,7 +328,7 @@ buildActionMask = 2147483647; files = ( E180B6002992CD9300425DB0 /* SoyuzTests.swift in Sources */, - E16378B429A491E6002F05E9 /* PrinterRequestManagerTests.swift in Sources */, + E16378B429A491E6002F05E9 /* MoonrakerSocketManager.swift in Sources */, E1A93C6929CD627100BAE750 /* BonjourBrowserTests.swift in Sources */, E16378B229A43CE1002F05E9 /* SoyuzScratchTests.swift in Sources */, ); diff --git a/Soyuz.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Soyuz.xcodeproj/project.xcworkspace/contents.xcworkspacedata old mode 100644 new mode 100755 diff --git a/Soyuz.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Soyuz.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist old mode 100644 new mode 100755 diff --git a/Soyuz.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Soyuz.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved old mode 100644 new mode 100755 diff --git a/Soyuz.xcodeproj/xcuserdata/madeline.xcuserdatad/xcschemes/xcschememanagement.plist b/Soyuz.xcodeproj/xcuserdata/madeline.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..e0967e9 --- /dev/null +++ b/Soyuz.xcodeproj/xcuserdata/madeline.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Soyuz.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Soyuz.xcodeproj/xcuserdata/madelinecr.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Soyuz.xcodeproj/xcuserdata/madelinecr.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist old mode 100644 new mode 100755 index 0dc4b3a..8c4e110 --- a/Soyuz.xcodeproj/xcuserdata/madelinecr.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Soyuz.xcodeproj/xcuserdata/madelinecr.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -20,5 +20,53 @@ landmarkType = "7"> + + + + + + + + + + diff --git a/Soyuz.xcodeproj/xcuserdata/madelinecr.xcuserdatad/xcschemes/xcschememanagement.plist b/Soyuz.xcodeproj/xcuserdata/madelinecr.xcuserdatad/xcschemes/xcschememanagement.plist old mode 100644 new mode 100755 diff --git a/Soyuz/Assets.xcassets/AccentColor.colorset/Contents.json b/Soyuz/Assets.xcassets/AccentColor.colorset/Contents.json old mode 100644 new mode 100755 diff --git a/Soyuz/Assets.xcassets/AppIcon.appiconset/Contents.json b/Soyuz/Assets.xcassets/AppIcon.appiconset/Contents.json old mode 100644 new mode 100755 diff --git a/Soyuz/Assets.xcassets/Contents.json b/Soyuz/Assets.xcassets/Contents.json old mode 100644 new mode 100755 diff --git a/Soyuz/Info.plist b/Soyuz/Info.plist old mode 100644 new mode 100755 diff --git a/Soyuz/KlipperMon.xcdatamodeld/.xccurrentversion b/Soyuz/KlipperMon.xcdatamodeld/.xccurrentversion old mode 100644 new mode 100755 diff --git a/Soyuz/KlipperMon.xcdatamodeld/KlipperMon.xcdatamodel/contents b/Soyuz/KlipperMon.xcdatamodeld/KlipperMon.xcdatamodel/contents old mode 100644 new mode 100755 diff --git a/Soyuz/Persistence.swift b/Soyuz/Persistence.swift old mode 100644 new mode 100755 diff --git a/Soyuz/Preview Content/Preview Assets.xcassets/Contents.json b/Soyuz/Preview Content/Preview Assets.xcassets/Contents.json old mode 100644 new mode 100755 diff --git a/Soyuz/Soyuz.entitlements b/Soyuz/Soyuz.entitlements old mode 100644 new mode 100755 diff --git a/Soyuz/SoyuzApp.swift b/Soyuz/SoyuzApp.swift old mode 100644 new mode 100755 index b4806f5..019184b --- a/Soyuz/SoyuzApp.swift +++ b/Soyuz/SoyuzApp.swift @@ -13,7 +13,7 @@ struct SoyuzApp: App { @State var currentIcon = "move.3d" - @ObservedObject static var printerManager = PrinterRequestManager() + @ObservedObject static var printerManager = MoonrakerSocketManager() var body: some Scene { // WindowGroup(id: "floating-stats") { diff --git a/Soyuz/ViewModels/BonjourBrowser.swift b/Soyuz/ViewModels/BonjourBrowser.swift old mode 100644 new mode 100755 diff --git a/Soyuz/ViewModels/PrinterRequestManager.swift b/Soyuz/ViewModels/MoonrakerSocketManager.swift old mode 100644 new mode 100755 similarity index 99% rename from Soyuz/ViewModels/PrinterRequestManager.swift rename to Soyuz/ViewModels/MoonrakerSocketManager.swift index 99234eb..e479ed1 --- a/Soyuz/ViewModels/PrinterRequestManager.swift +++ b/Soyuz/ViewModels/MoonrakerSocketManager.swift @@ -13,7 +13,7 @@ import Starscream // MARK: PrinterRequestManager //@MainActor -class PrinterRequestManager: ObservableObject, WebSocketDelegate { +class MoonrakerSocketManager: ObservableObject, WebSocketDelegate { let WEBSOCKET_TIMEOUT_INTERVAL: TimeInterval = 60.0 // Websocket JSON-RPC published data diff --git a/Soyuz/ViewModels/PrinterObjectsQuery.swift b/Soyuz/ViewModels/PrinterObjectsQuery.swift old mode 100644 new mode 100755 diff --git a/Soyuz/Views/PrinterConfigView.swift b/Soyuz/Views/PrinterConfigView.swift old mode 100644 new mode 100755 index 5d198ca..54df80e --- a/Soyuz/Views/PrinterConfigView.swift +++ b/Soyuz/Views/PrinterConfigView.swift @@ -10,7 +10,7 @@ import Network // MARK: PrinterConfigView struct PrinterConfigView: View { - @ObservedObject var printerManager: PrinterRequestManager + @ObservedObject var printerManager: MoonrakerSocketManager @ObservedObject var bonjourBrowser = BonjourBrowser() var body: some View { @@ -54,7 +54,7 @@ struct PrinterConfigView: View { } struct PrinterConfigView_Previews: PreviewProvider { - @State static var printerManager = PrinterRequestManager() + @State static var printerManager = MoonrakerSocketManager() static var previews: some View { PrinterConfigView(printerManager: printerManager) diff --git a/Soyuz/Views/SoyuzMenuBarExtraView.swift b/Soyuz/Views/SoyuzMenuBarExtraView.swift old mode 100644 new mode 100755 index ba7cbec..631edf7 --- a/Soyuz/Views/SoyuzMenuBarExtraView.swift +++ b/Soyuz/Views/SoyuzMenuBarExtraView.swift @@ -11,11 +11,12 @@ import Network struct SoyuzMenuBarExtraView: View { // The threshhold considered a burn-risk, at which point certain UI elements turn red. + // Measured in degrees Celsius let DANGERTEMP = 40.0 @Environment(\.openWindow) var openWindow - @ObservedObject var printerManager: PrinterRequestManager + @ObservedObject var printerManager: MoonrakerSocketManager @State var printPercentage: Double = 0 @@ -100,7 +101,7 @@ struct SoyuzMenuBarExtraView: View { struct KlipperMonMenuBarExtraView_Previews: PreviewProvider { @State static var currentMenuBarIcon = "move.3d" - @State static var printerManager = PrinterRequestManager() + @State static var printerManager = MoonrakerSocketManager() static var previews: some View { SoyuzMenuBarExtraView(printerManager: printerManager, currentMenuBarIcon: $currentMenuBarIcon) diff --git a/SoyuzTests/BonjourBrowserTests.swift b/SoyuzTests/BonjourBrowserTests.swift old mode 100644 new mode 100755 index e923739..2ddb9b8 --- a/SoyuzTests/BonjourBrowserTests.swift +++ b/SoyuzTests/BonjourBrowserTests.swift @@ -29,7 +29,7 @@ class SoyuzBonjourBrowserTests: XCTestCase { bonjourBrowser = BonjourBrowser(browser: NWBrowser(for: .bonjour(type: "_xctest._tcp", domain: "local."), using: .tcp)) } - func testBonjourDiscoveredItemsNotNil() { + func testBonjourDiscoveredItemsPopulated() { guard let browser = bonjourBrowser else { XCTAssert(false) return diff --git a/SoyuzTests/PrinterRequestManagerTests.swift b/SoyuzTests/MoonrakerSocketManager.swift old mode 100644 new mode 100755 similarity index 52% rename from SoyuzTests/PrinterRequestManagerTests.swift rename to SoyuzTests/MoonrakerSocketManager.swift index cc336f9..374afec --- a/SoyuzTests/PrinterRequestManagerTests.swift +++ b/SoyuzTests/MoonrakerSocketManager.swift @@ -6,13 +6,40 @@ // import XCTest +import Starscream import Network @testable import Soyuz class PrinterRequestManagerTests: XCTestCase { - var printerRequestManager: PrinterRequestManager? + var socketManager: MoonrakerSocketManager? - var testBonjourListener: NWListener? + // Server-side test variables + let server = WebSocketServer() + let address = "localhost" + let port: UInt16 = 80 + + override func setUp() { + let server = WebSocketServer() + + let error = server.start(address: address, port: port) + + if let err = error { + print("Error starting WebSocket server: \(err)") + } + + socketManager = MoonrakerSocketManager() + } + + func testBlah() { + guard let url = URL(string: "\(address):\(port)") else { + return + } + print("Success") + let endpoint = NWEndpoint.url(url) + print(endpoint.debugDescription) + socketManager?.connectToBonjourEndpoint(endpoint) + return + } // override func setUp() { // printerRequestManager = PrinterRequestManager(browser: NWBrowser(for: .bonjour(type: "_http._tcp", domain: "local."), using: .tcp)) diff --git a/SoyuzTests/SoyuzScratchTests.swift b/SoyuzTests/SoyuzScratchTests.swift old mode 100644 new mode 100755 diff --git a/SoyuzTests/SoyuzTests.swift b/SoyuzTests/SoyuzTests.swift old mode 100644 new mode 100755 diff --git a/SoyuzUITests/SoyuzUITests.swift b/SoyuzUITests/SoyuzUITests.swift old mode 100644 new mode 100755 diff --git a/SoyuzUITests/SoyuzUITestsLaunchTests.swift b/SoyuzUITests/SoyuzUITestsLaunchTests.swift old mode 100644 new mode 100755