Revert "Reduce battery usage by using exp backoff on connections"
This is causing pretty bad fail to reconnect issues This reverts commit252a77fd97, reversing changes made toa611a5d252.
This commit is contained in:
1 parent
e0984aab34
commit
9091cb1aae
12 files changed
+161
-323
No files matched your search
@@ -7,16 +7,6 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
extension RelayConnection.State {
|
||||
var indicatorColor: Color {
|
||||
switch self {
|
||||
case .connected: return .green
|
||||
case .connecting, .reconnecting: return .yellow
|
||||
default: return .red
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RelayStatus: View {
|
||||
let pool: RelayPool
|
||||
let relay: String
|
||||
@@ -26,10 +16,18 @@ struct RelayStatus: View {
|
||||
@State var conn_color: Color = .gray
|
||||
|
||||
func update_connection_color() {
|
||||
guard let relay = pool.relays.first(where: { $0.id == relay }) else {
|
||||
return
|
||||
for relay in pool.relays {
|
||||
if relay.id == self.relay {
|
||||
let c = relay.connection
|
||||
if c.isConnected {
|
||||
conn_color = .green
|
||||
} else if c.isConnecting || c.isReconnecting {
|
||||
conn_color = .yellow
|
||||
} else {
|
||||
conn_color = .red
|
||||
}
|
||||
}
|
||||
}
|
||||
conn_color = relay.connection.state.indicatorColor
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
|
||||
Reference in new issue
Block a user