mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Various fixes
This commit is contained in:
parent
2685120ecd
commit
53d305eb2e
@ -243,7 +243,7 @@ class ScreenHeaderComponent extends Component {
|
||||
</Picker>
|
||||
);
|
||||
} else {
|
||||
let title = 'title' in this.props && this.props.title !== null ? this.props.title : _(this.props.navState.routeName);
|
||||
let title = 'title' in this.props && this.props.title !== null ? this.props.title : '';
|
||||
return <Text style={styles.titleText}>{title}</Text>
|
||||
}
|
||||
}
|
||||
|
@ -71,6 +71,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
showNoteMetadata: false,
|
||||
folder: null,
|
||||
lastSavedNote: null,
|
||||
isLoading: true,
|
||||
};
|
||||
|
||||
this.saveButtonHasBeenShown_ = false;
|
||||
@ -116,6 +117,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
note: note,
|
||||
mode: mode,
|
||||
folder: await Folder.load(note.parent_id),
|
||||
isLoading: false,
|
||||
});
|
||||
|
||||
this.refreshNoteMetadata();
|
||||
@ -270,9 +272,18 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.isLoading) {
|
||||
return (
|
||||
<View style={this.styles().screen}>
|
||||
<ScreenHeader navState={this.props.navigation.state}/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const note = this.state.note;
|
||||
const isTodo = !!Number(note.is_todo);
|
||||
const folder = this.state.folder;
|
||||
const isNew = !note.id;
|
||||
|
||||
let bodyComponent = null;
|
||||
if (this.state.mode == 'view') {
|
||||
@ -395,10 +406,11 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
</View>
|
||||
);
|
||||
} else {
|
||||
const focusBody = !isNew && !!note.title;
|
||||
bodyComponent = (
|
||||
<TextInput
|
||||
autoCapitalize="sentences"
|
||||
autoFocus={true}
|
||||
autoFocus={focusBody}
|
||||
style={styles.bodyTextInput}
|
||||
multiline={true}
|
||||
value={note.body}
|
||||
@ -478,7 +490,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
onSaveButtonPress={() => this.saveNoteButton_press()}
|
||||
/>
|
||||
<View style={titleContainerStyle}>
|
||||
{ isTodo && <Checkbox checked={!!Number(note.todo_completed)} onChange={(checked) => { this.todoCheckbox_change(checked) }} /> }<TextInput underlineColorAndroid="#ffffff00" autoCapitalize="sentences" style={styles.titleTextInput} value={note.title} onChangeText={(text) => this.title_changeText(text)} />
|
||||
{ isTodo && <Checkbox checked={!!Number(note.todo_completed)} onChange={(checked) => { this.todoCheckbox_change(checked) }} /> }<TextInput autoFocus={isNew} underlineColorAndroid="#ffffff00" autoCapitalize="sentences" style={styles.titleTextInput} value={note.title} onChangeText={(text) => this.title_changeText(text)} />
|
||||
</View>
|
||||
{ bodyComponent }
|
||||
{ actionButtonComp }
|
||||
|
@ -50,6 +50,7 @@ class OneDriveLoginScreenComponent extends BaseScreenComponent {
|
||||
try {
|
||||
await reg.oneDriveApi().execTokenRequest(this.authCode_, this.redirectUrl(), true);
|
||||
this.props.dispatch({ type: 'Navigation/BACK' });
|
||||
reg.scheduleSync(0);
|
||||
} catch (error) {
|
||||
alert(error.message);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import { connect } from 'react-redux'
|
||||
import Icon from 'react-native-vector-icons/Ionicons';
|
||||
import { Log } from 'lib/log.js';
|
||||
import { Note } from 'lib/models/note.js';
|
||||
import { Setting } from 'lib/models/setting.js';
|
||||
import { FoldersScreenUtils } from 'lib/components/screens/folders-utils.js'
|
||||
import { NotesScreenUtils } from 'lib/components/screens/notes-utils.js'
|
||||
import { Synchronizer } from 'lib/synchronizer.js';
|
||||
@ -70,21 +71,22 @@ class SideMenuContentComponent extends Component {
|
||||
}
|
||||
|
||||
async synchronize_press() {
|
||||
if (Setting.value('sync.target') == Setting.SYNC_TARGET_ONEDRIVE && !reg.oneDriveApi().auth()) {
|
||||
this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
|
||||
|
||||
this.props.dispatch({
|
||||
type: 'Navigation/NAVIGATE',
|
||||
routeName: 'OneDriveLogin',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const sync = await reg.synchronizer(Setting.value('sync.target'))
|
||||
|
||||
if (this.props.syncStarted) {
|
||||
sync.cancel();
|
||||
} else {
|
||||
if (reg.oneDriveApi().auth()) {
|
||||
reg.scheduleSync(1);
|
||||
} else {
|
||||
this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
|
||||
|
||||
this.props.dispatch({
|
||||
type: 'Navigation/NAVIGATE',
|
||||
routeName: 'OneDriveLogin',
|
||||
});
|
||||
}
|
||||
reg.scheduleSync(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,16 +409,16 @@ async function initialize(dispatch, backButtonHandler) {
|
||||
let folderId = Setting.value('activeFolderId');
|
||||
let folder = await Folder.load(folderId);
|
||||
|
||||
dispatch({
|
||||
type: 'Navigation/NAVIGATE',
|
||||
routeName: 'Config',
|
||||
});
|
||||
// dispatch({
|
||||
// type: 'Navigation/NAVIGATE',
|
||||
// routeName: 'Config',
|
||||
// });
|
||||
|
||||
// if (folder) {
|
||||
// await NotesScreenUtils.openNoteList(folderId);
|
||||
// } else {
|
||||
// await NotesScreenUtils.openDefaultNoteList();
|
||||
// }
|
||||
if (folder) {
|
||||
await NotesScreenUtils.openNoteList(folderId);
|
||||
} else {
|
||||
await NotesScreenUtils.openDefaultNoteList();
|
||||
}
|
||||
} catch (error) {
|
||||
reg.logger().error('Initialization error:', error);
|
||||
}
|
||||
@ -429,7 +429,7 @@ async function initialize(dispatch, backButtonHandler) {
|
||||
|
||||
PoorManIntervals.setInterval(() => {
|
||||
reg.logger().info('Running background sync on timer...');
|
||||
reg.scheduleSync(1);
|
||||
reg.scheduleSync(0);
|
||||
}, 1000 * 60 * 5);
|
||||
|
||||
if (Setting.value('env') == 'dev') {
|
||||
|
Loading…
Reference in New Issue
Block a user