1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

Add simple sharing facilities for Android

- react code should be cross platform but support needs to be added
    for ios
  - only shares plain text notes for now
This commit is contained in:
Caleb John
2018-07-20 11:04:25 +02:00
parent f63668350b
commit 8840631266
12 changed files with 129 additions and 6 deletions

View File

@@ -50,6 +50,7 @@ const { PoorManIntervals } = require('lib/poor-man-intervals.js');
const { reducer, defaultState } = require('lib/reducer.js');
const { FileApiDriverLocal } = require('lib/file-api-driver-local.js');
const DropdownAlert = require('react-native-dropdownalert').default;
const ShareExtension = require('react-native-share-extension').default;
const SyncTargetRegistry = require('lib/SyncTargetRegistry.js');
const SyncTargetOneDrive = require('lib/SyncTargetOneDrive.js');
@@ -235,6 +236,12 @@ const appReducer = (state = appDefaultState, action) => {
newState.selectedItemType = action.itemType;
}
if ('sharedData' in action) {
newState.sharedData = action.sharedData;
} else {
newState.sharedData = null;
}
newState.route = action;
newState.historyCanGoBack = !!navHistory.length;
break;
@@ -517,6 +524,27 @@ class AppComponent extends React.Component {
});
}
try {
const { type, value } = await ShareExtension.data();
if (type != "") {
console.log(value);
console.log(type)
this.props.dispatch({
type: 'NAV_GO',
routeName: 'Note',
noteId: null,
sharedData: {type: type, value: value},
folderId: this.props.parentFolderId,
itemType: 'note',
});
}
} catch(e) {
console.log('Error in ShareExtension.data', e);
}
BackButtonService.initialize(this.backButtonHandler_);
AlarmService.setInAppNotificationHandler(async (alarmId) => {