From 5ec028a59dae3d7c149398781ab3ac87761cba49 Mon Sep 17 00:00:00 2001 From: Chris Marshall Date: Sat, 27 Jul 2024 15:22:19 -0400 Subject: [PATCH] Made the next start time getter faster. --- .../VMF_MainViewController_Protocols.swift | 30 +++++++++++++++---- .../project.pbxproj | 16 +++++----- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/Sources/VirtualMeetingFinder/ViewControllers/VMF_MainViewController_Protocols.swift b/Sources/VirtualMeetingFinder/ViewControllers/VMF_MainViewController_Protocols.swift index 4b2b3f9..581aa5b 100644 --- a/Sources/VirtualMeetingFinder/ViewControllers/VMF_MainViewController_Protocols.swift +++ b/Sources/VirtualMeetingFinder/ViewControllers/VMF_MainViewController_Protocols.swift @@ -128,6 +128,26 @@ extension VMF_MainViewController: UIPageViewControllerDelegate { // MARK: UIPickerViewDataSource Conformance /* ###################################################################################################################################### */ extension VMF_MainViewController: UIPickerViewDataSource { + /* ################################################################################################################################## */ + // MARK: PickerView Component Enum + /* ################################################################################################################################## */ + /** + This enumerates the two PickerView components. + */ + enum PickerViewComponents: Int { + /* ############################################################## */ + /** + The leftmost component is for the weekday. + */ + case weekday + + /* ############################################################## */ + /** + The rightmost component is for the time slot. + */ + case time + } + /* ################################################################## */ /** This returns the number of components in the picker view. @@ -149,7 +169,7 @@ extension VMF_MainViewController: UIPickerViewDataSource { func pickerView(_ inPickerView: UIPickerView, numberOfRowsInComponent inComponent: Int) -> Int { guard !isNameSearchMode else { return 0 } - let ret = 1 == inComponent ? getDailyMeetings(for: unMapWeekday(inPickerView.selectedRow(inComponent: 0) + 1)).count : 7 + let ret = PickerViewComponents.time.rawValue == inComponent ? getDailyMeetings(for: unMapWeekday(inPickerView.selectedRow(inComponent: PickerViewComponents.weekday.rawValue) + 1)).count : 7 return ret } @@ -176,10 +196,10 @@ extension VMF_MainViewController: UIPickerViewDelegate { ret.minimumScaleFactor = 0.5 if !isNameSearchMode { - if 0 == inComponent { + if PickerViewComponents.weekday.rawValue == inComponent { ret.text = Calendar.current.standaloneWeekdaySymbols[unMapWeekday(inRow + 1) - 1] } else { - let dayIndex = unMapWeekday(inPickerView.selectedRow(inComponent: 0) + 1) + let dayIndex = unMapWeekday(inPickerView.selectedRow(inComponent: PickerViewComponents.weekday.rawValue) + 1) if let time = getTimeOf(dayIndex: dayIndex, timeIndex: inRow) { let hour = time / 100 let minute = time - (hour * 100) @@ -224,7 +244,7 @@ extension VMF_MainViewController: UIPickerViewDelegate { - parameter inComponent: The 0-based component index. */ func pickerView(_ inPickerView: UIPickerView, didSelectRow inRow: Int, inComponent: Int) { - if 0 == inComponent { + if PickerViewComponents.weekday.rawValue == inComponent { // This whackiness, is because we want to try to set the time index to be as close as possible to the last one. guard let originalDayIndex = tableDisplayController?.dayIndex, var timeIndex = tableDisplayController?.timeIndex, @@ -238,7 +258,7 @@ extension VMF_MainViewController: UIPickerViewDelegate { inPickerView.selectRow(timeIndex, inComponent: 1, animated: false) openTo(dayIndex: inRow + 1, time: time) } else { - let dayIndex = unMapWeekday(inPickerView.selectedRow(inComponent: 0) + 1) + let dayIndex = unMapWeekday(inPickerView.selectedRow(inComponent: PickerViewComponents.weekday.rawValue) + 1) guard let time = getTimeOf(dayIndex: dayIndex, timeIndex: inRow) else { return } openTo(dayIndex: dayIndex, time: time) } diff --git a/VirtualMeetingFinder.xcodeproj/project.pbxproj b/VirtualMeetingFinder.xcodeproj/project.pbxproj index 70a3d3e..e98c5b4 100644 --- a/VirtualMeetingFinder.xcodeproj/project.pbxproj +++ b/VirtualMeetingFinder.xcodeproj/project.pbxproj @@ -25,7 +25,6 @@ D493933C2C2616C7006438AE /* Base in Resources */ = {isa = PBXBuildFile; fileRef = D493933B2C2616C7006438AE /* Base */; }; D493933E2C2616C8006438AE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D493933D2C2616C8006438AE /* Assets.xcassets */; }; D49393412C2616C8006438AE /* Base in Resources */ = {isa = PBXBuildFile; fileRef = D49393402C2616C8006438AE /* Base */; }; - D4B2ECE42C5044F100AFB5E0 /* SwiftBMLSDK in Frameworks */ = {isa = PBXBuildFile; productRef = D4B2ECE32C5044F100AFB5E0 /* SwiftBMLSDK */; }; D4B3E2B42C41B6CE00CD672E /* VirtualMeetingFinder.docc in Sources */ = {isa = PBXBuildFile; fileRef = D4B3E2B32C41B6CE00CD672E /* VirtualMeetingFinder.docc */; }; D4B69A342C2B162900D24DA6 /* VMF_MeetingInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4B69A332C2B162800D24DA6 /* VMF_MeetingInspectorViewController.swift */; }; D4BBD0E22C528E3500301D0F /* RevealServer.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D4BBD0E12C528E3500301D0F /* RevealServer.xcframework */; settings = {ATTRIBUTES = (Weak, ); }; }; @@ -33,6 +32,7 @@ D4E7C6C92C4293E10045ACE6 /* VMF_MainViewController_Methods.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4E7C6C82C4293E10045ACE6 /* VMF_MainViewController_Methods.swift */; }; D4E7C6CB2C4294FE0045ACE6 /* VMF_MainViewController_Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4E7C6CA2C4294FE0045ACE6 /* VMF_MainViewController_Protocols.swift */; }; D4F4BCED2C36DAFC0023C21B /* VMF_MapMarker.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4F4BCEC2C36DAFC0023C21B /* VMF_MapMarker.swift */; }; + D4F70AA22C55800E000378E9 /* SwiftBMLSDK in Frameworks */ = {isa = PBXBuildFile; productRef = D4F70AA12C55800E000378E9 /* SwiftBMLSDK */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -83,8 +83,8 @@ buildActionMask = 2147483647; files = ( D48816152C35860F008DF936 /* RVS_BasicGCDTimer in Frameworks */, + D4F70AA22C55800E000378E9 /* SwiftBMLSDK in Frameworks */, D4398E672C2892790001FAE3 /* RVS_Generic_Swift_Toolbox in Frameworks */, - D4B2ECE42C5044F100AFB5E0 /* SwiftBMLSDK in Frameworks */, D4398E6A2C2892830001FAE3 /* RVS_UIKit_Toolbox in Frameworks */, D43A9C132C373F67001285FC /* RVS_Persistent_Prefs in Frameworks */, D4BBD0E22C528E3500301D0F /* RevealServer.xcframework in Frameworks */, @@ -246,7 +246,7 @@ D4398E692C2892830001FAE3 /* RVS_UIKit_Toolbox */, D48816142C35860F008DF936 /* RVS_BasicGCDTimer */, D43A9C122C373F67001285FC /* RVS_Persistent_Prefs */, - D4B2ECE32C5044F100AFB5E0 /* SwiftBMLSDK */, + D4F70AA12C55800E000378E9 /* SwiftBMLSDK */, ); productName = VirtualMeetingFinder; productReference = D49393312C2616C7006438AE /* Virtual NA Meeting Finder.app */; @@ -282,7 +282,7 @@ D4398E682C2892830001FAE3 /* XCRemoteSwiftPackageReference "RVS_UIKit_Toolbox" */, D48816132C35860F008DF936 /* XCRemoteSwiftPackageReference "RVS_BasicGCDTimer" */, D43A9C112C373F67001285FC /* XCRemoteSwiftPackageReference "RVS_PersistentPrefs" */, - D4B2ECE22C5044F100AFB5E0 /* XCRemoteSwiftPackageReference "SwiftBMLSDK" */, + D4F70AA02C55800E000378E9 /* XCRemoteSwiftPackageReference "SwiftBMLSDK" */, ); productRefGroup = D49393322C2616C7006438AE /* Products */; projectDirPath = ""; @@ -618,12 +618,12 @@ minimumVersion = 1.7.1; }; }; - D4B2ECE22C5044F100AFB5E0 /* XCRemoteSwiftPackageReference "SwiftBMLSDK" */ = { + D4F70AA02C55800E000378E9 /* XCRemoteSwiftPackageReference "SwiftBMLSDK" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/LittleGreenViper/SwiftBMLSDK"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 1.0.14; + minimumVersion = 1.0.15; }; }; /* End XCRemoteSwiftPackageReference section */ @@ -649,9 +649,9 @@ package = D48816132C35860F008DF936 /* XCRemoteSwiftPackageReference "RVS_BasicGCDTimer" */; productName = RVS_BasicGCDTimer; }; - D4B2ECE32C5044F100AFB5E0 /* SwiftBMLSDK */ = { + D4F70AA12C55800E000378E9 /* SwiftBMLSDK */ = { isa = XCSwiftPackageProductDependency; - package = D4B2ECE22C5044F100AFB5E0 /* XCRemoteSwiftPackageReference "SwiftBMLSDK" */; + package = D4F70AA02C55800E000378E9 /* XCRemoteSwiftPackageReference "SwiftBMLSDK" */; productName = SwiftBMLSDK; }; /* End XCSwiftPackageProductDependency section */