feat(mobile): share intent (#4599)

* feat(mobile): share intent

* feat(ios): share content

* feat(share): fix kUTType* deprecation

* feat(share): fix result of call to 'openURL' is unused

* fix screenshot copy rewrite issue

* fix AndroidManifest.xml

* fix(iOS): app not showing in share list

* address comment
This commit is contained in:
llcc
2022-03-28 12:30:32 +08:00
committed by GitHub
parent 2de5352af2
commit 21e172feb6
21 changed files with 780 additions and 17 deletions

View File

@@ -23,6 +23,15 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
<data android:mimeType="image/*" />
<data android:mimeType="application/*" />
<data android:mimeType="video/*" />
</intent-filter>
</activity>
<provider

View File

@@ -18,5 +18,13 @@
{
"pkg": "@capacitor/splash-screen",
"classpath": "com.capacitorjs.plugins.splashscreen.SplashScreenPlugin"
},
{
"pkg": "@capacitor/status-bar",
"classpath": "com.capacitorjs.plugins.statusbar.StatusBarPlugin"
},
{
"pkg": "send-intent",
"classpath": "de.mindlib.sendIntent.SendIntent"
}
]

View File

@@ -1,6 +1,8 @@
package com.logseq.app;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.ValueCallback;
import com.getcapacitor.BridgeActivity;
@@ -17,4 +19,22 @@ public class MainActivity extends BridgeActivity {
overridePendingTransition(0, R.anim.byebye);
super.onPause();
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
String action = intent.getAction();
String type = intent.getType();
if (Intent.ACTION_SEND.equals(action) && type != null) {
bridge.getActivity().setIntent(intent);
bridge.eval("window.dispatchEvent(new Event('sendIntentReceived'))", new ValueCallback<String>() {
@Override
public void onReceiveValue(String s) {
//
}
});
}
}
}