import * as React from 'react'; import useSyncTargetUpgrade from '@joplin/lib/services/synchronizer/gui/useSyncTargetUpgrade'; import { _ } from '@joplin/lib/locale'; const { View, Text, ScrollView } = require('react-native'); const { connect } = require('react-redux'); const { themeStyle } = require('../global-style.js'); import ScreenHeader from '../ScreenHeader'; function UpgradeSyncTargetScreen(props: any) { const upgradeResult = useSyncTargetUpgrade(); const theme = themeStyle(props.themeId); const lineStyle = { ...theme.normalText, marginBottom: 20 }; const stackTraceStyle = { ...theme.normalText, flexWrap: 'nowrap', fontSize: theme.fontSize * 0.5, color: theme.colorFaded }; const headerStyle = { ...theme.headerStyle, marginBottom: 20 }; function renderUpgradeError() { if (!upgradeResult.error) return null; return ( Error The sync target could not be upgraded due to an error. For support, please copy the content of this page and paste it in the forum: https://discourse.joplinapp.org/ The full error was: {upgradeResult.error.message} {upgradeResult.error.stack} ); } function renderInProgress() { if (upgradeResult.error || upgradeResult.done) return null; return ( Joplin upgrade in progress... Please wait while the sync target is being upgraded. It may take a few seconds or a few minutes depending on the upgrade. Make sure you leave your device on and the app opened while the upgrade is in progress. ); } function renderDone() { if (upgradeResult.error || !upgradeResult.done) return null; return ( Upgrade complete The upgrade has been applied successfully. Please press Back to exit this screen. ); } return ( {renderInProgress()} {renderDone()} {renderUpgradeError()} ); } export default connect((state: any) => { return { themeId: state.settings.theme, }; })(UpgradeSyncTargetScreen);