You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Merge branch 'master' into alarm-support
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import React, { Component } from 'react';
|
||||
import { View, Switch, Slider, StyleSheet, Picker, Text, Button } from 'react-native';
|
||||
import { connect } from 'react-redux'
|
||||
import { ScreenHeader } from 'lib/components/screen-header.js';
|
||||
import { _, setLocale } from 'lib/locale.js';
|
||||
import { BaseScreenComponent } from 'lib/components/base-screen.js';
|
||||
import { themeStyle } from 'lib/components/global-style.js';
|
||||
import { Setting } from 'lib/models/setting.js';
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { TouchableOpacity, Linking, View, Switch, Slider, StyleSheet, Text, Button, ScrollView } = require('react-native');
|
||||
const { connect } = require('react-redux');
|
||||
const { ScreenHeader } = require('lib/components/screen-header.js');
|
||||
const { _, setLocale } = require('lib/locale.js');
|
||||
const { BaseScreenComponent } = require('lib/components/base-screen.js');
|
||||
const { Dropdown } = require('lib/components/Dropdown.js');
|
||||
const { themeStyle } = require('lib/components/global-style.js');
|
||||
const { Setting } = require('lib/models/setting.js');
|
||||
|
||||
class ConfigScreenComponent extends BaseScreenComponent {
|
||||
|
||||
@@ -26,7 +27,15 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
this.styles_ = {};
|
||||
|
||||
let styles = {
|
||||
body: {
|
||||
flex: 1,
|
||||
justifyContent: 'flex-start',
|
||||
flexDirection: 'column',
|
||||
},
|
||||
settingContainer: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: theme.dividerColor,
|
||||
paddingTop: theme.marginTop,
|
||||
@@ -38,13 +47,12 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
fontWeight: 'bold',
|
||||
color: theme.color,
|
||||
fontSize: theme.fontSize,
|
||||
flex: 1,
|
||||
},
|
||||
settingControl: {
|
||||
color: theme.color,
|
||||
flex: 1,
|
||||
},
|
||||
pickerItem: {
|
||||
fontSize: theme.fontSize,
|
||||
}
|
||||
}
|
||||
|
||||
styles.switchSettingText = Object.assign({}, styles.settingText);
|
||||
@@ -54,15 +62,24 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
styles.switchSettingContainer.flexDirection = 'row';
|
||||
styles.switchSettingContainer.justifyContent = 'space-between';
|
||||
|
||||
styles.linkText = Object.assign({}, styles.settingText);
|
||||
styles.linkText.borderBottomWidth = 1;
|
||||
styles.linkText.borderBottomColor = theme.color;
|
||||
styles.linkText.flex = 0;
|
||||
styles.linkText.fontWeight = 'normal';
|
||||
|
||||
styles.switchSettingControl = Object.assign({}, styles.settingControl);
|
||||
delete styles.switchSettingControl.color;
|
||||
styles.switchSettingControl.width = '20%';
|
||||
//styles.switchSettingControl.width = '20%';
|
||||
styles.switchSettingControl.flex = 0;
|
||||
|
||||
this.styles_[themeId] = StyleSheet.create(styles);
|
||||
return this.styles_[themeId];
|
||||
}
|
||||
|
||||
settingToComponent(key, value) {
|
||||
const themeId = this.props.theme;
|
||||
const theme = themeStyle(themeId);
|
||||
let output = null;
|
||||
|
||||
const updateSettingValue = (key, value) => {
|
||||
@@ -72,25 +89,36 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
const md = Setting.settingMetadata(key);
|
||||
|
||||
if (md.isEnum) {
|
||||
// The Picker component doesn't work properly with int values, so
|
||||
// convert everything to string (Setting.setValue will convert
|
||||
// back to the correct type.
|
||||
|
||||
value = value.toString();
|
||||
|
||||
let items = [];
|
||||
const settingOptions = md.options();
|
||||
for (let k in settingOptions) {
|
||||
if (!settingOptions.hasOwnProperty(k)) continue;
|
||||
items.push(<Picker.Item label={settingOptions[k]} value={k.toString()} key={k}/>);
|
||||
items.push({ label: settingOptions[k], value: k.toString() });
|
||||
}
|
||||
|
||||
return (
|
||||
<View key={key} style={this.styles().settingContainer}>
|
||||
<Text key="label" style={this.styles().settingText}>{md.label()}</Text>
|
||||
<Picker key="control" style={this.styles().settingControl} selectedValue={value} onValueChange={(itemValue, itemIndex) => updateSettingValue(key, itemValue)} >
|
||||
{ items }
|
||||
</Picker>
|
||||
<Dropdown
|
||||
key="control"
|
||||
style={this.styles().settingControl}
|
||||
items={items}
|
||||
selectedValue={value}
|
||||
itemListStyle={{
|
||||
backgroundColor: theme.backgroundColor,
|
||||
}}
|
||||
headerStyle={{
|
||||
color: theme.color,
|
||||
fontSize: theme.fontSize,
|
||||
}}
|
||||
itemStyle={{
|
||||
color: theme.color,
|
||||
fontSize: theme.fontSize,
|
||||
}}
|
||||
onValueChange={(itemValue, itemIndex) => { updateSettingValue(key, itemValue); }}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
} else if (md.type == Setting.TYPE_BOOL) {
|
||||
@@ -117,23 +145,42 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
render() {
|
||||
const settings = this.props.settings;
|
||||
|
||||
const keys = Setting.keys(true, 'mobile');
|
||||
let settingComps = [];
|
||||
for (let key in settings) {
|
||||
if (key == 'sync.target') continue;
|
||||
if (!settings.hasOwnProperty(key)) continue;
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
if (key == 'sync.target' && !settings.showAdvancedOptions) continue;
|
||||
if (!Setting.isPublic(key)) continue;
|
||||
|
||||
const comp = this.settingToComponent(key, settings[key]);
|
||||
if (!comp) continue;
|
||||
settingComps.push(comp);
|
||||
}
|
||||
|
||||
settingComps.push(
|
||||
<View key="website_link" style={this.styles().settingContainer}>
|
||||
<TouchableOpacity onPress={() => { Linking.openURL('http://joplin.cozic.net/') }}>
|
||||
<Text key="label" style={this.styles().linkText}>Joplin Website</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
);
|
||||
|
||||
settingComps.push(
|
||||
<View key="privacy_link" style={this.styles().settingContainer}>
|
||||
<TouchableOpacity onPress={() => { Linking.openURL('http://joplin.cozic.net/privacy/') }}>
|
||||
<Text key="label" style={this.styles().linkText}>Privacy Policy</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
);
|
||||
|
||||
//style={this.styles().body}
|
||||
|
||||
return (
|
||||
<View style={this.rootStyle(this.props.theme).root}>
|
||||
<ScreenHeader title={_('Configuration')}/>
|
||||
<View style={this.styles().body}>
|
||||
<ScrollView >
|
||||
{ settingComps }
|
||||
</View>
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -149,4 +196,4 @@ const ConfigScreen = connect(
|
||||
}
|
||||
)(ConfigScreenComponent)
|
||||
|
||||
export { ConfigScreen };
|
||||
module.exports = { ConfigScreen };
|
||||
@@ -1,16 +1,16 @@
|
||||
import React, { Component } from 'react';
|
||||
import { View, Button, TextInput, StyleSheet } from 'react-native';
|
||||
import { connect } from 'react-redux'
|
||||
import { Log } from 'lib/log.js'
|
||||
import { ActionButton } from 'lib/components/action-button.js';
|
||||
import { Folder } from 'lib/models/folder.js'
|
||||
import { BaseModel } from 'lib/base-model.js'
|
||||
import { ScreenHeader } from 'lib/components/screen-header.js';
|
||||
import { reg } from 'lib/registry.js';
|
||||
import { BaseScreenComponent } from 'lib/components/base-screen.js';
|
||||
import { dialogs } from 'lib/dialogs.js';
|
||||
import { themeStyle } from 'lib/components/global-style.js';
|
||||
import { _ } from 'lib/locale.js';
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { View, Button, TextInput, StyleSheet } = require('react-native');
|
||||
const { connect } = require('react-redux');
|
||||
const { Log } = require('lib/log.js');
|
||||
const { ActionButton } = require('lib/components/action-button.js');
|
||||
const { Folder } = require('lib/models/folder.js');
|
||||
const { BaseModel } = require('lib/base-model.js');
|
||||
const { ScreenHeader } = require('lib/components/screen-header.js');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const { BaseScreenComponent } = require('lib/components/base-screen.js');
|
||||
const { dialogs } = require('lib/dialogs.js');
|
||||
const { themeStyle } = require('lib/components/global-style.js');
|
||||
const { _ } = require('lib/locale.js');
|
||||
|
||||
class FolderScreenComponent extends BaseScreenComponent {
|
||||
|
||||
@@ -36,6 +36,7 @@ class FolderScreenComponent extends BaseScreenComponent {
|
||||
let styles = {
|
||||
textInput: {
|
||||
color: theme.color,
|
||||
paddingLeft: 10,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -129,4 +130,4 @@ const FolderScreen = connect(
|
||||
}
|
||||
)(FolderScreenComponent)
|
||||
|
||||
export { FolderScreen };
|
||||
module.exports = { FolderScreen };
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Folder } from 'lib/models/folder.js'
|
||||
|
||||
class FoldersScreenUtils {
|
||||
|
||||
static async refreshFolders() {
|
||||
let initialFolders = await Folder.all({ includeConflictFolder: true });
|
||||
this.dispatch({
|
||||
type: 'FOLDERS_UPDATE_ALL',
|
||||
folders: initialFolders,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export { FoldersScreenUtils }
|
||||
@@ -1,14 +1,14 @@
|
||||
import React, { Component } from 'react';
|
||||
import { ListView, View, Text, Button, StyleSheet } from 'react-native';
|
||||
import { connect } from 'react-redux'
|
||||
import { Log } from 'lib/log.js'
|
||||
import { reg } from 'lib/registry.js'
|
||||
import { ScreenHeader } from 'lib/components/screen-header.js';
|
||||
import { time } from 'lib/time-utils'
|
||||
import { themeStyle } from 'lib/components/global-style.js';
|
||||
import { Logger } from 'lib/logger.js';
|
||||
import { BaseScreenComponent } from 'lib/components/base-screen.js';
|
||||
import { _ } from 'lib/locale.js';
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { ListView, View, Text, Button, StyleSheet } = require('react-native');
|
||||
const { connect } = require('react-redux');
|
||||
const { Log } = require('lib/log.js');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const { ScreenHeader } = require('lib/components/screen-header.js');
|
||||
const { time } = require('lib/time-utils');
|
||||
const { themeStyle } = require('lib/components/global-style.js');
|
||||
const { Logger } = require('lib/logger.js');
|
||||
const { BaseScreenComponent } = require('lib/components/base-screen.js');
|
||||
const { _ } = require('lib/locale.js');
|
||||
|
||||
class LogScreenComponent extends BaseScreenComponent {
|
||||
|
||||
@@ -106,4 +106,4 @@ const LogScreen = connect(
|
||||
}
|
||||
)(LogScreenComponent)
|
||||
|
||||
export { LogScreen };
|
||||
module.exports = { LogScreen };
|
||||
@@ -1,30 +1,36 @@
|
||||
import React, { Component } from 'react';
|
||||
import { Keyboard, BackHandler, View, Button, TextInput, WebView, Text, StyleSheet, Linking, Image } from 'react-native';
|
||||
import { connect } from 'react-redux'
|
||||
import { uuid } from 'lib/uuid.js';
|
||||
import { Log } from 'lib/log.js'
|
||||
import { Note } from 'lib/models/note.js'
|
||||
import { Resource } from 'lib/models/resource.js'
|
||||
import { Folder } from 'lib/models/folder.js'
|
||||
import { BackButtonService } from 'lib/services/back-button.js';
|
||||
import { BaseModel } from 'lib/base-model.js'
|
||||
import { ActionButton } from 'lib/components/action-button.js';
|
||||
import Icon from 'react-native-vector-icons/Ionicons';
|
||||
import { ScreenHeader } from 'lib/components/screen-header.js';
|
||||
import { time } from 'lib/time-utils.js';
|
||||
import { Checkbox } from 'lib/components/checkbox.js'
|
||||
import { _ } from 'lib/locale.js';
|
||||
import { reg } from 'lib/registry.js';
|
||||
import { shim } from 'lib/shim.js';
|
||||
import { BaseScreenComponent } from 'lib/components/base-screen.js';
|
||||
import { dialogs } from 'lib/dialogs.js';
|
||||
import { globalStyle, themeStyle } from 'lib/components/global-style.js';
|
||||
import DialogBox from 'react-native-dialogbox';
|
||||
import { NoteBodyViewer } from 'lib/components/note-body-viewer.js';
|
||||
import RNFetchBlob from 'react-native-fetch-blob';
|
||||
import { DocumentPicker, DocumentPickerUtil } from 'react-native-document-picker';
|
||||
import ImageResizer from 'react-native-image-resizer';
|
||||
import { SelectDateTimeDialog } from 'lib/components/select-date-time-dialog.js';
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { Platform, Keyboard, BackHandler, View, Button, TextInput, WebView, Text, StyleSheet, Linking, Image } = require('react-native');
|
||||
const { connect } = require('react-redux');
|
||||
const { uuid } = require('lib/uuid.js');
|
||||
const { Log } = require('lib/log.js');
|
||||
const RNFS = require('react-native-fs');
|
||||
const { Note } = require('lib/models/note.js');
|
||||
const { Setting } = require('lib/models/setting.js');
|
||||
const { Resource } = require('lib/models/resource.js');
|
||||
const { Folder } = require('lib/models/folder.js');
|
||||
const { BackButtonService } = require('lib/services/back-button.js');
|
||||
const { BaseModel } = require('lib/base-model.js');
|
||||
const { ActionButton } = require('lib/components/action-button.js');
|
||||
const Icon = require('react-native-vector-icons/Ionicons').default;
|
||||
const { fileExtension, basename } = require('lib/path-utils.js');
|
||||
const mimeUtils = require('lib/mime-utils.js').mime;
|
||||
const { ScreenHeader } = require('lib/components/screen-header.js');
|
||||
const { time } = require('lib/time-utils.js');
|
||||
const { Checkbox } = require('lib/components/checkbox.js');
|
||||
const { _ } = require('lib/locale.js');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const { shim } = require('lib/shim.js');
|
||||
const { BaseScreenComponent } = require('lib/components/base-screen.js');
|
||||
const { dialogs } = require('lib/dialogs.js');
|
||||
const { globalStyle, themeStyle } = require('lib/components/global-style.js');
|
||||
const DialogBox = require('react-native-dialogbox').default;
|
||||
const { NoteBodyViewer } = require('lib/components/note-body-viewer.js');
|
||||
const RNFetchBlob = require('react-native-fetch-blob').default;
|
||||
const { DocumentPicker, DocumentPickerUtil } = require('react-native-document-picker');
|
||||
const ImageResizer = require('react-native-image-resizer').default;
|
||||
const shared = require('lib/components/shared/note-screen-shared.js');
|
||||
const ImagePicker = require('react-native-image-picker');
|
||||
const { SelectDateTimeDialog } = require('lib/components/select-date-time-dialog.js');
|
||||
|
||||
class NoteScreenComponent extends BaseScreenComponent {
|
||||
|
||||
@@ -42,11 +48,13 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
folder: null,
|
||||
lastSavedNote: null,
|
||||
isLoading: true,
|
||||
resources: {},
|
||||
titleTextInputHeight: 20,
|
||||
alarmDialogShown: false,
|
||||
};
|
||||
|
||||
// iOS doesn't support multiline text fields properly so disable it
|
||||
this.enableMultilineTitle_ = Platform.OS !== 'ios';
|
||||
|
||||
this.saveButtonHasBeenShown_ = false;
|
||||
|
||||
this.styles_ = {};
|
||||
@@ -130,123 +138,41 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
}
|
||||
|
||||
isModified() {
|
||||
if (!this.state.note || !this.state.lastSavedNote) return false;
|
||||
let diff = BaseModel.diffObjects(this.state.note, this.state.lastSavedNote);
|
||||
delete diff.type_;
|
||||
return !!Object.getOwnPropertyNames(diff).length;
|
||||
return shared.isModified(this);
|
||||
}
|
||||
|
||||
async componentWillMount() {
|
||||
BackButtonService.addHandler(this.backHandler);
|
||||
|
||||
let note = null;
|
||||
let mode = 'view';
|
||||
if (!this.props.noteId) {
|
||||
note = this.props.itemType == 'todo' ? Note.newTodo(this.props.folderId) : Note.new(this.props.folderId);
|
||||
mode = 'edit';
|
||||
} else {
|
||||
note = await Note.load(this.props.noteId);
|
||||
}
|
||||
|
||||
const folder = Folder.byId(this.props.folders, note.parent_id);
|
||||
|
||||
this.setState({
|
||||
lastSavedNote: Object.assign({}, note),
|
||||
note: note,
|
||||
mode: mode,
|
||||
folder: folder,
|
||||
isLoading: false,
|
||||
});
|
||||
await shared.initState(this);
|
||||
|
||||
this.refreshNoteMetadata();
|
||||
}
|
||||
|
||||
refreshNoteMetadata(force = null) {
|
||||
return shared.refreshNoteMetadata(this, force);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
BackButtonService.removeHandler(this.backHandler);
|
||||
}
|
||||
|
||||
noteComponent_change(propName, propValue) {
|
||||
let note = Object.assign({}, this.state.note);
|
||||
note[propName] = propValue;
|
||||
this.setState({ note: note });
|
||||
}
|
||||
|
||||
async refreshNoteMetadata(force = null) {
|
||||
if (force !== true && !this.state.showNoteMetadata) return;
|
||||
|
||||
let noteMetadata = await Note.serializeAllProps(this.state.note);
|
||||
this.setState({ noteMetadata: noteMetadata });
|
||||
}
|
||||
|
||||
title_changeText(text) {
|
||||
this.noteComponent_change('title', text);
|
||||
shared.noteComponent_change(this, 'title', text);
|
||||
}
|
||||
|
||||
body_changeText(text) {
|
||||
this.noteComponent_change('body', text);
|
||||
}
|
||||
|
||||
async noteExists(noteId) {
|
||||
const existingNote = await Note.load(noteId);
|
||||
return !!existingNote;
|
||||
shared.noteComponent_change(this, 'body', text);
|
||||
}
|
||||
|
||||
async saveNoteButton_press() {
|
||||
let note = Object.assign({}, this.state.note);
|
||||
await shared.saveNoteButton_press(this);
|
||||
|
||||
// Note has been deleted while user was modifying it. In that, we
|
||||
// just save a new note by clearing the note ID.
|
||||
if (note.id && !(await this.noteExists(note.id))) delete note.id;
|
||||
|
||||
reg.logger().info('Saving note: ', note);
|
||||
|
||||
if (!note.parent_id) {
|
||||
let folder = await Folder.defaultFolder();
|
||||
if (!folder) {
|
||||
Log.warn('Cannot save note without a notebook');
|
||||
return;
|
||||
}
|
||||
note.parent_id = folder.id;
|
||||
}
|
||||
|
||||
let isNew = !note.id;
|
||||
|
||||
if (isNew && !note.title) {
|
||||
note.title = Note.defaultTitle(note);
|
||||
}
|
||||
|
||||
note = await Note.save(note);
|
||||
this.setState({
|
||||
lastSavedNote: Object.assign({}, note),
|
||||
note: note,
|
||||
});
|
||||
if (isNew) Note.updateGeolocation(note.id);
|
||||
this.refreshNoteMetadata();
|
||||
Keyboard.dismiss();
|
||||
}
|
||||
|
||||
async saveOneProperty(name, value) {
|
||||
let note = Object.assign({}, this.state.note);
|
||||
|
||||
// Note has been deleted while user was modifying it. In that, we
|
||||
// just save a new note by clearing the note ID.
|
||||
if (note.id && !(await this.noteExists(note.id))) delete note.id;
|
||||
|
||||
reg.logger().info('Saving note property: ', note.id, name, value);
|
||||
|
||||
if (note.id) {
|
||||
let toSave = { id: note.id };
|
||||
toSave[name] = value;
|
||||
toSave = await Note.save(toSave);
|
||||
note[name] = toSave[name];
|
||||
|
||||
this.setState({
|
||||
lastSavedNote: Object.assign({}, note),
|
||||
note: note,
|
||||
});
|
||||
} else {
|
||||
note[name] = value;
|
||||
this.setState({ note: note });
|
||||
}
|
||||
await shared.saveOneProperty(this, name, value);
|
||||
}
|
||||
|
||||
async deleteNote_onPress() {
|
||||
@@ -269,9 +195,12 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
|
||||
async pickDocument() {
|
||||
return new Promise((resolve, reject) => {
|
||||
DocumentPicker.show({ filetype: [DocumentPickerUtil.images()] }, (error,res) => {
|
||||
DocumentPicker.show({ filetype: [DocumentPickerUtil.allFiles()] }, (error,res) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
// Also returns an error if the user doesn't pick a file
|
||||
// so just resolve with null.
|
||||
console.info('pickDocument error:', error);
|
||||
resolve(null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -288,51 +217,100 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
});
|
||||
}
|
||||
|
||||
async attachFile_onPress() {
|
||||
const res = await this.pickDocument();
|
||||
showImagePicker(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ImagePicker.showImagePicker(options, (response) => {
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const localFilePath = res.uri;
|
||||
async resizeImage(localFilePath, targetPath, mimeType) {
|
||||
const maxSize = Resource.IMAGE_MAX_DIMENSION;
|
||||
|
||||
let dimensions = await this.imageDimensions(localFilePath);
|
||||
|
||||
reg.logger().info('Original dimensions ', dimensions);
|
||||
if (dimensions.width > maxSize || dimensions.height > maxSize) {
|
||||
dimensions.width = maxSize;
|
||||
dimensions.height = maxSize;
|
||||
}
|
||||
reg.logger().info('New dimensions ', dimensions);
|
||||
|
||||
const format = mimeType == 'image/png' ? 'PNG' : 'JPEG';
|
||||
reg.logger().info('Resizing image ' + localFilePath);
|
||||
const resizedImage = await ImageResizer.createResizedImage(localFilePath, dimensions.width, dimensions.height, format, 85); //, 0, targetPath);
|
||||
|
||||
const resizedImagePath = resizedImage.uri;
|
||||
reg.logger().info('Resized image ', resizedImagePath);
|
||||
reg.logger().info('Moving ' + resizedImagePath + ' => ' + targetPath);
|
||||
|
||||
await RNFS.copyFile(resizedImagePath, targetPath);
|
||||
|
||||
try {
|
||||
await RNFS.unlink(resizedImagePath);
|
||||
} catch (error) {
|
||||
reg.logger().warn('Error when unlinking cached file: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
async attachFile(pickerResponse, fileType) {
|
||||
if (!pickerResponse) {
|
||||
reg.logger().warn('Got no response from picker');
|
||||
return;
|
||||
}
|
||||
|
||||
if (pickerResponse.error) {
|
||||
reg.logger().warn('Got error from picker', pickerResponse.error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pickerResponse.didCancel) {
|
||||
reg.logger().info('User cancelled picker');
|
||||
return;
|
||||
}
|
||||
|
||||
const localFilePath = pickerResponse.uri;
|
||||
let mimeType = pickerResponse.type;
|
||||
|
||||
if (!mimeType) {
|
||||
const ext = fileExtension(localFilePath);
|
||||
mimeType = mimeUtils.fromFileExtension(ext);
|
||||
}
|
||||
|
||||
if (!mimeType && fileType === 'image') {
|
||||
// Assume JPEG if we couldn't determine the file type. It seems to happen with the image picker
|
||||
// when the file path is something like content://media/external/images/media/123456
|
||||
// If the image is not a JPEG, something will throw an error below, but there's a good chance
|
||||
// it will work.
|
||||
reg.logger().info('Missing file type and could not detect it - assuming image/jpg');
|
||||
mimeType = 'image/jpg';
|
||||
}
|
||||
|
||||
reg.logger().info('Got file: ' + localFilePath);
|
||||
reg.logger().info('Got type: ' + res.type);
|
||||
|
||||
// res.uri,
|
||||
// res.type, // mime type
|
||||
// res.fileName,
|
||||
// res.fileSize
|
||||
reg.logger().info('Got type: ' + mimeType);
|
||||
|
||||
let resource = Resource.new();
|
||||
resource.id = uuid.create();
|
||||
resource.mime = res.type;
|
||||
resource.title = res.fileName ? res.fileName : _('Untitled');
|
||||
resource.mime = mimeType;
|
||||
resource.title = pickerResponse.fileName ? pickerResponse.fileName : _('Untitled');
|
||||
|
||||
let targetPath = Resource.fullPath(resource);
|
||||
|
||||
if (res.type == 'image/jpeg' || res.type == 'image/jpg' || res.type == 'image/png') {
|
||||
const maxSize = 1920;
|
||||
|
||||
let dimensions = await this.imageDimensions(localFilePath);
|
||||
|
||||
reg.logger().info('Original dimensions ', dimensions);
|
||||
if (dimensions.width > maxSize || dimensions.height > maxSize) {
|
||||
dimensions.width = maxSize;
|
||||
dimensions.height = maxSize;
|
||||
try {
|
||||
if (mimeType == 'image/jpeg' || mimeType == 'image/jpg' || mimeType == 'image/png') {
|
||||
await this.resizeImage(localFilePath, targetPath, pickerResponse.mime);
|
||||
} else {
|
||||
if (fileType === 'image') {
|
||||
dialogs.error(this, _('Unsupported image type: %s', mimeType));
|
||||
return;
|
||||
} else {
|
||||
await RNFetchBlob.fs.cp(localFilePath, targetPath);
|
||||
}
|
||||
}
|
||||
reg.logger().info('New dimensions ', dimensions);
|
||||
|
||||
const format = res.type == 'image/png' ? 'PNG' : 'JPEG';
|
||||
reg.logger().info('Resizing image ' + localFilePath);
|
||||
const resizedImagePath = await ImageResizer.createResizedImage(localFilePath, dimensions.width, dimensions.height, format, 85);
|
||||
reg.logger().info('Resized image ', resizedImagePath);
|
||||
RNFetchBlob.fs.cp(resizedImagePath, targetPath); // mv doesn't work ("source path does not exist") so need to do cp and unlink
|
||||
|
||||
try {
|
||||
RNFetchBlob.fs.unlink(resizedImagePath);
|
||||
} catch (error) {
|
||||
reg.logger().info('Error when unlinking cached file: ', error);
|
||||
}
|
||||
} else {
|
||||
RNFetchBlob.fs.cp(localFilePath, targetPath);
|
||||
} catch (error) {
|
||||
reg.logger().warn('Could not attach file:', error);
|
||||
return;
|
||||
}
|
||||
|
||||
await Resource.save(resource, { isNew: true });
|
||||
@@ -344,10 +322,21 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
this.setState({ note: newNote });
|
||||
}
|
||||
|
||||
async attachImage_onPress() {
|
||||
const options = {
|
||||
mediaType: 'photo',
|
||||
};
|
||||
const response = await this.showImagePicker(options);
|
||||
await this.attachFile(response, 'image');
|
||||
}
|
||||
|
||||
async attachFile_onPress() {
|
||||
const response = await this.pickDocument();
|
||||
await this.attachFile(response, 'all');
|
||||
}
|
||||
|
||||
toggleIsTodo_onPress() {
|
||||
let newNote = Note.toggleIsTodo(this.state.note);
|
||||
let newState = { note: newNote };
|
||||
this.setState(newState);
|
||||
shared.toggleIsTodo_onPress(this);
|
||||
}
|
||||
|
||||
setAlarm_onPress() {
|
||||
@@ -371,8 +360,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
}
|
||||
|
||||
showMetadata_onPress() {
|
||||
this.setState({ showNoteMetadata: !this.state.showNoteMetadata });
|
||||
this.refreshNoteMetadata(true);
|
||||
shared.showMetadata_onPress(this);
|
||||
}
|
||||
|
||||
async showOnMap_onPress() {
|
||||
@@ -389,14 +377,31 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
|
||||
menuOptions() {
|
||||
const note = this.state.note;
|
||||
const isTodo = note && !!note.is_todo;
|
||||
|
||||
return [
|
||||
{ title: _('Attach file'), onPress: () => { this.attachFile_onPress(); } },
|
||||
{ title: _('Delete note'), onPress: () => { this.deleteNote_onPress(); } },
|
||||
{ title: note && !!note.is_todo ? _('Convert to regular note') : _('Convert to todo'), onPress: () => { this.toggleIsTodo_onPress(); } },
|
||||
{ title: this.state.showNoteMetadata ? _('Hide metadata') : _('Show metadata'), onPress: () => { this.showMetadata_onPress(); } },
|
||||
{ title: _('View location on map'), onPress: () => { this.showOnMap_onPress(); } },
|
||||
];
|
||||
let output = [];
|
||||
|
||||
// The file attachement modules only work in Android >= 5 (Version 21)
|
||||
// https://github.com/react-community/react-native-image-picker/issues/606
|
||||
let canAttachPicture = true;
|
||||
if (Platform.OS === 'android' && Platform.Version < 21) canAttachPicture = false;
|
||||
if (canAttachPicture) {
|
||||
output.push({ title: _('Attach image'), onPress: () => { this.attachImage_onPress(); } });
|
||||
output.push({ title: _('Attach any other file'), onPress: () => { this.attachFile_onPress(); } });
|
||||
}
|
||||
output.push({ title: _('Delete note'), onPress: () => { this.deleteNote_onPress(); } });
|
||||
output.push({ title: _('Alarm'), onPress: () => { this.setState({ alarmDialogShown: true }) }});;
|
||||
|
||||
// if (isTodo) {
|
||||
// let text = note.todo_due ? _('Edit/Clear alarm') : _('Set an alarm');
|
||||
// output.push({ title: text, onPress: () => { this.setAlarm_onPress(); } });
|
||||
// }
|
||||
|
||||
output.push({ title: isTodo ? _('Convert to regular note') : _('Convert to todo'), onPress: () => { this.toggleIsTodo_onPress(); } });
|
||||
if (this.props.showAdvancedOptions) output.push({ title: this.state.showNoteMetadata ? _('Hide metadata') : _('Show metadata'), onPress: () => { this.showMetadata_onPress(); } });
|
||||
output.push({ title: _('View location on map'), onPress: () => { this.showOnMap_onPress(); } });
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
async todoCheckbox_change(checked) {
|
||||
@@ -404,6 +409,8 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
}
|
||||
|
||||
titleTextInput_contentSizeChange(event) {
|
||||
if (!this.enableMultilineTitle_) return;
|
||||
|
||||
let height = event.nativeEvent.contentSize.height;
|
||||
this.setState({ titleTextInputHeight: height });
|
||||
}
|
||||
@@ -432,6 +439,9 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
bodyComponent = <NoteBodyViewer style={this.styles().noteBodyViewer} webViewStyle={theme} note={note} onCheckboxChange={(newBody) => { onCheckboxChange(newBody) }}/>
|
||||
} else {
|
||||
const focusBody = !isNew && !!note.title;
|
||||
|
||||
// Note: blurOnSubmit is necessary to get multiline to work.
|
||||
// See https://github.com/facebook/react-native/issues/12717#issuecomment-327001997
|
||||
bodyComponent = (
|
||||
<TextInput
|
||||
autoCapitalize="sentences"
|
||||
@@ -440,6 +450,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
multiline={true}
|
||||
value={note.body}
|
||||
onChangeText={(text) => this.body_changeText(text)}
|
||||
blurOnSubmit={false}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -460,15 +471,6 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
return <ActionButton multiStates={true} buttons={buttons} buttonIndex={0} />
|
||||
}
|
||||
|
||||
const titlePickerItems = () => {
|
||||
let output = [];
|
||||
for (let i = 0; i < this.props.folders.length; i++) {
|
||||
let f = this.props.folders[i];
|
||||
output.push({ label: f.title, value: f.id });
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
const actionButtonComp = renderActionButton();
|
||||
|
||||
let showSaveButton = this.state.mode == 'edit' || this.isModified() || this.saveButtonHasBeenShown_;
|
||||
@@ -485,14 +487,18 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
backgroundColor: theme.backgroundColor,
|
||||
fontWeight: 'bold',
|
||||
fontSize: theme.fontSize,
|
||||
paddingTop: 10, // Added for iOS (Not needed for Android??)
|
||||
paddingBottom: 10, // Added for iOS (Not needed for Android??)
|
||||
};
|
||||
|
||||
titleTextInputStyle.height = this.state.titleTextInputHeight;
|
||||
if (this.enableMultilineTitle_) titleTextInputStyle.height = this.state.titleTextInputHeight;
|
||||
|
||||
let checkboxStyle = {
|
||||
color: theme.color,
|
||||
paddingRight: 10,
|
||||
paddingLeft: theme.marginLeft,
|
||||
paddingTop: 10, // Added for iOS (Not needed for Android??)
|
||||
paddingBottom: 10, // Added for iOS (Not needed for Android??)
|
||||
}
|
||||
|
||||
const dueDate = isTodo && note.todo_due ? new Date(note.todo_due) : null;
|
||||
@@ -503,7 +509,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
<TextInput
|
||||
onContentSizeChange={(event) => this.titleTextInput_contentSizeChange(event)}
|
||||
autoFocus={isNew}
|
||||
multiline={true}
|
||||
multiline={this.enableMultilineTitle_}
|
||||
underlineColorAndroid="#ffffff00"
|
||||
autoCapitalize="sentences"
|
||||
style={titleTextInputStyle}
|
||||
@@ -516,19 +522,10 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
return (
|
||||
<View style={this.rootStyle(this.props.theme).root}>
|
||||
<ScreenHeader
|
||||
titlePicker={{
|
||||
items: titlePickerItems(),
|
||||
selectedValue: folder ? folder.id : null,
|
||||
folderPickerOptions={{
|
||||
enabled: true,
|
||||
selectedFolderId: folder ? folder.id : null,
|
||||
onValueChange: async (itemValue, itemIndex) => {
|
||||
let note = Object.assign({}, this.state.note);
|
||||
|
||||
// RN bug: https://github.com/facebook/react-native/issues/9220
|
||||
// The Picker fires the onValueChange when the component is initialized
|
||||
// so we need to check that it has actually changed.
|
||||
if (note.parent_id == itemValue) return;
|
||||
|
||||
reg.logger().info('Moving note: ' + note.parent_id + ' => ' + itemValue);
|
||||
|
||||
if (note.id) await Note.moveToFolder(note.id, itemValue);
|
||||
note.parent_id = itemValue;
|
||||
|
||||
@@ -539,7 +536,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
note: note,
|
||||
folder: folder,
|
||||
});
|
||||
}
|
||||
},
|
||||
}}
|
||||
menuOptions={this.menuOptions()}
|
||||
showSaveButton={showSaveButton}
|
||||
@@ -568,13 +565,14 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
const NoteScreen = connect(
|
||||
(state) => {
|
||||
return {
|
||||
noteId: state.selectedNoteId,
|
||||
noteId: state.selectedNoteIds.length ? state.selectedNoteIds[0] : null,
|
||||
folderId: state.selectedFolderId,
|
||||
itemType: state.selectedItemType,
|
||||
folders: state.folders,
|
||||
theme: state.settings.theme,
|
||||
showAdvancedOptions: state.settings.showAdvancedOptions,
|
||||
};
|
||||
}
|
||||
)(NoteScreenComponent)
|
||||
|
||||
export { NoteScreen };
|
||||
module.exports = { NoteScreen };
|
||||
@@ -1,21 +1,21 @@
|
||||
import React, { Component } from 'react';
|
||||
import { View, Button, Picker } from 'react-native';
|
||||
import { connect } from 'react-redux'
|
||||
import { reg } from 'lib/registry.js';
|
||||
import { Log } from 'lib/log.js'
|
||||
import { NoteList } from 'lib/components/note-list.js'
|
||||
import { Folder } from 'lib/models/folder.js'
|
||||
import { Tag } from 'lib/models/tag.js'
|
||||
import { Note } from 'lib/models/note.js'
|
||||
import { Setting } from 'lib/models/setting.js'
|
||||
import { themeStyle } from 'lib/components/global-style.js';
|
||||
import { ScreenHeader } from 'lib/components/screen-header.js';
|
||||
import { MenuOption, Text } from 'react-native-popup-menu';
|
||||
import { _ } from 'lib/locale.js';
|
||||
import { ActionButton } from 'lib/components/action-button.js';
|
||||
import { dialogs } from 'lib/dialogs.js';
|
||||
import DialogBox from 'react-native-dialogbox';
|
||||
import { BaseScreenComponent } from 'lib/components/base-screen.js';
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { View, Button } = require('react-native');
|
||||
const { connect } = require('react-redux');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const { Log } = require('lib/log.js');
|
||||
const { NoteList } = require('lib/components/note-list.js');
|
||||
const { Folder } = require('lib/models/folder.js');
|
||||
const { Tag } = require('lib/models/tag.js');
|
||||
const { Note } = require('lib/models/note.js');
|
||||
const { Setting } = require('lib/models/setting.js');
|
||||
const { themeStyle } = require('lib/components/global-style.js');
|
||||
const { ScreenHeader } = require('lib/components/screen-header.js');
|
||||
const { MenuOption, Text } = require('react-native-popup-menu');
|
||||
const { _ } = require('lib/locale.js');
|
||||
const { ActionButton } = require('lib/components/action-button.js');
|
||||
const { dialogs } = require('lib/dialogs.js');
|
||||
const DialogBox = require('react-native-dialogbox').default;
|
||||
const { BaseScreenComponent } = require('lib/components/base-screen.js');
|
||||
|
||||
class NotesScreenComponent extends BaseScreenComponent {
|
||||
|
||||
@@ -62,7 +62,7 @@ class NotesScreenComponent extends BaseScreenComponent {
|
||||
}
|
||||
|
||||
this.props.dispatch({
|
||||
type: 'NOTES_UPDATE_ALL',
|
||||
type: 'NOTE_UPDATE_ALL',
|
||||
notes: notes,
|
||||
notesSource: source,
|
||||
});
|
||||
@@ -142,12 +142,22 @@ class NotesScreenComponent extends BaseScreenComponent {
|
||||
|
||||
let title = parent ? parent.title : null;
|
||||
const addFolderNoteButtons = this.props.selectedFolderId && this.props.selectedFolderId != Folder.conflictFolderId();
|
||||
const thisComp = this;
|
||||
const actionButtonComp = this.props.noteSelectionEnabled ? null : <ActionButton addFolderNoteButtons={addFolderNoteButtons} parentFolderId={this.props.selectedFolderId}></ActionButton>
|
||||
|
||||
return (
|
||||
<View style={rootStyle}>
|
||||
<ScreenHeader title={title} menuOptions={this.menuOptions()} />
|
||||
<ScreenHeader
|
||||
title={title}
|
||||
menuOptions={this.menuOptions()}
|
||||
parentComponent={thisComp}
|
||||
folderPickerOptions={{
|
||||
enabled: this.props.noteSelectionEnabled,
|
||||
mustSelect: true,
|
||||
}}
|
||||
/>
|
||||
<NoteList style={{flex: 1}}/>
|
||||
<ActionButton addFolderNoteButtons={addFolderNoteButtons} parentFolderId={this.props.selectedFolderId}></ActionButton>
|
||||
{ actionButtonComp }
|
||||
<DialogBox ref={dialogbox => { this.dialogbox = dialogbox }}/>
|
||||
</View>
|
||||
);
|
||||
@@ -160,6 +170,7 @@ const NotesScreen = connect(
|
||||
folders: state.folders,
|
||||
tags: state.tags,
|
||||
selectedFolderId: state.selectedFolderId,
|
||||
selectedNoteIds: state.selectedNoteIds,
|
||||
selectedTagId: state.selectedTagId,
|
||||
notesParentType: state.notesParentType,
|
||||
notes: state.notes,
|
||||
@@ -167,8 +178,9 @@ const NotesScreen = connect(
|
||||
notesSource: state.notesSource,
|
||||
uncompletedTodosOnTop: state.settings.uncompletedTodosOnTop,
|
||||
theme: state.settings.theme,
|
||||
noteSelectionEnabled: state.noteSelectionEnabled,
|
||||
};
|
||||
}
|
||||
)(NotesScreenComponent)
|
||||
|
||||
export { NotesScreen };
|
||||
module.exports = { NotesScreen };
|
||||
@@ -1,13 +1,13 @@
|
||||
import React, { Component } from 'react';
|
||||
import { View } 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'
|
||||
import { ScreenHeader } from 'lib/components/screen-header.js';
|
||||
import { reg } from 'lib/registry.js';
|
||||
import { _ } from 'lib/locale.js';
|
||||
import { BaseScreenComponent } from 'lib/components/base-screen.js';
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { View } = require('react-native');
|
||||
const { WebView, Button, Text } = require('react-native');
|
||||
const { connect } = require('react-redux');
|
||||
const { Log } = require('lib/log.js');
|
||||
const { Setting } = require('lib/models/setting.js');
|
||||
const { ScreenHeader } = require('lib/components/screen-header.js');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const { _ } = require('lib/locale.js');
|
||||
const { BaseScreenComponent } = require('lib/components/base-screen.js');
|
||||
|
||||
class OneDriveLoginScreenComponent extends BaseScreenComponent {
|
||||
|
||||
@@ -28,11 +28,11 @@ class OneDriveLoginScreenComponent extends BaseScreenComponent {
|
||||
}
|
||||
|
||||
startUrl() {
|
||||
return reg.oneDriveApi().authCodeUrl(this.redirectUrl());
|
||||
return reg.syncTarget().api().authCodeUrl(this.redirectUrl());
|
||||
}
|
||||
|
||||
redirectUrl() {
|
||||
return 'https://login.microsoftonline.com/common/oauth2/nativeclient';
|
||||
return reg.syncTarget().api().nativeClientRedirectUrl();
|
||||
}
|
||||
|
||||
async webview_load(noIdeaWhatThisIs) {
|
||||
@@ -48,7 +48,7 @@ class OneDriveLoginScreenComponent extends BaseScreenComponent {
|
||||
this.authCode_ = code[1];
|
||||
|
||||
try {
|
||||
await reg.oneDriveApi().execTokenRequest(this.authCode_, this.redirectUrl(), true);
|
||||
await reg.syncTarget().api().execTokenRequest(this.authCode_, this.redirectUrl(), true);
|
||||
this.props.dispatch({ type: 'NAV_BACK' });
|
||||
reg.scheduleSync(0);
|
||||
} catch (error) {
|
||||
@@ -107,4 +107,4 @@ const OneDriveLoginScreen = connect(
|
||||
}
|
||||
)(OneDriveLoginScreenComponent)
|
||||
|
||||
export { OneDriveLoginScreen };
|
||||
module.exports = { OneDriveLoginScreen };
|
||||
@@ -1,13 +1,15 @@
|
||||
import React, { Component } from 'react';
|
||||
import { ListView, StyleSheet, View, TextInput, FlatList, TouchableHighlight } from 'react-native';
|
||||
import { connect } from 'react-redux'
|
||||
import { ScreenHeader } from 'lib/components/screen-header.js';
|
||||
import Icon from 'react-native-vector-icons/Ionicons';
|
||||
import { _ } from 'lib/locale.js';
|
||||
import { Note } from 'lib/models/note.js';
|
||||
import { NoteItem } from 'lib/components/note-item.js';
|
||||
import { BaseScreenComponent } from 'lib/components/base-screen.js';
|
||||
import { themeStyle } from 'lib/components/global-style.js';
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { ListView, StyleSheet, View, TextInput, FlatList, TouchableHighlight } = require('react-native');
|
||||
const { connect } = require('react-redux');
|
||||
const { ScreenHeader } = require('lib/components/screen-header.js');
|
||||
const Icon = require('react-native-vector-icons/Ionicons').default;
|
||||
const { _ } = require('lib/locale.js');
|
||||
const { Note } = require('lib/models/note.js');
|
||||
const { NoteItem } = require('lib/components/note-item.js');
|
||||
const { BaseScreenComponent } = require('lib/components/base-screen.js');
|
||||
const { themeStyle } = require('lib/components/global-style.js');
|
||||
const { dialogs } = require('lib/dialogs.js');
|
||||
const DialogBox = require('react-native-dialogbox').default;
|
||||
|
||||
class SearchScreenComponent extends BaseScreenComponent {
|
||||
|
||||
@@ -139,9 +141,18 @@ class SearchScreenComponent extends BaseScreenComponent {
|
||||
rootStyle.flex = 0.001; // This is a bit of a hack but it seems to work fine - it makes the component invisible but without unmounting it
|
||||
}
|
||||
|
||||
const thisComponent = this;
|
||||
|
||||
return (
|
||||
<View style={rootStyle}>
|
||||
<ScreenHeader title={_('Search')}/>
|
||||
<ScreenHeader
|
||||
title={_('Search')}
|
||||
parentComponent={thisComponent}
|
||||
folderPickerOptions={{
|
||||
enabled: this.props.noteSelectionEnabled,
|
||||
mustSelect: true,
|
||||
}}
|
||||
/>
|
||||
<View style={this.styles().body}>
|
||||
<View style={this.styles().searchContainer}>
|
||||
<TextInput
|
||||
@@ -163,6 +174,7 @@ class SearchScreenComponent extends BaseScreenComponent {
|
||||
renderItem={(event) => <NoteItem note={event.item}/>}
|
||||
/>
|
||||
</View>
|
||||
<DialogBox ref={dialogbox => { this.dialogbox = dialogbox }}/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -174,8 +186,9 @@ const SearchScreen = connect(
|
||||
return {
|
||||
query: state.searchQuery,
|
||||
theme: state.settings.theme,
|
||||
noteSelectionEnabled: state.noteSelectionEnabled,
|
||||
};
|
||||
}
|
||||
)(SearchScreenComponent)
|
||||
|
||||
export { SearchScreen };
|
||||
module.exports = { SearchScreen };
|
||||
@@ -1,19 +1,19 @@
|
||||
import React, { Component } from 'react';
|
||||
import { ListView, StyleSheet, View, Text, Button, FlatList } from 'react-native';
|
||||
import { Setting } from 'lib/models/setting.js';
|
||||
import { connect } from 'react-redux'
|
||||
import { Log } from 'lib/log.js'
|
||||
import { reg } from 'lib/registry.js'
|
||||
import { ScreenHeader } from 'lib/components/screen-header.js';
|
||||
import { time } from 'lib/time-utils'
|
||||
import { Logger } from 'lib/logger.js';
|
||||
import { BaseItem } from 'lib/models/base-item.js';
|
||||
import { Database } from 'lib/database.js';
|
||||
import { Folder } from 'lib/models/folder.js';
|
||||
import { ReportService } from 'lib/services/report.js';
|
||||
import { _ } from 'lib/locale.js';
|
||||
import { BaseScreenComponent } from 'lib/components/base-screen.js';
|
||||
import { globalStyle, themeStyle } from 'lib/components/global-style.js';
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { ListView, StyleSheet, View, Text, Button, FlatList } = require('react-native');
|
||||
const { Setting } = require('lib/models/setting.js');
|
||||
const { connect } = require('react-redux');
|
||||
const { Log } = require('lib/log.js');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const { ScreenHeader } = require('lib/components/screen-header.js');
|
||||
const { time } = require('lib/time-utils');
|
||||
const { Logger } = require('lib/logger.js');
|
||||
const { BaseItem } = require('lib/models/base-item.js');
|
||||
const { Database } = require('lib/database.js');
|
||||
const { Folder } = require('lib/models/folder.js');
|
||||
const { ReportService } = require('lib/services/report.js');
|
||||
const { _ } = require('lib/locale.js');
|
||||
const { BaseScreenComponent } = require('lib/components/base-screen.js');
|
||||
const { globalStyle, themeStyle } = require('lib/components/global-style.js');
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
body: {
|
||||
@@ -119,4 +119,4 @@ const StatusScreen = connect(
|
||||
}
|
||||
)(StatusScreenComponent)
|
||||
|
||||
export { StatusScreen };
|
||||
module.exports = { StatusScreen };
|
||||
@@ -1,13 +1,13 @@
|
||||
import React, { Component } from 'react';
|
||||
import { ListView, StyleSheet, View, TextInput, FlatList, TouchableHighlight } from 'react-native';
|
||||
import { connect } from 'react-redux'
|
||||
import { ScreenHeader } from 'lib/components/screen-header.js';
|
||||
import Icon from 'react-native-vector-icons/Ionicons';
|
||||
import { _ } from 'lib/locale.js';
|
||||
import { Note } from 'lib/models/note.js';
|
||||
import { NoteItem } from 'lib/components/note-item.js';
|
||||
import { BaseScreenComponent } from 'lib/components/base-screen.js';
|
||||
import { globalStyle } from 'lib/components/global-style.js';
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { ListView, StyleSheet, View, TextInput, FlatList, TouchableHighlight } = require('react-native');
|
||||
const { connect } = require('react-redux');
|
||||
const { ScreenHeader } = require('lib/components/screen-header.js');
|
||||
const Icon = require('react-native-vector-icons/Ionicons').default;
|
||||
const { _ } = require('lib/locale.js');
|
||||
const { Note } = require('lib/models/note.js');
|
||||
const { NoteItem } = require('lib/components/note-item.js');
|
||||
const { BaseScreenComponent } = require('lib/components/base-screen.js');
|
||||
const { globalStyle } = require('lib/components/global-style.js');
|
||||
|
||||
let styles = {
|
||||
body: {
|
||||
@@ -40,7 +40,7 @@ class TagScreenComponent extends BaseScreenComponent {
|
||||
const notes = await Tag.notes(props.selectedTagId);
|
||||
|
||||
this.props.dispatch({
|
||||
type: 'NOTES_UPDATE_ALL',
|
||||
type: 'NOTE_UPDATE_ALL',
|
||||
notes: notes,
|
||||
notesSource: source,
|
||||
});
|
||||
@@ -73,4 +73,4 @@ const TagScreen = connect(
|
||||
}
|
||||
)(TagScreenComponent)
|
||||
|
||||
export { TagScreen };
|
||||
module.exports = { TagScreen };
|
||||
@@ -1,12 +1,12 @@
|
||||
import React, { Component } from 'react';
|
||||
import { View, Text, StyleSheet } from 'react-native';
|
||||
import { connect } from 'react-redux'
|
||||
import { Log } from 'lib/log.js'
|
||||
import { ScreenHeader } from 'lib/components/screen-header.js';
|
||||
import { ActionButton } from 'lib/components/action-button.js';
|
||||
import { BaseScreenComponent } from 'lib/components/base-screen.js';
|
||||
import { _ } from 'lib/locale.js';
|
||||
import { themeStyle } from 'lib/components/global-style.js';
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { View, Text, StyleSheet } = require('react-native');
|
||||
const { connect } = require('react-redux');
|
||||
const { Log } = require('lib/log.js');
|
||||
const { ScreenHeader } = require('lib/components/screen-header.js');
|
||||
const { ActionButton } = require('lib/components/action-button.js');
|
||||
const { BaseScreenComponent } = require('lib/components/base-screen.js');
|
||||
const { _ } = require('lib/locale.js');
|
||||
const { themeStyle } = require('lib/components/global-style.js');
|
||||
|
||||
class WelcomeScreenComponent extends BaseScreenComponent {
|
||||
|
||||
@@ -61,4 +61,4 @@ const WelcomeScreen = connect(
|
||||
}
|
||||
)(WelcomeScreenComponent)
|
||||
|
||||
export { WelcomeScreen };
|
||||
module.exports = { WelcomeScreen };
|
||||
Reference in New Issue
Block a user