address code review
This commit is contained in:
parent
f59401a80a
commit
c1f6a0d06d
|
@ -4,7 +4,6 @@ import ../status/libstatus
|
||||||
import ../status/accounts as status_accounts
|
import ../status/accounts as status_accounts
|
||||||
import ../status/utils
|
import ../status/utils
|
||||||
import ../status/utils
|
import ../status/utils
|
||||||
# import "../../status/core" as status
|
|
||||||
|
|
||||||
type
|
type
|
||||||
GeneratedAccount* = object
|
GeneratedAccount* = object
|
||||||
|
@ -35,7 +34,7 @@ proc delete*(self: AccountModel) =
|
||||||
discard
|
discard
|
||||||
|
|
||||||
proc generateAddresses*(self: AccountModel): seq[GeneratedAccount] =
|
proc generateAddresses*(self: AccountModel): seq[GeneratedAccount] =
|
||||||
let accounts = parseJson(status_accounts.generateAddresses())
|
let accounts = status_accounts.generateAddresses().parseJson
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
var generatedAccount = GeneratedAccount()
|
var generatedAccount = GeneratedAccount()
|
||||||
|
|
||||||
|
@ -46,8 +45,8 @@ proc generateAddresses*(self: AccountModel): seq[GeneratedAccount] =
|
||||||
generatedAccount.mnemonic = account["mnemonic"].str
|
generatedAccount.mnemonic = account["mnemonic"].str
|
||||||
generatedAccount.derived = account["derived"]
|
generatedAccount.derived = account["derived"]
|
||||||
|
|
||||||
generatedAccount.username = $libstatus.generateAlias(account["publicKey"].str.toGoString)
|
generatedAccount.username = status_accounts.generateAlias(account["publicKey"].str)
|
||||||
generatedAccount.identicon = $libstatus.identicon(account["publicKey"].str.toGoString)
|
generatedAccount.identicon = status_accounts.generateIdenticon(account["publicKey"].str)
|
||||||
generatedAccount.key = account["address"].str
|
generatedAccount.key = account["address"].str
|
||||||
|
|
||||||
self.generatedAddresses.add(generatedAccount)
|
self.generatedAddresses.add(generatedAccount)
|
||||||
|
|
|
@ -31,6 +31,9 @@ proc generateAddresses*(): string =
|
||||||
proc generateAlias*(publicKey: string): string =
|
proc generateAlias*(publicKey: string): string =
|
||||||
result = $libstatus.generateAlias(publicKey.toGoString)
|
result = $libstatus.generateAlias(publicKey.toGoString)
|
||||||
|
|
||||||
|
proc generateIdenticon*(publicKey: string): string =
|
||||||
|
result = $libstatus.identicon(publicKey.toGoString)
|
||||||
|
|
||||||
proc ensureDir(dirname: string) =
|
proc ensureDir(dirname: string) =
|
||||||
if not existsDir(dirname):
|
if not existsDir(dirname):
|
||||||
# removeDir(dirname)
|
# removeDir(dirname)
|
||||||
|
|
|
@ -9,9 +9,6 @@ SwipeView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
currentIndex: 0
|
currentIndex: 0
|
||||||
|
|
||||||
// property string strGeneratedAccounts: onboardingLogic.generatedAddresses
|
|
||||||
// property var generatedAccounts: {}
|
|
||||||
// signal storeAccountAndLoginResult(response: var)
|
|
||||||
signal loginDone()
|
signal loginDone()
|
||||||
|
|
||||||
onCurrentItemChanged: {
|
onCurrentItemChanged: {
|
||||||
|
@ -50,44 +47,13 @@ SwipeView {
|
||||||
Component {
|
Component {
|
||||||
id: addressViewDelegate
|
id: addressViewDelegate
|
||||||
|
|
||||||
// Item {
|
|
||||||
// id: addressViewContainer
|
|
||||||
// height: 56
|
|
||||||
// anchors.right: parent.right
|
|
||||||
// anchors.rightMargin: 0
|
|
||||||
// anchors.left: parent.left
|
|
||||||
// anchors.leftMargin: 0
|
|
||||||
|
|
||||||
// Text {
|
|
||||||
// text: "address"
|
|
||||||
// font.pointSize: 24
|
|
||||||
// anchors.verticalCenter: parent.verticalCenter
|
|
||||||
// font.pixelSize: 14
|
|
||||||
// font.strikeout: false
|
|
||||||
// anchors.left: parent.left
|
|
||||||
// anchors.leftMargin: 72
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
height: 56
|
height: 56
|
||||||
// anchors.leftMargin: 20
|
|
||||||
// anchors.rightMargin: 20
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 0
|
anchors.rightMargin: 0
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 0
|
anchors.leftMargin: 0
|
||||||
|
|
||||||
// Text {
|
|
||||||
// id: keyValue
|
|
||||||
// text: key
|
|
||||||
// anchors.verticalCenter: parent.verticalCenter
|
|
||||||
// font.pixelSize: 14
|
|
||||||
// font.strikeout: false
|
|
||||||
// anchors.left: parent.left
|
|
||||||
// anchors.leftMargin: 72
|
|
||||||
// }
|
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
RadioButton {
|
RadioButton {
|
||||||
// checked: index == 0 ? true : false
|
// checked: index == 0 ? true : false
|
||||||
|
@ -100,7 +66,6 @@ SwipeView {
|
||||||
Column {
|
Column {
|
||||||
Image {
|
Image {
|
||||||
source: identicon
|
source: identicon
|
||||||
// source: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAF0lEQVR42mPk+c9Qz0ACYBzVMKoBOwAA3IgShVgwlIUAAAAASUVORK5CYII="
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Column {
|
Column {
|
||||||
|
@ -250,15 +215,9 @@ SwipeView {
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedAccountIndex = wizardStep2.selectedIndex
|
const selectedAccountIndex = wizardStep2.selectedIndex
|
||||||
|
|
||||||
const storeResponse = onboardingModel.storeAccountAndLogin(selectedAccountIndex, txtPassword.text)
|
const storeResponse = onboardingModel.storeAccountAndLogin(selectedAccountIndex, txtPassword.text)
|
||||||
|
|
||||||
// const response = JSON.parse(storeResponse);
|
swipeView.loginDone();
|
||||||
// if (response.error) {
|
|
||||||
// storeAccountAndLoginError.text += response.error;
|
|
||||||
// return storeAccountAndLoginError.open();
|
|
||||||
// }
|
|
||||||
swipeView.loginDone();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue