Make profile photos visible by default (#3553)

* Make profile photos visible by default

* Slight refactoring
This commit is contained in:
Alexander 2023-06-19 18:55:04 +02:00 committed by GitHub
parent f702b54d08
commit 49187cc553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 65 additions and 65 deletions

View File

@ -33,7 +33,8 @@ func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derive
s.BackupEnabled = true s.BackupEnabled = true
logLevel := "INFO" logLevel := "INFO"
s.LogLevel = &logLevel s.LogLevel = &logLevel
s.ProfilePicturesShowTo = settings.ProfilePicturesShowToContactsOnly s.ProfilePicturesShowTo = settings.ProfilePicturesShowToEveryone
s.ProfilePicturesVisibility = settings.ProfilePicturesVisibilityEveryone
s.KeyUID = generatedAccountInfo.KeyUID s.KeyUID = generatedAccountInfo.KeyUID
s.Address = types.HexToAddress(generatedAccountInfo.Address) s.Address = types.HexToAddress(generatedAccountInfo.Address)
s.WalletRootAddress = types.HexToAddress(derivedAddresses[pathWalletRoot].Address) s.WalletRootAddress = types.HexToAddress(derivedAddresses[pathWalletRoot].Address)
@ -62,7 +63,6 @@ func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derive
s.PreviewPrivacy = true s.PreviewPrivacy = true
s.Currency = "usd" s.Currency = "usd"
s.ProfilePicturesVisibility = 1
s.LinkPreviewRequestEnabled = true s.LinkPreviewRequestEnabled = true
visibleTokens := make(map[string][]string) visibleTokens := make(map[string][]string)

View File

@ -266,37 +266,37 @@ var paths = []string{pathWalletRoot, pathEIP1581, pathDefaultChat, pathDefaultWa
func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derivedAddresses map[string]generator.AccountInfo, mnemonic *string) (*settings.Settings, error) { func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derivedAddresses map[string]generator.AccountInfo, mnemonic *string) (*settings.Settings, error) {
chatKeyString := derivedAddresses[pathDefaultChat].PublicKey chatKeyString := derivedAddresses[pathDefaultChat].PublicKey
settings := &settings.Settings{} defaultSettings := &settings.Settings{}
settings.KeyUID = generatedAccountInfo.KeyUID defaultSettings.KeyUID = generatedAccountInfo.KeyUID
settings.Address = types.HexToAddress(generatedAccountInfo.Address) defaultSettings.Address = types.HexToAddress(generatedAccountInfo.Address)
settings.WalletRootAddress = types.HexToAddress(derivedAddresses[pathWalletRoot].Address) defaultSettings.WalletRootAddress = types.HexToAddress(derivedAddresses[pathWalletRoot].Address)
// Set chat key & name // Set chat key & name
name, err := alias.GenerateFromPublicKeyString(chatKeyString) name, err := alias.GenerateFromPublicKeyString(chatKeyString)
if err != nil { if err != nil {
return nil, err return nil, err
} }
settings.Name = name defaultSettings.Name = name
settings.PublicKey = chatKeyString defaultSettings.PublicKey = chatKeyString
settings.DappsAddress = types.HexToAddress(derivedAddresses[pathDefaultWallet].Address) defaultSettings.DappsAddress = types.HexToAddress(derivedAddresses[pathDefaultWallet].Address)
settings.EIP1581Address = types.HexToAddress(derivedAddresses[pathEIP1581].Address) defaultSettings.EIP1581Address = types.HexToAddress(derivedAddresses[pathEIP1581].Address)
settings.Mnemonic = mnemonic defaultSettings.Mnemonic = mnemonic
signingPhrase, err := buildSigningPhrase() signingPhrase, err := buildSigningPhrase()
if err != nil { if err != nil {
return nil, err return nil, err
} }
settings.SigningPhrase = signingPhrase defaultSettings.SigningPhrase = signingPhrase
settings.SendPushNotifications = true defaultSettings.SendPushNotifications = true
settings.InstallationID = uuid.New().String() defaultSettings.InstallationID = uuid.New().String()
settings.UseMailservers = true defaultSettings.UseMailservers = true
settings.PreviewPrivacy = true defaultSettings.PreviewPrivacy = true
settings.Currency = "usd" defaultSettings.Currency = "usd"
settings.ProfilePicturesVisibility = 1 defaultSettings.ProfilePicturesVisibility = settings.ProfilePicturesVisibilityEveryone
settings.LinkPreviewRequestEnabled = true defaultSettings.LinkPreviewRequestEnabled = true
visibleTokens := make(map[string][]string) visibleTokens := make(map[string][]string)
visibleTokens["mainnet"] = []string{"SNT"} visibleTokens["mainnet"] = []string{"SNT"}
@ -305,7 +305,7 @@ func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derive
return nil, err return nil, err
} }
visibleTokenJSONRaw := json.RawMessage(visibleTokensJSON) visibleTokenJSONRaw := json.RawMessage(visibleTokensJSON)
settings.WalletVisibleTokens = &visibleTokenJSONRaw defaultSettings.WalletVisibleTokens = &visibleTokenJSONRaw
// TODO: fix this // TODO: fix this
networks := make([]map[string]string, 0) networks := make([]map[string]string, 0)
@ -314,10 +314,10 @@ func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derive
return nil, err return nil, err
} }
networkRawMessage := json.RawMessage(networksJSON) networkRawMessage := json.RawMessage(networksJSON)
settings.Networks = &networkRawMessage defaultSettings.Networks = &networkRawMessage
settings.CurrentNetwork = "mainnet_rpc" defaultSettings.CurrentNetwork = "mainnet_rpc"
return settings, nil return defaultSettings, nil
} }
func defaultNodeConfig(installationID string) (*params.NodeConfig, error) { func defaultNodeConfig(installationID string) (*params.NodeConfig, error) {

View File

@ -330,37 +330,37 @@ var paths = []string{pathWalletRoot, pathEIP1581, pathDefaultChat, pathDefaultWa
func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derivedAddresses map[string]generator.AccountInfo, mnemonic *string) (*settings.Settings, error) { func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derivedAddresses map[string]generator.AccountInfo, mnemonic *string) (*settings.Settings, error) {
chatKeyString := derivedAddresses[pathDefaultChat].PublicKey chatKeyString := derivedAddresses[pathDefaultChat].PublicKey
settings := &settings.Settings{} defaultSettings := &settings.Settings{}
settings.KeyUID = generatedAccountInfo.KeyUID defaultSettings.KeyUID = generatedAccountInfo.KeyUID
settings.Address = types.HexToAddress(generatedAccountInfo.Address) defaultSettings.Address = types.HexToAddress(generatedAccountInfo.Address)
settings.WalletRootAddress = types.HexToAddress(derivedAddresses[pathWalletRoot].Address) defaultSettings.WalletRootAddress = types.HexToAddress(derivedAddresses[pathWalletRoot].Address)
// Set chat key & name // Set chat key & name
name, err := alias.GenerateFromPublicKeyString(chatKeyString) name, err := alias.GenerateFromPublicKeyString(chatKeyString)
if err != nil { if err != nil {
return nil, err return nil, err
} }
settings.Name = name defaultSettings.Name = name
settings.PublicKey = chatKeyString defaultSettings.PublicKey = chatKeyString
settings.DappsAddress = types.HexToAddress(derivedAddresses[pathDefaultWallet].Address) defaultSettings.DappsAddress = types.HexToAddress(derivedAddresses[pathDefaultWallet].Address)
settings.EIP1581Address = types.HexToAddress(derivedAddresses[pathEIP1581].Address) defaultSettings.EIP1581Address = types.HexToAddress(derivedAddresses[pathEIP1581].Address)
settings.Mnemonic = mnemonic defaultSettings.Mnemonic = mnemonic
signingPhrase, err := buildSigningPhrase() signingPhrase, err := buildSigningPhrase()
if err != nil { if err != nil {
return nil, err return nil, err
} }
settings.SigningPhrase = signingPhrase defaultSettings.SigningPhrase = signingPhrase
settings.SendPushNotifications = true defaultSettings.SendPushNotifications = true
settings.InstallationID = uuid.New().String() defaultSettings.InstallationID = uuid.New().String()
settings.UseMailservers = true defaultSettings.UseMailservers = true
settings.PreviewPrivacy = true defaultSettings.PreviewPrivacy = true
settings.Currency = "usd" defaultSettings.Currency = "usd"
settings.ProfilePicturesVisibility = 1 defaultSettings.ProfilePicturesVisibility = settings.ProfilePicturesVisibilityEveryone
settings.LinkPreviewRequestEnabled = true defaultSettings.LinkPreviewRequestEnabled = true
visibleTokens := make(map[string][]string) visibleTokens := make(map[string][]string)
visibleTokens["mainnet"] = []string{"SNT"} visibleTokens["mainnet"] = []string{"SNT"}
@ -369,7 +369,7 @@ func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derive
return nil, err return nil, err
} }
visibleTokenJSONRaw := json.RawMessage(visibleTokensJSON) visibleTokenJSONRaw := json.RawMessage(visibleTokensJSON)
settings.WalletVisibleTokens = &visibleTokenJSONRaw defaultSettings.WalletVisibleTokens = &visibleTokenJSONRaw
// TODO: fix this // TODO: fix this
networks := make([]map[string]string, 0) networks := make([]map[string]string, 0)
@ -378,10 +378,10 @@ func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derive
return nil, err return nil, err
} }
networkRawMessage := json.RawMessage(networksJSON) networkRawMessage := json.RawMessage(networksJSON)
settings.Networks = &networkRawMessage defaultSettings.Networks = &networkRawMessage
settings.CurrentNetwork = "mainnet_rpc" defaultSettings.CurrentNetwork = "mainnet_rpc"
return settings, nil return defaultSettings, nil
} }
func defaultNodeConfig(installationID string) (*params.NodeConfig, error) { func defaultNodeConfig(installationID string) (*params.NodeConfig, error) {

View File

@ -207,37 +207,37 @@ var paths = []string{pathWalletRoot, pathEIP1581, pathDefaultChat, pathDefaultWa
func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derivedAddresses map[string]generator.AccountInfo, mnemonic *string) (*settings.Settings, error) { func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derivedAddresses map[string]generator.AccountInfo, mnemonic *string) (*settings.Settings, error) {
chatKeyString := derivedAddresses[pathDefaultChat].PublicKey chatKeyString := derivedAddresses[pathDefaultChat].PublicKey
settings := &settings.Settings{} defaultSettings := &settings.Settings{}
settings.KeyUID = generatedAccountInfo.KeyUID defaultSettings.KeyUID = generatedAccountInfo.KeyUID
settings.Address = types.HexToAddress(generatedAccountInfo.Address) defaultSettings.Address = types.HexToAddress(generatedAccountInfo.Address)
settings.WalletRootAddress = types.HexToAddress(derivedAddresses[pathWalletRoot].Address) defaultSettings.WalletRootAddress = types.HexToAddress(derivedAddresses[pathWalletRoot].Address)
// Set chat key & name // Set chat key & name
name, err := alias.GenerateFromPublicKeyString(chatKeyString) name, err := alias.GenerateFromPublicKeyString(chatKeyString)
if err != nil { if err != nil {
return nil, err return nil, err
} }
settings.Name = name defaultSettings.Name = name
settings.PublicKey = chatKeyString defaultSettings.PublicKey = chatKeyString
settings.DappsAddress = types.HexToAddress(derivedAddresses[pathDefaultWallet].Address) defaultSettings.DappsAddress = types.HexToAddress(derivedAddresses[pathDefaultWallet].Address)
settings.EIP1581Address = types.HexToAddress(derivedAddresses[pathEIP1581].Address) defaultSettings.EIP1581Address = types.HexToAddress(derivedAddresses[pathEIP1581].Address)
settings.Mnemonic = mnemonic defaultSettings.Mnemonic = mnemonic
signingPhrase, err := buildSigningPhrase() signingPhrase, err := buildSigningPhrase()
if err != nil { if err != nil {
return nil, err return nil, err
} }
settings.SigningPhrase = signingPhrase defaultSettings.SigningPhrase = signingPhrase
settings.SendPushNotifications = true defaultSettings.SendPushNotifications = true
settings.InstallationID = uuid.New().String() defaultSettings.InstallationID = uuid.New().String()
settings.UseMailservers = true defaultSettings.UseMailservers = true
settings.PreviewPrivacy = true defaultSettings.PreviewPrivacy = true
settings.Currency = "usd" defaultSettings.Currency = "usd"
settings.ProfilePicturesVisibility = 1 defaultSettings.ProfilePicturesVisibility = settings.ProfilePicturesVisibilityEveryone
settings.LinkPreviewRequestEnabled = true defaultSettings.LinkPreviewRequestEnabled = true
visibleTokens := make(map[string][]string) visibleTokens := make(map[string][]string)
visibleTokens["mainnet"] = []string{"SNT"} visibleTokens["mainnet"] = []string{"SNT"}
@ -246,7 +246,7 @@ func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derive
return nil, err return nil, err
} }
visibleTokenJSONRaw := json.RawMessage(visibleTokensJSON) visibleTokenJSONRaw := json.RawMessage(visibleTokensJSON)
settings.WalletVisibleTokens = &visibleTokenJSONRaw defaultSettings.WalletVisibleTokens = &visibleTokenJSONRaw
// TODO: fix this // TODO: fix this
networks := make([]map[string]string, 0) networks := make([]map[string]string, 0)
@ -255,10 +255,10 @@ func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derive
return nil, err return nil, err
} }
networkRawMessage := json.RawMessage(networksJSON) networkRawMessage := json.RawMessage(networksJSON)
settings.Networks = &networkRawMessage defaultSettings.Networks = &networkRawMessage
settings.CurrentNetwork = "mainnet_rpc" defaultSettings.CurrentNetwork = "mainnet_rpc"
return settings, nil return defaultSettings, nil
} }
func defaultNodeConfig(installationID string) (*params.NodeConfig, error) { func defaultNodeConfig(installationID string) (*params.NodeConfig, error) {