feat: Add generate account button to login screen

This commit is contained in:
emizzle 2020-05-28 14:06:57 +10:00 committed by Iuri Matias
parent 0f59529c57
commit a2e255e72c
3 changed files with 78 additions and 65 deletions

View File

@ -55,7 +55,7 @@ proc mainProc() =
var profile = profile.newController(appEvents)
engine.setRootContextProperty("profileModel", profile.variant)
appEvents.on("login") do(a: Args):
appEvents.once("login") do(a: Args):
var args = AccountArgs(a)
status_core.startMessenger()
wallet.init()
@ -68,12 +68,11 @@ proc mainProc() =
let showLogin = nodeAccounts.len > 0
engine.setRootContextProperty("showLogin", newQVariant(showLogin))
if nodeAccounts.len > 0:
login.init(nodeAccounts)
engine.setRootContextProperty("loginModel", login.variant)
else:
onboarding.init()
engine.setRootContextProperty("onboardingModel", onboarding.variant)
login.init(nodeAccounts)
engine.setRootContextProperty("loginModel", login.variant)
onboarding.init()
engine.setRootContextProperty("onboardingModel", onboarding.variant)
signalController.init()
signalController.addSubscriber(SignalType.Wallet, wallet)
@ -90,8 +89,8 @@ proc mainProc() =
chat.load(channel.name)
)
# accountsModel.appEvents.on("login") do(a: Args):
# appEvents.on("login") do(a: Args):
# accountsModel.appEvents.once("login") do(a: Args):
# appEvents.once("login") do(a: Args):
# appState.addChannel("test")
# appState.addChannel("test2")
# appState.addChannel("status")

View File

@ -9,11 +9,11 @@ SwipeView {
anchors.fill: parent
currentIndex: 0
signal loginDone(response: var)
property alias btnGenKey: btnGenKey
onCurrentItemChanged: {
currentItem.txtPassword.focus = true;
}
onCurrentItemChanged: {
currentItem.txtPassword.focus = true;
}
Item {
id: wizardStep2
@ -37,60 +37,69 @@ SwipeView {
Layout.fillWidth: true
spacing: 10
ButtonGroup {
id: accountGroup
}
Component {
id: addressViewDelegate
Item {
height: 56
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
Row {
RadioButton {
checked: index == 0 ? true : false
ButtonGroup.group: accountGroup
onClicked: {
wizardStep2.selectedIndex = index;
}
}
Column {
Image {
source: identicon
}
}
Column {
Text {
text: username
}
Text {
text: key
width: 160
elide: Text.ElideMiddle
}
}
}
}
}
ListView {
id: addressesView
contentWidth: 200
model: loginModel
delegate: addressViewDelegate
Layout.fillHeight: true
Layout.fillWidth: true
anchors.topMargin: 36
anchors.fill: parent
}
id: accountGroup
}
Component {
id: addressViewDelegate
Item {
height: 56
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
Row {
RadioButton {
checked: index == 0 ? true : false
ButtonGroup.group: accountGroup
onClicked: {
wizardStep2.selectedIndex = index;
}
}
Column {
Image {
source: identicon
}
}
Column {
Text {
text: username
}
Text {
text: key
width: 160
elide: Text.ElideMiddle
}
}
}
}
}
ListView {
id: addressesView
contentWidth: 200
model: loginModel
delegate: addressViewDelegate
Layout.fillHeight: true
Layout.fillWidth: true
anchors.topMargin: 36
anchors.fill: parent
}
}
Button {
id: btnGenKey
text: "Generate new account"
anchors.left: parent.left
anchors.leftMargin: 20
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
}
Button {
text: "Select"
anchors.horizontalCenter: parent.horizontalCenter

View File

@ -73,6 +73,11 @@ Page {
return !resp.error
}
}
DSM.SignalTransition {
targetState: genKeyState
signal: login.btnGenKey.clicked
}
}
DSM.FinalState {