nextcloud / nextcloud/android

Add Export/Import Functionality for User Configuration

Open
#15,542 1 comment 3 reactions 2 assignees Claimed by @alperozturk96 View on GitHub
enhancement
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### How to use GitHub

* Please use the 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to show that you are interested into the same feature.
* Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
* Subscribe to receive notifications on status change and new comments.

**Is your feature request related to a problem? Please describe.**

Currently, there is no way for users to export or import their configuration, including auto-upload folder settings, two-way-sync folders, user preferences, and other personalized settings. This makes it difficult to migrate settings across devices or for testing purposes.

Imagine you purchase a new device and want to transfer your exact app configuration from your old device, especially for settings that are not stored on the server. Alternatively, as a user, you may want to test a new QA APK without having to manually reconfigure it.

**Describe the solution you'd like**

Implement a two-way export/import mechanism for user configurations and preferences. This should include:

Auto-upload folder configurations
User preferences (global pause state, two-way-sync configs, gridMode, theme)
Other relevant configuration data

**Technical Details:**

Use JSON for export and import.
Consider versioning the JSON structure to handle future changes without breaking backward compatibility. Include a "version" field at the top level of the exported JSON.

Data format:

```
{
"version": "1.0",
"userPreferences": {
"lastDisplayedAccountName": "john.doe@example.com",
"theme": "dark",
"gridMode": true
},
"autoUploadFolders": [
{
"folderName": "FolderA",
"path": "/storage/emulated/0/FolderA"
},
{
"folderName": "FolderB",
"path": "/storage/emulated/0/FolderB"
},
{
"folderName": "FolderC",
"path": "/storage/emulated/0/FolderC"
}
],
"twoWaySync": {
"enabled": true,
"lastSyncTimestamp": 1694010000000
}
}
```

Implementation:

Export: Serialize user settings into a JSON object and save it as a file.
Import: Parse the JSON file, validate its version, and update user settings accordingly.
Use `kotlinx.serialization`

Backward Compatibility:

When adding new settings in the future, maintain default values if the imported JSON does not contain them.
Validate JSON schema to ensure corrupted or partially-complete files don’t break the app.

@tobiasKaminsky @jancborchardt

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.