From 4be5e2948ed08b9661d8e65e90b6255d09890762 Mon Sep 17 00:00:00 2001 From: Max Tharr Date: Sun, 29 Aug 2021 22:56:24 +0200 Subject: [PATCH] Fix behaviour on iOS 14 and remove Timelane --- Gemfile.lock | 141 +++++++++++------- PayForMe.xcodeproj/project.pbxproj | 25 +--- .../xcshareddata/swiftpm/Package.resolved | 18 --- PayForMe/Info.plist | 2 +- PayForMe/Views/BillList/BillList.swift | 82 +++++++--- .../Manual/AddProjectManualViewModel.swift | 10 +- PayForMeTests/Info.plist | 2 +- PayForMeUITests/Info.plist | 2 +- 8 files changed, 154 insertions(+), 128 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 615ec8a..ac056c9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,57 +2,74 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.3) - addressable (2.7.0) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) + artifactory (3.0.15) atomos (0.1.3) - aws-eventstream (1.1.0) - aws-partitions (1.413.0) - aws-sdk-core (3.110.0) + aws-eventstream (1.1.1) + aws-partitions (1.490.0) + aws-sdk-core (3.119.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.40.0) - aws-sdk-core (~> 3, >= 3.109.0) + aws-sdk-kms (1.46.0) + aws-sdk-core (~> 3, >= 3.119.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.87.0) - aws-sdk-core (~> 3, >= 3.109.0) + aws-sdk-s3 (1.99.0) + aws-sdk-core (~> 3, >= 3.119.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.2) + aws-sigv4 (1.2.4) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) claide (1.0.3) colored (1.2) colored2 (3.1.2) - commander-fastlane (4.4.6) - highline (~> 1.7.2) + commander (4.6.0) + highline (~> 2.0.0) declarative (0.0.20) - declarative-option (0.1.0) - digest-crc (0.6.3) + digest-crc (0.6.4) rake (>= 12.0.0, < 14.0.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dotenv (2.7.6) - emoji_regex (3.2.1) - excon (0.78.1) - faraday (1.2.0) + emoji_regex (3.2.2) + excon (0.85.0) + faraday (1.7.0) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0.1) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.1) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) multipart-post (>= 1.2, < 3) - ruby2_keywords + ruby2_keywords (>= 0.0.4) faraday-cookie_jar (0.0.7) faraday (>= 0.8.0) http-cookie (~> 1.0.0) - faraday_middleware (1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday_middleware (1.1.0) faraday (~> 1.0) - fastimage (2.2.1) - fastlane (2.170.0) + fastimage (2.2.5) + fastlane (2.192.0) CFPropertyList (>= 2.3, < 4.0.0) - addressable (>= 2.3, < 3.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) aws-sdk-s3 (~> 1.0) babosa (>= 1.0.3, < 2.0.0) bundler (>= 1.12.0, < 3.0.0) colored - commander-fastlane (>= 4.4.6, < 5.0.0) + commander (~> 4.6) dotenv (>= 2.1.1, < 3.0.0) emoji_regex (>= 0.1, < 4.0) excon (>= 0.71.0, < 1.0.0) @@ -61,18 +78,20 @@ GEM faraday_middleware (~> 1.0) fastimage (>= 2.1.0, < 3.0.0) gh_inspector (>= 1.1.2, < 2.0.0) - google-api-client (>= 0.37.0, < 0.39.0) - google-cloud-storage (>= 1.15.0, < 2.0.0) - highline (>= 1.7.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-storage (~> 1.31) + highline (~> 2.0) json (< 3.0.0) jwt (>= 2.1.0, < 3) mini_magick (>= 4.9.4, < 5.0.0) multipart-post (~> 2.0.0) + naturally (~> 2.2) + optparse (~> 0.1.1) plist (>= 3.1.0, < 4.0.0) rubyzip (>= 2.0.0, < 3.0.0) security (= 0.1.3) simctl (~> 1.6.3) - slack-notifier (>= 2.0.0, < 3.0.0) terminal-notifier (>= 2.0.0, < 3.0.0) terminal-table (>= 1.4.5, < 2.0.0) tty-screen (>= 0.6.3, < 1.0.0) @@ -85,62 +104,74 @@ GEM json mini_magick (>= 4.9.4, < 5.0.0) gh_inspector (1.1.3) - google-api-client (0.38.0) + google-apis-androidpublisher_v3 (0.10.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-core (0.4.1) addressable (~> 2.5, >= 2.5.1) - googleauth (~> 0.9) - httpclient (>= 2.8.1, < 3.0) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) mini_mime (~> 1.0) representable (~> 3.0) - retriable (>= 2.0, < 4.0) - signet (~> 0.12) - google-cloud-core (1.5.0) + retriable (>= 2.0, < 4.a) + rexml + webrick + google-apis-iamcredentials_v1 (0.7.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-playcustomapp_v1 (0.5.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-storage_v1 (0.6.0) + google-apis-core (>= 0.4, < 2.a) + google-cloud-core (1.6.0) google-cloud-env (~> 1.0) google-cloud-errors (~> 1.0) - google-cloud-env (1.4.0) + google-cloud-env (1.5.0) faraday (>= 0.17.3, < 2.0) - google-cloud-errors (1.0.1) - google-cloud-storage (1.29.2) + google-cloud-errors (1.1.0) + google-cloud-storage (1.34.1) addressable (~> 2.5) digest-crc (~> 0.4) - google-api-client (~> 0.33) - google-cloud-core (~> 1.2) - googleauth (~> 0.9) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.1) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (0.14.0) + googleauth (0.17.0) faraday (>= 0.17.3, < 2.0) jwt (>= 1.4, < 3.0) memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (~> 0.14) - highline (1.7.10) - http-cookie (1.0.3) + highline (2.0.3) + http-cookie (1.0.4) domain_name (~> 0.5) httpclient (2.8.3) jmespath (1.4.0) json (2.5.1) - jwt (2.2.2) + jwt (2.2.3) memoist (0.16.2) mini_magick (4.11.0) - mini_mime (1.0.2) + mini_mime (1.1.1) multi_json (1.15.0) multipart-post (2.0.0) nanaimo (0.3.0) - naturally (2.2.0) + naturally (2.2.1) + optparse (0.1.1) os (1.1.1) - plist (3.5.0) + plist (3.6.0) public_suffix (4.0.6) - rake (13.0.3) - representable (3.0.4) + rake (13.0.6) + representable (3.1.1) declarative (< 0.1.0) - declarative-option (< 0.2.0) + trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) + rexml (3.2.5) rouge (2.0.7) - ruby2_keywords (0.0.2) - rubyzip (2.3.0) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) security (0.1.3) - signet (0.14.0) + signet (0.15.0) addressable (~> 2.3) faraday (>= 0.17.3, < 2.0) jwt (>= 1.5, < 3.0) @@ -148,10 +179,10 @@ GEM simctl (1.6.8) CFPropertyList naturally - slack-notifier (2.3.2) terminal-notifier (2.0.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) + trailblazer-option (0.1.1) tty-cursor (0.7.1) tty-screen (0.8.1) tty-spinner (0.9.3) @@ -161,16 +192,18 @@ GEM unf_ext unf_ext (0.0.7.7) unicode-display_width (1.7.0) + webrick (1.7.0) word_wrap (1.0.0) - xcodeproj (1.19.0) + xcodeproj (1.21.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) + rexml (~> 3.2.4) xcpretty (0.3.0) rouge (~> 2.0.7) - xcpretty-travis-formatter (1.0.0) + xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) PLATFORMS diff --git a/PayForMe.xcodeproj/project.pbxproj b/PayForMe.xcodeproj/project.pbxproj index 6654f0b..7320ed8 100644 --- a/PayForMe.xcodeproj/project.pbxproj +++ b/PayForMe.xcodeproj/project.pbxproj @@ -18,7 +18,6 @@ 65005A0223DDFB1A00D1D599 /* WhoPaidView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65005A0123DDFB1A00D1D599 /* WhoPaidView.swift */; }; 65005A0423DE0C5C00D1D599 /* BillList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65005A0323DE0C5C00D1D599 /* BillList.swift */; }; 650504A123FEA461000E5F9C /* PersonText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650504A023FEA461000E5F9C /* PersonText.swift */; }; - 651B0CAE2559A32E00D02CA9 /* TimelaneCombine in Frameworks */ = {isa = PBXBuildFile; productRef = 651B0CAD2559A32E00D02CA9 /* TimelaneCombine */; }; 651B0CD02559C40900D02CA9 /* SlickLoadingSpinner in Frameworks */ = {isa = PBXBuildFile; productRef = 651B0CCF2559C40900D02CA9 /* SlickLoadingSpinner */; }; 6523FC4C25580EEF00BCD843 /* UrlExtensionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6523FC4B25580EEF00BCD843 /* UrlExtensionsTests.swift */; }; 6523FC512558153600BCD843 /* AddPasswordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6523FC502558153600BCD843 /* AddPasswordView.swift */; }; @@ -161,7 +160,6 @@ 6524D60225385E0800B2AA7B /* GRDB in Frameworks */, 658FC555252727C1004A49AA /* CarBode in Frameworks */, 651B0CD02559C40900D02CA9 /* SlickLoadingSpinner in Frameworks */, - 651B0CAE2559A32E00D02CA9 /* TimelaneCombine in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -411,7 +409,6 @@ packageProductDependencies = ( 658FC554252727C1004A49AA /* CarBode */, 6524D60125385E0800B2AA7B /* GRDB */, - 651B0CAD2559A32E00D02CA9 /* TimelaneCombine */, 651B0CCF2559C40900D02CA9 /* SlickLoadingSpinner */, ); productName = iCospend; @@ -476,7 +473,6 @@ packageReferences = ( 658FC553252727C1004A49AA /* XCRemoteSwiftPackageReference "CarBode-Barcode-Scanner-For-SwiftUI" */, 6524D60025385E0800B2AA7B /* XCRemoteSwiftPackageReference "GRDB.swift" */, - 651B0CAC2559A32E00D02CA9 /* XCRemoteSwiftPackageReference "TimelaneCombine" */, 651B0CCE2559C40900D02CA9 /* XCRemoteSwiftPackageReference "SlickLoadingSpinner" */, ); productRefGroup = 65662A0023D7320000303207 /* Products */; @@ -791,7 +787,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = PayForMe/PayForMe.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 85; + CURRENT_PROJECT_VERSION = 89; DEVELOPMENT_ASSET_PATHS = "\"PayForMe/Preview Content\""; DEVELOPMENT_TEAM = L79BTFY6FV; ENABLE_PREVIEWS = YES; @@ -801,7 +797,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.2; + MARKETING_VERSION = 2.3.1; PRODUCT_BUNDLE_IDENTIFIER = de.mayflower.PayForMe; PRODUCT_NAME = PayForMe; SWIFT_VERSION = 5.0; @@ -815,7 +811,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = PayForMe/PayForMe.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 85; + CURRENT_PROJECT_VERSION = 89; DEVELOPMENT_ASSET_PATHS = "\"PayForMe/Preview Content\""; DEVELOPMENT_TEAM = L79BTFY6FV; ENABLE_PREVIEWS = YES; @@ -825,7 +821,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.2; + MARKETING_VERSION = 2.3.1; PRODUCT_BUNDLE_IDENTIFIER = de.mayflower.PayForMe; PRODUCT_NAME = PayForMe; SWIFT_VERSION = 5.0; @@ -913,14 +909,6 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - 651B0CAC2559A32E00D02CA9 /* XCRemoteSwiftPackageReference "TimelaneCombine" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/icanzilb/TimelaneCombine"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 2.0.0; - }; - }; 651B0CCE2559C40900D02CA9 /* XCRemoteSwiftPackageReference "SlickLoadingSpinner" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/Hustenbonbon/SlickLoadingSpinner.git"; @@ -948,11 +936,6 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - 651B0CAD2559A32E00D02CA9 /* TimelaneCombine */ = { - isa = XCSwiftPackageProductDependency; - package = 651B0CAC2559A32E00D02CA9 /* XCRemoteSwiftPackageReference "TimelaneCombine" */; - productName = TimelaneCombine; - }; 651B0CCF2559C40900D02CA9 /* SlickLoadingSpinner */ = { isa = XCSwiftPackageProductDependency; package = 651B0CCE2559C40900D02CA9 /* XCRemoteSwiftPackageReference "SlickLoadingSpinner" */; diff --git a/PayForMe.xcworkspace/xcshareddata/swiftpm/Package.resolved b/PayForMe.xcworkspace/xcshareddata/swiftpm/Package.resolved index e54c523..aa583ca 100644 --- a/PayForMe.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/PayForMe.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -27,24 +27,6 @@ "revision": "c1b125fabf245717df0a44655cd8a96b603ee55e", "version": "2.0.1" } - }, - { - "package": "TimelaneCombine", - "repositoryURL": "https://github.com/icanzilb/TimelaneCombine", - "state": { - "branch": null, - "revision": "e6837bcbb19332866d5e37d501c05d68fbf985f2", - "version": "2.0.0" - } - }, - { - "package": "TimelaneCore", - "repositoryURL": "https://github.com/icanzilb/TimelaneCore", - "state": { - "branch": null, - "revision": "1ce6992ee42d88590d38fe6dceae9b6e2a8f4919", - "version": "2.0.0" - } } ] }, diff --git a/PayForMe/Info.plist b/PayForMe/Info.plist index 062907f..aea01dc 100644 --- a/PayForMe/Info.plist +++ b/PayForMe/Info.plist @@ -32,7 +32,7 @@ CFBundleVersion - $(CURRENT_PROJECT_VERSION) + 89 LSRequiresIPhoneOS NSCameraUsageDescription diff --git a/PayForMe/Views/BillList/BillList.swift b/PayForMe/Views/BillList/BillList.swift index 75c3650..388eb40 100644 --- a/PayForMe/Views/BillList/BillList.swift +++ b/PayForMe/Views/BillList/BillList.swift @@ -19,23 +19,10 @@ struct BillList: View { var body: some View { NavigationView { List { - Section(header: Picker("Sort by", selection: $viewModel.sortBy) { - Text("Expense date").tag(BillListViewModel.SortedBy.expenseDate) - Text("Changed date").tag(BillListViewModel.SortedBy.changedDate) - }.pickerStyle(SegmentedPickerStyle())) { - ForEach(viewModel.sortedBills) { bill in - NavigationLink(destination: - BillDetailView(showModal: .constant(false), - viewModel: BillDetailViewModel(currentBill: bill), - navBarTitle: "Edit Bill", - sendButtonTitle: "Update Bill")) { - BillCell(viewModel: self.viewModel, bill: bill) - } - } - .onDelete(perform: { - offset in - self.deleteAlert = offset - }) + if #available(iOS 15, *) { + iOS15ListContent + } else { + iOS14ListContent } } .addFloatingAddButton() @@ -49,23 +36,70 @@ struct BillList: View { }, secondaryButton: .cancel()) } + .listStyle(InsetGroupedListStyle()) } .onAppear { ProjectManager.shared.loadBillsAndMembers() } } -func deleteBill(at offsets: IndexSet) { - for offset in offsets { - guard let bill = viewModel.currentProject.bills[safe: offset] else { - return + @ViewBuilder + var iOS15ListContent: some View { + Section(header: Picker("Sort by", selection: $viewModel.sortBy) { + Text("Expense date").tag(BillListViewModel.SortedBy.expenseDate) + Text("Changed date").tag(BillListViewModel.SortedBy.changedDate) + }.pickerStyle(SegmentedPickerStyle())) { + ForEach(viewModel.sortedBills) { bill in + NavigationLink(destination: + BillDetailView(showModal: .constant(false), + viewModel: BillDetailViewModel(currentBill: bill), + navBarTitle: "Edit Bill", + sendButtonTitle: "Update Bill")) { + BillCell(viewModel: self.viewModel, bill: bill) + } } - ProjectManager.shared.deleteBill(bill, completion: { - ProjectManager.shared.loadBillsAndMembers() + .onDelete(perform: { + offset in + self.deleteAlert = offset }) } -} + } + @ViewBuilder + var iOS14ListContent: some View { + Section { + Picker("Sort by", selection: $viewModel.sortBy) { + Text("Expense date").tag(BillListViewModel.SortedBy.expenseDate) + Text("Changed date").tag(BillListViewModel.SortedBy.changedDate) + }.pickerStyle(SegmentedPickerStyle()) + } + Section { + ForEach(viewModel.sortedBills) { bill in + NavigationLink(destination: + BillDetailView(showModal: .constant(false), + viewModel: BillDetailViewModel(currentBill: bill), + navBarTitle: "Edit Bill", + sendButtonTitle: "Update Bill")) { + BillCell(viewModel: self.viewModel, bill: bill) + } + } + .onDelete(perform: { + offset in + self.deleteAlert = offset + }) + } + } + + func deleteBill(at offsets: IndexSet) { + for offset in offsets { + guard let bill = viewModel.sortedBills[safe: offset] else { + return + } + ProjectManager.shared.deleteBill(bill, completion: { + ProjectManager.shared.loadBillsAndMembers() + }) + } + } } extension IndexSet: Identifiable { diff --git a/PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift b/PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift index e57ef3e..bc244dd 100644 --- a/PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift +++ b/PayForMe/Views/Projects/Manual/AddProjectManualViewModel.swift @@ -9,7 +9,6 @@ import Foundation import UIKit import Combine -import TimelaneCombine import SlickLoadingSpinner class AddProjectManualViewModel: ObservableObject { @@ -34,8 +33,8 @@ class AddProjectManualViewModel: ObservableObject { private var lastProjectTestedSuccessfully: Project? init() { - validatedInput.map { _ in LoadingState.connecting }.lane("connecting").assign(to: &$validationProgress) - validatedServer.map { $0 == 200 ? LoadingState.success : LoadingState.failure }.lane("right/wrong").assign(to: &$validationProgress) + validatedInput.map { _ in LoadingState.connecting }.assign(to: &$validationProgress) + validatedServer.map { $0 == 200 ? LoadingState.success : LoadingState.failure }.assign(to: &$validationProgress) errorTextPublisher.assign(to: &$errorText) serverCheckUnsupportedPorts.assign(to: &$errorText) } @@ -142,9 +141,7 @@ class AddProjectManualViewModel: ObservableObject { return nil } } - .lane("Input") .removeDuplicates() - .lane("InputUnduplicated") .eraseToAnyPublisher() } @@ -157,16 +154,13 @@ class AddProjectManualViewModel: ObservableObject { self.lastProjectTestedSuccessfully = project return code } - .lane("Server") .removeDuplicates() - .lane("ServerUnDuplicated") .receive(on: RunLoop.main) .eraseToAnyPublisher() } private var errorTextPublisher: AnyPublisher { validatedServer - .lane("ErrorText") .map { statusCode in switch statusCode { diff --git a/PayForMeTests/Info.plist b/PayForMeTests/Info.plist index 7e5ed41..141aa66 100644 --- a/PayForMeTests/Info.plist +++ b/PayForMeTests/Info.plist @@ -17,6 +17,6 @@ CFBundleShortVersionString 1.0 CFBundleVersion - 72 + 89 diff --git a/PayForMeUITests/Info.plist b/PayForMeUITests/Info.plist index beea4b0..172842f 100644 --- a/PayForMeUITests/Info.plist +++ b/PayForMeUITests/Info.plist @@ -17,6 +17,6 @@ CFBundleShortVersionString 1.0 CFBundleVersion - 72 + 89