address code review

This commit is contained in:
Iuri Matias 2020-05-21 17:41:27 -04:00
parent f59401a80a
commit c1f6a0d06d
3 changed files with 7 additions and 46 deletions

View File

@ -4,7 +4,6 @@ import ../status/libstatus
import ../status/accounts as status_accounts
import ../status/utils
import ../status/utils
# import "../../status/core" as status
type
GeneratedAccount* = object
@ -35,7 +34,7 @@ proc delete*(self: AccountModel) =
discard
proc generateAddresses*(self: AccountModel): seq[GeneratedAccount] =
let accounts = parseJson(status_accounts.generateAddresses())
let accounts = status_accounts.generateAddresses().parseJson
for account in accounts:
var generatedAccount = GeneratedAccount()
@ -46,8 +45,8 @@ proc generateAddresses*(self: AccountModel): seq[GeneratedAccount] =
generatedAccount.mnemonic = account["mnemonic"].str
generatedAccount.derived = account["derived"]
generatedAccount.username = $libstatus.generateAlias(account["publicKey"].str.toGoString)
generatedAccount.identicon = $libstatus.identicon(account["publicKey"].str.toGoString)
generatedAccount.username = status_accounts.generateAlias(account["publicKey"].str)
generatedAccount.identicon = status_accounts.generateIdenticon(account["publicKey"].str)
generatedAccount.key = account["address"].str
self.generatedAddresses.add(generatedAccount)

View File

@ -31,6 +31,9 @@ proc generateAddresses*(): string =
proc generateAlias*(publicKey: string): string =
result = $libstatus.generateAlias(publicKey.toGoString)
proc generateIdenticon*(publicKey: string): string =
result = $libstatus.identicon(publicKey.toGoString)
proc ensureDir(dirname: string) =
if not existsDir(dirname):
# removeDir(dirname)

View File

@ -9,9 +9,6 @@ SwipeView {
anchors.fill: parent
currentIndex: 0
// property string strGeneratedAccounts: onboardingLogic.generatedAddresses
// property var generatedAccounts: {}
// signal storeAccountAndLoginResult(response: var)
signal loginDone()
onCurrentItemChanged: {
@ -50,44 +47,13 @@ SwipeView {
Component {
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 {
height: 56
// anchors.leftMargin: 20
// anchors.rightMargin: 20
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
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 {
RadioButton {
// checked: index == 0 ? true : false
@ -100,7 +66,6 @@ SwipeView {
Column {
Image {
source: identicon
// source: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAF0lEQVR42mPk+c9Qz0ACYBzVMKoBOwAA3IgShVgwlIUAAAAASUVORK5CYII="
}
}
Column {
@ -250,14 +215,8 @@ SwipeView {
}
const selectedAccountIndex = wizardStep2.selectedIndex
const storeResponse = onboardingModel.storeAccountAndLogin(selectedAccountIndex, txtPassword.text)
// const response = JSON.parse(storeResponse);
// if (response.error) {
// storeAccountAndLoginError.text += response.error;
// return storeAccountAndLoginError.open();
// }
swipeView.loginDone();
}
}