mirror of
https://github.com/status-im/status-go.git
synced 2025-02-19 18:28:18 +00:00
fix: set device type on init
This commit is contained in:
parent
f607164122
commit
8fe077380b
@ -4,6 +4,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/status-im/status-go/multiaccounts/settings"
|
"github.com/status-im/status-go/multiaccounts/settings"
|
||||||
@ -158,17 +159,25 @@ func (m *Messenger) setInstallationHostname() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the name is already set, don't do anything
|
// If the name and device are already set, don't do anything
|
||||||
if len(imd.Name) != 0 {
|
if len(imd.Name) != 0 && len(imd.DeviceType) != 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(imd.Name) == 0 {
|
||||||
hn, err := server.GetDeviceName()
|
hn, err := server.GetDeviceName()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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)
|
return m.setInstallationMetadata(m.installationID, imd)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Messenger) getOurInstallationMetadata() (*multidevice.InstallationMetadata, error) {
|
func (m *Messenger) getOurInstallationMetadata() (*multidevice.InstallationMetadata, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user