diff --git a/ReactNativeClient/android/gradle.properties b/ReactNativeClient/android/gradle.properties index d541811d0..1a5d0b9d7 100644 --- a/ReactNativeClient/android/gradle.properties +++ b/ReactNativeClient/android/gradle.properties @@ -19,5 +19,5 @@ # Required for react-native-webview # https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md -# android.useAndroidX=true -# android.enableJetifier=true \ No newline at end of file +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/ReactNativeClient/lib/components/screens/config.js b/ReactNativeClient/lib/components/screens/config.js index e5096b347..6dd34d799 100644 --- a/ReactNativeClient/lib/components/screens/config.js +++ b/ReactNativeClient/lib/components/screens/config.js @@ -1,5 +1,5 @@ const React = require('react'); const Component = React.Component; -const { Platform, TouchableOpacity, Linking, View, Switch, StyleSheet, Text, Button, ScrollView, TextInput } = require('react-native'); +const { Platform, TouchableOpacity, Linking, View, Switch, StyleSheet, Text, Button, ScrollView, TextInput, Alert } = require('react-native'); const { connect } = require('react-redux'); const { ScreenHeader } = require('lib/components/screen-header.js'); const { _, setLocale } = require('lib/locale.js'); @@ -7,6 +7,7 @@ const { BaseScreenComponent } = require('lib/components/base-screen.js'); const { Dropdown } = require('lib/components/Dropdown.js'); const { themeStyle } = require('lib/components/global-style.js'); const Setting = require('lib/models/Setting.js'); +const BaseItem = require('lib/models/BaseItem.js'); const shared = require('lib/components/shared/config-shared.js'); const SyncTargetRegistry = require('lib/SyncTargetRegistry'); const { reg } = require('lib/registry.js'); @@ -33,6 +34,35 @@ class ConfigScreenComponent extends BaseScreenComponent { this.saveButton_press = () => { return shared.saveSettings(this); }; + + this.clearSyncStateButton_click = () => { + Alert.alert( + '', + _('WARNING: This will clear the local synchronisation state. It means the entire data will be synced again with the sync target. DO NOT USE if you have not been advised to do so, or if you do not understand the consequences.'), + [ + { + text: _('Help'), + onPress: () => { + Linking.openURL('https://joplinapp.org/faq/#how-to-clear-local-sync-data'); + }, + }, + { + text: _('Cancel'), + onPress: () => {}, + style: 'cancel', + }, + { + text: _('OK'), + onPress: async () => { + const syncTarget = this.props.settings['sync.target']; + await BaseItem.clearLocalSyncState(syncTarget); + alert(_('The local sync data has been cleared.')); + }, + }, + ], + { cancelable: false }, + ); + }; } UNSAFE_componentWillMount() { @@ -273,6 +303,18 @@ class ConfigScreenComponent extends BaseScreenComponent { const settingComps = shared.settingsToComponents2(this, 'mobile', settings); + settingComps.push(this.renderHeader('advanced', _('Advanced'))); + + settingComps.push( + + + +