Bläddra i källkod

enhance(mobile): enable camera permission on iOS

leizhe 3 år sedan
förälder
incheckning
94350c3ceb
3 ändrade filer med 9 tillägg och 1 borttagningar
  1. 6 0
      ios/App/App/Info.plist
  2. 1 0
      ios/App/Podfile
  3. 2 1
      src/main/frontend/mobile/camera.cljs

+ 6 - 0
ios/App/App/Info.plist

@@ -40,6 +40,8 @@
 		<key>NSAllowsArbitraryLoads</key>
 		<true/>
 	</dict>
+	<key>NSCameraUsageDescription</key>
+	<string></string>
 	<key>NSDocumentsFolderUsageDescription</key>
 	<string></string>
 	<key>NSDownloadsFolderUsageDescription</key>
@@ -48,6 +50,10 @@
 	<string></string>
 	<key>NSFileProviderPresenceUsageDescription</key>
 	<string></string>
+	<key>NSPhotoLibraryAddUsageDescription</key>
+	<string></string>
+	<key>NSPhotoLibraryUsageDescription</key>
+	<string></string>
 	<key>NSUbiquitousContainers</key>
 	<dict>
 		<key>iCloud.$(PRODUCT_BUNDLE_IDENTIFIER)</key>

+ 1 - 0
ios/App/Podfile

@@ -12,6 +12,7 @@ def capacitor_pods
   pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
   pod 'CapacitorFilesystem', :path => '../../node_modules/@capacitor/filesystem'
   pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
+  pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera'
 end
 
 target 'Logseq' do

+ 2 - 1
src/main/frontend/mobile/camera.cljs

@@ -23,7 +23,8 @@
           path (str "file://" repo-dir "/" assets-dir "/" filename)
           _file (.writeFile Filesystem (clj->js
                                          {:data (.-data photo-buffer)
-                                          :path path}))]
+                                          :path path
+                                          :recursive true}))]
     (p/resolved filename)))
 
 (defn embed-photo [id]