Skip to content

Commit

Permalink
implement reset code and ping
Browse files Browse the repository at this point in the history
  • Loading branch information
JJTech0130 committed Mar 26, 2024
1 parent 3dab327 commit 33397d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 6 additions & 3 deletions ValidationRelay/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,14 @@ struct ContentView: View {

Section {
Button("Reset Registration Code") {
// Do reset stuff
relayConnectionManager.savedRegistrationURL = ""
relayConnectionManager.savedRegistrationCode = ""
relayConnectionManager.savedRegistrationSecret = ""
relayConnectionManager.registrationCode = "None"
wantRelayConnected = false
}
//.foregroundColor(.red)
.foregroundColor(.red)
.frame(maxWidth: .infinity)
.disabled(true)
} footer: {
Text("You will need to re-enter the code on your other devices")
}
Expand Down
7 changes: 4 additions & 3 deletions ValidationRelay/Relay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class RelayConnectionManager: WebSocketConnectionDelegate, ObservableObject {
@Published var connectionStatusMessage: String = ""

// These must all be saved together
@AppStorage("savedRegistrationSecret") var savedRegistrationSecret = ""
@AppStorage("savedRegistrationCode") var savedRegistrationCode = ""
@AppStorage("savedRegistrationURL") var savedRegistrationURL = ""
@AppStorage("savedRegistrationSecret") public var savedRegistrationSecret = ""
@AppStorage("savedRegistrationCode") public var savedRegistrationCode = ""
@AppStorage("savedRegistrationURL") public var savedRegistrationURL = ""

var currentURL: URL? = nil

Expand All @@ -55,6 +55,7 @@ class RelayConnectionManager: WebSocketConnectionDelegate, ObservableObject {
let connection = NWWebSocket(url: url, connectAutomatically: true)
connection.delegate = self
connection.connect()
connection.ping(interval: 30)
self.connection = connection
//print(getIdentifiers())
}
Expand Down

0 comments on commit 33397d6

Please sign in to comment.