mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-27 08:21:03 +02:00
Clean up
This commit is contained in:
parent
e3a37ec2d6
commit
4e303be85f
@ -6,7 +6,7 @@
|
||||
"scripts": {
|
||||
"test": "gulp buildTests -L && node node_modules/jasmine/bin/jasmine.js --fail-fast=true --config=tests/support/jasmine.json",
|
||||
"test-ci": "gulp buildTests -L && node node_modules/jasmine/bin/jasmine.js --config=tests/support/jasmine.json",
|
||||
"postinstall": "npm run build && patch-package --patch-dir ../patches",
|
||||
"postinstall": "npm run build && patch-package --patch-dir ../patches/shared && patch-package --patch-dir ../patches/node",
|
||||
"build": "gulp build",
|
||||
"start": "gulp build -L && node 'build/main.js' --stack-trace-enabled --log-level debug --env dev"
|
||||
},
|
||||
|
@ -154,7 +154,7 @@ describe('services_rest_Api', function() {
|
||||
expect(note.altitude).toBe('21.0000');
|
||||
}
|
||||
|
||||
await api.route('PUT', 'notes/' + noteId, null, JSON.stringify({
|
||||
await api.route('PUT', `notes/${noteId}`, null, JSON.stringify({
|
||||
latitude: '49',
|
||||
longitude: '-3',
|
||||
altitude: '22',
|
||||
|
@ -5,7 +5,7 @@
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"dist": "node_modules/.bin/electron-builder",
|
||||
"build": "patch-package --patch-dir ../patches && gulp build",
|
||||
"build": "patch-package --patch-dir ../patches/shared && patch-package --patch-dir ../patches/node && gulp build",
|
||||
"postinstall": "npm run build && gulp electronRebuild",
|
||||
"start": "gulp build && electron . --env dev --log-level debug --no-welcome --open-dev-tools"
|
||||
},
|
||||
|
@ -1,114 +0,0 @@
|
||||
/**
|
||||
* Sample React Native App
|
||||
* https://github.com/facebook/react-native
|
||||
*
|
||||
* @format
|
||||
* @flow strict-local
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {
|
||||
SafeAreaView,
|
||||
StyleSheet,
|
||||
ScrollView,
|
||||
View,
|
||||
Text,
|
||||
StatusBar,
|
||||
} from 'react-native';
|
||||
|
||||
import {
|
||||
Header,
|
||||
LearnMoreLinks,
|
||||
Colors,
|
||||
DebugInstructions,
|
||||
ReloadInstructions,
|
||||
} from 'react-native/Libraries/NewAppScreen';
|
||||
|
||||
const App: () => React$Node = () => {
|
||||
return (
|
||||
<>
|
||||
<StatusBar barStyle="dark-content" />
|
||||
<SafeAreaView>
|
||||
<ScrollView
|
||||
contentInsetAdjustmentBehavior="automatic"
|
||||
style={styles.scrollView}>
|
||||
<Header />
|
||||
{global.HermesInternal == null ? null : (
|
||||
<View style={styles.engine}>
|
||||
<Text style={styles.footer}>Engine: Hermes</Text>
|
||||
</View>
|
||||
)}
|
||||
<View style={styles.body}>
|
||||
<View style={styles.sectionContainer}>
|
||||
<Text style={styles.sectionTitle}>Step One</Text>
|
||||
<Text style={styles.sectionDescription}>
|
||||
Edit <Text style={styles.highlight}>App.js</Text> to change this
|
||||
screen and then come back to see your edits.
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.sectionContainer}>
|
||||
<Text style={styles.sectionTitle}>See Your Changes</Text>
|
||||
<Text style={styles.sectionDescription}>
|
||||
<ReloadInstructions />
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.sectionContainer}>
|
||||
<Text style={styles.sectionTitle}>Debug</Text>
|
||||
<Text style={styles.sectionDescription}>
|
||||
<DebugInstructions />
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.sectionContainer}>
|
||||
<Text style={styles.sectionTitle}>Learn More</Text>
|
||||
<Text style={styles.sectionDescription}>
|
||||
Read the docs to discover what to do next:
|
||||
</Text>
|
||||
</View>
|
||||
<LearnMoreLinks />
|
||||
</View>
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
scrollView: {
|
||||
backgroundColor: Colors.lighter,
|
||||
},
|
||||
engine: {
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
},
|
||||
body: {
|
||||
backgroundColor: Colors.white,
|
||||
},
|
||||
sectionContainer: {
|
||||
marginTop: 32,
|
||||
paddingHorizontal: 24,
|
||||
},
|
||||
sectionTitle: {
|
||||
fontSize: 24,
|
||||
fontWeight: '600',
|
||||
color: Colors.black,
|
||||
},
|
||||
sectionDescription: {
|
||||
marginTop: 8,
|
||||
fontSize: 18,
|
||||
fontWeight: '400',
|
||||
color: Colors.dark,
|
||||
},
|
||||
highlight: {
|
||||
fontWeight: '700',
|
||||
},
|
||||
footer: {
|
||||
color: Colors.dark,
|
||||
fontSize: 12,
|
||||
fontWeight: '600',
|
||||
padding: 4,
|
||||
paddingRight: 12,
|
||||
textAlign: 'right',
|
||||
},
|
||||
});
|
||||
|
||||
export default App;
|
@ -1,14 +0,0 @@
|
||||
/**
|
||||
* @format
|
||||
*/
|
||||
|
||||
import 'react-native';
|
||||
import React from 'react';
|
||||
import App from '../App';
|
||||
|
||||
// Note: test renderer must be required after react-native.
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
it('renders correctly', () => {
|
||||
renderer.create(<App />);
|
||||
});
|
@ -6,8 +6,8 @@
|
||||
|
||||
// So there's basically still a one way flux: React => SQLite => Redux => React
|
||||
|
||||
import {LogBox, AppRegistry} from 'react-native';
|
||||
const {Root} = require('./root.js');
|
||||
import { LogBox, AppRegistry } from 'react-native';
|
||||
const { Root } = require('./root.js');
|
||||
|
||||
// Seems JavaScript developers love adding warnings everywhere, even when these warnings can't be fixed
|
||||
// or don't really matter. Because we want important warnings to actually be fixed, we disable
|
||||
|
@ -36,7 +36,7 @@ export default class Cache {
|
||||
private checkExpiredRecords() {
|
||||
const now = Date.now();
|
||||
|
||||
for (let key in this.expirableKeys_) {
|
||||
for (const key in this.expirableKeys_) {
|
||||
if (!this.records_[key]) {
|
||||
delete this.expirableKeys_[key];
|
||||
} else {
|
||||
@ -68,7 +68,7 @@ export default class Cache {
|
||||
this.records_[key] = {
|
||||
value: value,
|
||||
expiredTime: ttl ? Date.now() + ttl : 0,
|
||||
}
|
||||
};
|
||||
|
||||
const idx = this.recordKeyHistory_.indexOf(key);
|
||||
if (idx >= 0) this.recordKeyHistory_.splice(idx, 1);
|
||||
|
@ -64,7 +64,7 @@ export default function NoteBodyViewer(props:Props) {
|
||||
}, [props.onLoadEnd]);
|
||||
|
||||
function onError() {
|
||||
reg.logger().error('WebView error')
|
||||
reg.logger().error('WebView error');
|
||||
}
|
||||
|
||||
// On iOS scalesPageToFit work like this:
|
||||
|
@ -4,7 +4,7 @@ const shared = require('lib/components/shared/note-screen-shared');
|
||||
export default function useOnMessage(onCheckboxChange:Function, noteBody:string, onMarkForDownload:Function, onJoplinLinkClick:Function, onResourceLongPress:Function) {
|
||||
return useCallback((event:any) => {
|
||||
// Since RN 58 (or 59) messages are now escaped twice???
|
||||
let msg = unescape(unescape(event.nativeEvent.data));
|
||||
const msg = unescape(unescape(event.nativeEvent.data));
|
||||
|
||||
console.info('Got IPC message: ', msg);
|
||||
|
||||
@ -20,7 +20,7 @@ export default function useOnMessage(onCheckboxChange:Function, noteBody:string,
|
||||
} else if (msg.startsWith('joplin:')) {
|
||||
onJoplinLinkClick(msg);
|
||||
} else if (msg.startsWith('error:')) {
|
||||
console.error('Webview injected script error: ' + msg);
|
||||
console.error(`Webview injected script error: ${msg}`);
|
||||
}
|
||||
}, [onCheckboxChange, noteBody, onMarkForDownload, onJoplinLinkClick, onResourceLongPress]);
|
||||
}
|
@ -9,7 +9,7 @@ const { dialogs } = require('lib/dialogs.js');
|
||||
const Resource = require('lib/models/Resource.js');
|
||||
const Share = require('react-native-share').default;
|
||||
|
||||
export default function onResourceLongPress(onJoplinLinkClick:Function, dialogBoxRef:any) {
|
||||
export default function useOnResourceLongPress(onJoplinLinkClick:Function, dialogBoxRef:any) {
|
||||
return useCallback(async (msg:string) => {
|
||||
try {
|
||||
const resourceId = msg.split(':')[1];
|
||||
|
@ -125,7 +125,7 @@ export default function useSource(noteBody:string, noteMarkupLanguage:number, th
|
||||
</html>
|
||||
`;
|
||||
|
||||
const tempFile = `${Setting.value('resourceDir')}/NoteBodyViewer.html`
|
||||
const tempFile = `${Setting.value('resourceDir')}/NoteBodyViewer.html`;
|
||||
await shim.fsDriver().writeFile(tempFile, html, 'utf8');
|
||||
|
||||
if (cancelled) return;
|
||||
@ -135,7 +135,7 @@ export default function useSource(noteBody:string, noteMarkupLanguage:number, th
|
||||
//
|
||||
// `baseUrl` is where the images will be loaded from. So images must use a path relative to resourceDir.
|
||||
setSource({
|
||||
uri: 'file://' + tempFile + '?r=' + Math.round(Math.random() * 100000000),
|
||||
uri: `file://${tempFile}?r=${Math.round(Math.random() * 100000000)}`,
|
||||
baseUrl: `file://${Setting.value('resourceDir')}/`,
|
||||
});
|
||||
|
||||
@ -158,7 +158,7 @@ export default function useSource(noteBody:string, noteMarkupLanguage:number, th
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
}
|
||||
};
|
||||
}, [resourceLoadedTime, noteBody, noteMarkupLanguage, themeId, rendererTheme, highlightedKeywords, noteResources, noteHash, isFirstRender]);
|
||||
|
||||
return { source, injectedJs };
|
||||
|
@ -60,7 +60,7 @@ class ActionButtonComponent extends React.Component {
|
||||
|
||||
renderIconMultiStates() {
|
||||
const button = this.props.buttons[this.state.buttonIndex];
|
||||
return <Icon name={button.icon} style={styles.actionButtonIcon} />
|
||||
return <Icon name={button.icon} style={styles.actionButtonIcon} />;
|
||||
}
|
||||
|
||||
renderIcon() {
|
||||
|
@ -322,7 +322,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
borderTopWidth: 1,
|
||||
borderBottomColor: theme.dividerColor,
|
||||
borderBottomWidth: 1,
|
||||
}
|
||||
};
|
||||
|
||||
styles.titleContainer = {
|
||||
flex: 0,
|
||||
|
@ -31,7 +31,7 @@ export default class AlarmServiceDriver {
|
||||
// Returns -1 if could not be found
|
||||
private alarmJoplinAlarmId(alarm:any):number {
|
||||
if (!alarm.data) return -1;
|
||||
const m = alarm.data.match(/joplinNotificationId==>(\d+)/)
|
||||
const m = alarm.data.match(/joplinNotificationId==>(\d+)/);
|
||||
return m ? Number(m[1]) : -1;
|
||||
}
|
||||
|
||||
@ -50,10 +50,10 @@ export default class AlarmServiceDriver {
|
||||
const alarmNotifData = {
|
||||
title: notification.title,
|
||||
message: notification.body ? notification.body : '-', // Required
|
||||
channel: "net.cozic.joplin.notification",
|
||||
small_icon: "ic_launcher",
|
||||
channel: 'net.cozic.joplin.notification',
|
||||
small_icon: 'ic_launcher',
|
||||
color: 'white',
|
||||
data: { joplinNotificationId: notification.id + '' },
|
||||
data: { joplinNotificationId: `${notification.id}` },
|
||||
};
|
||||
|
||||
// ReactNativeAN expects a string as a date and it seems this utility
|
||||
|
3131
ReactNativeClient/package-lock.json
generated
3131
ReactNativeClient/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "Joplin",
|
||||
"version": "0.0.1",
|
||||
"description": "Joplin for Mobile",
|
||||
"license": "MIT",
|
||||
"version": "0.8.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"android": "react-native run-android",
|
||||
"ios": "react-native run-ios",
|
||||
"start": "react-native start --reset-cache",
|
||||
"test": "jest",
|
||||
"lint": "eslint ."
|
||||
"build": "gulp build",
|
||||
"postinstall": "patch-package --patch-dir ../patches/shared && jetify && npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-community/clipboard": "^1.5.0",
|
||||
@ -96,21 +96,12 @@
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/runtime": "^7.11.2",
|
||||
"@react-native-community/eslint-config": "^2.0.0",
|
||||
"app-module-path": "^2.2.0",
|
||||
"babel-jest": "^26.5.2",
|
||||
"eslint": "^7.11.0",
|
||||
"execa": "^4.0.0",
|
||||
"fs-extra": "^8.1.0",
|
||||
"gulp": "^4.0.2",
|
||||
"jest": "^26.5.3",
|
||||
"jetifier": "^1.6.5",
|
||||
"metro-react-native-babel-preset": "^0.63.0",
|
||||
"patch-package": "^6.2.2",
|
||||
"react-native-log-ios": "^1.5.0",
|
||||
"react-test-renderer": "16.13.1"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "react-native"
|
||||
"patch-package": "^6.2.2"
|
||||
}
|
||||
}
|
||||
|
1
patches/node/README.md
Normal file
1
patches/node/README.md
Normal file
@ -0,0 +1 @@
|
||||
Patches that apply to the Node.js applications, i.e. the desktop and CLI apps.
|
1
patches/shared/README.md
Normal file
1
patches/shared/README.md
Normal file
@ -0,0 +1 @@
|
||||
Patches that apply to all apps, mobile, desktop and CLI.
|
Loading…
Reference in New Issue
Block a user