2021-10-12 18:26:02 +00:00
|
|
|
pragma Singleton
|
|
|
|
|
|
|
|
import QtQuick 2.13
|
2022-03-07 22:59:38 +00:00
|
|
|
import utils 1.0
|
2021-10-12 18:26:02 +00:00
|
|
|
|
|
|
|
QtObject {
|
2022-03-07 22:59:38 +00:00
|
|
|
id: root
|
|
|
|
property var profileSectionModuleInst: profileSectionModule
|
|
|
|
property var profileModule: profileSectionModuleInst.profileModule
|
|
|
|
property var onboardingModuleInst: onboardingModule
|
|
|
|
property var mainModuleInst: !!mainModule ? mainModule : undefined
|
|
|
|
property var accountSettings: localAccountSettings
|
|
|
|
property var privacyModule: profileSectionModuleInst.privacyModule
|
|
|
|
property string displayName: userProfile !== undefined ? userProfile.displayName : ""
|
|
|
|
|
|
|
|
property url profImgUrl: ""
|
|
|
|
property real profImgAX: 0.0
|
|
|
|
property real profImgAY: 0.0
|
|
|
|
property real profImgBX: 0.0
|
|
|
|
property real profImgBY: 0.0
|
|
|
|
property bool accountCreated: false
|
|
|
|
|
|
|
|
property bool showBeforeGetStartedPopup: true
|
2021-10-12 18:26:02 +00:00
|
|
|
|
2022-04-06 11:12:11 +00:00
|
|
|
function generateImage(source, aX, aY, bX, bY) {
|
|
|
|
return onboardingModuleInst.generateImage(source, aX, aY, bX, bY)
|
|
|
|
}
|
|
|
|
|
2021-10-12 18:26:02 +00:00
|
|
|
function importMnemonic(mnemonic) {
|
2022-03-07 22:59:38 +00:00
|
|
|
onboardingModuleInst.importMnemonic(mnemonic)
|
2021-10-12 18:26:02 +00:00
|
|
|
}
|
|
|
|
|
2022-03-15 22:27:36 +00:00
|
|
|
function setCurrentAccountAndDisplayName(displayName) {
|
|
|
|
onboardingModuleInst.setDisplayName(displayName);
|
|
|
|
if (!onboardingModuleInst.importedAccountPubKey) {
|
|
|
|
onboardingModuleInst.setSelectedAccountByIndex(0);
|
|
|
|
}
|
2022-03-29 19:15:42 +00:00
|
|
|
}
|
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
function updatedDisplayName(displayName) {
|
|
|
|
if (displayName !== root.displayName) {
|
|
|
|
print(displayName, root.displayName)
|
|
|
|
root.profileModule.setDisplayName(displayName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function saveImage() {
|
|
|
|
root.profileModule.upload(root.profImgUrl, root.profImgAX, root.profImgAY, root.profImgBX, root.profImgBY);
|
|
|
|
}
|
|
|
|
|
2022-04-14 10:10:08 +00:00
|
|
|
function setImageProps(source, aX, aY, bX, bY) {
|
2022-03-07 22:59:38 +00:00
|
|
|
root.profImgUrl = source;
|
|
|
|
root.profImgAX = aX;
|
|
|
|
root.profImgAY = aY;
|
|
|
|
root.profImgBX = bX;
|
|
|
|
root.profImgBY = bY;
|
2022-04-14 10:10:08 +00:00
|
|
|
}
|
2022-04-06 11:12:11 +00:00
|
|
|
|
2022-04-14 10:10:08 +00:00
|
|
|
function clearImageProps() {
|
|
|
|
root.profImgUrl = "";
|
|
|
|
root.profImgAX = 0.0;
|
|
|
|
root.profImgAY = 0.0;
|
|
|
|
root.profImgBX = 0.0;
|
|
|
|
root.profImgBY = 0.0;
|
2022-03-07 22:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function removeImage() {
|
|
|
|
return root.profileModule.remove();
|
|
|
|
}
|
|
|
|
|
|
|
|
function finishCreatingAccount(pass) {
|
|
|
|
root.onboardingModuleInst.storeSelectedAccountAndLogin(pass);
|
|
|
|
}
|
|
|
|
|
|
|
|
function storeToKeyChain(pass) {
|
|
|
|
mainModule.storePassword(pass);
|
2021-10-12 18:26:02 +00:00
|
|
|
}
|
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
function changePassword(password, newPassword) {
|
2022-03-15 22:27:36 +00:00
|
|
|
root.privacyModule.changePassword(password, newPassword);
|
|
|
|
}
|
|
|
|
|
|
|
|
function validateMnemonic(text) {
|
2022-04-04 20:13:07 +00:00
|
|
|
return root.onboardingModuleInst.validateMnemonic(text);
|
2022-03-22 09:29:59 +00:00
|
|
|
}
|
|
|
|
|
2021-10-12 18:26:02 +00:00
|
|
|
property ListModel accountsSampleData: ListModel {
|
|
|
|
ListElement {
|
|
|
|
username: "Ferocious Herringbone Sinewave2"
|
|
|
|
address: "0x123456789009876543211234567890"
|
|
|
|
}
|
|
|
|
ListElement {
|
|
|
|
username: "Another Account"
|
|
|
|
address: "0x123456789009876543211234567890"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|