Send bad credentials state if default sms app flag is false
This commit is contained in:
parent
a4bb7e69cf
commit
51c68f4919
3 changed files with 10 additions and 1 deletions
|
@ -32,6 +32,7 @@ const (
|
||||||
GMConnecting status.BridgeStateErrorCode = "gm-connecting"
|
GMConnecting status.BridgeStateErrorCode = "gm-connecting"
|
||||||
GMConnectionFailed status.BridgeStateErrorCode = "gm-connection-failed"
|
GMConnectionFailed status.BridgeStateErrorCode = "gm-connection-failed"
|
||||||
GMPingFailed status.BridgeStateErrorCode = "gm-ping-failed"
|
GMPingFailed status.BridgeStateErrorCode = "gm-ping-failed"
|
||||||
|
GMNotDefaultSMSApp status.BridgeStateErrorCode = "gm-not-default-sms-app"
|
||||||
|
|
||||||
GMBrowserInactive status.BridgeStateErrorCode = "gm-browser-inactive"
|
GMBrowserInactive status.BridgeStateErrorCode = "gm-browser-inactive"
|
||||||
GMBrowserInactiveTimeout status.BridgeStateErrorCode = "gm-browser-inactive-timeout"
|
GMBrowserInactiveTimeout status.BridgeStateErrorCode = "gm-browser-inactive-timeout"
|
||||||
|
@ -46,6 +47,7 @@ func init() {
|
||||||
GMFatalError: "Fatal error polling messages from Google Messages server, please re-link the bridge",
|
GMFatalError: "Fatal error polling messages from Google Messages server, please re-link the bridge",
|
||||||
GMUnpaired: "Unpaired from Google Messages, please re-link the connection to continue using SMS/RCS",
|
GMUnpaired: "Unpaired from Google Messages, please re-link the connection to continue using SMS/RCS",
|
||||||
GMUnpaired404: "Unpaired from Google Messages, please re-link the connection to continue using SMS/RCS",
|
GMUnpaired404: "Unpaired from Google Messages, please re-link the connection to continue using SMS/RCS",
|
||||||
|
GMNotDefaultSMSApp: "Google Messages isn't set as the default SMS app. Please set the default SMS app on your Android phone to Google Messages to continue using SMS/RCS.",
|
||||||
GMBrowserInactive: "Google Messages opened in another browser",
|
GMBrowserInactive: "Google Messages opened in another browser",
|
||||||
GMBrowserInactiveTimeout: "Google Messages disconnected due to timeout",
|
GMBrowserInactiveTimeout: "Google Messages disconnected due to timeout",
|
||||||
GMBrowserInactiveInactivity: "Google Messages disconnected due to inactivity",
|
GMBrowserInactiveInactivity: "Google Messages disconnected due to inactivity",
|
||||||
|
|
|
@ -63,6 +63,7 @@ func (uq *UserQuery) GetByMXID(ctx context.Context, userID id.UserID) (*User, er
|
||||||
}
|
}
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
|
SettingsReceived bool `json:"settings_received"`
|
||||||
RCSEnabled bool `json:"rcs_enabled"`
|
RCSEnabled bool `json:"rcs_enabled"`
|
||||||
ReadReceipts bool `json:"read_receipts"`
|
ReadReceipts bool `json:"read_receipts"`
|
||||||
TypingNotifications bool `json:"typing_notifications"`
|
TypingNotifications bool `json:"typing_notifications"`
|
||||||
|
|
8
user.go
8
user.go
|
@ -773,8 +773,10 @@ func (user *User) handleSettings(settings *gmproto.Settings) {
|
||||||
if user.Settings.RCSEnabled != newRCSSettings.GetIsEnabled() ||
|
if user.Settings.RCSEnabled != newRCSSettings.GetIsEnabled() ||
|
||||||
user.Settings.ReadReceipts != newRCSSettings.GetSendReadReceipts() ||
|
user.Settings.ReadReceipts != newRCSSettings.GetSendReadReceipts() ||
|
||||||
user.Settings.TypingNotifications != newRCSSettings.GetShowTypingIndicators() ||
|
user.Settings.TypingNotifications != newRCSSettings.GetShowTypingIndicators() ||
|
||||||
user.Settings.IsDefaultSMSApp != newRCSSettings.GetIsDefaultSMSApp() {
|
user.Settings.IsDefaultSMSApp != newRCSSettings.GetIsDefaultSMSApp() ||
|
||||||
|
!user.Settings.SettingsReceived {
|
||||||
user.Settings = database.Settings{
|
user.Settings = database.Settings{
|
||||||
|
SettingsReceived: true,
|
||||||
RCSEnabled: newRCSSettings.GetIsEnabled(),
|
RCSEnabled: newRCSSettings.GetIsEnabled(),
|
||||||
ReadReceipts: newRCSSettings.GetSendReadReceipts(),
|
ReadReceipts: newRCSSettings.GetSendReadReceipts(),
|
||||||
TypingNotifications: newRCSSettings.GetShowTypingIndicators(),
|
TypingNotifications: newRCSSettings.GetShowTypingIndicators(),
|
||||||
|
@ -801,6 +803,10 @@ func (user *User) FillBridgeState(state status.BridgeState) status.BridgeState {
|
||||||
state.Info["battery_low"] = user.batteryLow
|
state.Info["battery_low"] = user.batteryLow
|
||||||
state.Info["mobile_data"] = user.mobileData
|
state.Info["mobile_data"] = user.mobileData
|
||||||
state.Info["browser_active"] = user.browserInactiveType == ""
|
state.Info["browser_active"] = user.browserInactiveType == ""
|
||||||
|
if user.Settings.SettingsReceived && !user.Settings.IsDefaultSMSApp {
|
||||||
|
state.StateEvent = status.StateBadCredentials
|
||||||
|
state.Error = GMNotDefaultSMSApp
|
||||||
|
}
|
||||||
if !user.ready {
|
if !user.ready {
|
||||||
state.StateEvent = status.StateConnecting
|
state.StateEvent = status.StateConnecting
|
||||||
state.Error = GMConnecting
|
state.Error = GMConnecting
|
||||||
|
|
Loading…
Reference in a new issue