You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Fixes for release apk
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
import { connect } from 'react-redux'
|
||||
import { Button } from 'react-native';
|
||||
import { Button, Text } from 'react-native';
|
||||
import { Log } from 'lib/log.js';
|
||||
import { Note } from 'lib/models/note.js';
|
||||
import { NotesScreenUtils } from 'lib/components/screens/notes-utils.js'
|
||||
import { reg } from 'lib/registry.js';
|
||||
import { _ } from 'lib/locale.js';
|
||||
|
||||
const React = require('react');
|
||||
const {
|
||||
@ -11,7 +13,6 @@ const {
|
||||
ScrollView,
|
||||
View,
|
||||
Image,
|
||||
Text,
|
||||
} = require('react-native');
|
||||
const { Component } = React;
|
||||
|
||||
@ -41,6 +42,11 @@ const styles = StyleSheet.create({
|
||||
|
||||
class SideMenuContentComponent extends Component {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.state = { syncReportText: '' };
|
||||
}
|
||||
|
||||
folder_press(folder) {
|
||||
this.props.dispatch({
|
||||
type: 'SIDE_MENU_CLOSE',
|
||||
@ -49,19 +55,57 @@ class SideMenuContentComponent extends Component {
|
||||
NotesScreenUtils.openNoteList(folder.id);
|
||||
}
|
||||
|
||||
async synchronize_press() {
|
||||
if (reg.oneDriveApi().auth()) {
|
||||
let options = {
|
||||
onProgress: (report) => {
|
||||
let line = [];
|
||||
line.push(_('Items to upload: %d/%d.', report.createRemote + report.updateRemote, report.remotesToUpdate));
|
||||
line.push(_('Remote items to delete: %d/%d.', report.deleteRemote, report.remotesToDelete));
|
||||
line.push(_('Items to download: %d/%d.', report.createLocal + report.updateLocal, report.localsToUdpate));
|
||||
line.push(_('Local items to delete: %d/%d.', report.deleteLocal, report.localsToDelete));
|
||||
this.setState({ syncReportText: line.join("\n") });
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
const sync = await reg.synchronizer()
|
||||
sync.start(options);
|
||||
} catch (error) {
|
||||
Log.error(error);
|
||||
}
|
||||
} else {
|
||||
this.props.dispatch({
|
||||
type: 'Navigation/NAVIGATE',
|
||||
routeName: 'OneDriveLogin',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let buttons = [];
|
||||
let keyIndex = 0;
|
||||
let key = () => {
|
||||
return 'smitem_' + (keyIndex++);
|
||||
}
|
||||
|
||||
let items = [];
|
||||
for (let i = 0; i < this.props.folders.length; i++) {
|
||||
let f = this.props.folders[i];
|
||||
let title = f.title ? f.title : '';
|
||||
buttons.push(
|
||||
<Button style={styles.button} title={title} onPress={() => { this.folder_press(f) }} key={f.id} />
|
||||
items.push(
|
||||
<Button style={styles.button} title={title} onPress={() => { this.folder_press(f) }} key={key()} />
|
||||
);
|
||||
}
|
||||
|
||||
items.push(<Text key={key()}></Text>); // DIVIDER
|
||||
|
||||
items.push(<Button style={styles.button} title="Synchronize" onPress={() => { this.synchronize_press() }} key={key()} />);
|
||||
|
||||
items.push(<Text key={key()}>{this.state.syncReportText}</Text>);
|
||||
|
||||
return (
|
||||
<ScrollView scrollsToTop={false} style={styles.menu}>
|
||||
{ buttons }
|
||||
{ items }
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user