add RelayLog to the bottom of the RelayDetailView
Signed-off-by: Bryan Montz <bryanmontz@me.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
a63ea1e22b
commit
91f02ccff5
@@ -12,8 +12,18 @@ struct RelayDetailView: View {
|
|||||||
let relay: String
|
let relay: String
|
||||||
let nip11: RelayMetadata
|
let nip11: RelayMetadata
|
||||||
|
|
||||||
|
@ObservedObject var log: RelayLog
|
||||||
|
|
||||||
@Environment(\.dismiss) var dismiss
|
@Environment(\.dismiss) var dismiss
|
||||||
|
|
||||||
|
init(state: DamusState, relay: String, nip11: RelayMetadata) {
|
||||||
|
self.state = state
|
||||||
|
self.relay = relay
|
||||||
|
self.nip11 = nip11
|
||||||
|
|
||||||
|
log = state.relay_model_cache.model(with_relay_id: relay)?.log ?? RelayLog()
|
||||||
|
}
|
||||||
|
|
||||||
func check_connection() -> Bool {
|
func check_connection() -> Bool {
|
||||||
for relay in state.pool.relays {
|
for relay in state.pool.relays {
|
||||||
if relay.id == self.relay {
|
if relay.id == self.relay {
|
||||||
@@ -114,6 +124,15 @@ struct RelayDetailView: View {
|
|||||||
Text(nipsList(nips: nips))
|
Text(nipsList(nips: nips))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let log_contents = log.contents {
|
||||||
|
Section("Log") {
|
||||||
|
Text(log_contents)
|
||||||
|
.font(.system(size: 13))
|
||||||
|
.lineLimit(nil)
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onReceive(handle_notify(.switched_timeline)) { notif in
|
.onReceive(handle_notify(.switched_timeline)) { notif in
|
||||||
|
|||||||
Reference in New Issue
Block a user