feat(StatusLetterIdenticon): make useAcronymForLetterIdenticon mode charactersLen unaware
This commit is contained in:
parent
aeb9929fcd
commit
b2ab3a455a
|
@ -13,6 +13,13 @@ Rectangle {
|
|||
property int letterSize: 21
|
||||
property int charactersLen: 1
|
||||
property color letterIdenticonColor: Theme.palette.miscColor5
|
||||
|
||||
// In this mode, one or two letters are used depending on words used:
|
||||
// John -> J
|
||||
// John Smith -> JS
|
||||
// John Smith Junior -> JS
|
||||
//
|
||||
// characterLen is ignored
|
||||
property bool useAcronymForLetterIdenticon: false
|
||||
property bool strictBackgroundColor: !useAcronymForLetterIdenticon
|
||||
|
||||
|
@ -57,19 +64,18 @@ Rectangle {
|
|||
}
|
||||
|
||||
text: {
|
||||
let parts = root.name.split(" ")
|
||||
if (root.useAcronymForLetterIdenticon && parts.length > 1) {
|
||||
let word = ""
|
||||
for (let i=0; i<root.charactersLen; i++) {
|
||||
if (i >= parts.length) {
|
||||
return word
|
||||
}
|
||||
const parts = root.name.split(" ")
|
||||
|
||||
if (root.useAcronymForLetterIdenticon) {
|
||||
let word = ""
|
||||
|
||||
for (let i = 0; i < Math.min(parts.length, 2); i++) {
|
||||
let shift = (parts[i].charAt(0) === "#") ||
|
||||
(parts[i].charAt(0) === "@")
|
||||
|
||||
word += parts[i].substring(shift, shift + 1).toUpperCase()
|
||||
}
|
||||
|
||||
return word
|
||||
}
|
||||
|
||||
|
|
|
@ -62,13 +62,6 @@ StatusListItem {
|
|||
width: 40
|
||||
height: 40
|
||||
color: Utils.getColorForId(root.colorId)
|
||||
charactersLen: {
|
||||
let parts = root.name.split(" ")
|
||||
if (parts.length > 1) {
|
||||
return 2
|
||||
}
|
||||
return 1
|
||||
}
|
||||
isLetterIdenticon: true
|
||||
useAcronymForLetterIdenticon: true
|
||||
}
|
||||
|
|
|
@ -563,12 +563,7 @@ StatusModal {
|
|||
color: model.color
|
||||
isLetterIdenticon: !model.icon
|
||||
useAcronymForLetterIdenticon: model.type === AddEditSavedAddressPopup.CardType.SavedAddress
|
||||
charactersLen: {
|
||||
if (model.type === AddEditSavedAddressPopup.CardType.SavedAddress && model.title.split(" ").length == 1) {
|
||||
return 1
|
||||
}
|
||||
return 2
|
||||
}
|
||||
charactersLen: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -231,13 +231,7 @@ StatusModal {
|
|||
name: !root.selectedAccount.name && !root.selectedAccount.emoji? "status-logo-icon" : ""
|
||||
color: !root.selectedAccount.name && !root.selectedAccount.emoji? "transparent" : Utils.getColorForId(root.selectedAccount.colorId)
|
||||
emoji: root.selectedAccount.emoji
|
||||
charactersLen: {
|
||||
let parts = root.selectedAccount.name.split(" ")
|
||||
if (parts.length > 1) {
|
||||
return 2
|
||||
}
|
||||
return 1
|
||||
}
|
||||
charactersLen: 1
|
||||
isLetterIdenticon: root.selectedAccount.name && !root.selectedAccount.emoji
|
||||
useAcronymForLetterIdenticon: root.selectedAccount.name && !root.selectedAccount.emoji
|
||||
}
|
||||
|
|
|
@ -54,13 +54,6 @@ StatusDialog {
|
|||
name: root.name
|
||||
asset {
|
||||
color: Utils.getColorForId(root.colorId)
|
||||
charactersLen: {
|
||||
let parts = root.name.split(" ")
|
||||
if (parts.length > 1) {
|
||||
return 2
|
||||
}
|
||||
return 1
|
||||
}
|
||||
isLetterIdenticon: true
|
||||
useAcronymForLetterIdenticon: true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue