1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Various changes

This commit is contained in:
Laurent Cozic 2017-07-08 00:25:10 +01:00
parent 38c9d49cdb
commit a9f7b0d531
11 changed files with 44 additions and 21 deletions

View File

@ -5,9 +5,9 @@
android:versionName="0.8.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> -->
<!-- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> -->
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/>
<uses-sdk

View File

@ -0,0 +1,4 @@
@echo off
rmdir /s/q android\app\build
rmdir /s/q android\build
rmdir /s/q android\.gradle

View File

@ -59,13 +59,19 @@ class ItemListComponent extends Component {
}
// `enableEmptySections` is to fix this warning: https://github.com/FaridSafi/react-native-gifted-listview/issues/39
return (
<ListView
dataSource={this.state.dataSource}
renderRow={renderRow}
enableEmptySections={true}
/>
);
if (this.state.dataSource.getRowCount()) {
return (
<ListView
dataSource={this.state.dataSource}
renderRow={renderRow}
enableEmptySections={true}
/>
);
} else {
const noItemMessage = this.props.noItemMessage ? this.props.noItemMessage : '';
return <Text>{noItemMessage}</Text>;
}
}
}

View File

@ -24,6 +24,7 @@ class ScreenHeaderComponent extends Component {
// Note: this is hardcoded for now because navigation.state doesn't tell whether
// it's possible to go back or not. Maybe it's possible to get this information
// from somewhere else.
return true;
return this.props.navState.routeName != 'Notes';
}

View File

@ -17,7 +17,7 @@ class FoldersScreenComponent extends React.Component {
return (
<View style={{flex: 1}}>
<ScreenHeader navState={this.props.navigation.state} />
<FolderList style={{flex: 1}}/>
<FolderList noItemMessage={_('There is currently no notebook. Create one by clicking on the (+) button.')} style={{flex: 1}}/>
<ActionButton></ActionButton>
</View>
);

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { ListView, View, Text } from 'react-native';
import { ListView, View, Text, Button } from 'react-native';
import { connect } from 'react-redux'
import { Log } from 'lib/log.js'
import { reg } from 'lib/registry.js'
@ -23,6 +23,10 @@ class LogScreenComponent extends React.Component {
}
componentWillMount() {
this.resfreshLogEntries();
}
resfreshLogEntries() {
reg.logger().lastEntries(1000).then((entries) => {
const newDataSource = this.state.dataSource.cloneWithRows(entries);
this.setState({ dataSource: newDataSource });
@ -47,6 +51,7 @@ class LogScreenComponent extends React.Component {
renderRow={renderRow}
enableEmptySections={true}
/>
<Button title="Refresh" onPress={() => { this.resfreshLogEntries(); }}/>
</View>
);
}

View File

@ -49,7 +49,7 @@ class NotesScreenComponent extends React.Component {
return (
<View style={{flex: 1}}>
<ScreenHeader title={title} navState={this.props.navigation.state} menuOptions={this.menuOptions()} />
<NoteList style={{flex: 1}}/>
<NoteList noItemMessage={_('There are currently no notes. Create one by clicking on the (+) button.')} style={{flex: 1}}/>
<ActionButton parentFolderId={this.props.selectedFolderId}></ActionButton>
</View>
);

View File

@ -46,7 +46,12 @@ class OneDriveLoginScreenComponent extends React.Component {
let code = url.split('?code=');
this.authCode_ = code[1];
await reg.oneDriveApi().execTokenRequest(this.authCode_, this.redirectUrl(), true);
try {
await reg.oneDriveApi().execTokenRequest(this.authCode_, this.redirectUrl(), true);
this.props.dispatch({ type: 'Navigation/BACK' });
} catch (error) {
alert(error.message);
}
this.authCode_ = null;
}

View File

@ -259,14 +259,14 @@ class AppComponent extends React.Component {
if (Setting.value('env') == 'prod') {
await db.open({ name: 'joplin.sqlite' })
} else {
await db.open({ name: 'joplin-51.sqlite' })
await db.open({ name: 'joplin-52.sqlite' })
// await db.exec('DELETE FROM notes');
// await db.exec('DELETE FROM folders');
// await db.exec('DELETE FROM tags');
// await db.exec('DELETE FROM note_tags');
// await db.exec('DELETE FROM resources');
// await db.exec('DELETE FROM deleted_items');
await db.exec('DELETE FROM notes');
await db.exec('DELETE FROM folders');
await db.exec('DELETE FROM tags');
await db.exec('DELETE FROM note_tags');
await db.exec('DELETE FROM resources');
await db.exec('DELETE FROM deleted_items');
}
reg.logger().info('Database is ready.');

View File

@ -0,0 +1,2 @@
@echo off
npm start -- --reset-cache