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:
@ -37,6 +37,7 @@ class ItemListComponent extends Component {
|
||||
await Note.save({ id: note.id, todo_completed: checked });
|
||||
}
|
||||
|
||||
listView_itemLongPress(itemId) {}
|
||||
listView_itemPress(itemId) {}
|
||||
|
||||
render() {
|
||||
@ -50,8 +51,8 @@ class ItemListComponent extends Component {
|
||||
|
||||
return (
|
||||
<TouchableHighlight onPress={onPress} onLongPress={onLongPress}>
|
||||
<View style={{flexDirection: 'row'}}>
|
||||
{ !!Number(item.is_todo) && <Checkbox checked={!!Number(item.todo_completed)} onChange={(checked) => { this.todoCheckbox_change(item.id, checked) }}/> }<Text>{item.title} [{item.id}]</Text>
|
||||
<View style={{flexDirection: 'row', paddingLeft: 10, paddingTop:5, paddingBottom:5 }}>
|
||||
{ !!Number(item.is_todo) && <Checkbox checked={!!Number(item.todo_completed)} onChange={(checked) => { this.todoCheckbox_change(item.id, checked) }}/> }<Text>{item.title}</Text>
|
||||
</View>
|
||||
</TouchableHighlight>
|
||||
);
|
||||
|
@ -41,22 +41,6 @@ class ScreenHeaderComponent extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
async menu_synchronize() {
|
||||
if (reg.oneDriveApi().auth()) {
|
||||
const sync = await reg.synchronizer();
|
||||
try {
|
||||
sync.start();
|
||||
} catch (error) {
|
||||
Log.error(error);
|
||||
}
|
||||
} else {
|
||||
this.props.dispatch({
|
||||
type: 'Navigation/NAVIGATE',
|
||||
routeName: 'OneDriveLogin',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let key = 0;
|
||||
let menuOptionComponents = [];
|
||||
@ -72,15 +56,10 @@ class ScreenHeaderComponent extends Component {
|
||||
menuOptionComponents.push(<View key={'menuOption_' + key++} style={styles.divider}/>);
|
||||
}
|
||||
|
||||
menuOptionComponents.push(
|
||||
<MenuOption value={() => this.menu_synchronize()} key={'menuOption_' + key++}>
|
||||
<Text>{_('Synchronize')}</Text>
|
||||
</MenuOption>);
|
||||
|
||||
menuOptionComponents.push(
|
||||
<MenuOption value={1} key={'menuOption_' + key++}>
|
||||
<Text>{_('Configuration')}</Text>
|
||||
</MenuOption>);
|
||||
// menuOptionComponents.push(
|
||||
// <MenuOption value={1} key={'menuOption_' + key++}>
|
||||
// <Text>{_('Configuration')}</Text>
|
||||
// </MenuOption>);
|
||||
|
||||
let title = 'title' in this.props && this.props.title !== null ? this.props.title : _(this.props.navState.routeName);
|
||||
|
||||
|
@ -85,7 +85,7 @@ class NoteScreenComponent extends React.Component {
|
||||
<View style={{ flexDirection: 'row' }}>
|
||||
{ isTodo && <Checkbox checked={!!Number(note.todo_completed)} /> }<TextInput style={{flex:1}} value={note.title} onChangeText={(text) => this.title_changeText(text)} />
|
||||
</View>
|
||||
<TextInput style={{flex: 1, textAlignVertical: 'top'}} multiline={true} value={note.body} onChangeText={(text) => this.body_changeText(text)} />
|
||||
<TextInput style={{flex: 1, textAlignVertical: 'top', fontFamily: 'monospace'}} multiline={true} value={note.body} onChangeText={(text) => this.body_changeText(text)} />
|
||||
{ todoComponents }
|
||||
<Button title="Save note" onPress={() => this.saveNoteButton_press()} />
|
||||
</View>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { Component } from 'react';
|
||||
import { View } from 'react-native';
|
||||
import { WebView, Button } from 'react-native';
|
||||
import { WebView, Button, Text } from 'react-native';
|
||||
import { connect } from 'react-redux'
|
||||
import { Log } from 'lib/log.js'
|
||||
import { Setting } from 'lib/models/setting.js'
|
||||
@ -22,10 +22,14 @@ class OneDriveLoginScreenComponent extends React.Component {
|
||||
|
||||
componentWillMount() {
|
||||
this.setState({
|
||||
webviewUrl: reg.oneDriveApi().authCodeUrl(this.redirectUrl()),
|
||||
webviewUrl: this.startUrl(),
|
||||
});
|
||||
}
|
||||
|
||||
startUrl() {
|
||||
return reg.oneDriveApi().authCodeUrl(this.redirectUrl());
|
||||
}
|
||||
|
||||
redirectUrl() {
|
||||
return 'https://login.microsoftonline.com/common/oauth2/nativeclient';
|
||||
}
|
||||
@ -37,7 +41,7 @@ class OneDriveLoginScreenComponent extends React.Component {
|
||||
const url = noIdeaWhatThisIs.url;
|
||||
|
||||
if (!this.authCode_ && url.indexOf(this.redirectUrl() + '?code=') === 0) {
|
||||
console.info('URL: ' + url);
|
||||
Log.info('URL: ' + url);
|
||||
|
||||
let code = url.split('?code=');
|
||||
this.authCode_ = code[1];
|
||||
@ -48,6 +52,28 @@ class OneDriveLoginScreenComponent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
async webview_error(error) {
|
||||
Log.error(error);
|
||||
}
|
||||
|
||||
retryButton_click() {
|
||||
// It seems the only way it would reload the page is by loading an unrelated
|
||||
// URL, waiting a bit, and then loading the actual URL. There's probably
|
||||
// a better way to do this.
|
||||
|
||||
this.setState({
|
||||
webviewUrl: 'https://microsoft.com',
|
||||
});
|
||||
this.forceUpdate();
|
||||
|
||||
setTimeout(() => {
|
||||
this.setState({
|
||||
webviewUrl: this.startUrl(),
|
||||
});
|
||||
this.forceUpdate();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
render() {
|
||||
const source = {
|
||||
uri: this.state.webviewUrl,
|
||||
@ -60,7 +86,10 @@ class OneDriveLoginScreenComponent extends React.Component {
|
||||
source={source}
|
||||
style={{marginTop: 20}}
|
||||
onNavigationStateChange={(o) => { this.webview_load(o); }}
|
||||
onError={(error) => { this.webview_error(error); }}
|
||||
/>
|
||||
|
||||
<Button title="Retry" onPress={() => { this.retryButton_click(); }}></Button>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
@ -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