TagSpaces is an offline, open source, document manager with tagging support
chore: changes needed for the capacitor app
Ilian Sapundshiev6b1ed335c331
diff --git a/capacitor/ios/App/App.xcodeproj/project.pbxproj b/capacitor/ios/App/App.xcodeproj/project.pbxprojindex 3a65971f2..7f1c0699c 100644--- a/capacitor/ios/App/App.xcodeproj/project.pbxproj+++ b/capacitor/ios/App/App.xcodeproj/project.pbxproj@@ -15,12 +15,13 @@504EC30F1FED79650016851F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30E1FED79650016851F /* Assets.xcassets */; };504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; };50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; };+ D1F87A2C0000000000000002 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = D1F87A2C0000000000000001 /* PrivacyInfo.xcprivacy */; };/* End PBXBuildFile section *//* Begin PBXFileReference section */2FAD9762203C412B000D30F8 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = config.xml; sourceTree = "<group>"; };50379B222058CBB4000EE86E /* capacitor.config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = capacitor.config.json; sourceTree = "<group>"; };- 504EC3041FED79650016851F /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };+ 504EC3041FED79650016851F /* TagSpaces.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TagSpaces.app; sourceTree = BUILT_PRODUCTS_DIR; };504EC3071FED79650016851F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };504EC30C1FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };504EC30E1FED79650016851F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };@@ -28,6 +29,7 @@504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = "<group>"; };958DCC722DB07C7200EA8C5F /* debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = debug.xcconfig; path = ../debug.xcconfig; sourceTree = SOURCE_ROOT; };+ D1F87A2C0000000000000001 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };/* End PBXFileReference section *//* Begin PBXFrameworksBuildPhase section */@@ -54,7 +56,7 @@504EC3051FED79650016851F /* Products */ = {isa = PBXGroup;children = (- 504EC3041FED79650016851F /* App.app */,+ 504EC3041FED79650016851F /* TagSpaces.app */,);name = Products;sourceTree = "<group>";@@ -68,6 +70,7 @@504EC30E1FED79650016851F /* Assets.xcassets */,504EC3101FED79650016851F /* LaunchScreen.storyboard */,504EC3131FED79650016851F /* Info.plist */,+ D1F87A2C0000000000000001 /* PrivacyInfo.xcprivacy */,2FAD9762203C412B000D30F8 /* config.xml */,50B271D01FEDC1A000F3C39B /* public */,);@@ -94,7 +97,7 @@4D22ABE82AF431CB00220026 /* CapApp-SPM */,);productName = App;- productReference = 504EC3041FED79650016851F /* App.app */;+ productReference = 504EC3041FED79650016851F /* TagSpaces.app */;productType = "com.apple.product-type.application";};/* End PBXNativeTarget section */@@ -145,6 +148,7 @@50379B232058CBB4000EE86E /* capacitor.config.json in Resources */,504EC30D1FED79650016851F /* Main.storyboard in Resources */,2FAD9763203C412B000D30F8 /* config.xml in Resources */,+ D1F87A2C0000000000000002 /* PrivacyInfo.xcprivacy in Resources */,);runOnlyForDeploymentPostprocessing = 0;};@@ -307,7 +311,7 @@MARKETING_VERSION = 1.0;OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";PRODUCT_BUNDLE_IDENTIFIER = org.tagspaces.mobileapp;- PRODUCT_NAME = "$(TARGET_NAME)";+ PRODUCT_NAME = TagSpaces;SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;SWIFT_VERSION = 5.0;TARGETED_DEVICE_FAMILY = "1,2";@@ -329,7 +333,7 @@);MARKETING_VERSION = 1.0;PRODUCT_BUNDLE_IDENTIFIER = org.tagspaces.mobileapp;- PRODUCT_NAME = "$(TARGET_NAME)";+ PRODUCT_NAME = TagSpaces;SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";SWIFT_VERSION = 5.0;TARGETED_DEVICE_FAMILY = "1,2";diff --git a/capacitor/ios/App/App.xcodeproj/xcshareddata/xcschemes/TagSpaces.xcscheme b/capacitor/ios/App/App.xcodeproj/xcshareddata/xcschemes/TagSpaces.xcschemenew file mode 100644index 000000000..68608addb--- /dev/null+++ b/capacitor/ios/App/App.xcodeproj/xcshareddata/xcschemes/TagSpaces.xcscheme@@ -0,0 +1,91 @@+<?xml version="1.0" encoding="UTF-8"?>+<Scheme+ LastUpgradeVersion = "0920"+ version = "1.3">+ <BuildAction+ parallelizeBuildables = "YES"+ buildImplicitDependencies = "YES">+ <BuildActionEntries>+ <BuildActionEntry+ buildForTesting = "YES"+ buildForRunning = "YES"+ buildForProfiling = "YES"+ buildForArchiving = "YES"+ buildForAnalyzing = "YES">+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "504EC3031FED79650016851F"+ BuildableName = "TagSpaces.app"+ BlueprintName = "App"+ ReferencedContainer = "container:App.xcodeproj">+ </BuildableReference>+ </BuildActionEntry>+ </BuildActionEntries>+ </BuildAction>+ <TestAction+ buildConfiguration = "Debug"+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"+ shouldUseLaunchSchemeArgsEnv = "YES">+ <Testables>+ </Testables>+ <MacroExpansion>+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "504EC3031FED79650016851F"+ BuildableName = "TagSpaces.app"+ BlueprintName = "App"+ ReferencedContainer = "container:App.xcodeproj">+ </BuildableReference>+ </MacroExpansion>+ <AdditionalOptions>+ </AdditionalOptions>+ </TestAction>+ <LaunchAction+ buildConfiguration = "Debug"+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"+ launchStyle = "0"+ useCustomWorkingDirectory = "NO"+ ignoresPersistentStateOnLaunch = "NO"+ debugDocumentVersioning = "YES"+ debugServiceExtension = "internal"+ allowLocationSimulation = "YES">+ <BuildableProductRunnable+ runnableDebuggingMode = "0">+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "504EC3031FED79650016851F"+ BuildableName = "TagSpaces.app"+ BlueprintName = "App"+ ReferencedContainer = "container:App.xcodeproj">+ </BuildableReference>+ </BuildableProductRunnable>+ <AdditionalOptions>+ </AdditionalOptions>+ </LaunchAction>+ <ProfileAction+ buildConfiguration = "Release"+ shouldUseLaunchSchemeArgsEnv = "YES"+ savedToolIdentifier = ""+ useCustomWorkingDirectory = "NO"+ debugDocumentVersioning = "YES">+ <BuildableProductRunnable+ runnableDebuggingMode = "0">+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "504EC3031FED79650016851F"+ BuildableName = "TagSpaces.app"+ BlueprintName = "App"+ ReferencedContainer = "container:App.xcodeproj">+ </BuildableReference>+ </BuildableProductRunnable>+ </ProfileAction>+ <AnalyzeAction+ buildConfiguration = "Debug">+ </AnalyzeAction>+ <ArchiveAction+ buildConfiguration = "Release"+ revealArchiveInOrganizer = "YES">+ </ArchiveAction>+</Scheme>diff --git a/capacitor/ios/App/App/AppDelegate.swift b/capacitor/ios/App/App/AppDelegate.swiftindex c3cd83b5c..5e097b3bf 100644--- a/capacitor/ios/App/App/AppDelegate.swift+++ b/capacitor/ios/App/App/AppDelegate.swift@@ -1,5 +1,6 @@import UIKitimport Capacitor+import AVFoundation@UIApplicationMainclass AppDelegate: UIResponder, UIApplicationDelegate {@@ -7,10 +8,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {var window: UIWindow?func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {- // Override point for customization after application launch.+ configureAudioSession()return true}+ private func configureAudioSession() {+ // .playAndRecord supports both audiobook playback (continues when screen+ // locks, paired with UIBackgroundModes=audio in Info.plist) and voice-memo+ // recording. .defaultToSpeaker routes playback through the main speaker+ // instead of the earpiece; .allowBluetoothA2DP keeps stereo headphones.+ do {+ let session = AVAudioSession.sharedInstance()+ try session.setCategory(.playAndRecord,+ mode: .default,+ options: [.defaultToSpeaker, .allowBluetoothA2DP])+ try session.setActive(true)+ } catch {+ CAPLog.print("Failed to configure AVAudioSession: \(error)")+ }+ }+func applicationWillResignActive(_ application: UIApplication) {// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.diff --git a/capacitor/ios/App/App/Info.plist b/capacitor/ios/App/App/Info.plistindex 727e984e0..1f81f42af 100644--- a/capacitor/ios/App/App/Info.plist+++ b/capacitor/ios/App/App/Info.plist@@ -36,7 +36,7 @@<key>NSCameraUsageDescription</key><string>This app uses the camera to capture photos for tagging.</string><key>NSMicrophoneUsageDescription</key>- <string></string>+ <string>This app uses the microphone to record voice memos and audio notes.</string><key>NSPhotoLibraryAddUsageDescription</key><string>This app requires photo library access to save photos.</string><key>NSPhotoLibraryUsageDescription</key>@@ -53,7 +53,7 @@<string>Main</string><key>UIRequiredDeviceCapabilities</key><array>- <string>armv7</string>+ <string>arm64</string></array><key>UISupportedInterfaceOrientations</key><array>diff --git a/capacitor/ios/App/App/PrivacyInfo.xcprivacy b/capacitor/ios/App/App/PrivacyInfo.xcprivacynew file mode 100644index 000000000..c08efed19--- /dev/null+++ b/capacitor/ios/App/App/PrivacyInfo.xcprivacy@@ -0,0 +1,39 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>NSPrivacyTracking</key>+ <false/>+ <key>NSPrivacyTrackingDomains</key>+ <array/>+ <key>NSPrivacyCollectedDataTypes</key>+ <array/>+ <key>NSPrivacyAccessedAPITypes</key>+ <array>+ <dict>+ <key>NSPrivacyAccessedAPIType</key>+ <string>NSPrivacyAccessedAPICategoryUserDefaults</string>+ <key>NSPrivacyAccessedAPITypeReasons</key>+ <array>+ <string>CA92.1</string>+ </array>+ </dict>+ <dict>+ <key>NSPrivacyAccessedAPIType</key>+ <string>NSPrivacyAccessedAPICategoryFileTimestamp</string>+ <key>NSPrivacyAccessedAPITypeReasons</key>+ <array>+ <string>C617.1</string>+ </array>+ </dict>+ <dict>+ <key>NSPrivacyAccessedAPIType</key>+ <string>NSPrivacyAccessedAPICategoryDiskSpace</string>+ <key>NSPrivacyAccessedAPITypeReasons</key>+ <array>+ <string>E174.1</string>+ </array>+ </dict>+ </array>+</dict>+</plist>diff --git a/package.json b/package.jsonindex 867ecfc38..88333189d 100644--- a/package.json+++ b/package.json@@ -181,6 +181,7 @@"@mui/x-date-pickers": "9.0.4","@tagspaces/tagspaces-common": "4.8.6","@tagspaces/tagspaces-common-aws3": "4.8.6",+ "@tagspaces/tagspaces-common-capacitor": "4.8.6","@tagspaces/tagspaces-common-cordova": "4.8.6","@tagspaces/tagspaces-indexer": "4.8.6","@tagspaces/tagspaces-search": "4.8.6",diff --git a/src/renderer/services/utils-io.ts b/src/renderer/services/utils-io.tsindex 224ddf0a5..37f3648c4 100644--- a/src/renderer/services/utils-io.ts+++ b/src/renderer/services/utils-io.ts@@ -1120,9 +1120,7 @@ export function getDevicePaths(): Promise<any> {if (AppConfig.isElectron) {return window.electronIO.ipcRenderer.invoke('getDevicePaths');} else if (AppConfig.isCapacitor) {- // Dynamic require to avoid webpack resolving this for Electron/web builds- const capPkg = '@tagspaces/tagspaces-common-capacitor';- const ioAPI = require(capPkg);+ const ioAPI = require('@tagspaces/tagspaces-common-capacitor');return ioAPI.getDevicePaths();} else if (AppConfig.isCordova) {const ioAPI = require('@tagspaces/tagspaces-common-cordova');@@ -1269,8 +1267,7 @@ export function selectDirectoryDialog(): Promise<any> {if (AppConfig.isElectron) {return window.electronIO.ipcRenderer.invoke('selectDirectoryDialog');} else if (AppConfig.isCapacitor) {- const capPkg = '@tagspaces/tagspaces-common-capacitor';- const ioAPI = require(capPkg);+ const ioAPI = require('@tagspaces/tagspaces-common-capacitor');return ioAPI.selectDirectoryDialog();} else if (AppConfig.isCordova) {const ioAPI = require('@tagspaces/tagspaces-common-cordova');diff --git a/src/renderer/utils/CommonLocation.ts b/src/renderer/utils/CommonLocation.tsindex d847c6a88..3042b3599 100644--- a/src/renderer/utils/CommonLocation.ts+++ b/src/renderer/utils/CommonLocation.ts@@ -19,19 +19,7 @@ import { getFulfilledResults, getMimeType } from '-/services/utils-io';import { TS } from '-/tagspaces.namespace';import { offlineRejectionIfRemote } from '-/utils/OfflineError';import * as cordovaIO from '@tagspaces/tagspaces-common-cordova';--// Capacitor IO is loaded dynamically to avoid breaking Electron/web builds-// where the package isn't available. The variable indirection prevents-// webpack from resolving the module statically.-let capacitorIO: any;-if (AppConfig.isCapacitor) {- try {- const capPkg = '@tagspaces/tagspaces-common-capacitor';- capacitorIO = require(capPkg);- } catch (e) {- console.warn('tagspaces-common-capacitor not available');- }-}+import * as capacitorIO from '@tagspaces/tagspaces-common-capacitor';/*** Shallow-clone `obj` dropping any function-valued properties.