1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +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

@@ -137,7 +137,7 @@ android {
}
dependencies {
compile project(':react-native-file-viewer')
compile project(':react-native-file-viewer')
compile project(':react-native-securerandom')
compile project(':react-native-push-notification')
compile project(':react-native-fs')
@@ -151,6 +151,8 @@ dependencies {
compile project(':react-native-fetch-blob')
compile project(':react-native-document-picker')
compile project(':react-native-image-resizer')
compile project(':react-native-share-extension')
compile "com.facebook.react:react-native:+"
}
// Run this once to be able to run the application with BUCK

View File

@@ -63,5 +63,19 @@
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<activity
android:noHistory="true"
android:name=".share.ShareActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -7,6 +7,7 @@ import com.vinzscam.reactnativefileviewer.RNFileViewerPackage;
import net.rhogan.rnsecurerandom.RNSecureRandomPackage;
import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
import com.imagepicker.ImagePickerPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
@@ -18,6 +19,8 @@ import com.rnfs.RNFSPackage;
import fr.bamlab.rnimageresizer.ImageResizerPackage;
import org.pgsqlite.SQLitePluginPackage;
import com.alinz.parkerdan.shareextension.SharePackage;
import java.util.Arrays;
import java.util.List;
@@ -42,7 +45,8 @@ public class MainApplication extends Application implements ReactApplication {
new RNFetchBlobPackage(),
new RNFSPackage(),
new SQLitePluginPackage(),
new VectorIconsPackage()
new VectorIconsPackage(),
new SharePackage()
);
}
};

View File

@@ -0,0 +1,15 @@
package net.cozic.joplin.share;
// import ReactActivity
import com.facebook.react.ReactActivity;
public class ShareActivity extends ReactActivity {
@Override
protected String getMainComponentName() {
// this is the name AppRegistry will use to launch the Share View
return "Joplin";
}
}

View File

@@ -0,0 +1,38 @@
package net.cozic.joplin.share;
// import build config
import net.cozic.joplin.BuildConfig;
import com.alinz.parkerdan.shareextension.SharePackage;
import android.app.Application;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactPackage;
import java.util.Arrays;
import java.util.List;
public class ShareApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new SharePackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}