fix(@desktop/wallet): 18 words seed option is missing when adding an account in wallet
Fixes #5445
This commit is contained in:
parent
b9c65be808
commit
4403fde4ca
|
@ -56,8 +56,7 @@ GridView {
|
||||||
property int seedPhraseInputWidth: 220
|
property int seedPhraseInputWidth: 220
|
||||||
property var mnemonicInput: []
|
property var mnemonicInput: []
|
||||||
property string errorString: ""
|
property string errorString: ""
|
||||||
readonly property int twelveWordsModel: 12
|
readonly property var seedPhraseWordsOptions: ([12, 18, 24])
|
||||||
readonly property int twentyFourWordsModel: 24
|
|
||||||
|
|
||||||
function getSeedPhraseString() {
|
function getSeedPhraseString() {
|
||||||
var seedPhrase = ""
|
var seedPhrase = ""
|
||||||
|
@ -75,8 +74,6 @@ GridView {
|
||||||
interactive: false
|
interactive: false
|
||||||
z: 100000
|
z: 100000
|
||||||
|
|
||||||
model: _internal.twelveWordsModel
|
|
||||||
|
|
||||||
onModelChanged: {
|
onModelChanged: {
|
||||||
mnemonicString = "";
|
mnemonicString = "";
|
||||||
let menmonicInputTemp = _internal.mnemonicInput.filter(function(value) {
|
let menmonicInputTemp = _internal.mnemonicInput.filter(function(value) {
|
||||||
|
@ -111,14 +108,12 @@ GridView {
|
||||||
let words = clipboardText.split(/[, \s]+/)
|
let words = clipboardText.split(/[, \s]+/)
|
||||||
|
|
||||||
let timeout = 0
|
let timeout = 0
|
||||||
if ((grid.model === _internal.twelveWordsModel && words.length === _internal.twentyFourWordsModel) ||
|
let indexOfWordsOption = _internal.seedPhraseWordsOptions.indexOf(words.length)
|
||||||
(grid.model === _internal.twentyFourWordsModel && words.length === _internal.twelveWordsModel)) {
|
if(indexOfWordsOption == -1) {
|
||||||
footerItem.pressButton()
|
|
||||||
// Set the teimeout to 100 so the grid has time to generate the new items
|
|
||||||
timeout = 100
|
|
||||||
} else if (words.length !== _internal.twentyFourWordsModel && words.length !== _internal.twelveWordsModel) {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
footerItem.switchToIndex(indexOfWordsOption)
|
||||||
|
timeout = 100
|
||||||
|
|
||||||
timer.setTimeout(function(){
|
timer.setTimeout(function(){
|
||||||
_internal.mnemonicInput = []
|
_internal.mnemonicInput = []
|
||||||
|
@ -232,12 +227,12 @@ GridView {
|
||||||
footer: Item {
|
footer: Item {
|
||||||
id: footerC
|
id: footerC
|
||||||
|
|
||||||
function pressButton() {
|
function switchToIndex(index) {
|
||||||
changeSeedNbWordsBtn.clicked(null)
|
changeSeedNbWordsTabBar.currentIndex = index
|
||||||
}
|
}
|
||||||
|
|
||||||
width: grid.width - Style.current.padding
|
width: grid.width - Style.current.padding
|
||||||
height: changeSeedNbWordsBtn.height + errorMessage.height + Style.current.padding*2
|
height: changeSeedNbWordsTabBar.height + errorMessage.height + Style.current.padding*2
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
id: errorMessage
|
id: errorMessage
|
||||||
|
|
||||||
|
@ -255,21 +250,20 @@ GridView {
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
StatusButton {
|
StatusSwitchTabBar {
|
||||||
id: changeSeedNbWordsBtn
|
id: changeSeedNbWordsTabBar
|
||||||
anchors.top: errorMessage.bottom
|
anchors.top: errorMessage.bottom
|
||||||
anchors.topMargin: Style.current.padding
|
anchors.topMargin: Style.current.padding
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
text: grid.model === _internal.twelveWordsModel ? qsTr("Use 24 word seed phrase"):
|
Repeater {
|
||||||
qsTr("Use 12 word seed phrase")
|
model: _internal.seedPhraseWordsOptions
|
||||||
onClicked: {
|
StatusSwitchTabButton {
|
||||||
if(grid.model === _internal.twelveWordsModel) {
|
text: qsTr("%1 words").arg(modelData)
|
||||||
grid.model = _internal.twentyFourWordsModel
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
grid.model = _internal.twelveWordsModel
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onCurrentIndexChanged: {
|
||||||
|
grid.model = _internal.seedPhraseWordsOptions[changeSeedNbWordsTabBar.currentIndex]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue