1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Android: Resolves #2896: Enable sharing to Joplin on Android (#2870)

This commit is contained in:
Roman Musin
2020-06-04 18:40:44 +01:00
committed by GitHub
parent 949c92f6d6
commit 33ad0dce15
13 changed files with 324 additions and 99 deletions

View File

@ -36,7 +36,7 @@ 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');
// const ShareExtension = require('react-native-share-extension').default;
const ShareExtension = require('lib/ShareExtension.js').default;
const CameraView = require('lib/components/CameraView');
const SearchEngine = require('lib/services/SearchEngine');
const urlUtils = require('lib/urlUtils');
@ -123,6 +123,19 @@ class NoteScreenComponent extends BaseScreenComponent {
return true;
}
if (this.state.fromShare) {
// effectively the same as NAV_BACK but NAV_BACK causes undesired behaviour in this case:
// - share to Joplin from some other app
// - open Joplin and open any note
// - go back -- with NAV_BACK this causes the app to exit rather than just showing notes
this.props.dispatch({
type: 'NAV_GO',
routeName: 'Notes',
folderId: this.state.note.parent_id,
});
return true;
}
return false;
};
@ -333,9 +346,9 @@ class NoteScreenComponent extends BaseScreenComponent {
shared.uninstallResourceHandling(this.refreshResource);
// if (Platform.OS !== 'ios' && this.state.fromShare) {
// ShareExtension.close();
// }
if (this.state.fromShare) {
ShareExtension.close();
}
}
title_changeText(text) {
@ -527,7 +540,7 @@ class NoteScreenComponent extends BaseScreenComponent {
try {
if (mimeType == 'image/jpeg' || mimeType == 'image/jpg' || mimeType == 'image/png') {
const done = await this.resizeImage(localFilePath, targetPath, pickerResponse.mime);
const done = await this.resizeImage(localFilePath, targetPath, mimeType);
if (!done) return;
} else {
if (fileType === 'image') {