From 8fe077380bdd29290e01ccd0fdd19d5a8ee5c141 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Wed, 8 Mar 2023 10:04:02 -0400 Subject: [PATCH] fix: set device type on init --- protocol/messenger_identity.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/protocol/messenger_identity.go b/protocol/messenger_identity.go index 0d67e1b90..bf6e2669f 100644 --- a/protocol/messenger_identity.go +++ b/protocol/messenger_identity.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "regexp" + "runtime" "strings" "github.com/status-im/status-go/multiaccounts/settings" @@ -158,17 +159,25 @@ func (m *Messenger) setInstallationHostname() error { return err } - // If the name is already set, don't do anything - if len(imd.Name) != 0 { + // If the name and device are already set, don't do anything + if len(imd.Name) != 0 && len(imd.DeviceType) != 0 { return nil } - hn, err := server.GetDeviceName() - if err != nil { - return err + if len(imd.Name) == 0 { + hn, err := server.GetDeviceName() + if err != nil { + return err + } + imd.Name = fmt.Sprintf("%s %s", hn, imd.Name) } - imd.Name = fmt.Sprintf("%s %s", hn, imd.Name) + + if len(imd.DeviceType) == 0 { + imd.DeviceType = runtime.GOOS + } + return m.setInstallationMetadata(m.installationID, imd) + } func (m *Messenger) getOurInstallationMetadata() (*multidevice.InstallationMetadata, error) {