import { WebApplication } from '@/ui_models/application'; import { PureComponent } from './Abstract/PureComponent'; import { Fragment } from 'preact'; type Props = { application: WebApplication; close: () => void; }; export class SyncResolutionMenu extends PureComponent { private status: Partial<{ backupFinished: boolean; resolving: boolean; attemptedResolution: boolean; success: boolean; fail: boolean; }> = {}; constructor(props: Props) { super(props, props.application); } downloadBackup(encrypted: boolean) { this.props.application.getArchiveService().downloadBackup(encrypted); this.status.backupFinished = true; } skipBackup() { this.status.backupFinished = true; } async performSyncResolution() { this.status.resolving = true; await this.props.application.resolveOutOfSync(); this.status.resolving = false; this.status.attemptedResolution = true; if (this.props.application.isOutOfSync()) { this.status.fail = true; } else { this.status.success = true; } } close() { this.props.close(); } render() { return (
Out of Sync
Close
We've detected that the data on the server may not match the data in the current application session.
Option 1 — Restart App:
Quit the application and re-open it. Sometimes, this may resolve the issue.
Option 2 (recommended) — Sign Out:
Sign out of your account, then sign back in. This will ensure your data is consistent with the server.
Be sure to download a backup of your data before doing so.
Option 3 — Sync Resolution:
We can attempt to reconcile changes by downloading all data from the server. No existing data will be overwritten. If the local contents of an item differ from what the server has, a conflicted copy will be created.
{!this.status.backupFinished && (
Please download a backup before we attempt to perform a full account sync resolution.
)} {this.status.backupFinished && (
{!this.status.resolving && !this.status.attemptedResolution && (
)} {this.status.resolving && (
Attempting sync resolution...
)} {this.status.fail && (
Sync Resolution Failed
We attempted to reconcile local content and server content, but were unable to do so. At this point, we recommend signing out of your account and signing back in. You may wish to download a data backup before doing so.
)} {this.status.success && (
Sync Resolution Success
Your local data is now in sync with the server. You may close this window.
)}
)}
); } }