Skip to content

Commit

Permalink
Update CredentialsManager.swift
Browse files Browse the repository at this point in the history
Made Hidden wifi connection
  • Loading branch information
ilianTsonev authored Dec 22, 2024
1 parent 1c3fdb5 commit 3b9b53f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions HeliPort/CredentialsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,28 @@ final class CredentialsManager {
entity.network.auth = auth
return entity
}

}
func connectToHiddenNetwork(_ ssid: String) {
guard let auth = getAuthFromSsid(ssid) else {
Log.error("No credentials found for hidden network: \(ssid)")
return
}

// Attempt connection using saved credentials
Log.info("Attempting to connect to hidden network: \(ssid)")

WiFiManager.connect(ssid: ssid, password: auth.password) { success, error in
if success {
Log.info("Successfully connected to hidden network: \(ssid)")
} else if let error = error {
Log.error("Failed to connect to hidden network: \(ssid). Error: \(error.localizedDescription)")
} else {
Log.error("Unknown error occurred while connecting to hidden network: \(ssid)")
}
}
}

}

fileprivate extension NetworkInfo {
Expand Down

0 comments on commit 3b9b53f

Please sign in to comment.