mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-24 14:34:12 +01:00
Update hacky workaround for transient disconnect states
The previous version didn't handle the case where the reconnect is what triggers the `wa-phone-offline` state in the first place.
This commit is contained in:
parent
9b6ca8d6f1
commit
dcfa9e1b34
1 changed files with 1 additions and 1 deletions
2
user.go
2
user.go
|
@ -628,7 +628,7 @@ func (user *User) HandleEvent(event interface{}) {
|
|||
case *events.Disconnected:
|
||||
// Don't send the normal transient disconnect state if we're already in a different transient disconnect state.
|
||||
// TODO remove this if/when the phone offline state is moved to a sub-state of CONNECTED
|
||||
if user.GetPrevBridgeState().Error != WAPhoneOffline {
|
||||
if user.GetPrevBridgeState().Error != WAPhoneOffline && user.PhoneRecentlySeen(false) {
|
||||
go user.sendBridgeState(BridgeState{StateEvent: StateTransientDisconnect, Message: "Disconnected from WhatsApp. Trying to reconnect."})
|
||||
}
|
||||
user.bridge.Metrics.TrackConnectionState(user.JID, false)
|
||||
|
|
Loading…
Reference in a new issue