Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/app/global/local_account_sensitive_settings.nim
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@ QtObject:
proc getLocalBackupChosenPath*(self: LocalAccountSensitiveSettings): string {.slot.} =
let setting = self.getLocalBackupChosenPathSetting()
if setting == "":
when defined(android):
# Return an empty string to make it clear to users that without permissisons we cannot access any path
return ""
return DEFAULT_BACKUP_DIR

return setting
Expand Down
1 change: 0 additions & 1 deletion src/app_service/service/devices/service.nim
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ QtObject:

let backupPath = singletonInstance.localAccountSensitiveSettings.getLocalBackupChosenPath()


if backupPath.len == 0 or not backupPath.startsWith("content://"):
raise newException(CatchableError, "invalid backup path for SAF copy")

Expand Down
3 changes: 3 additions & 0 deletions src/app_service/service/settings/service.nim
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ QtObject:
# New local setting needs to be initialized from old setting value
# TODO remove this migration in 2.37 (one release cycle interval)
proc migrateBackupPath*(self: Service) =
when defined(android):
# On Android we cannot use arbitrary paths without requesting storage permissions
return
if singletonInstance.localAccountSensitiveSettings.getLocalBackupChosenPathSetting().len == 0 and self.settings.backupPath.len > 0:
singletonInstance.localAccountSensitiveSettings.setLocalBackupChosenPath(self.settings.backupPath)

