From 8d68d175bfadef064439ecf393ec588dc8fc17b6 Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Mon, 28 Apr 2025 17:00:02 +0200 Subject: [PATCH] Create new credential via main app link (#771) --- .../Views/CredentialProviderView.swift | 10 ++- .../ios/aliasvault.xcodeproj/project.pbxproj | 87 +++---------------- mobile-app/ios/aliasvault/Info.plist | 4 + mobile-app/utils/WebApiService.ts | 6 +- 4 files changed, 25 insertions(+), 82 deletions(-) diff --git a/mobile-app/ios/VaultUI/Views/CredentialProviderView.swift b/mobile-app/ios/VaultUI/Views/CredentialProviderView.swift index b66a38567..8e00fbea9 100644 --- a/mobile-app/ios/VaultUI/Views/CredentialProviderView.swift +++ b/mobile-app/ios/VaultUI/Views/CredentialProviderView.swift @@ -51,7 +51,10 @@ public struct CredentialProviderView: View { if !viewModel.isChoosingTextToInsert { VStack(spacing: 12) { Button(action: { - viewModel.showAddCredential = true + if let url = URL(string: "net.aliasvault.app://addCredential?service=example.com") { + UIApplication.shared.open(url, options: [:], completionHandler: nil) + } + //viewModel.showAddCredential = true }) { HStack { Image(systemName: "plus.circle.fill") @@ -98,7 +101,10 @@ public struct CredentialProviderView: View { ToolbarItem(placement: .navigationBarTrailing) { HStack { Button("Add") { - viewModel.showAddCredential = true + if let url = URL(string: "net.aliasvault.app://addCredential?service=example.com") { + UIApplication.shared.open(url, options: [:], completionHandler: nil) + } + //viewModel.showAddCredential = true } .foregroundColor(ColorConstants.Light.primary) } diff --git a/mobile-app/ios/aliasvault.xcodeproj/project.pbxproj b/mobile-app/ios/aliasvault.xcodeproj/project.pbxproj index 3cc0fd909..b60ddc9e0 100644 --- a/mobile-app/ios/aliasvault.xcodeproj/project.pbxproj +++ b/mobile-app/ios/aliasvault.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 60; + objectVersion = 70; objects = { /* Begin PBXBuildFile section */ @@ -208,7 +208,7 @@ /* End PBXFileReference section */ /* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ - CEE9098F2DA548C7008D568F /* Exceptions for "Autofill" folder in "Autofill" target */ = { + CEE9098F2DA548C7008D568F /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = { isa = PBXFileSystemSynchronizedBuildFileExceptionSet; membershipExceptions = ( Info.plist, @@ -218,73 +218,12 @@ /* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ - CEE480882DBE86DC00F4A367 /* VaultStoreKit */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - ); - explicitFileTypes = { - }; - explicitFolders = ( - ); - path = VaultStoreKit; - sourceTree = ""; - }; - CEE480972DBE86DD00F4A367 /* VaultStoreKitTests */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - ); - explicitFileTypes = { - }; - explicitFolders = ( - ); - path = VaultStoreKitTests; - sourceTree = ""; - }; - CEE4816B2DBE8AC800F4A367 /* VaultUI */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - ); - explicitFileTypes = { - }; - explicitFolders = ( - ); - path = VaultUI; - sourceTree = ""; - }; - CEE4817A2DBE8AC800F4A367 /* VaultUITests */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - ); - explicitFileTypes = { - }; - explicitFolders = ( - ); - path = VaultUITests; - sourceTree = ""; - }; - CEE482AB2DBE8EFE00F4A367 /* VaultModels */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - ); - explicitFileTypes = { - }; - explicitFolders = ( - ); - path = VaultModels; - sourceTree = ""; - }; - CEE909812DA548C7008D568F /* Autofill */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - CEE9098F2DA548C7008D568F /* Exceptions for "Autofill" folder in "Autofill" target */, - ); - explicitFileTypes = { - }; - explicitFolders = ( - ); - path = Autofill; - sourceTree = ""; - }; + CEE480882DBE86DC00F4A367 /* VaultStoreKit */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultStoreKit; sourceTree = ""; }; + CEE480972DBE86DD00F4A367 /* VaultStoreKitTests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultStoreKitTests; sourceTree = ""; }; + CEE4816B2DBE8AC800F4A367 /* VaultUI */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultUI; sourceTree = ""; }; + CEE4817A2DBE8AC800F4A367 /* VaultUITests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultUITests; sourceTree = ""; }; + CEE482AB2DBE8EFE00F4A367 /* VaultModels */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultModels; sourceTree = ""; }; + CEE909812DA548C7008D568F /* Autofill */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (CEE9098F2DA548C7008D568F /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = Autofill; sourceTree = ""; }; /* End PBXFileSystemSynchronizedRootGroup section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1272,10 +1211,7 @@ LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\""; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; @@ -1330,10 +1266,7 @@ ); LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\""; MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; USE_HERMES = true; diff --git a/mobile-app/ios/aliasvault/Info.plist b/mobile-app/ios/aliasvault/Info.plist index 1df28a5fd..de452fb8f 100644 --- a/mobile-app/ios/aliasvault/Info.plist +++ b/mobile-app/ios/aliasvault/Info.plist @@ -30,6 +30,10 @@ CFBundleURLTypes + CFBundleTypeRole + Editor + CFBundleURLName + net.aliasvault.app.urlscheme CFBundleURLSchemes AliasVault diff --git a/mobile-app/utils/WebApiService.ts b/mobile-app/utils/WebApiService.ts index b648eff0b..0a504909c 100644 --- a/mobile-app/utils/WebApiService.ts +++ b/mobile-app/utils/WebApiService.ts @@ -101,15 +101,15 @@ export class WebApiService { const baseUrl = await this.getBaseUrl(); const url = baseUrl + endpoint; const headers = new Headers(options.headers ?? {}); - + // Add client version header headers.set('X-AliasVault-Client', `${AppInfo.CLIENT_NAME}-${AppInfo.VERSION}`); - + const requestOptions: RequestInit = { ...options, headers, }; - + try { const response = await fetch(url, requestOptions); return response;