You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
Web: Show sync wizard on first start (#13470)
This commit is contained in:
@@ -10,6 +10,7 @@ import JoplinCloudIcon from './JoplinCloudIcon';
|
||||
import NavService from '@joplin/lib/services/NavService';
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
import CardButton from '../buttons/CardButton';
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
|
||||
interface Props {
|
||||
dispatch: Dispatch;
|
||||
@@ -86,6 +87,11 @@ const SyncWizard: React.FC<Props> = ({ themeId, visible, dispatch }) => {
|
||||
});
|
||||
}, [dispatch]);
|
||||
|
||||
const onManualDismiss = useCallback(() => {
|
||||
Setting.setValue('sync.wizard.autoShowOnStartup', false);
|
||||
onDismiss();
|
||||
}, [onDismiss]);
|
||||
|
||||
const onSelectJoplinCloud = useCallback(async () => {
|
||||
onDismiss();
|
||||
await NavService.go('JoplinCloudLogin');
|
||||
@@ -99,7 +105,7 @@ const SyncWizard: React.FC<Props> = ({ themeId, visible, dispatch }) => {
|
||||
return <DismissibleDialog
|
||||
themeId={themeId}
|
||||
visible={visible}
|
||||
onDismiss={onDismiss}
|
||||
onDismiss={onManualDismiss}
|
||||
size={DialogVariant.SmallResize}
|
||||
scrollOverflow={true}
|
||||
heading={_('Sync')}
|
||||
|
||||
@@ -488,6 +488,14 @@ const buildStartupTasks = (
|
||||
|
||||
// await printTestData();
|
||||
});
|
||||
addTask('buildStartupTasks/optionally show sync wizard', async () => {
|
||||
if (Setting.value('sync.wizard.autoShowOnStartup') && Setting.value('sync.target') === 0) {
|
||||
dispatch({
|
||||
type: 'SYNC_WIZARD_VISIBLE_CHANGE',
|
||||
visible: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return startupTasks;
|
||||
};
|
||||
|
||||
@@ -109,6 +109,15 @@ const builtInMetadata = (Setting: typeof SettingType) => {
|
||||
section: 'sync',
|
||||
},
|
||||
|
||||
'sync.wizard.autoShowOnStartup': {
|
||||
value: mobilePlatform === 'web',
|
||||
type: SettingItemType.Bool,
|
||||
public: false,
|
||||
appTypes: [AppType.Mobile],
|
||||
label: () => 'Show the sync wizard on startup if no sync target is selected',
|
||||
section: 'sync',
|
||||
},
|
||||
|
||||
'sync.target': {
|
||||
value: 0,
|
||||
type: SettingItemType.Int,
|
||||
|
||||
Reference in New Issue
Block a user