Skip to content

Commit

Permalink
Made the next start time getter faster.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisMarshallNY committed Jul 27, 2024
1 parent b249875 commit 5ec028a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}
Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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)
}
Expand Down
16 changes: 8 additions & 8 deletions VirtualMeetingFinder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
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, ); }; };
D4DDAB822C4039570018944E /* VMF_AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4DDAB812C4039570018944E /* VMF_AboutViewController.swift */; };
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 */
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */;
Expand Down Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down

0 comments on commit 5ec028a

Please sign in to comment.