fix(wallet-emoji): fix wallet emoji save by only saving the utf char

Fixes #5161
This commit is contained in:
Jonathan Rainville 2022-04-04 12:55:56 -04:00 committed by Iuri Matias
parent 033726e7f7
commit 684a1ce913
2 changed files with 7 additions and 11 deletions

View File

@ -23,7 +23,6 @@ StatusModal {
property string channelColor: "" property string channelColor: ""
property bool emojiPopupOpened: false property bool emojiPopupOpened: false
property var emojiPopup: null property var emojiPopup: null
readonly property string emojiRegexStr: 'alt="(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])"'
readonly property var communityColorValidator: Utils.Validate.NoEmpty readonly property var communityColorValidator: Utils.Validate.NoEmpty
| Utils.Validate.TextHexColor | Utils.Validate.TextHexColor
@ -279,12 +278,7 @@ StatusModal {
return return
} }
let error = ""; let error = "";
let emoji = popup.contentItem.channelName.input.icon.emoji let emoji = StatusQUtils.Emoji.deparseFromParse(popup.contentItem.channelName.input.icon.emoji)
// Extract the UTF emoji from the `img` tag so that we only store the emoi and not the full image
const found = RegExp(emojiRegexStr, 'g').exec(emoji);
if (found) {
emoji = found[1]
}
if (!isEdit) { if (!isEdit) {
//popup.contentItem.communityColor.color.toString().toUpperCase() //popup.contentItem.communityColor.color.toString().toUpperCase()

View File

@ -187,24 +187,26 @@ StatusModal {
return loading = false return loading = false
} }
let emoji = StatusQUtils.Emoji.deparseFromParse(accountNameInput.input.icon.emoji)
var errMessage = "" var errMessage = ""
if(advancedSelection.expandableItem) { if(advancedSelection.expandableItem) {
switch(advancedSelection.expandableItem.addAccountType) { switch(advancedSelection.expandableItem.addAccountType) {
case AdvancedAddAccountView.AddAccountType.GenerateNew: case AdvancedAddAccountView.AddAccountType.GenerateNew:
errMessage = RootStore.generateNewAccount(passwordInput.text, accountNameInput.text, colorSelectionGrid.selectedColor, accountNameInput.input.icon.emoji) errMessage = RootStore.generateNewAccount(passwordInput.text, accountNameInput.text, colorSelectionGrid.selectedColor, emoji)
break break
case AdvancedAddAccountView.AddAccountType.ImportSeedPhrase: case AdvancedAddAccountView.AddAccountType.ImportSeedPhrase:
errMessage = RootStore.addAccountsFromSeed(advancedSelection.expandableItem.mnemonicText, passwordInput.text, accountNameInput.text, colorSelectionGrid.selectedColor, accountNameInput.input.icon.emoji) errMessage = RootStore.addAccountsFromSeed(advancedSelection.expandableItem.mnemonicText, passwordInput.text, accountNameInput.text, colorSelectionGrid.selectedColor, emoji)
break break
case AdvancedAddAccountView.AddAccountType.ImportPrivateKey: case AdvancedAddAccountView.AddAccountType.ImportPrivateKey:
errMessage = RootStore.addAccountsFromPrivateKey(advancedSelection.expandableItem.privateKey, passwordInput.text, accountNameInput.text, colorSelectionGrid.selectedColor, accountNameInput.input.icon.emoji) errMessage = RootStore.addAccountsFromPrivateKey(advancedSelection.expandableItem.privateKey, passwordInput.text, accountNameInput.text, colorSelectionGrid.selectedColor, emoji)
break break
case AdvancedAddAccountView.AddAccountType.WatchOnly: case AdvancedAddAccountView.AddAccountType.WatchOnly:
errMessage = RootStore.addWatchOnlyAccount(advancedSelection.expandableItem.watchAddress, accountNameInput.text, colorSelectionGrid.selectedColor, accountNameInput.input.icon.emoji) errMessage = RootStore.addWatchOnlyAccount(advancedSelection.expandableItem.watchAddress, accountNameInput.text, colorSelectionGrid.selectedColor, accountNameInput.input.icon.emoji)
break break
} }
} else { } else {
errMessage = RootStore.generateNewAccount(passwordInput.text, accountNameInput.text, colorSelectionGrid.selectedColor, accountNameInput.input.icon.emoji) errMessage = RootStore.generateNewAccount(passwordInput.text, accountNameInput.text, colorSelectionGrid.selectedColor, emoji)
} }
loading = false loading = false