mirror of
https://github.com/yggdrasil-network/yggdrasil-ios.git
synced 2025-04-28 22:25:10 +03:00
More updates
This commit is contained in:
parent
5fbb735f56
commit
0bea3a1613
9 changed files with 150 additions and 38 deletions
|
@ -6,6 +6,7 @@
|
|||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
struct YggdrasilSummary: Codable {
|
||||
var address: String
|
||||
|
@ -17,14 +18,18 @@ struct YggdrasilSummary: Codable {
|
|||
func list() -> [String] {
|
||||
return peers.map { $0.remote }
|
||||
}
|
||||
|
||||
func listUp() -> [String] {
|
||||
return peers.filter { $0.up }.map { $0.remote }
|
||||
}
|
||||
}
|
||||
|
||||
struct YggdrasilPeer: Codable, Identifiable {
|
||||
var id: String { remote } // For Identifiable protocol
|
||||
let remote: String
|
||||
let up: Bool
|
||||
let address: String
|
||||
let key: String
|
||||
let address: String?
|
||||
let key: String?
|
||||
let priority: UInt8
|
||||
let cost: UInt16?
|
||||
|
||||
|
@ -36,4 +41,11 @@ struct YggdrasilPeer: Codable, Identifiable {
|
|||
case priority = "Priority"
|
||||
case cost = "Cost"
|
||||
}
|
||||
|
||||
public func getStatusBadgeColor() -> SwiftUI.Color {
|
||||
if self.up {
|
||||
return .green
|
||||
}
|
||||
return .gray
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue