fix: iOS share

related to https://github.com/logseq/db-test/issues/427
This commit is contained in:
Tienson Qin
2025-08-25 17:34:57 +08:00
parent 38bc596cf1
commit f44fdeb2ea
9 changed files with 66 additions and 34 deletions

View File

@@ -1,15 +1,15 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
}
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation 'androidx.core:core-ktx:1.16.0'
implementation project(':capacitor-community-safe-area')
implementation project(':capacitor-action-sheet')
implementation project(':capacitor-app')
implementation project(':capacitor-camera')
@@ -17,6 +17,7 @@ dependencies {
implementation project(':capacitor-filesystem')
implementation project(':capacitor-haptics')
implementation project(':capacitor-keyboard')
implementation project(':capacitor-network')
implementation project(':capacitor-share')
implementation project(':capacitor-splash-screen')
implementation project(':capacitor-status-bar')
@@ -30,5 +31,5 @@ dependencies {
if (hasProperty('postBuildExtras')) {
postBuildExtras()
postBuildExtras()
}

View File

@@ -1,4 +1,8 @@
[
{
"pkg": "@capacitor-community/safe-area",
"classpath": "com.getcapacitor.community.safearea.SafeAreaPlugin"
},
{
"pkg": "@capacitor/action-sheet",
"classpath": "com.capacitorjs.plugins.actionsheet.ActionSheetPlugin"
@@ -27,6 +31,10 @@
"pkg": "@capacitor/keyboard",
"classpath": "com.capacitorjs.plugins.keyboard.KeyboardPlugin"
},
{
"pkg": "@capacitor/network",
"classpath": "com.capacitorjs.plugins.network.NetworkPlugin"
},
{
"pkg": "@capacitor/share",
"classpath": "com.capacitorjs.plugins.share.SharePlugin"

View File

@@ -2,6 +2,9 @@
include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
include ':capacitor-community-safe-area'
project(':capacitor-community-safe-area').projectDir = new File('../node_modules/@capacitor-community/safe-area/android')
include ':capacitor-action-sheet'
project(':capacitor-action-sheet').projectDir = new File('../node_modules/@capacitor/action-sheet/android')
@@ -23,6 +26,9 @@ project(':capacitor-haptics').projectDir = new File('../node_modules/@capacitor/
include ':capacitor-keyboard'
project(':capacitor-keyboard').projectDir = new File('../node_modules/@capacitor/keyboard/android')
include ':capacitor-network'
project(':capacitor-network').projectDir = new File('../node_modules/@capacitor/network/android')
include ':capacitor-share'
project(':capacitor-share').projectDir = new File('../node_modules/@capacitor/share/android')

View File

@@ -11,6 +11,7 @@ install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCommunitySafeArea', :path => '../../node_modules/@capacitor-community/safe-area'
pod 'CapacitorActionSheet', :path => '../../node_modules/@capacitor/action-sheet'
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera'
@@ -22,7 +23,6 @@ def capacitor_pods
pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share'
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'CapacitorCommunitySafeArea', :path => '../../node_modules/@capacitor-community/safe-area'
pod 'CapawesomeCapacitorBackgroundTask', :path => '../../node_modules/@capawesome/capacitor-background-task'
pod 'CapgoCapacitorNavigationBar', :path => '../../node_modules/@capgo/capacitor-navigation-bar'
pod 'CapacitorVoiceRecorder', :path => '../../node_modules/capacitor-voice-recorder'

View File

@@ -34,7 +34,7 @@ PODS:
- Capacitor
- JcesarmobileSslSkip (0.4.0):
- Capacitor
- SendIntent (0.0.1):
- SendIntent (7.0.0):
- Capacitor
DEPENDENCIES:
@@ -117,8 +117,8 @@ SPEC CHECKSUMS:
CapawesomeCapacitorBackgroundTask: 834d797abc9933fac4354490d1a2f3c0e389b98d
CapgoCapacitorNavigationBar: 3a0e93a40b7da3d3cb74c0410bb761a1525406be
JcesarmobileSslSkip: b0f921e9d397a57f7983731209ca1ee244119c1f
SendIntent: 0a17b6984c4f27e9dfa56513267ba2c044a5a6c8
SendIntent: 1f4f65c7103eb423067c566682dfcda973b5fb29
PODFILE CHECKSUM: b39c58d1809083b0ebe56edcfe13ef1d4d568b1e
PODFILE CHECKSUM: ff3bf6a88afbe92d5ba5070b8809418a3e98ead6
COCOAPODS: 1.16.2

View File

@@ -184,15 +184,15 @@ class ShareViewController: UIViewController {
}
@discardableResult
@objc func openURL(_ url: URL) -> Bool {
@objc func openURL(_ url: URL) {
var responder: UIResponder? = self
while responder != nil {
if let application = responder as? UIApplication {
return application.perform(#selector(openURL(_:)), with: url) != nil
application.open(url, options: [:], completionHandler: nil)
return
}
responder = responder?.next
}
return false
}
@@ -204,4 +204,3 @@ extension URL {
return type?.preferredMIMEType
}
}

View File

@@ -107,6 +107,7 @@
"postinstall": "yarn tldraw:build && yarn amplify:build && yarn ui:build"
},
"dependencies": {
"@capacitor-community/safe-area": "7.0.0-alpha.1",
"@capacitor/action-sheet": "7.0.1",
"@capacitor/android": "7.2.0",
"@capacitor/app": "7.0.1",
@@ -121,7 +122,6 @@
"@capacitor/share": "7.0.1",
"@capacitor/splash-screen": "7.0.1",
"@capacitor/status-bar": "7.0.1",
"@capacitor-community/safe-area": "7.0.0-alpha.1",
"@capawesome/capacitor-background-task": "7.0.1",
"@capgo/capacitor-navigation-bar": "7.1.2",
"@dnd-kit/core": "^6.0.8",
@@ -187,7 +187,7 @@
"react-virtuoso": "4.12.5",
"remove-accents": "0.4.2",
"sanitize-filename": "1.6.3",
"send-intent": "^5.0.0",
"send-intent": "^7.0.0",
"shepherd.js": "^9.1.0",
"tailwind-capitalize-first-letter": "^1.0.4",
"threads": "1.6.5",

View File

@@ -65,10 +65,7 @@
(editor-handler/escape-editing)
:else false))
(prn "TODO: handle back button in Android"))))
(.addEventListener js/window "sendIntentReceived"
#(intent/handle-received)))
(prn "TODO: handle back button in Android")))))
(defn- app-state-change-handler
"NOTE: don't add more logic in this listener, use mobile-flows instead"
@@ -110,7 +107,13 @@
(.addListener Network "networkStatusChange" #(reset! mobile-flows/*mobile-network-status %)))
(defn init! []
(.addEventListener js/window "sendIntentReceived" intent/handle-received)
;; handle share for code start
(intent/handle-received)
(reset! mobile-flows/*network Network)
(when (mobile-util/native-android?)
(android-init))

View File

@@ -240,7 +240,7 @@
tslib "^2.8.1"
xml2js "^0.6.2"
"@capacitor/cli@^5.0.0", "@capacitor/cli@^5.3.0":
"@capacitor/cli@^5.3.0":
version "5.7.8"
resolved "https://registry.yarnpkg.com/@capacitor/cli/-/cli-5.7.8.tgz#0fd28569b286192db71335dbd16222c341322785"
integrity sha512-qN8LDlREMhrYhOvVXahoJVNkP8LP55/YPRJrzTAFrMqlNJC18L3CzgWYIblFPnuwfbH/RxbfoZT/ydkwgVpMrw==
@@ -263,6 +263,29 @@
tslib "^2.4.0"
xml2js "^0.5.0"
"@capacitor/cli@^7.0.0":
version "7.4.3"
resolved "https://registry.yarnpkg.com/@capacitor/cli/-/cli-7.4.3.tgz#4f8be36a89c2671c2eb681b714f67fcc3b6ebc9c"
integrity sha512-SWozpdDgrbQ/ry1nIapugDFvE9z+l22BmU/+fpgL2Zv5487hGdXvCX5+1SluuFBP3IPpx6b4LjsKnBigyJoUWg==
dependencies:
"@ionic/cli-framework-output" "^2.2.8"
"@ionic/utils-subprocess" "^3.0.1"
"@ionic/utils-terminal" "^2.3.5"
commander "^12.1.0"
debug "^4.4.0"
env-paths "^2.2.0"
fs-extra "^11.2.0"
kleur "^4.1.5"
native-run "^2.0.1"
open "^8.4.0"
plist "^3.1.0"
prompts "^2.4.2"
rimraf "^6.0.1"
semver "^7.6.3"
tar "^6.1.11"
tslib "^2.8.1"
xml2js "^0.6.2"
"@capacitor/clipboard@7.0.1":
version "7.0.1"
resolved "https://registry.yarnpkg.com/@capacitor/clipboard/-/clipboard-7.0.1.tgz#159fefa56b7d23632e9d08c9efd9cbd75a868b21"
@@ -275,13 +298,6 @@
dependencies:
tslib "^2.1.0"
"@capacitor/core@^5.0.0":
version "5.7.8"
resolved "https://registry.yarnpkg.com/@capacitor/core/-/core-5.7.8.tgz#584d5ac2754501ef1443ab4bf182d8f5be16f65e"
integrity sha512-rrZcm/2vJM0WdWRQup1TUidbjQV9PfIadSkV4rAGLD7R6PuzZSMPGT0gmoZzCRlXkqrazrWWDkurei3ozU02FA==
dependencies:
tslib "^2.1.0"
"@capacitor/filesystem@7.0.1":
version "7.0.1"
resolved "https://registry.yarnpkg.com/@capacitor/filesystem/-/filesystem-7.0.1.tgz#b0518d781f7640e936f529b80a59724e221d0471"
@@ -9012,13 +9028,12 @@ semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.4, semve
resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58"
integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==
send-intent@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/send-intent/-/send-intent-5.0.0.tgz#95d00455a7db4d95d9f79f8203698e96760c7408"
integrity sha512-d3moLwVdQlv/lWPR8MYPUv3HufOrfcbyAvELla8DnJZwzLD9vYWF4UlgsEp/l5ADOyNW0KuvRVIE2cuCZqZLxA==
send-intent@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/send-intent/-/send-intent-7.0.0.tgz#792c1e72ca42ca98f4d94a31fb74eb13b319fcb9"
integrity sha512-J37bBkKdLYEsv1wHfrOFVfXqOLXgl3ced8Y9+WXgcZ3vLeCVTfmMrAbo0tBfU5x53fyjuZ8UkJfUkneAfrIqIg==
dependencies:
"@capacitor/cli" "^5.0.0"
"@capacitor/core" "^5.0.0"
"@capacitor/cli" "^7.0.0"
serialize-error@^7.0.1:
version "7.0.1"