From 4d92187327dd261b3fd74275b0bef6179886403c Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Fri, 28 Jun 2019 00:48:52 +0100 Subject: [PATCH] Mobile: Added button to fix search engine index --- .../lib/components/screens/config.js | 20 ++++++++++++++++++- .../lib/services/SearchEngine.js | 18 ++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/ReactNativeClient/lib/components/screens/config.js b/ReactNativeClient/lib/components/screens/config.js index 24b580064..dba492f1b 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'); @@ -14,6 +14,7 @@ const NavService = require('lib/services/NavService.js'); const VersionInfo = require('react-native-version-info').default; const { ReportService } = require('lib/services/report.js'); const { time } = require('lib/time-utils'); +const SearchEngine = require('lib/services/SearchEngine'); const RNFS = require('react-native-fs'); import Slider from '@react-native-community/slider'; @@ -78,6 +79,12 @@ class ConfigScreenComponent extends BaseScreenComponent { this.setState({ creatingReport: false }); } + this.fixSearchEngineIndexButtonPress_ = async () => { + this.setState({ fixingSearchIndex: true }); + await SearchEngine.instance().rebuildIndex(); + this.setState({ fixingSearchIndex: false }); + } + this.logButtonPress_ = () => { NavService.go('Log'); } @@ -191,6 +198,15 @@ class ConfigScreenComponent extends BaseScreenComponent { renderButton(key, title, clickHandler, options = null) { if (!options) options = {}; + let descriptionComp = null; + if (options.description) { + descriptionComp = ( + + {options.description} + + ); + } + return ( @@ -198,6 +214,7 @@ class ConfigScreenComponent extends BaseScreenComponent {