Skip to content

improve backup transfer dialog. #4476

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

Merged
merged 7 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Prefer to encrypt if E2eeEnabled even if peers have EncryptPreference::NoPreference.
- Allow empty `To` field for self-sent messages.
- displayname may not be empty anymore #4471
- Improve backup transfer dialog (different message for connection step, timed message to tell user to check out troubleshooting, button to link to trouble shooting) #4476

## Fixed
- fix chat "scrolls up" right after switching (rev 2) #4431
Expand Down
3 changes: 3 additions & 0 deletions _locales/_untranslated_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,8 @@
},
"contact_is_blocked": {
"message": "This contact is blocked"
},
"multidevice_connection_takes_too_long": {
"message": "This takes longer than expected 🐌 make sure both devices are on the same Wi-Fi or network and check troubleshooting"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,24 @@ import {
import useTranslationFunction from '../../../hooks/useTranslationFunction'

import type { DialogProps } from '../../../contexts/DialogContext'
import { runtime } from '@deltachat-desktop/runtime-interface'

const log = getLogger('renderer/receive_backup')

type Props = {
QrWithToken: string
}

// time it takes on progress === 0 to show the trouble shooting button in ms
const TROUBLESHOOTING_TIMEOUT = 4000

export function ReceiveBackupProgressDialog({
onClose,
QrWithToken,
}: Props & DialogProps) {
const [importProgress, setImportProgress] = useState(0.0)
const [error, setError] = useState<string | null>(null)
const [troubleTimerFired, setTroubleTimerFired] = useState(false)
const tx = useTranslationFunction()

const onImexProgress = ({ progress }: DcEventType<'ImexProgress'>) => {
Expand Down Expand Up @@ -56,6 +61,8 @@ export function ReceiveBackupProgressDialog({
window.__selectAccount(accountId)
})()

setTimeout(() => setTroubleTimerFired(true), TROUBLESHOOTING_TIMEOUT)

const emitter = BackendRemote.getContextEvents(accountId)
emitter.on('ImexProgress', onImexProgress)
return () => {
Expand All @@ -76,13 +83,26 @@ export function ReceiveBackupProgressDialog({
{tx('error')}: {error}
</p>
)}
<p>
{importProgress === 0
? tx('connectivity_connecting')
: tx('transferring')}
</p>
<DeltaProgressBar
progress={importProgress}
intent={error ? 'danger' : 'success'}
/>
{troubleTimerFired && importProgress === 0 && (
<p>{tx('multidevice_connection_takes_too_long')}</p>
)}
</DialogContent>
<DialogFooter>
<FooterActions align='end'>
<FooterActions align='spaceBetween'>
<FooterActionButton
onClick={() => runtime.openHelpWindow('multiclient')}
>
{tx('troubleshooting')}
</FooterActionButton>
<FooterActionButton onClick={cancel}>
{tx('cancel')}
</FooterActionButton>
Expand Down
Loading