You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
iOS: Fixed sharing file
This commit is contained in:
@@ -614,6 +614,9 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS\n\n$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS\n\n$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS\n\n$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS\n\n",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
@@ -669,6 +672,9 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS\n\n$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS\n\n$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS\n\n$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS\n\n",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#import <React/RCTRootView.h>
|
||||
|
||||
#import <React/RCTAppSetupUtils.h>
|
||||
#import <React/RCTLinkingManager.h>
|
||||
|
||||
#import <RNCPushNotificationIOS.h>
|
||||
#import "RNQuickActionManager.h"
|
||||
@@ -32,6 +33,23 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
// ===================================================
|
||||
// BEGIN Linking support
|
||||
// ===================================================
|
||||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
openURL:(NSURL *)url
|
||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
|
||||
{
|
||||
return [RCTLinkingManager application:application openURL:url options:options];
|
||||
}
|
||||
|
||||
// ===================================================
|
||||
// END Linking support
|
||||
// ===================================================
|
||||
|
||||
|
||||
|
||||
// ===================================================
|
||||
// BEGIN react-native-quick-actions
|
||||
// ===================================================
|
||||
|
||||
@@ -117,6 +117,8 @@ import sensorInfo from './components/biometrics/sensorInfo';
|
||||
import { getCurrentProfile } from '@joplin/lib/services/profileConfig';
|
||||
import { getDatabaseName, getProfilesRootDir, getResourceDir, setDispatch } from './services/profiles';
|
||||
|
||||
const logger = Logger.create('root');
|
||||
|
||||
let storeDispatch = function(_action: any) {};
|
||||
|
||||
const logReducerAction = function(action: any) {
|
||||
@@ -727,17 +729,23 @@ class AppComponent extends React.Component {
|
||||
};
|
||||
|
||||
this.handleOpenURL_ = (event: any) => {
|
||||
logger.info('Sharing: handleOpenURL_: start');
|
||||
|
||||
// If this is called while biometrics haven't been done yet, we can
|
||||
// ignore the call, because handleShareData() will be called once
|
||||
// biometricsDone is `true`.
|
||||
if (event.url === ShareExtension.shareURL && this.props.biometricsDone) {
|
||||
logger.info('Sharing: handleOpenURL_: Processing share data');
|
||||
void this.handleShareData();
|
||||
}
|
||||
};
|
||||
|
||||
this.handleNewShare_ = () => {
|
||||
logger.info('Sharing: handleNewShare_: start');
|
||||
|
||||
// look at this.handleOpenURL_ comment
|
||||
if (this.props.biometricsDone) {
|
||||
logger.info('Sharing: handleNewShare_: Processing share data');
|
||||
void this.handleShareData();
|
||||
}
|
||||
};
|
||||
@@ -865,6 +873,7 @@ class AppComponent extends React.Component {
|
||||
}
|
||||
|
||||
if (this.props.biometricsDone !== prevProps.biometricsDone && this.props.biometricsDone) {
|
||||
logger.info('Sharing: componentDidUpdate: biometricsDone');
|
||||
void this.handleShareData();
|
||||
}
|
||||
}
|
||||
@@ -892,9 +901,13 @@ class AppComponent extends React.Component {
|
||||
|
||||
private async handleShareData() {
|
||||
const sharedData = await ShareExtension.data();
|
||||
|
||||
logger.info('Sharing: handleShareData:', sharedData);
|
||||
|
||||
if (sharedData) {
|
||||
reg.logger().info('Received shared data');
|
||||
if (this.props.selectedFolderId) {
|
||||
logger.info('Sharing: handleShareData: Processing...');
|
||||
await handleShared(sharedData, this.props.selectedFolderId, this.props.dispatch);
|
||||
} else {
|
||||
reg.logger().info('Cannot handle share - default folder id is not set');
|
||||
|
||||
Reference in New Issue
Block a user