mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-11-17 23:43:10 +01:00
Always wait for offline sync to finish before sending connected state
This commit is contained in:
parent
b389354bcc
commit
be68203056
1 changed files with 4 additions and 3 deletions
7
user.go
7
user.go
|
@ -545,7 +545,6 @@ func (user *User) HandleEvent(event interface{}) {
|
|||
user.bridge.Metrics.TrackConnectionState(user.JID, false)
|
||||
user.bridge.Metrics.TrackLoginState(user.JID, false)
|
||||
case *events.Connected:
|
||||
go user.sendBridgeState(BridgeState{StateEvent: StateConnected})
|
||||
user.bridge.Metrics.TrackConnectionState(user.JID, true)
|
||||
user.bridge.Metrics.TrackLoginState(user.JID, true)
|
||||
if len(user.Client.Store.PushName) > 0 {
|
||||
|
@ -567,8 +566,10 @@ func (user *User) HandleEvent(event interface{}) {
|
|||
if !user.PhoneRecentlySeen(true) {
|
||||
user.log.Infofln("Offline sync completed, but phone last seen date is still %s - sending phone offline bridge status", user.PhoneLastSeen)
|
||||
go user.sendBridgeState(BridgeState{StateEvent: StateTransientDisconnect, Error: WAPhoneOffline})
|
||||
} else if user.GetPrevBridgeState().StateEvent == StateBackfilling {
|
||||
user.log.Infoln("Offline sync completed")
|
||||
} else {
|
||||
if user.GetPrevBridgeState().StateEvent == StateBackfilling {
|
||||
user.log.Infoln("Offline sync completed")
|
||||
}
|
||||
go user.sendBridgeState(BridgeState{StateEvent: StateConnected})
|
||||
}
|
||||
case *events.AppStateSyncComplete:
|
||||
|
|
Loading…
Reference in a new issue