Skip to content

Commit

Permalink
Remove WelcomeScreen and refactor login functionality.
Browse files Browse the repository at this point in the history
- Removed Presentation.Welcome from futr.cabal and refactored login handling to KeyMgmt.
- Deleted WelcomeScreen from QML resources and adjusted KeyMgmtScreen for account handling.
- Moved welcome-related logic, such as seed phrase generation and account imports, to KeyMgmt context.
  • Loading branch information
prolic committed Aug 22, 2024
1 parent 5592064 commit f0b1d6e
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 413 deletions.
1 change: 0 additions & 1 deletion futr.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ executable futr
Nostr.Profile
Nostr.Relay
Presentation.KeyMgmt
Presentation.Welcome
Types

default-language: Haskell2010
Expand Down
6 changes: 0 additions & 6 deletions resources/qml/content/App.qml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ ApplicationWindow {
visible: currentScreen == "KeyMgmt"
}

WelcomeScreen {
anchors.margins: 10
anchors.fill: parent
visible: currentScreen == "Welcome"
}

HomeScreen {
anchors.margins: 10
anchors.fill: parent
Expand Down
31 changes: 19 additions & 12 deletions resources/qml/content/KeyMgmtScreen.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Rectangle {
onExited: parent.parent.parent.mouseHover = false

onClicked: {
ctxKeyMgmt.selectAccount(modelData.npub)
login(modelData.npub)
}
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ Rectangle {
onExited: parent.parent.parent.mouseHover = false

onClicked: {
ctxKeyMgmt.selectAccount(modelData.npub)
login(modelData.npub)
}
}
}
Expand Down Expand Up @@ -191,7 +191,7 @@ Rectangle {
Layout.rightMargin: 30

onClicked: function () {
ctxWelcome.generateSeedphrase()
ctxKeyMgmt.generateSeedphrase()
keysGeneratedDialog.visible = true
}
}
Expand Down Expand Up @@ -250,15 +250,15 @@ Rectangle {
id: radionsec
checked: true
Layout.alignment: Qt.AlignLeft
onClicked: ctxWelcome.errorMsg = ""
onClicked: ctxKeyMgmt.errorMsg = ""
}

RadioButton {
text: qsTr("Import from seedphrase")
id: radioseedphrase
checked: false
Layout.alignment: Qt.AlignRight
onClicked: ctxWelcome.errorMsg = ""
onClicked: ctxKeyMgmt.errorMsg = ""
}
}

Expand Down Expand Up @@ -288,7 +288,7 @@ Rectangle {

Text {
id: errorMessage
text: ctxWelcome.errorMsg
text: ctxKeyMgmt.errorMsg
color: "red"
visible: errorMessage != ""
Layout.alignment: Qt.AlignLeft
Expand All @@ -312,10 +312,17 @@ Rectangle {
target: importbutton
onClicked: function () {
if (radionsec.checked) {
ctxWelcome.importSecretKey(secretkey.text)
var res = ctxKeyMgmt.importSecretKey(secretkey.text);
if (res !== null) {
login(res)
importAccountDialog.visible = false
}
} else if (radioseedphrase.checked) {
ctxWelcome.importSeedphrase(seedphrase.text,
password.text)
var res = ctxKeyMgmt.importSeedphrase(seedphrase.text, password.text)
if (res !== null) {
login(res)
importAccountDialog.visible = false
}
}
}
}
Expand Down Expand Up @@ -386,7 +393,7 @@ Rectangle {

TextArea {
id: seedPhraseText
text: ctxWelcome.seedphrase
text: ctxKeyMgmt.seedphrase
Layout.fillWidth: true
font: Constants.font
readOnly: true
Expand Down Expand Up @@ -427,7 +434,7 @@ Rectangle {

TextArea {
id: privateKeyText
text: ctxWelcome.nsec
text: ctxKeyMgmt.nsec
Layout.fillWidth: true
readOnly: true
wrapMode: Text.Wrap
Expand Down Expand Up @@ -467,7 +474,7 @@ Rectangle {

TextArea {
id: publicKeyText
text: ctxWelcome.npub
text: ctxKeyMgmt.npub
Layout.fillWidth: true
readOnly: true
wrapMode: Text.Wrap
Expand Down
224 changes: 0 additions & 224 deletions resources/qml/content/WelcomeScreen.ui.qml

This file was deleted.

4 changes: 1 addition & 3 deletions resources/qml/content/qmldir
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
module content
App 1.0 App.qml
HomeScreen 1.0 HomeScreen.ui.qml
KeysGeneratedScreen 1.0 KeysGeneratedScreen.ui.qml
KeyMgmtScreen 1.0 KeyMgmtScreen.ui.qml
WelcomeScreen 1.0 WelcomeScreen.ui.qml
KeyMgmtScreen 1.0 KeyMgmtScreen.ui.qml
Loading

0 comments on commit f0b1d6e

Please sign in to comment.