You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
@ -2,7 +2,7 @@ import setUpQuickActions from './setUpQuickActions';
|
||||
import PluginAssetsLoader from './PluginAssetsLoader';
|
||||
|
||||
const React = require('react');
|
||||
const { AppState, Keyboard, NativeModules, BackHandler, Platform, Animated, View, StatusBar } = require('react-native');
|
||||
const { AppState, Keyboard, NativeModules, BackHandler, Animated, View, StatusBar } = require('react-native');
|
||||
const SafeAreaView = require('lib/components/SafeAreaView');
|
||||
const { connect, Provider } = require('react-redux');
|
||||
const { BackButtonService } = require('lib/services/back-button.js');
|
||||
@ -57,7 +57,8 @@ 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 ShareExtension = require('lib/ShareExtension.js').default;
|
||||
const handleShared = require('lib/shareHandler').default;
|
||||
const ResourceFetcher = require('lib/services/ResourceFetcher');
|
||||
const SearchEngine = require('lib/services/SearchEngine');
|
||||
const WelcomeUtils = require('lib/WelcomeUtils');
|
||||
@ -614,43 +615,6 @@ class AppComponent extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
if (Platform.OS !== 'ios') {
|
||||
// try {
|
||||
// const { type, value } = await ShareExtension.data();
|
||||
|
||||
// // reg.logger().info('Got share data:', type, value);
|
||||
|
||||
// if (type != '' && this.props.selectedFolderId) {
|
||||
// const newNote = await Note.save({
|
||||
// title: Note.defaultTitleFromBody(value),
|
||||
// body: value,
|
||||
// parent_id: this.props.selectedFolderId,
|
||||
// });
|
||||
|
||||
// // This is a bit hacky, but the surest way to go to
|
||||
// // the needed note. We go back one screen in case there's
|
||||
// // already a note open - if we don't do this, the dispatch
|
||||
// // below will do nothing (because routeName wouldn't change)
|
||||
// // Then we wait a bit for the state to be set correctly, and
|
||||
// // finally we go to the new note.
|
||||
// this.props.dispatch({
|
||||
// type: 'NAV_BACK',
|
||||
// });
|
||||
|
||||
// setTimeout(() => {
|
||||
// this.props.dispatch({
|
||||
// type: 'NAV_GO',
|
||||
// routeName: 'Note',
|
||||
// noteId: newNote.id,
|
||||
// });
|
||||
// }, 5);
|
||||
// }
|
||||
|
||||
// } catch (e) {
|
||||
// reg.logger().error('Error in ShareExtension.data', e);
|
||||
// }
|
||||
}
|
||||
|
||||
BackButtonService.initialize(this.backButtonHandler_);
|
||||
|
||||
AlarmService.setInAppNotificationHandler(async (alarmId) => {
|
||||
@ -660,6 +624,16 @@ class AppComponent extends React.Component {
|
||||
});
|
||||
|
||||
AppState.addEventListener('change', this.onAppStateChange_);
|
||||
|
||||
const sharedData = await ShareExtension.data();
|
||||
if (sharedData) {
|
||||
reg.logger().info('Received shared data');
|
||||
if (this.props.selectedFolderId) {
|
||||
handleShared(sharedData, this.props.selectedFolderId, this.props.dispatch);
|
||||
} else {
|
||||
reg.logger.info('Cannot handle share - default folder id is not set');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
Reference in New Issue
Block a user