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

@ -200,8 +200,7 @@ shared.initState = async function(comp) {
const note = await Note.load(comp.props.noteId);
let mode = 'view';
if (isProvisionalNote) {
// note = comp.props.itemType == 'todo' ? Note.newTodo(comp.props.folderId) : Note.new(comp.props.folderId);
if (isProvisionalNote && !comp.props.sharedData) {
mode = 'edit';
comp.scheduleFocusUpdate();
}
@ -218,8 +217,25 @@ shared.initState = async function(comp) {
noteResources: await shared.attachedResources(note ? note.body : ''),
});
if (comp.props.sharedData) {
this.noteComponent_change(comp, 'body', comp.props.sharedData.value);
if (comp.props.sharedData.title) {
this.noteComponent_change(comp, 'title', comp.props.sharedData.title);
}
if (comp.props.sharedData.text) {
this.noteComponent_change(comp, 'body', comp.props.sharedData.text);
}
if (comp.props.sharedData.resources) {
for (let i = 0; i < comp.props.sharedData.resources.length; i++) {
const resource = comp.props.sharedData.resources[i];
reg.logger().info(`about to attach resource ${JSON.stringify(resource)}`);
await comp.attachFile({
uri: resource.uri,
type: resource.mimeType,
fileName: resource.name,
}, null);
}
}
}
// eslint-disable-next-line require-atomic-updates