-
Notifications
You must be signed in to change notification settings - Fork 86
feat(backup): add SettingsLine in SyncingView to change backup path #18209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/local-backup-popup
Are you sure you want to change the base?
Conversation
Jenkins BuildsClick to see older builds (11)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one minor thing
ca91432
to
033f0fe
Compare
7265e0e
to
b2bec06
Compare
033f0fe
to
8123023
Compare
b2bec06
to
c88fd91
Compare
8123023
to
330ecf1
Compare
c88fd91
to
6e49a3d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here some comments! :)
@@ -21,6 +21,14 @@ QtObject { | |||
// Backup import properties | |||
readonly property int backupImportState: syncModule ? syncModule.backupImportState : 0 | |||
readonly property string backupImportError: syncModule ? syncModule.backupImportError : "" | |||
readonly property string backupPath: appSettings.backupPath | |||
function setBackupPath(path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we have this pattern used in lots of stores right now but I would opt to start thinking on treating the Context Properties
this way: "Public Read, Private Write", enforcing unidirectional data flow via:
- Stores expose read-only state (readonly property)
- Explicit mutation methods (setSomething())
@@ -21,6 +21,14 @@ QtObject { | |||
// Backup import properties | |||
readonly property int backupImportState: syncModule ? syncModule.backupImportState : 0 | |||
readonly property string backupImportError: syncModule ? syncModule.backupImportError : "" | |||
readonly property string backupPath: appSettings.backupPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also another comment here regarding this pattern: I would avoid accessing directly to a Context Property
since it can have performance penalties bc of needed lookups when accessing it. Instead, it's better to create a new and "private / internal" property and access it via a reference. Here my suggestion (indeed we use this pattern in other stores but still not consistently):
QtObject {
id: d
readonly property var appSettingsInst: appSettings
}
readonly property string backupPath: d.appSettingsInst.backupPath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, this pattern gives us clearer ownership and cleaner boundaries too! :)
} | ||
|
||
function toFileUri(path) { | ||
return globalUtils.toFileUri(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same reasoning than with appSettings
applies here.
anchors.leftMargin: 0 | ||
anchors.rightMargin: 0 | ||
text: qsTr("Directory of the local backup files") | ||
currentValue: root.devicesStore.backupPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would opt for declaring a new property backupPath
and avoid accessing directly from the store
here.
The idea is moving up the stores as much as possible and explicitly pass the needed data to the needed components, making an explicit api for each component and reducing passing unecessary data up / down.
id: backupPathDialog | ||
|
||
title: qsTr("Select your backup directory") | ||
currentFolder:root.devicesStore.toFileUri(root.devicesStore.backupPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same reasoning here related to the deviceStore
access.
|
||
title: qsTr("Select your backup directory") | ||
currentFolder:root.devicesStore.toFileUri(root.devicesStore.backupPath) | ||
onAccepted: root.devicesStore.setBackupPath(backupPathDialog.selectedFolder) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here!
330ecf1
to
f79fdf2
Compare
Fixes #18128 Adds a SettingsLine above the "Backup Data" and "Import Backup" buttons that shows what is the current path for the backup and let,s the user change that path.
6e49a3d
to
f7d465f
Compare
What does the PR do
Fixes #18128
Adds a SettingsLine above the "Backup Data" and "Import Backup" buttons that shows what is the current path for the backup and let's the user change that path.
Status-go PR: status-im/status-go#6699
Affected areas
formatImagePath
tofromPathUri
because it's not just useful for imagesArchitecture compliance
My PR is consistent with this document: Status Desktop Architecture Guide
Screenshot of functionality
change-setting-path.webm
Impact on end user
Let's the user know what the path is and change it if needed
How to test
service.ext
and in Desktopexport FLAG_LOCAL_BACKUP_ENABLED=1
)Risk
Tick one:
-->