Adjust pairing init timeout message

This commit is contained in:
Tulir Asokan 2024-04-10 16:42:24 +03:00
parent bbfb5e7b5b
commit c82a38b662
2 changed files with 6 additions and 2 deletions

View file

@ -160,7 +160,7 @@ func fnLoginGoogle(ce *WrappedCommandEvent) {
const (
pairingErrMsgNoDevices = "No devices found. Make sure you've enabled account pairing in the Google Messages app on your phone."
pairingErrPhoneNotResponding = "Phone not responding. Make sure your phone is connected to the internet and that account pairing is enabled in the Google Messages app. You may need to keep the app open and/or disable battery optimizations."
pairingErrPhoneNotResponding = "Phone not responding. Make sure your phone is connected to the internet and that account pairing is enabled in the Google Messages app. You may need to keep the app open and/or disable battery optimizations. Alternatively, try QR pairing"
pairingErrMsgIncorrectEmoji = "Incorrect emoji chosen on phone, please try again"
pairingErrMsgCancelled = "Pairing cancelled on phone"
pairingErrMsgTimeout = "Pairing timed out, please try again"

View file

@ -372,8 +372,12 @@ func (prov *ProvisioningAPI) GoogleLoginStart(w http.ResponseWriter, r *http.Req
ErrCode: "no-devices-found",
})
case errors.Is(err, libgm.ErrPairingInitTimeout):
errMsg := pairingErrPhoneNotResponding
if strings.Contains(r.UserAgent(), "; Android") {
errMsg += " using the desktop app"
}
jsonResponse(w, http.StatusBadRequest, Error{
Error: pairingErrPhoneNotResponding,
Error: errMsg,
ErrCode: "timeout",
})
default: