import * as React from 'react';
import { View, Text, ScrollView } from 'react-native';
import useSyncTargetUpgrade from 'lib/services/synchronizer/gui/useSyncTargetUpgrade';
const { connect } = require('react-redux');
const { themeStyle } = require('lib/components/global-style.js');
const { ScreenHeader } = require('lib/components/screen-header.js');
const { _ } = require('lib/locale.js');
function UpgradeSyncTargetScreen(props:any) {
const upgradeResult = useSyncTargetUpgrade();
const theme = themeStyle(props.theme);
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 {
theme: state.settings.theme,
};
})(UpgradeSyncTargetScreen);