diff --git a/example-config.yaml b/example-config.yaml index 3485976..2092473 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -90,10 +90,10 @@ metrics: google_messages: # OS name to tell the phone. This is the name that shows up in the paired devices list. - os: Android (mautrix) + os: mautrix-gmessages # Browser type to tell the phone. This decides which icon is shown. # Valid types: OTHER, CHROME, FIREFOX, SAFARI, OPERA, IE, EDGE - browser: CHROME + browser: OTHER # Device type to tell the phone. This also affects the icon, as well as how many sessions are allowed simultaneously. # One web, two tablets and one PWA should be able to connect at the same time. # Valid types: WEB, TABLET, PWA diff --git a/libgm/pair.go b/libgm/pair.go index 384c30a..95d7961 100644 --- a/libgm/pair.go +++ b/libgm/pair.go @@ -4,6 +4,7 @@ import ( "crypto/x509" "encoding/base64" "fmt" + "time" "github.com/google/uuid" "google.golang.org/protobuf/proto" @@ -60,6 +61,10 @@ func (c *Client) completePairing(data *gmproto.PairedData) { c.triggerEvent(&events.PairSuccessful{PairedData: data}) go func() { + // Sleep for a bit to let the phone save the pair data. If we reconnect too quickly, + // the phone won't recognize the session the bridge will get unpaired. + time.Sleep(2 * time.Second) + err := c.Reconnect() if err != nil { c.triggerEvent(&events.ListenFatalError{Error: fmt.Errorf("failed to reconnect after pair success: %w", err)})