From f5e0282f228d46aa16b6ea04f337adcdbb598c8f Mon Sep 17 00:00:00 2001 From: Tobi Date: Mon, 22 May 2023 21:44:57 +0200 Subject: [PATCH 01/10] Hopefully fixed: "Publishing changes from background threads" Except in CBScanner.swift from third-party barcode scanner, issue is open: https://github.com/heart/CarBode-Barcode-Scanner-For-SwiftUI/issues/66 --- .../Projects/Manual/AddProjectManualView.swift | 13 ++++++++----- .../Projects/QRCodes/AddProjectQRViewModel.swift | 8 ++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/PayForMe/Views/Projects/Manual/AddProjectManualView.swift b/PayForMe/Views/Projects/Manual/AddProjectManualView.swift index 2fc535a..667c580 100644 --- a/PayForMe/Views/Projects/Manual/AddProjectManualView.swift +++ b/PayForMe/Views/Projects/Manual/AddProjectManualView.swift @@ -59,7 +59,6 @@ struct AddProjectManualView: View { } } .id(viewmodel.projectType == .cospend ? "cospend" : "iHateMoney") - .frame(width: UIScreen.main.bounds.width, height: 220, alignment: .center) SlickLoadingSpinner(connectionState: viewmodel.validationProgress) .frame(width: 50, height: 50) FancyButton( @@ -84,13 +83,17 @@ struct AddProjectManualView: View { } private func pasteLink(pasteString: String) { - viewmodel.pasteAddress(address: pasteString) + DispatchQueue.main.async { + viewmodel.pasteAddress(address: pasteString) + } } private func pasteLink() { - if let pasteString = UIPasteboard.general.string { - print(pasteString) - viewmodel.pasteAddress(address: pasteString) + DispatchQueue.main.async { + if let pasteString = UIPasteboard.general.string { + print(pasteString) + viewmodel.pasteAddress(address: pasteString) + } } } } diff --git a/PayForMe/Views/Projects/QRCodes/AddProjectQRViewModel.swift b/PayForMe/Views/Projects/QRCodes/AddProjectQRViewModel.swift index 9211cb5..1631d30 100644 --- a/PayForMe/Views/Projects/QRCodes/AddProjectQRViewModel.swift +++ b/PayForMe/Views/Projects/QRCodes/AddProjectQRViewModel.swift @@ -102,12 +102,16 @@ class AddProjectQRViewModel: ObservableObject { do { let apiProject = try await NetworkService.shared.getProjectName(project) try ProjectManager.shared.addProject(apiProject) - self.isTestingSubject.send(.success) + DispatchQueue.main.async { + self.isTestingSubject.send(.success) + } } catch { print(codedUrl) print() print(error) - self.isTestingSubject.send(.failure) + DispatchQueue.main.async { + self.isTestingSubject.send(.failure) + } } } // NetworkService.shared.testProject(project) From f5f40c5f97df5dafff25e243f43bbbaa8e1ea95a Mon Sep 17 00:00:00 2001 From: Tobi Date: Mon, 22 May 2023 21:58:31 +0200 Subject: [PATCH 02/10] Share url by arrow-up and show qr code with qr code --- PayForMe/Views/Projects/ProjectListEntry.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/PayForMe/Views/Projects/ProjectListEntry.swift b/PayForMe/Views/Projects/ProjectListEntry.swift index 2674d96..108a26a 100644 --- a/PayForMe/Views/Projects/ProjectListEntry.swift +++ b/PayForMe/Views/Projects/ProjectListEntry.swift @@ -17,6 +17,13 @@ struct ProjectListEntry: View { @State var edit = false @State var me = 0 + + func actionShare(url: String) { + guard let data = URL(string: url) else { return } + let av = UIActivityViewController(activityItems: [data], applicationActivities: nil) + UIApplication.shared.connectedScenes.flatMap { ($0 as? UIWindowScene)?.windows ?? [] } + .first { $0.isKeyWindow }?.rootViewController!.present(av, animated: true) + } var body: some View { Button(action: { @@ -39,10 +46,16 @@ struct ProjectListEntry: View { } if project.backend == .cospend { Button(action: { - self.shareProject = project + actionShare(url: project.url.absoluteString) }, label: { HStack(spacing: 5) { Image(systemName: "square.and.arrow.up") + } + }) + Button(action: { + self.shareProject = project + }, label: { + HStack(spacing: 5) { Image(systemName: "qrcode") } }) From 52dc286e4a554cb093479c1b993bafd17f420162 Mon Sep 17 00:00:00 2001 From: Tobi Date: Mon, 22 May 2023 22:03:53 +0200 Subject: [PATCH 03/10] Add translation --- PayForMe/Strings/cs.lproj/Localizable.strings | 2 ++ PayForMe/Strings/de.lproj/Localizable.strings | 2 ++ PayForMe/Strings/en.lproj/Localizable.strings | 2 ++ PayForMe/Strings/es.lproj/Localizable.strings | 2 ++ PayForMe/Strings/fr.lproj/Localizable.strings | 2 ++ PayForMe/Strings/ru.lproj/Localizable.strings | 2 ++ 6 files changed, 12 insertions(+) diff --git a/PayForMe/Strings/cs.lproj/Localizable.strings b/PayForMe/Strings/cs.lproj/Localizable.strings index 356d180..89109bf 100644 --- a/PayForMe/Strings/cs.lproj/Localizable.strings +++ b/PayForMe/Strings/cs.lproj/Localizable.strings @@ -104,6 +104,8 @@ /* AddProjectQRView.swift */ "Scan the Cospend QR code to proceed" = "Pokud chcete pokračovat, naskenujte QR kód z Cospend"; +"Scan the QR code to proceed" = "Naskenujte kód QR a pokračujte"; + /* AddProjectManualView.swift */ "Server Address" = "Adresa serveru"; diff --git a/PayForMe/Strings/de.lproj/Localizable.strings b/PayForMe/Strings/de.lproj/Localizable.strings index 9e670a4..3e67a04 100644 --- a/PayForMe/Strings/de.lproj/Localizable.strings +++ b/PayForMe/Strings/de.lproj/Localizable.strings @@ -101,6 +101,8 @@ /* AddProjectQRView.swift */ "Scan the Cospend QR code to proceed" = "Scanne den Cospend QR-Code um fortzufahren"; +"Scan the QR code to proceed" = "Scannen Sie den QR-Code, um fortzufahren"; + /* AddProjectManualView.swift */ "Server Address" = "Server URL"; diff --git a/PayForMe/Strings/en.lproj/Localizable.strings b/PayForMe/Strings/en.lproj/Localizable.strings index 37bb86d..c795456 100644 --- a/PayForMe/Strings/en.lproj/Localizable.strings +++ b/PayForMe/Strings/en.lproj/Localizable.strings @@ -104,6 +104,8 @@ /* AddProjectQRView.swift */ "Scan the Cospend QR code to proceed" = "Scan the Cospend QR code to proceed"; +"Scan the QR code to proceed" = "Scan the QR code to proceed"; + /* AddProjectManualView.swift */ "Server Address" = "Server Address"; diff --git a/PayForMe/Strings/es.lproj/Localizable.strings b/PayForMe/Strings/es.lproj/Localizable.strings index 6fcdf6d..f4f438e 100644 --- a/PayForMe/Strings/es.lproj/Localizable.strings +++ b/PayForMe/Strings/es.lproj/Localizable.strings @@ -101,6 +101,8 @@ /* */ "Scan the Cospend QR code to proceed" = "Escanee el código QR de Cospend para continuar"; +"Scan the QR code to proceed" = "Escanee el código QR para continuar"; + /* Localizable.strings PayForMe diff --git a/PayForMe/Strings/fr.lproj/Localizable.strings b/PayForMe/Strings/fr.lproj/Localizable.strings index d306df8..97de88b 100644 --- a/PayForMe/Strings/fr.lproj/Localizable.strings +++ b/PayForMe/Strings/fr.lproj/Localizable.strings @@ -101,6 +101,8 @@ /* */ "Scan the Cospend QR code to proceed" = "Scannez le code QR de Cospend pour continuer"; +"Scan the QR code to proceed" = "Scannez le code QR pour continuer"; + /* Localizable.strings PayForMe diff --git a/PayForMe/Strings/ru.lproj/Localizable.strings b/PayForMe/Strings/ru.lproj/Localizable.strings index 6813389..2ebbf60 100644 --- a/PayForMe/Strings/ru.lproj/Localizable.strings +++ b/PayForMe/Strings/ru.lproj/Localizable.strings @@ -101,6 +101,8 @@ /* */ "Scan the Cospend QR code to proceed" = "Сканирование QR-кода Cospend для продолжения работы"; +"Scan the QR code to proceed" = "Сканируйте QR-код, чтобы продолжить"; + /* From 246f9af02a82c0f977a638d0c6b5290479dc8391 Mon Sep 17 00:00:00 2001 From: Tobi Date: Mon, 22 May 2023 23:46:35 +0200 Subject: [PATCH 04/10] Remove warnings --- PayForMe/Services/StorageService.swift | 2 +- PayForMe/Util/FloatingAddButtonViewModifier.swift | 2 +- .../Views/BillDetail/CommunicationIndicator.swift | 6 +++--- PayForMe/Views/LoadingDots.swift | 11 ++++++----- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/PayForMe/Services/StorageService.swift b/PayForMe/Services/StorageService.swift index bc33691..2bdbb97 100644 --- a/PayForMe/Services/StorageService.swift +++ b/PayForMe/Services/StorageService.swift @@ -107,7 +107,7 @@ class StorageService { func removeProject(project: Project) { let storedProject = StoredProject(project: project) do { - try dbQueue.write { db in + try _ = dbQueue.write { db in try storedProject.delete(db) } } catch { diff --git a/PayForMe/Util/FloatingAddButtonViewModifier.swift b/PayForMe/Util/FloatingAddButtonViewModifier.swift index d4bb470..06a1dee 100644 --- a/PayForMe/Util/FloatingAddButtonViewModifier.swift +++ b/PayForMe/Util/FloatingAddButtonViewModifier.swift @@ -46,7 +46,7 @@ private struct FloatingAddButtonView: View { struct FloatingAddButtonViewModifier_Previews: PreviewProvider { static var previews: some View { - FloatingAddButtonView(sheetToggle: .constant(true)) + // FloatingAddButtonView(sheetToggle: .constant(true)) let viewModel = BillListViewModel() previewProject.members = previewPersons viewModel.currentProject = previewProject diff --git a/PayForMe/Views/BillDetail/CommunicationIndicator.swift b/PayForMe/Views/BillDetail/CommunicationIndicator.swift index 8094d53..85d131b 100644 --- a/PayForMe/Views/BillDetail/CommunicationIndicator.swift +++ b/PayForMe/Views/BillDetail/CommunicationIndicator.swift @@ -37,7 +37,7 @@ struct LoadingRings: View { .frame(width: 100, height: 100) .foregroundColor(.red) .rotation3DEffect(.degrees(spin3D_x ? 180 : 1), axis: (x: spin3D_x ? 1 : 0, y: 0, z: 0)) - .animation(Animation.linear(duration: 1).repeatForever(autoreverses: false)) + .animation(Animation.linear(duration: 1).repeatForever(autoreverses: false), value: self.spin3D_x) .onAppear { self.spin3D_x.toggle() } @@ -46,7 +46,7 @@ struct LoadingRings: View { .frame(width: 60, height: 60) .foregroundColor(.green) .rotation3DEffect(.degrees(spin3D_y ? 360 : 1), axis: (x: 0, y: spin3D_y ? 1 : 0, z: 0)) - .animation(Animation.linear(duration: 1).repeatForever(autoreverses: false)) + .animation(Animation.linear(duration: 1).repeatForever(autoreverses: false), value: self.spin3D_y) .onAppear { self.spin3D_y.toggle() } @@ -55,7 +55,7 @@ struct LoadingRings: View { .frame(width: 20, height: 20) .foregroundColor(.blue) .rotation3DEffect(.degrees(spin3D_xy ? 180 : 1), axis: (x: spin3D_xy ? 0 : 1, y: spin3D_xy ? 0 : 1, z: 0)) - .animation(Animation.linear(duration: 1).repeatForever(autoreverses: false)) + .animation(Animation.linear(duration: 1).repeatForever(autoreverses: false), value: self.spin3D_xy) .onAppear { self.spin3D_xy.toggle() } diff --git a/PayForMe/Views/LoadingDots.swift b/PayForMe/Views/LoadingDots.swift index f197d95..388209f 100644 --- a/PayForMe/Views/LoadingDots.swift +++ b/PayForMe/Views/LoadingDots.swift @@ -21,7 +21,7 @@ struct LoadingDots: View { .stroke(lineWidth: 3) .frame(width: 12, height: 12) .scaleEffect(leftAnimates ? 1 : 0) - .animation(Animation.spring().repeatForever(autoreverses: false).speed(0.5)) + .animation(Animation.spring().repeatForever(autoreverses: false).speed(0.5), value: self.leftAnimates) .onAppear { self.leftAnimates.toggle() } @@ -30,7 +30,7 @@ struct LoadingDots: View { .stroke(lineWidth: 3) .frame(width: 12, height: 12) .scaleEffect(middleAnimates ? 1 : 0) - .animation(Animation.spring().repeatForever(autoreverses: false).speed(0.5).delay(0.15)) + .animation(Animation.spring().repeatForever(autoreverses: false).speed(0.5).delay(0.15), value: self.middleAnimates) .onAppear { self.middleAnimates.toggle() } @@ -40,7 +40,7 @@ struct LoadingDots: View { .stroke(lineWidth: 3) .frame(width: 12, height: 12) .scaleEffect(rightAnimates ? 1 : 0) - .animation(Animation.spring().repeatForever(autoreverses: false).speed(0.5).delay(0.25)) + .animation(Animation.spring().repeatForever(autoreverses: false).speed(0.5).delay(0.25), value: rightAnimates) .onAppear { self.rightAnimates.toggle() } @@ -48,7 +48,7 @@ struct LoadingDots: View { .stroke(lineWidth: 3) .frame(width: 12, height: 12) .scaleEffect(rightAnimates ? 1 : 0) - .animation(Animation.spring().repeatForever(autoreverses: false).speed(0.5).delay(0.35)) + .animation(Animation.spring().repeatForever(autoreverses: false).speed(0.5).delay(0.35), value: rightAnimates) .onAppear { self.rightAnimates.toggle() } @@ -56,7 +56,7 @@ struct LoadingDots: View { .stroke(lineWidth: 3) .frame(width: 12, height: 12) .scaleEffect(rightAnimates ? 1 : 0) - .animation(Animation.spring().repeatForever(autoreverses: false).speed(0.5).delay(0.45)) + .animation(Animation.spring().repeatForever(autoreverses: false).speed(0.5).delay(0.45), value: rightAnimates) .onAppear { self.rightAnimates.toggle() } @@ -65,6 +65,7 @@ struct LoadingDots: View { } struct LoadingDots_Previews: PreviewProvider { + static var previews: some View { LoadingDots() } From bc8df63a301e3e94823f35183f86de642d4a9689 Mon Sep 17 00:00:00 2001 From: Tobi Date: Tue, 23 May 2023 00:12:02 +0200 Subject: [PATCH 05/10] Update dependencies Set space between icons in project list --- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- .../Projects/Manual/AddProjectManualView.swift | 1 + PayForMe/Views/Projects/ProjectListEntry.swift | 13 ++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/PayForMe.xcworkspace/xcshareddata/swiftpm/Package.resolved b/PayForMe.xcworkspace/xcshareddata/swiftpm/Package.resolved index 929c44d..654223f 100644 --- a/PayForMe.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/PayForMe.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/groue/GRDB.swift.git", "state" : { - "revision" : "fead2ea634c1bf7dd81a3e02f796154992165ffd", - "version" : "5.24.0" + "revision" : "dd7e7f39e8e4d7a22d258d9809a882f914690b01", + "version" : "5.26.1" } }, { diff --git a/PayForMe/Views/Projects/Manual/AddProjectManualView.swift b/PayForMe/Views/Projects/Manual/AddProjectManualView.swift index 667c580..a9921c2 100644 --- a/PayForMe/Views/Projects/Manual/AddProjectManualView.swift +++ b/PayForMe/Views/Projects/Manual/AddProjectManualView.swift @@ -59,6 +59,7 @@ struct AddProjectManualView: View { } } .id(viewmodel.projectType == .cospend ? "cospend" : "iHateMoney") + .frame(width: UIScreen.main.bounds.width, height: 220, alignment: .center) SlickLoadingSpinner(connectionState: viewmodel.validationProgress) .frame(width: 50, height: 50) FancyButton( diff --git a/PayForMe/Views/Projects/ProjectListEntry.swift b/PayForMe/Views/Projects/ProjectListEntry.swift index 108a26a..852d4e6 100644 --- a/PayForMe/Views/Projects/ProjectListEntry.swift +++ b/PayForMe/Views/Projects/ProjectListEntry.swift @@ -33,6 +33,8 @@ struct ProjectListEntry: View { HStack { VStack(alignment: .leading) { Text(project.name) + .allowsTightening(true) + .lineLimit(1) Text(project.backend == .cospend ? "Cospend" : "iHateMoney").font(.caption).foregroundColor(Color.gray) } Spacer() @@ -42,22 +44,19 @@ struct ProjectListEntry: View { }, label: { Image(systemName: "pencil") }) - .padding(.trailing, 5) + .padding(.trailing, 8) } if project.backend == .cospend { Button(action: { actionShare(url: project.url.absoluteString) }, label: { - HStack(spacing: 5) { - Image(systemName: "square.and.arrow.up") - } + Image(systemName: "square.and.arrow.up") }) + .padding(.trailing, 8) Button(action: { self.shareProject = project }, label: { - HStack(spacing: 5) { - Image(systemName: "qrcode") - } + Image(systemName: "qrcode") }) } } From 966dac6eda968c9b772215610e9eb376017a903b Mon Sep 17 00:00:00 2001 From: Tobi Date: Tue, 23 May 2023 01:18:22 +0200 Subject: [PATCH 06/10] Add "Copy Link" --- PayForMe.xcodeproj/project.pbxproj | 20 +++++++++---------- PayForMe/Strings/cs.lproj/Localizable.strings | 4 ++++ PayForMe/Strings/de.lproj/Localizable.strings | 3 +++ PayForMe/Strings/en.lproj/Localizable.strings | 3 +++ PayForMe/Strings/es.lproj/Localizable.strings | 3 +++ PayForMe/Strings/fr.lproj/Localizable.strings | 3 +++ PayForMe/Strings/ru.lproj/Localizable.strings | 3 +++ .../Views/Projects/ShareProjectQRCode.swift | 10 +++++++++- 8 files changed, 38 insertions(+), 11 deletions(-) diff --git a/PayForMe.xcodeproj/project.pbxproj b/PayForMe.xcodeproj/project.pbxproj index d979eb1..8a4c286 100644 --- a/PayForMe.xcodeproj/project.pbxproj +++ b/PayForMe.xcodeproj/project.pbxproj @@ -633,7 +633,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = L79BTFY6FV; + DEVELOPMENT_TEAM = Q74M3KUZHW; INFOPLIST_FILE = PayForMeTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -641,7 +641,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = de.maxtharr.PayForMeTests; + PRODUCT_BUNDLE_IDENTIFIER = dev.huppertz.PayForMeTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -655,7 +655,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = L79BTFY6FV; + DEVELOPMENT_TEAM = Q74M3KUZHW; INFOPLIST_FILE = PayForMeTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -663,7 +663,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = de.maxtharr.PayForMeTests; + PRODUCT_BUNDLE_IDENTIFIER = dev.huppertz.PayForMeTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -795,7 +795,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 109; DEVELOPMENT_ASSET_PATHS = "\"PayForMe/Preview Content\""; - DEVELOPMENT_TEAM = L79BTFY6FV; + DEVELOPMENT_TEAM = Q74M3KUZHW; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = PayForMe/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; @@ -804,7 +804,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 2.4.1; - PRODUCT_BUNDLE_IDENTIFIER = de.mayflower.PayForMe; + PRODUCT_BUNDLE_IDENTIFIER = dev.huppertz.PayForMe; PRODUCT_NAME = PayForMe; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; @@ -819,7 +819,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 109; DEVELOPMENT_ASSET_PATHS = "\"PayForMe/Preview Content\""; - DEVELOPMENT_TEAM = L79BTFY6FV; + DEVELOPMENT_TEAM = Q74M3KUZHW; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = PayForMe/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; @@ -828,7 +828,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 2.4.1; - PRODUCT_BUNDLE_IDENTIFIER = de.mayflower.PayForMe; + PRODUCT_BUNDLE_IDENTIFIER = dev.huppertz.PayForMe; PRODUCT_NAME = PayForMe; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; @@ -839,7 +839,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = L79BTFY6FV; + DEVELOPMENT_TEAM = Q74M3KUZHW; INFOPLIST_FILE = PayForMeUITests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -858,7 +858,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = L79BTFY6FV; + DEVELOPMENT_TEAM = Q74M3KUZHW; INFOPLIST_FILE = PayForMeUITests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/PayForMe/Strings/cs.lproj/Localizable.strings b/PayForMe/Strings/cs.lproj/Localizable.strings index 89109bf..f85bc99 100644 --- a/PayForMe/Strings/cs.lproj/Localizable.strings +++ b/PayForMe/Strings/cs.lproj/Localizable.strings @@ -89,6 +89,10 @@ "Paste Link" = "Vložit odkaz"; + +"Copy Link" = "Kopírovat odkaz"; + + /* BillDetail.swift */ "Payer" = "Plátce"; diff --git a/PayForMe/Strings/de.lproj/Localizable.strings b/PayForMe/Strings/de.lproj/Localizable.strings index 3e67a04..121e8e8 100644 --- a/PayForMe/Strings/de.lproj/Localizable.strings +++ b/PayForMe/Strings/de.lproj/Localizable.strings @@ -87,6 +87,9 @@ "Paste Link" = "Link einsetzen"; +"Copy Link" = "Link kopieren"; + + "Payer" = "Zahler"; /* ProjectQRPermissionCheckerView.swift */ diff --git a/PayForMe/Strings/en.lproj/Localizable.strings b/PayForMe/Strings/en.lproj/Localizable.strings index c795456..ea406dc 100644 --- a/PayForMe/Strings/en.lproj/Localizable.strings +++ b/PayForMe/Strings/en.lproj/Localizable.strings @@ -89,6 +89,9 @@ "Paste Link" = "Paste Link"; + +"Copy Link" = "Copy Link"; + /* BillDetail.swift */ "Payer" = "Payer"; diff --git a/PayForMe/Strings/es.lproj/Localizable.strings b/PayForMe/Strings/es.lproj/Localizable.strings index f4f438e..7616743 100644 --- a/PayForMe/Strings/es.lproj/Localizable.strings +++ b/PayForMe/Strings/es.lproj/Localizable.strings @@ -87,6 +87,9 @@ "Paste Link" = "Pegar enlace"; +"Copy Link" = "Copiar enlace"; + + "Payer" = "Pagador"; /* */ diff --git a/PayForMe/Strings/fr.lproj/Localizable.strings b/PayForMe/Strings/fr.lproj/Localizable.strings index 97de88b..4335107 100644 --- a/PayForMe/Strings/fr.lproj/Localizable.strings +++ b/PayForMe/Strings/fr.lproj/Localizable.strings @@ -87,6 +87,9 @@ "Paste Link" = "Lien de collage"; +"Copy Link" = "Copier le lien"; + + "Payer" = "Prêteur"; /* */ diff --git a/PayForMe/Strings/ru.lproj/Localizable.strings b/PayForMe/Strings/ru.lproj/Localizable.strings index 2ebbf60..a1c51b5 100644 --- a/PayForMe/Strings/ru.lproj/Localizable.strings +++ b/PayForMe/Strings/ru.lproj/Localizable.strings @@ -87,6 +87,9 @@ "Paste Link" = "Вставить ссылку"; +"Copy Link" = "Копировать ссылку"; + + "Payer" = "Кто платил"; /* */ diff --git a/PayForMe/Views/Projects/ShareProjectQRCode.swift b/PayForMe/Views/Projects/ShareProjectQRCode.swift index 446000c..adc85b1 100644 --- a/PayForMe/Views/Projects/ShareProjectQRCode.swift +++ b/PayForMe/Views/Projects/ShareProjectQRCode.swift @@ -17,7 +17,15 @@ struct ShareProjectQRCode: View { var body: some View { VStack { - Text(dataString).font(.caption) + Button(action: { + let pasteboard = UIPasteboard.general + pasteboard.string = dataString + }, label: { + Text("Copy Link") + }) + Text(dataString) + .padding() + .font(.caption) CarBode.CBBarcodeView(data: $dataString, barcodeType: .constant(.qrCode), orientation: .constant(.up), onGenerated: nil) .aspectRatio(contentMode: .fit) } From a1e858a69c85fff4e0193eb311d0db0eab646694 Mon Sep 17 00:00:00 2001 From: Tobi Date: Tue, 23 May 2023 20:42:41 +0200 Subject: [PATCH 07/10] Share full link --- PayForMe/Views/Projects/ProjectListEntry.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PayForMe/Views/Projects/ProjectListEntry.swift b/PayForMe/Views/Projects/ProjectListEntry.swift index 852d4e6..db7926a 100644 --- a/PayForMe/Views/Projects/ProjectListEntry.swift +++ b/PayForMe/Views/Projects/ProjectListEntry.swift @@ -18,9 +18,9 @@ struct ProjectListEntry: View { @State var edit = false @State var me = 0 - func actionShare(url: String) { - guard let data = URL(string: url) else { return } - let av = UIActivityViewController(activityItems: [data], applicationActivities: nil) + func actionShare(project: Project) { + guard let data = URL(string: "\(project.url)/apps/cospend/s/\(project.token)") else { return } + let av = UIActivityViewController(activityItems: [data.absoluteString], applicationActivities: nil) UIApplication.shared.connectedScenes.flatMap { ($0 as? UIWindowScene)?.windows ?? [] } .first { $0.isKeyWindow }?.rootViewController!.present(av, animated: true) } @@ -48,7 +48,7 @@ struct ProjectListEntry: View { } if project.backend == .cospend { Button(action: { - actionShare(url: project.url.absoluteString) + actionShare(project: project) }, label: { Image(systemName: "square.and.arrow.up") }) From 2ce5a18ccba71b44f9428920d32cec1608092a9a Mon Sep 17 00:00:00 2001 From: Tobi Date: Tue, 23 May 2023 20:50:45 +0200 Subject: [PATCH 08/10] Fix doublicate slashes in sharing link --- .../Manual/AddProjectManualViewModel.swift | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift b/PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift index 484a1c7..5523371 100644 --- a/PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift +++ b/PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift @@ -69,17 +69,15 @@ class AddProjectManualViewModel: ObservableObject { return } // If it is another url - - let pathComponents = url.pathComponents - let pureUrl = url.deletingPathExtension().absoluteString - let trimmIndices = url.absoluteString.indices(of: "/") - if let cutIndex = trimmIndices[safe: 2] { - let trimmedUrl = pureUrl[...cutIndex] - serverAddress = String(trimmedUrl) + if url.scheme != nil && url.host != nil { + serverAddress = "\(url.scheme!)://\(url.host!)" + if url.port != nil { + serverAddress+=":\(url.port!)" + } } else { - serverAddress = pureUrl + serverAddress = url.deletingPathExtension().absoluteString } - fillFieldsFromComponents(components: pathComponents) + fillFieldsFromComponents(components: url.pathComponents) } var serverAddressFormatted: AnyPublisher { From 1e0c6c88973d17cbaf1fdc844943fe28766d4312 Mon Sep 17 00:00:00 2001 From: Tobi Date: Tue, 23 May 2023 20:54:54 +0200 Subject: [PATCH 09/10] Set unit test --- PayForMeTests/AddProjectManuallyTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PayForMeTests/AddProjectManuallyTests.swift b/PayForMeTests/AddProjectManuallyTests.swift index 12634bb..d70ccc4 100644 --- a/PayForMeTests/AddProjectManuallyTests.swift +++ b/PayForMeTests/AddProjectManuallyTests.swift @@ -76,7 +76,7 @@ class AddProjectManuallyTests: XCTestCase { exp2.fulfill() }.store(in: &subscriptions) viewmodel.$projectPassword.sink { password in - XCTAssertEqual("", password) + XCTAssertEqual("no-pass", password) exp3.fulfill() }.store(in: &subscriptions) waitForExpectations(timeout: 1) @@ -124,7 +124,7 @@ class AddProjectManuallyTests: XCTestCase { XCTAssertEqual(project.backend, .cospend) XCTAssertEqual(project.name, "02939asdasd12asdj23") XCTAssertEqual(project.token, "02939asdasd12asdj23") - XCTAssertEqual(project.password, "") + XCTAssertEqual(project.password, "no-pass") XCTAssertEqual(project.url.absoluteString, "https://myserver.de") exp.fulfill() }.store(in: &subscriptions) From cbd2d540c937b28bffbbc656fa2b24380fd2ab34 Mon Sep 17 00:00:00 2001 From: Tobi Date: Tue, 23 May 2023 21:07:45 +0200 Subject: [PATCH 10/10] Revert account --- PayForMe.xcodeproj/project.pbxproj | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PayForMe.xcodeproj/project.pbxproj b/PayForMe.xcodeproj/project.pbxproj index 8a4c286..d979eb1 100644 --- a/PayForMe.xcodeproj/project.pbxproj +++ b/PayForMe.xcodeproj/project.pbxproj @@ -633,7 +633,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = Q74M3KUZHW; + DEVELOPMENT_TEAM = L79BTFY6FV; INFOPLIST_FILE = PayForMeTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -641,7 +641,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = dev.huppertz.PayForMeTests; + PRODUCT_BUNDLE_IDENTIFIER = de.maxtharr.PayForMeTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -655,7 +655,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = Q74M3KUZHW; + DEVELOPMENT_TEAM = L79BTFY6FV; INFOPLIST_FILE = PayForMeTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -663,7 +663,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = dev.huppertz.PayForMeTests; + PRODUCT_BUNDLE_IDENTIFIER = de.maxtharr.PayForMeTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -795,7 +795,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 109; DEVELOPMENT_ASSET_PATHS = "\"PayForMe/Preview Content\""; - DEVELOPMENT_TEAM = Q74M3KUZHW; + DEVELOPMENT_TEAM = L79BTFY6FV; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = PayForMe/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; @@ -804,7 +804,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 2.4.1; - PRODUCT_BUNDLE_IDENTIFIER = dev.huppertz.PayForMe; + PRODUCT_BUNDLE_IDENTIFIER = de.mayflower.PayForMe; PRODUCT_NAME = PayForMe; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; @@ -819,7 +819,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 109; DEVELOPMENT_ASSET_PATHS = "\"PayForMe/Preview Content\""; - DEVELOPMENT_TEAM = Q74M3KUZHW; + DEVELOPMENT_TEAM = L79BTFY6FV; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = PayForMe/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; @@ -828,7 +828,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 2.4.1; - PRODUCT_BUNDLE_IDENTIFIER = dev.huppertz.PayForMe; + PRODUCT_BUNDLE_IDENTIFIER = de.mayflower.PayForMe; PRODUCT_NAME = PayForMe; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; @@ -839,7 +839,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = Q74M3KUZHW; + DEVELOPMENT_TEAM = L79BTFY6FV; INFOPLIST_FILE = PayForMeUITests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -858,7 +858,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = Q74M3KUZHW; + DEVELOPMENT_TEAM = L79BTFY6FV; INFOPLIST_FILE = PayForMeUITests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)",