Expand Down
Binary file added ui/StatusQ/src/assets/png/backup-popup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui/StatusQ/src/assets/png/png.qrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/assets/png">
<file>backup-popup.png</file>
<file>browser/[email protected]</file>
<file>browser/pepehand.png</file>
<file>community/airdrops8_1.png</file>
Expand Down
7 changes: 6 additions & 1 deletion ui/app/AppLayouts/Profile/stores/DevicesStore.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ QtObject {
readonly property int backupDataState: syncModule ? syncModule.backupDataState : 0
readonly property string backupImportError: syncModule ? syncModule.backupImportError : ""
readonly property string backupDataError: syncModule ? syncModule.backupDataError : ""
readonly property url backupPath: toFileUri(d.localAccountSensitiveSettingsInst.localBackupChosenPath)
readonly property url backupPath: {
if (!d.localAccountSensitiveSettingsInst.localBackupChosenPath) {
return ""
}
return toFileUri(d.localAccountSensitiveSettingsInst.localBackupChosenPath)
}
readonly property bool messagesBackupEnabled: d.appSettingsInst.messagesBackupEnabled

readonly property QtObject _d: StatusQUtils.QObject {
Expand Down
11 changes: 9 additions & 2 deletions ui/app/AppLayouts/Profile/views/BackupView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import QtQuick.Controls
import QtQuick.Layouts

import StatusQ
import StatusQ.Core
import StatusQ.Controls
import StatusQ.Core
import StatusQ.Core.Theme
import StatusQ.Core.Utils as SQUtils
import StatusQ.Popups.Dialog

import utils
Expand Down Expand Up @@ -132,7 +133,13 @@ SettingsContentBase {
Layout.fillWidth: true
Layout.leftMargin: Theme.padding
wrapMode: Text.Wrap
text: qsTr("Choose a folder to store your backup files or use the default one.")
text: {
if (SQUtils.Utils.isAndroid) {
// We cannot use arbitrary paths on Android without requesting storage permissions
return qsTr("Choose a folder to store your backup files in.")
}
return qsTr("Choose a folder to store your backup files or use the default one.")
}
color: Theme.palette.baseColor1
}

Expand Down
20 changes: 18 additions & 2 deletions ui/i18n/qml_base_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2475,6 +2475,10 @@ To backup you recovery phrase, write it down and store it securely in a safe pla
<source>Backups are automatic (every 30 mins), secure (encrypted with your profile private key), and private (your data is stored &lt;b&gt;only&lt;/b&gt; on your device).</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose a folder to store your backup files in.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BalanceExceeded</name>
Expand Down Expand Up @@ -6753,11 +6757,23 @@ Remember your password and don&apos;t share it with anyone.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>On-device backups are:&lt;br&gt;Automatic – every 30 minutes&lt;br&gt;Secure – encrypted with your profile private key&lt;br&gt;Private – stored only on your device</source>
<source>Backups let you restore your 1-on-1, group, and community messages if you need to reinstall the app or switch devices. You can skip this step now and enable it anytime under: &lt;i&gt;Settings &gt; On-device backup &gt; Backup data&lt;/i&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Backups let you restore your 1-on-1, group, and community messages if you need to reinstall the app or switch devices. You can skip this step now and enable it anytime under: &lt;i&gt;Settings &gt; On-device backup &gt; Backup data&lt;/i&gt;</source>
<source>Enable on-device backup?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>On-device backups are:&lt;br&gt;&lt;b&gt;Automatic&lt;/b&gt; – created every 30 minutes&lt;br&gt;&lt;b&gt;Secure&lt;/b&gt; – encrypted with your profile’s private key&lt;br&gt;&lt;b&gt;Private&lt;/b&gt; – stored only on your device</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>To enable backups, choose a folder to store your backup files under the &lt;b&gt;Backup location&lt;/b&gt; setting.&lt;br&gt;&lt;br&gt;You can also &lt;b&gt;optionally&lt;/b&gt; back up your &lt;b&gt;1-on-1, group, and community messages&lt;/b&gt; by turning on the &lt;b&gt;Backup your messages&lt;/b&gt; toggle under the &lt;b&gt;Backup data&lt;/b&gt; setting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Go to settings</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down
28 changes: 24 additions & 4 deletions ui/i18n/qml_base_lokalise_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3035,6 +3035,11 @@
<comment>BackupView</comment>
<translation>Backups are automatic (every 30 mins), secure (encrypted with your profile private key), and private (your data is stored &lt;b&gt;only&lt;/b&gt; on your device).</translation>
</message>
<message>
<source>Choose a folder to store your backup files in.</source>
<comment>BackupView</comment>
<translation>Choose a folder to store your backup files in.</translation>
</message>
</context>
<context>
<name>BalanceExceeded</name>
Expand Down Expand Up @@ -8246,14 +8251,29 @@
<translation>Enable on-device message backup?</translation>
</message>
<message>
<source>On-device backups are:&lt;br&gt;Automatic – every 30 minutes&lt;br&gt;Secure – encrypted with your profile private key&lt;br&gt;Private – stored only on your device</source>
<source>Backups let you restore your 1-on-1, group, and community messages if you need to reinstall the app or switch devices. You can skip this step now and enable it anytime under: &lt;i&gt;Settings &gt; On-device backup &gt; Backup data&lt;/i&gt;</source>
<comment>EnableMessageBackupPopup</comment>
<translation>On-device backups are:&lt;br&gt;Automatic – every 30 minutes&lt;br&gt;Secure – encrypted with your profile private key&lt;br&gt;Private – stored only on your device</translation>
<translation>Backups let you restore your 1-on-1, group, and community messages if you need to reinstall the app or switch devices. You can skip this step now and enable it anytime under: &lt;i&gt;Settings &gt; On-device backup &gt; Backup data&lt;/i&gt;</translation>
</message>
<message>
<source>Backups let you restore your 1-on-1, group, and community messages if you need to reinstall the app or switch devices. You can skip this step now and enable it anytime under: &lt;i&gt;Settings &gt; On-device backup &gt; Backup data&lt;/i&gt;</source>
<source>Enable on-device backup?</source>
<comment>EnableMessageBackupPopup</comment>
<translation>Backups let you restore your 1-on-1, group, and community messages if you need to reinstall the app or switch devices. You can skip this step now and enable it anytime under: &lt;i&gt;Settings &gt; On-device backup &gt; Backup data&lt;/i&gt;</translation>
<translation>Enable on-device backup?</translation>
</message>
<message>
<source>On-device backups are:&lt;br&gt;&lt;b&gt;Automatic&lt;/b&gt; – created every 30 minutes&lt;br&gt;&lt;b&gt;Secure&lt;/b&gt; – encrypted with your profile’s private key&lt;br&gt;&lt;b&gt;Private&lt;/b&gt; – stored only on your device</source>
<comment>EnableMessageBackupPopup</comment>
<translation>On-device backups are:&lt;br&gt;&lt;b&gt;Automatic&lt;/b&gt; – created every 30 minutes&lt;br&gt;&lt;b&gt;Secure&lt;/b&gt; – encrypted with your profile’s private key&lt;br&gt;&lt;b&gt;Private&lt;/b&gt; – stored only on your device</translation>
</message>
<message>
<source>To enable backups, choose a folder to store your backup files under the &lt;b&gt;Backup location&lt;/b&gt; setting.&lt;br&gt;&lt;br&gt;You can also &lt;b&gt;optionally&lt;/b&gt; back up your &lt;b&gt;1-on-1, group, and community messages&lt;/b&gt; by turning on the &lt;b&gt;Backup your messages&lt;/b&gt; toggle under the &lt;b&gt;Backup data&lt;/b&gt; setting.</source>
<comment>EnableMessageBackupPopup</comment>
<translation>To enable backups, choose a folder to store your backup files under the &lt;b&gt;Backup location&lt;/b&gt; setting.&lt;br&gt;&lt;br&gt;You can also &lt;b&gt;optionally&lt;/b&gt; back up your &lt;b&gt;1-on-1, group, and community messages&lt;/b&gt; by turning on the &lt;b&gt;Backup your messages&lt;/b&gt; toggle under the &lt;b&gt;Backup data&lt;/b&gt; setting.</translation>
</message>
<message>
<source>Go to settings</source>
<comment>EnableMessageBackupPopup</comment>
<translation>Go to settings</translation>
</message>
</context>
<context>
Expand Down
20 changes: 18 additions & 2 deletions ui/i18n/qml_cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2482,6 +2482,10 @@ To backup you recovery phrase, write it down and store it securely in a safe pla
<source>Backups are automatic (every 30 mins), secure (encrypted with your profile private key), and private (your data is stored &lt;b&gt;only&lt;/b&gt; on your device).</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose a folder to store your backup files in.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BalanceExceeded</name>
Expand Down Expand Up @@ -6777,11 +6781,23 @@ Remember your password and don&apos;t share it with anyone.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>On-device backups are:&lt;br&gt;Automatic – every 30 minutes&lt;br&gt;Secure – encrypted with your profile private key&lt;br&gt;Private – stored only on your device</source>
<source>Backups let you restore your 1-on-1, group, and community messages if you need to reinstall the app or switch devices. You can skip this step now and enable it anytime under: &lt;i&gt;Settings &gt; On-device backup &gt; Backup data&lt;/i&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Backups let you restore your 1-on-1, group, and community messages if you need to reinstall the app or switch devices. You can skip this step now and enable it anytime under: &lt;i&gt;Settings &gt; On-device backup &gt; Backup data&lt;/i&gt;</source>
<source>Enable on-device backup?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>On-device backups are:&lt;br&gt;&lt;b&gt;Automatic&lt;/b&gt; – created every 30 minutes&lt;br&gt;&lt;b&gt;Secure&lt;/b&gt; – encrypted with your profile’s private key&lt;br&gt;&lt;b&gt;Private&lt;/b&gt; – stored only on your device</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>To enable backups, choose a folder to store your backup files under the &lt;b&gt;Backup location&lt;/b&gt; setting.&lt;br&gt;&lt;br&gt;You can also &lt;b&gt;optionally&lt;/b&gt; back up your &lt;b&gt;1-on-1, group, and community messages&lt;/b&gt; by turning on the &lt;b&gt;Backup your messages&lt;/b&gt; toggle under the &lt;b&gt;Backup data&lt;/b&gt; setting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Go to settings</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down
24 changes: 20 additions & 4 deletions ui/i18n/qml_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2478,6 +2478,10 @@ Para respaldar tu frase de recuperación, escríbela y guárdala de forma segura
<source>Supported backup formats (%1)</source>
<translation></translation>
</message>
<message>
<source>Choose a folder to store your backup files in.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BalanceExceeded</name>
Expand Down Expand Up @@ -6757,10 +6761,6 @@ Recuerda tu contraseña y no la compartas con nadie.</translation>
<source>Enable on-device message backup?</source>
<translation>¿Habilitar backup de mensajes en el dispositivo?</translation>
</message>
<message>
<source>On-device backups are:&lt;br&gt;Automatic – every 30 minutes&lt;br&gt;Secure – encrypted with your profile private key&lt;br&gt;Private – stored only on your device</source>
<translation>Los backups en el dispositivo son:&lt;br&gt;Automáticos: cada 30 minutos&lt;br&gt;Seguros: cifrados con tu clave privada del perfil&lt;br&gt;Privados: almacenados solo en tu dispositivo</translation>
</message>
<message>
<source>Backups let you restore your 1-on-1, group, and community messages if you need to reinstall the app or switch devices. You can skip this step now and enable it anytime under: &lt;i&gt;Settings &gt; On-device backup &gt; Backup data&lt;/i&gt;</source>
<translation>Los backups te permiten restaurar tus mensajes 1 a 1, grupales y de comunidad si necesitas reinstalar la app o cambiar de dispositivo. Puedes omitir este paso ahora y habilitarlo en cualquier momento en: &lt;i&gt;Configuración &gt; Respaldo en el dispositivo &gt; Datos de backup&lt;/i&gt;</translation>
Expand All @@ -6773,6 +6773,22 @@ Recuerda tu contraseña y no la compartas con nadie.</translation>
<source>Enable</source>
<translation>Habilitar</translation>
</message>
<message>
<source>Enable on-device backup?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>On-device backups are:&lt;br&gt;&lt;b&gt;Automatic&lt;/b&gt; – created every 30 minutes&lt;br&gt;&lt;b&gt;Secure&lt;/b&gt; – encrypted with your profile’s private key&lt;br&gt;&lt;b&gt;Private&lt;/b&gt; – stored only on your device</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>To enable backups, choose a folder to store your backup files under the &lt;b&gt;Backup location&lt;/b&gt; setting.&lt;br&gt;&lt;br&gt;You can also &lt;b&gt;optionally&lt;/b&gt; back up your &lt;b&gt;1-on-1, group, and community messages&lt;/b&gt; by turning on the &lt;b&gt;Backup your messages&lt;/b&gt; toggle under the &lt;b&gt;Backup data&lt;/b&gt; setting.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Go to settings</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EnsAddedView</name>
Expand Down
39 changes: 34 additions & 5 deletions ui/imports/shared/popups/EnableMessageBackupPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

import StatusQ.Components
import StatusQ.Core
import StatusQ.Core.Theme
import StatusQ.Core.Utils as SQUtils
import StatusQ.Controls
import StatusQ.Popups.Dialog

import utils

StatusDialog {
id: root

title: qsTr("Enable on-device message backup?")
title: {
if (SQUtils.Utils.isAndroid) {
// Android needs specific wording because it requires user permission to access storage
return qsTr("Enable on-device backup?")
}
return qsTr("Enable on-device message backup?")
}

padding: 20
width: 480
Expand All @@ -19,15 +29,27 @@ StatusDialog {
contentItem: ColumnLayout {
spacing: Theme.padding

StatusImage {
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: Math.min(496, parent.width)
source: Theme.png("backup-popup")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will no longer work in master due to the recent Theme changes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh crap. I'll create a new PR

mipmap: true
}

StatusBaseText {
Layout.fillWidth: true
wrapMode: Text.Wrap
text: qsTr("On-device backups are:<br>Automatic – every 30 minutes<br>Secure – encrypted with your profile private key<br>Private – stored only on your device")
text: qsTr("On-device backups are:<br><b>Automatic</b> created every 30 minutes<br><b>Secure</b> – encrypted with your profile’s private key<br><b>Private</b> – stored only on your device")
}
StatusBaseText {
Layout.fillWidth: true
wrapMode: Text.Wrap
text: qsTr("Backups let you restore your 1-on-1, group, and community messages if you need to reinstall the app or switch devices. You can skip this step now and enable it anytime under: <i>Settings > On-device backup > Backup data</i>")
text: {
if (SQUtils.Utils.isAndroid) {
return qsTr("To enable backups, choose a folder to store your backup files under the <b>Backup location</b> setting.<br><br>You can also <b>optionally</b> back up your <b>1-on-1, group, and community messages</b> by turning on the <b>Backup your messages</b> toggle under the <b>Backup data</b> setting.")
}
return qsTr("Backups let you restore your 1-on-1, group, and community messages if you need to reinstall the app or switch devices. You can skip this step now and enable it anytime under: <i>Settings > On-device backup > Backup data</i>")
}
}
}

Expand All @@ -42,8 +64,15 @@ StatusDialog {
rightButtons: ObjectModel {
StatusButton {
objectName: "backupMessageEnableStatusFlatButton"
text: qsTr("Enable")
onClicked: root.accept()
text: SQUtils.Utils.isAndroid ? qsTr("Go to settings") : qsTr("Enable")
onClicked: {
if (SQUtils.Utils.isAndroid) {
Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.backupSettings)
root.close()
return
}
root.accept()
}
}
}
}
Expand Down