diff --git a/TraccarClient.xcodeproj/project.pbxproj b/TraccarClient.xcodeproj/project.pbxproj index 35ab939b81ef2f19195108db2b27f824b55cedf7..daeccec8c2a7e105d627512227ae85ad44f59b71 100644 --- a/TraccarClient.xcodeproj/project.pbxproj +++ b/TraccarClient.xcodeproj/project.pbxproj @@ -1365,7 +1365,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = Z7STA3KGEU; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -1379,7 +1379,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 3.0.0; OTHER_SWIFT_FLAGS = "-D FIREBASE"; PRODUCT_BUNDLE_IDENTIFIER = com.nmo.ai.teams; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1541,7 +1541,7 @@ CODE_SIGN_ENTITLEMENTS = TraccarClient/TraccarClient.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = Z7STA3KGEU; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -1555,7 +1555,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 3.0.0; PRODUCT_BUNDLE_IDENTIFIER = com.nmo.ai.teams; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; @@ -1579,7 +1579,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = Z7STA3KGEU; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -1593,7 +1593,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 3.0.0; PRODUCT_BUNDLE_IDENTIFIER = com.nmo.ai.teams; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; diff --git a/TraccarClient.xcodeproj/project.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate b/TraccarClient.xcodeproj/project.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate index f689226b98fea0067d78720c8f3aa39ceb185807..a09bd43bbafe5e90854a4ec51163e55a141e504f 100644 Binary files a/TraccarClient.xcodeproj/project.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate and b/TraccarClient.xcodeproj/project.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/TraccarClient.xcodeproj/xcuserdata/g.makhoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/TraccarClient.xcodeproj/xcuserdata/g.makhoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 5e0af6ed2164476a5d793154de204bef86e03ecf..b7e446a85998f4b098752db381a9dc7223ca9690 100644 --- a/TraccarClient.xcodeproj/xcuserdata/g.makhoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/TraccarClient.xcodeproj/xcuserdata/g.makhoul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -3,4 +3,22 @@ uuid = "C69DA6DD-5592-40A4-92DB-D8BF97EDB011" type = "1" version = "2.0"> + <Breakpoints> + <BreakpointProxy + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> + <BreakpointContent + uuid = "AA2B4F9E-62D5-43E3-8D0D-3F2413C92F94" + shouldBeEnabled = "No" + ignoreCount = "0" + continueAfterRunningActions = "No" + filePath = "TraccarClient/ShiftsModel.swift" + startingColumnNumber = "9223372036854775807" + endingColumnNumber = "9223372036854775807" + startingLineNumber = "63" + endingLineNumber = "63" + landmarkName = "getStartTimeForToday(dayName:)" + landmarkType = "7"> + </BreakpointContent> + </BreakpointProxy> + </Breakpoints> </Bucket> diff --git a/TraccarClient/AppManager.swift b/TraccarClient/AppManager.swift index ecb4bead906c4349d62856ce4c5fa00515f0747d..c6b751cecf53048e4d88654cd0266c84a0f299e3 100644 --- a/TraccarClient/AppManager.swift +++ b/TraccarClient/AppManager.swift @@ -39,7 +39,7 @@ final class AppManager { ] // MARK: - Data - var environment: KNEnvironment = .production + var environment: KNEnvironment = .sandbox var delegate: AppDelegate! var isUpdatingProfile: Bool = false var isLoggedIn: Bool { diff --git a/TraccarClient/Globals.swift b/TraccarClient/Globals.swift index bc7292cf32839d7350c9d617948231baaabce42e..31307db24db82ed4ece718dae48f5f63df28d2f7 100644 --- a/TraccarClient/Globals.swift +++ b/TraccarClient/Globals.swift @@ -47,6 +47,14 @@ var showLeaderButton: Bool = false // MARK: - Global Custom AlertView typealias AlertViewClosure = () -> () +func getDayName() -> String { + let date = Date() // Use current date + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "EEEE" + let dayOfWeekString = dateFormatter.string(from: date) + return dayOfWeekString +} + // use this when you only need to display the error without any actions func ok(_ message: String, viewController:KNViewController? = nil) { let vc = KNAlertViewController(type: .error, message: message) diff --git a/TraccarClient/InitialViewController/Controller/InitialViewController.swift b/TraccarClient/InitialViewController/Controller/InitialViewController.swift index 80a094a3122e3275ab257521e178ec4beb881d1d..a86dfa092c4f0aa1c92be17912236c9dc78c4ff5 100644 --- a/TraccarClient/InitialViewController/Controller/InitialViewController.swift +++ b/TraccarClient/InitialViewController/Controller/InitialViewController.swift @@ -17,6 +17,7 @@ enum shiftStatus: String { case inProgress case end case failed + case weekend case none } @@ -66,14 +67,14 @@ final class InitialViewController: KNViewController { } func checkShiftStatus(startsAt: String, endsAt: String) -> shiftStatus { - if userDefaults.bool(forKey: Keys.User.autoTracking) == false && shift?.isHourly == false { + if userDefaults.bool(forKey: Keys.User.autoTracking) == true && shift?.isHourly == false { let dateFormatter = DateFormatter() dateFormatter.dateFormat = "HH:mm" guard let shiftStart = dateFormatter.date(from: startsAt), let shiftEnd = dateFormatter.date(from: endsAt) else { print("Invalid shift time format.") - return .failed + return .weekend } let calendar = Calendar.current @@ -104,8 +105,8 @@ final class InitialViewController: KNViewController { func navigationMethod (by shift: ShiftModel) { - let shiftStart = shift.timings[0].startsAt - let shiftEnd = shift.timings[0].endsAt + let shiftStart = shift.getStartTimeForToday() + let shiftEnd = shift.getEndTimeForToday() print("shiftStart: \(shiftStart)") print("shiftEnds: \(shiftEnd)") @@ -125,7 +126,7 @@ final class InitialViewController: KNViewController { window?.rootViewController = navigation window?.makeKeyAndVisible() - case .notStart, .end, .none: + case .notStart, .end, .none, .weekend: let connect = ConnectViewController() connect.shift = shift connect.shiftStatus = shiftStatus diff --git a/TraccarClient/LoginViewController/Controller/LoginViewController.swift b/TraccarClient/LoginViewController/Controller/LoginViewController.swift index 19286e3b9016530f6e6e3e1a2af88f54927dd0eb..9703be68d499f438e230f81a5c6b817b9826e075 100644 --- a/TraccarClient/LoginViewController/Controller/LoginViewController.swift +++ b/TraccarClient/LoginViewController/Controller/LoginViewController.swift @@ -19,7 +19,7 @@ final class LoginViewController: KNViewController { private var modelDataSource: LoginDataSource? private var modelController: LoginModelController? var window: UIWindow? - + // MARK: - LifeCycle override func viewDidLoad() { super.viewDidLoad() diff --git a/TraccarClient/LoginViewController/Model/LoginModelController.swift b/TraccarClient/LoginViewController/Model/LoginModelController.swift index 6439643383d6fc1335eb77aaecacb2cb2e423fcf..a610563c71b5c3e2da9a79bca36c6fc2c52c30d2 100644 --- a/TraccarClient/LoginViewController/Model/LoginModelController.swift +++ b/TraccarClient/LoginViewController/Model/LoginModelController.swift @@ -24,7 +24,8 @@ final class LoginModelController { } } private var shift: ShiftModel? - + let userDefaults = UserDefaults.standard + // MARK: - Init init(delegate: LoginViewControllerDelegate?, viewController: KNViewController) { self.delegate = delegate @@ -38,6 +39,70 @@ final class LoginModelController { inputProtocol?.setFields(fields: fields) } + func checkShiftStatus(startsAt: String, endsAt: String) -> shiftStatus { + if userDefaults.bool(forKey: Keys.User.autoTracking) == true && shift?.isHourly == false { + + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "HH:mm" + guard let shiftStart = dateFormatter.date(from: startsAt), + let shiftEnd = dateFormatter.date(from: endsAt) else { + print("Invalid shift time format.") + return .weekend + } + + let calendar = Calendar.current + let currentTime = Date() + let currentComponents = calendar.dateComponents([.hour, .minute], from: currentTime) + let startComponents = calendar.dateComponents([.hour, .minute], from: shiftStart) + let endComponents = calendar.dateComponents([.hour, .minute], from: shiftEnd) + + guard let currentHour = currentComponents.hour, let currentMinute = currentComponents.minute, + let startHour = startComponents.hour, let startMinute = startComponents.minute, + let endHour = endComponents.hour, let endMinute = endComponents.minute else { + print("Failed to extract hour and minute components.") + return .failed + } + + if currentHour < startHour || (currentHour == startHour && currentMinute < startMinute) { + return .notStart + } else if currentHour > endHour || (currentHour == endHour && currentMinute > endMinute) { + return .end + } else { + return .inProgress + } + } + else { + return .none + } + } + + func navigationMethod (by shift: ShiftModel) { + + let shiftStart = shift.getStartTimeForToday() + let shiftEnd = shift.getEndTimeForToday() + + print("shiftStart: \(shiftStart)") + print("shiftEnds: \(shiftEnd)") + + let shiftStatus = checkShiftStatus(startsAt: shiftStart, endsAt: shiftEnd) + + switch shiftStatus { + case .failed: + print("time formate error") + case .inProgress: + let alert = AlertViewController() + alert.shift = shift + alert.shiftStatus = shiftStatus + viewController.navigationController?.pushViewController(alert, animated: true) + + case .notStart, .end, .none, .weekend: + let connect = ConnectViewController() + connect.shift = shift + connect.shiftStatus = shiftStatus + viewController.navigationController?.pushViewController(connect, animated: true) + } + } + private func setupTracking() { UIDevice.current.isBatteryMonitoringEnabled = true @@ -92,9 +157,7 @@ final class LoginModelController { if item.field == .username { UserDefaults.standard.set("\(item.value.value)", forKey: "device_id_preference") strongSelf.setupTracking() - let connect = ConnectViewController() - connect.shift = strongSelf.shift - strongSelf.viewController.navigationController?.pushViewController(connect, animated: true) + strongSelf.navigationMethod(by: shift) } } } diff --git a/TraccarClient/MainViewController/ConnectViewController.swift b/TraccarClient/MainViewController/ConnectViewController.swift index 2bb89b5269cd4336c53fde64b7eabd6bc7e68605..43ff27ae57f3595c185792d2dc96b6196b968f32 100644 --- a/TraccarClient/MainViewController/ConnectViewController.swift +++ b/TraccarClient/MainViewController/ConnectViewController.swift @@ -89,11 +89,6 @@ final class ConnectViewController: KNViewController { private func setupShiftView() { switch shiftStatus { - case .notStart: - trackingView.isHidden = true - shiftsView.isHidden = false - shiftsView.set(model: shift ?? ShiftModel(), delegate: self) - case .inProgress: trackingView.isHidden = false shiftsView.isHidden = true @@ -106,7 +101,7 @@ final class ConnectViewController: KNViewController { AppDelegate.instance.trackingController = TrackingController() AppDelegate.instance.trackingController?.start() - case .end: + case .end, .notStart, .weekend: trackingView.isHidden = true shiftsView.isHidden = false shiftsView.set(model: shift ?? ShiftModel(), delegate: self) @@ -117,6 +112,7 @@ final class ConnectViewController: KNViewController { case .none: shiftsView.isHidden = true trackingView.isHidden = true + } } diff --git a/TraccarClient/MainViewController/CustomViews/ShiftsView/ShiftsView.swift b/TraccarClient/MainViewController/CustomViews/ShiftsView/ShiftsView.swift index 57cddec56b3c0bd7bfaf8df69599b28536afc7fa..d05ede0dd69ee0045fd636bab1b53011ec9b1720 100644 --- a/TraccarClient/MainViewController/CustomViews/ShiftsView/ShiftsView.swift +++ b/TraccarClient/MainViewController/CustomViews/ShiftsView/ShiftsView.swift @@ -18,7 +18,7 @@ final class ShiftsView: KNComponentView { @IBOutlet private weak var descLabel1: UILabel! @IBOutlet private weak var descLabel2: UILabel! @IBOutlet private weak var timeRemaining: UILabel! - + @IBOutlet private weak var workingDaysLabel: UILabel! @IBOutlet private weak var daysStack: UIStackView! @IBOutlet private weak var startLabel: UILabel! @@ -34,6 +34,8 @@ final class ShiftsView: KNComponentView { @IBOutlet private weak var thursdayLabel: UILabel! @IBOutlet private weak var fridayLabel: UILabel! @IBOutlet private weak var saturdayLabel: UILabel! + @IBOutlet private weak var startDateLabel_width: NSLayoutConstraint! + @IBOutlet private weak var endDateLabel_width: NSLayoutConstraint! // MARK: - Properties private var shiftModel = ShiftModel() @@ -70,7 +72,7 @@ final class ShiftsView: KNComponentView { descLabel2.set(text: "at the beginning of your shift", color: .black, font: .regular(16)) descLabel2.textAlignment = .center - + workingDaysLabel.set(text: "Working Days", color: .black, font: .medium(20)) workingDaysLabel.textAlignment = .center @@ -91,77 +93,113 @@ final class ShiftsView: KNComponentView { } @objc func updateTimeLabel() { - if remainingTime > 0 { - let hours = Int(remainingTime) / 3600 - let minutes = (Int(remainingTime) % 3600) / 60 - - timeRemaining.text = "\(hours) hours \(minutes) minutes" - - remainingTime -= 60 // Subtract 60 seconds (1 minute) - - } else { - timer?.invalidate() - - delegate?.startTime() -// let dateFormatter = DateFormatter() -// dateFormatter.dateFormat = "HH:mm" -// -// var currentTime = Date() -// let time = dateFormatter.string(from: Date()) -// if let current = dateFormatter.date(from: time) { -// currentTime = current -// } -// -// let targetTime = dateFormatter.date(from: shiftModel.timings[0].endsAt)! -// -// remainingToEnd = targetTime.timeIntervalSince(currentTime) -// -// if remainingToEnd > 0 { -// timer?.invalidate() -// delegate?.startTime() -// } -// else { -// self.startTimer(model: shiftModel) -// } - } + if remainingTime > 0 { + let hours = Int(remainingTime) / 3600 + let minutes = (Int(remainingTime) % 3600) / 60 + timeRemaining.text = "\(hours) hours \(minutes) minutes" + remainingTime -= 60 // Subtract 60 seconds (1 minute) + + } else { + timer?.invalidate() + delegate?.startTime() } + } private func initDays(days: [UILabel]) { for day in days { - day.addCorners(4) + day.layer.cornerRadius = 10 + day.clipsToBounds = true day.set(color: .invalidText) day.backgroundColor = .invalid } } - private func setShiftDays(daysId: [String]) { + private func setShiftDays(timings: [TimingModel]) { for day in days { - for id in daysId { - if day.restorationIdentifier == id { - day.set(color: .white) - day.backgroundColor = .secondary + for timing in timings { + for id in timing.daysOfWeek { + if day.restorationIdentifier == id { + day.set(color: .white) + day.backgroundColor = .secondary + } + if day.restorationIdentifier?.lowercased() == getDayName().lowercased() { + day.set(color: .secondary) + day.backgroundColor = .systemGreen + day.addBorder(radius: 10, width: 2, color: .secondary) + } + } + } + } + } + + @IBAction func dayTapped(_ sender: UIButton) { + deselectDays() + for day in days { + if day.restorationIdentifier?.lowercased() == sender.restorationIdentifier?.lowercased() { + day.addBorder(radius: 10, width: 2, color: getDayName().lowercased() == day.restorationIdentifier?.lowercased() ? .secondary : .systemGreen) + if shiftModel.getStartTimeForToday(dayName: day.restorationIdentifier?.lowercased() ?? "") == "Weekend" { + timeRemaining.text = "It's your weekend, Enjoy!" + startTimeLabel.text = "Weekend" + startDateLabel_width.constant = 200 + + endTimeView.hide() + startLabel.text = "" + endLabel.text = "" + descLabel1.text = "" + descLabel2.text = "" + } + else { + timeRemaining.text = "It's your weekend, Enjoy!" + startDateLabel_width.constant = 55 + startLabel.text = "Shift Starts at" + endLabel.text = "Shift Ends at" + endTimeView.show() + startTimeLabel.set(text: shiftModel.getStartTimeForToday(dayName: day.restorationIdentifier?.lowercased() ?? "")) + startTimeLabel.textAlignment = .center + + endTimeLabel.set(text: shiftModel.getEndTimeForToday(dayName: day.restorationIdentifier?.lowercased() ?? "")) + endTimeLabel.textAlignment = .center } } } + } + private func deselectDays() { + for day in days { + day.addBorder(radius: 10, width: 0, color: .clear) + } + } + private func startTimer(model: ShiftModel) { let dateFormatter = DateFormatter() dateFormatter.dateFormat = "HH:mm" - + var currentTime = Date() let time = dateFormatter.string(from: Date()) if let current = dateFormatter.date(from: time) { currentTime = current } - - var targetTime = dateFormatter.date(from: model.timings[0].startsAt)! - + + if model.getStartTimeForToday() == "Weekend" { + timeRemaining.text = "It's your weekend, Enjoy!" + startTimeLabel.text = "Weekend" + startDateLabel_width.constant = 200 + + endTimeView.hide() + startLabel.text = "" + endLabel.text = "" + descLabel1.text = "" + descLabel2.text = "" + return + } + + var targetTime = dateFormatter.date(from: model.getStartTimeForToday())! // if targetTime is earlier than currentTime, add 1 day to targetTime if targetTime < currentTime { targetTime = Calendar.current.date(byAdding: .day, value: 1, to: targetTime)! } - + remainingTime = targetTime.timeIntervalSince(currentTime) timer = Timer.scheduledTimer(timeInterval: 60, target: self, selector: #selector(updateTimeLabel), userInfo: nil, repeats: true) @@ -172,12 +210,12 @@ final class ShiftsView: KNComponentView { func set(model: ShiftModel, delegate: ShiftViewDelegate) { self.delegate = delegate self.shiftModel = model - setShiftDays(daysId: model.timings[0].daysOfWeek) + setShiftDays(timings: model.timings) - startTimeLabel.set(text: model.timings[0].startsAt) + startTimeLabel.set(text: model.getStartTimeForToday()) startTimeLabel.textAlignment = .center - endTimeLabel.set(text: model.timings[0].endsAt) + endTimeLabel.set(text: model.getEndTimeForToday()) endTimeLabel.textAlignment = .center startTimer(model: model) diff --git a/TraccarClient/MainViewController/CustomViews/ShiftsView/ShiftsView.xib b/TraccarClient/MainViewController/CustomViews/ShiftsView/ShiftsView.xib index c384068fe8a1aff6c7d7f4086be7e577e87bdfb2..f0349abcdfd9010f41d9475549bb7a6484192a24 100644 --- a/TraccarClient/MainViewController/CustomViews/ShiftsView/ShiftsView.xib +++ b/TraccarClient/MainViewController/CustomViews/ShiftsView/ShiftsView.xib @@ -15,12 +15,14 @@ <outlet property="daysStack" destination="zkz-CT-krb" id="mXc-nU-Fch"/> <outlet property="descLabel1" destination="cxv-Rj-jyZ" id="Sv5-d8-K84"/> <outlet property="descLabel2" destination="gvg-Dw-ZgB" id="qn5-dg-ngv"/> + <outlet property="endDateLabel_width" destination="kMd-Nk-6DD" id="k40-y0-iZj"/> <outlet property="endLabel" destination="Jn5-Yz-JFE" id="5nv-x8-sTT"/> <outlet property="endTimeLabel" destination="gVU-Ow-ZZ1" id="V12-PZ-8Eg"/> <outlet property="endTimeView" destination="3En-Qt-cec" id="sJh-kA-cmE"/> <outlet property="fridayLabel" destination="1z3-YS-wKP" id="20Q-lW-DH7"/> <outlet property="mondayLabel" destination="kmL-nQ-50h" id="j97-c6-diF"/> <outlet property="saturdayLabel" destination="v1N-k1-2ED" id="JQb-b4-OZc"/> + <outlet property="startDateLabel_width" destination="Q4w-aF-fvI" id="fXq-UY-CrT"/> <outlet property="startLabel" destination="1jP-g6-5ve" id="2fw-zw-mVj"/> <outlet property="startTimeLabel" destination="kfK-lP-2ey" id="N4e-BM-66v"/> <outlet property="startTimeView" destination="fKD-vo-qus" id="2zx-y4-xkO"/> @@ -50,55 +52,216 @@ <stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="zkz-CT-krb"> <rect key="frame" x="10" y="214" width="355" height="22"/> <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="sunday" text="SUN" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="U8p-VB-3J4"> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PtK-5b-dA3"> <rect key="frame" x="0.0" y="0.0" width="42" height="22"/> - <color key="backgroundColor" red="0.45098039215686275" green="0.40392156862745099" blue="0.94117647058823528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> - <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> - <nil key="highlightedColor"/> - </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="monday" text="MON" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kmL-nQ-50h"> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="sunday" text="SUN" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="U8p-VB-3J4"> + <rect key="frame" x="0.0" y="0.0" width="42" height="22"/> + <color key="backgroundColor" red="0.45098039215686275" green="0.40392156862745099" blue="0.94117647058823528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> + <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" restorationIdentifier="Sunday" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="X5B-PD-wjp"> + <rect key="frame" x="0.0" y="0.0" width="42" height="22"/> + <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> + <connections> + <action selector="dayTapped:" destination="-1" eventType="touchUpInside" id="2hh-Ig-CoQ"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstAttribute="trailing" secondItem="U8p-VB-3J4" secondAttribute="trailing" id="0jQ-pf-n9I"/> + <constraint firstItem="U8p-VB-3J4" firstAttribute="top" secondItem="PtK-5b-dA3" secondAttribute="top" id="0oh-Jv-54O"/> + <constraint firstAttribute="bottom" secondItem="U8p-VB-3J4" secondAttribute="bottom" id="2Wa-7R-Rg7"/> + <constraint firstItem="U8p-VB-3J4" firstAttribute="leading" secondItem="PtK-5b-dA3" secondAttribute="leading" id="6f5-8F-QcK"/> + <constraint firstAttribute="bottom" secondItem="X5B-PD-wjp" secondAttribute="bottom" id="Nle-5X-txn"/> + <constraint firstItem="X5B-PD-wjp" firstAttribute="top" secondItem="PtK-5b-dA3" secondAttribute="top" id="d0O-yE-lXV"/> + <constraint firstAttribute="trailing" secondItem="X5B-PD-wjp" secondAttribute="trailing" id="twL-0Z-XtF"/> + <constraint firstItem="X5B-PD-wjp" firstAttribute="leading" secondItem="PtK-5b-dA3" secondAttribute="leading" id="u9U-cR-YAf"/> + </constraints> + </view> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="CG7-FO-80z"> <rect key="frame" x="52" y="0.0" width="42.333333333333343" height="22"/> - <color key="backgroundColor" red="0.45098039220000002" green="0.4039215686" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> - <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> - <nil key="highlightedColor"/> - </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="tuesday" text="TUE" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CHf-5s-cu5"> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="monday" text="MON" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kmL-nQ-50h"> + <rect key="frame" x="0.0" y="0.0" width="42.333333333333336" height="22"/> + <color key="backgroundColor" red="0.45098039220000002" green="0.4039215686" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> + <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" restorationIdentifier="Monday" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kdH-yi-tGG"> + <rect key="frame" x="0.0" y="0.0" width="42.333333333333336" height="22"/> + <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> + <connections> + <action selector="dayTapped:" destination="-1" eventType="touchUpInside" id="sZG-2s-H9W"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstAttribute="trailing" secondItem="kdH-yi-tGG" secondAttribute="trailing" id="3jd-g8-nTI"/> + <constraint firstItem="kmL-nQ-50h" firstAttribute="top" secondItem="CG7-FO-80z" secondAttribute="top" id="BRT-el-rFv"/> + <constraint firstAttribute="bottom" secondItem="kmL-nQ-50h" secondAttribute="bottom" id="Pxa-Xy-tow"/> + <constraint firstItem="kmL-nQ-50h" firstAttribute="leading" secondItem="CG7-FO-80z" secondAttribute="leading" id="WCK-YC-cBn"/> + <constraint firstAttribute="bottom" secondItem="kdH-yi-tGG" secondAttribute="bottom" id="XIe-6A-akO"/> + <constraint firstItem="kdH-yi-tGG" firstAttribute="top" secondItem="CG7-FO-80z" secondAttribute="top" id="m9W-rQ-yJ1"/> + <constraint firstItem="kdH-yi-tGG" firstAttribute="leading" secondItem="CG7-FO-80z" secondAttribute="leading" id="xmb-Ty-vIz"/> + <constraint firstAttribute="trailing" secondItem="kmL-nQ-50h" secondAttribute="trailing" id="yjH-eR-TxE"/> + </constraints> + </view> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iDS-XH-5a8"> <rect key="frame" x="104.33333333333333" y="0.0" width="41.999999999999986" height="22"/> - <color key="backgroundColor" red="0.45098039220000002" green="0.4039215686" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> - <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> - <nil key="highlightedColor"/> - </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="wednesday" text="WED" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bh9-IG-I4y"> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="tuesday" text="TUE" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CHf-5s-cu5"> + <rect key="frame" x="0.0" y="0.0" width="42" height="22"/> + <color key="backgroundColor" red="0.45098039220000002" green="0.4039215686" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> + <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" restorationIdentifier="Tuesday" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EsF-ws-ofz"> + <rect key="frame" x="0.0" y="0.0" width="42" height="22"/> + <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> + <connections> + <action selector="dayTapped:" destination="-1" eventType="touchUpInside" id="IIG-gM-1M1"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstAttribute="bottom" secondItem="CHf-5s-cu5" secondAttribute="bottom" id="1Z2-yc-UI2"/> + <constraint firstAttribute="trailing" secondItem="EsF-ws-ofz" secondAttribute="trailing" id="5xO-Wu-PZs"/> + <constraint firstAttribute="trailing" secondItem="CHf-5s-cu5" secondAttribute="trailing" id="GM4-3B-Yb9"/> + <constraint firstItem="CHf-5s-cu5" firstAttribute="top" secondItem="iDS-XH-5a8" secondAttribute="top" id="Is8-kj-tvP"/> + <constraint firstItem="EsF-ws-ofz" firstAttribute="leading" secondItem="iDS-XH-5a8" secondAttribute="leading" id="Oev-o6-bUg"/> + <constraint firstAttribute="bottom" secondItem="EsF-ws-ofz" secondAttribute="bottom" id="gKJ-cG-dOL"/> + <constraint firstItem="CHf-5s-cu5" firstAttribute="leading" secondItem="iDS-XH-5a8" secondAttribute="leading" id="hnG-g6-Ifq"/> + <constraint firstItem="EsF-ws-ofz" firstAttribute="top" secondItem="iDS-XH-5a8" secondAttribute="top" id="jzc-pj-1Sc"/> + </constraints> + </view> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zdD-2Q-Mkd"> <rect key="frame" x="156.33333333333334" y="0.0" width="42.333333333333343" height="22"/> - <color key="backgroundColor" red="0.45098039220000002" green="0.4039215686" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> - <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> - <nil key="highlightedColor"/> - </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="thursday" text="THU" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sUk-PX-pYr"> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="wednesday" text="WED" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bh9-IG-I4y"> + <rect key="frame" x="0.0" y="0.0" width="42.333333333333336" height="22"/> + <color key="backgroundColor" red="0.45098039220000002" green="0.4039215686" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> + <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" restorationIdentifier="Wednesday" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Sb3-Sm-Q8B"> + <rect key="frame" x="0.0" y="0.0" width="42.333333333333336" height="22"/> + <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> + <connections> + <action selector="dayTapped:" destination="-1" eventType="touchUpInside" id="So7-Px-hgq"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstAttribute="trailing" secondItem="bh9-IG-I4y" secondAttribute="trailing" id="69m-2x-bM3"/> + <constraint firstAttribute="bottom" secondItem="Sb3-Sm-Q8B" secondAttribute="bottom" id="7pI-Rf-fxD"/> + <constraint firstItem="bh9-IG-I4y" firstAttribute="leading" secondItem="zdD-2Q-Mkd" secondAttribute="leading" id="Bzl-6f-dZR"/> + <constraint firstItem="Sb3-Sm-Q8B" firstAttribute="leading" secondItem="zdD-2Q-Mkd" secondAttribute="leading" id="YaB-tT-knZ"/> + <constraint firstItem="Sb3-Sm-Q8B" firstAttribute="top" secondItem="zdD-2Q-Mkd" secondAttribute="top" id="fca-Qk-NAA"/> + <constraint firstAttribute="trailing" secondItem="Sb3-Sm-Q8B" secondAttribute="trailing" id="l4G-LC-5IA"/> + <constraint firstAttribute="bottom" secondItem="bh9-IG-I4y" secondAttribute="bottom" id="nMp-Cm-7ap"/> + <constraint firstItem="bh9-IG-I4y" firstAttribute="top" secondItem="zdD-2Q-Mkd" secondAttribute="top" id="uSR-aL-WDm"/> + </constraints> + </view> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3ff-gC-Hsf"> <rect key="frame" x="208.66666666666666" y="0.0" width="42" height="22"/> - <color key="backgroundColor" red="0.45098039220000002" green="0.4039215686" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> - <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> - <nil key="highlightedColor"/> - </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="friday" text="FRI" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1z3-YS-wKP"> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="thursday" text="THU" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sUk-PX-pYr"> + <rect key="frame" x="0.0" y="0.0" width="42" height="22"/> + <color key="backgroundColor" red="0.45098039220000002" green="0.4039215686" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> + <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" restorationIdentifier="Thursday" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YiB-oW-4TA"> + <rect key="frame" x="0.0" y="0.0" width="42" height="22"/> + <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> + <connections> + <action selector="dayTapped:" destination="-1" eventType="touchUpInside" id="ptx-KQ-8Mb"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstItem="sUk-PX-pYr" firstAttribute="top" secondItem="3ff-gC-Hsf" secondAttribute="top" id="5qB-ro-ttv"/> + <constraint firstItem="sUk-PX-pYr" firstAttribute="leading" secondItem="3ff-gC-Hsf" secondAttribute="leading" id="BAh-R8-1zq"/> + <constraint firstItem="YiB-oW-4TA" firstAttribute="top" secondItem="3ff-gC-Hsf" secondAttribute="top" id="KPn-bx-I9V"/> + <constraint firstAttribute="bottom" secondItem="YiB-oW-4TA" secondAttribute="bottom" id="OVI-tV-d0G"/> + <constraint firstAttribute="bottom" secondItem="sUk-PX-pYr" secondAttribute="bottom" id="ggj-hI-qdc"/> + <constraint firstAttribute="trailing" secondItem="sUk-PX-pYr" secondAttribute="trailing" id="lvQ-lb-zgQ"/> + <constraint firstItem="YiB-oW-4TA" firstAttribute="leading" secondItem="3ff-gC-Hsf" secondAttribute="leading" id="t0c-ah-evn"/> + <constraint firstAttribute="trailing" secondItem="YiB-oW-4TA" secondAttribute="trailing" id="xQb-76-zx7"/> + </constraints> + </view> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="CYf-yP-dto"> <rect key="frame" x="260.66666666666669" y="0.0" width="42.333333333333314" height="22"/> - <color key="backgroundColor" red="0.29411764705882354" green="0.27450980392156865" blue="0.36078431372549019" alpha="0.16452814569536423" colorSpace="custom" customColorSpace="sRGB"/> - <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> - <color key="textColor" red="0.29411764705882354" green="0.27450980392156865" blue="0.36078431372549019" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <nil key="highlightedColor"/> - </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="saturday" text="SAT" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v1N-k1-2ED"> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="Friday" text="FRI" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1z3-YS-wKP"> + <rect key="frame" x="0.0" y="0.0" width="42.333333333333336" height="22"/> + <color key="backgroundColor" red="0.29411764705882354" green="0.27450980392156865" blue="0.36078431372549019" alpha="0.16452814569536423" colorSpace="custom" customColorSpace="sRGB"/> + <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> + <color key="textColor" red="0.29411764705882354" green="0.27450980392156865" blue="0.36078431372549019" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" restorationIdentifier="friday" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JGX-YY-JEn"> + <rect key="frame" x="0.0" y="0.0" width="42.333333333333336" height="22"/> + <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> + <connections> + <action selector="dayTapped:" destination="-1" eventType="touchUpInside" id="QO3-Gr-2vd"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstAttribute="bottom" secondItem="JGX-YY-JEn" secondAttribute="bottom" id="Bu5-Sg-MfA"/> + <constraint firstItem="1z3-YS-wKP" firstAttribute="top" secondItem="CYf-yP-dto" secondAttribute="top" id="MnH-oQ-8eo"/> + <constraint firstItem="1z3-YS-wKP" firstAttribute="leading" secondItem="CYf-yP-dto" secondAttribute="leading" id="cNV-Ts-tKh"/> + <constraint firstAttribute="bottom" secondItem="1z3-YS-wKP" secondAttribute="bottom" id="fvI-eU-lDO"/> + <constraint firstItem="JGX-YY-JEn" firstAttribute="top" secondItem="CYf-yP-dto" secondAttribute="top" id="oR0-9r-HTr"/> + <constraint firstAttribute="trailing" secondItem="1z3-YS-wKP" secondAttribute="trailing" id="qI1-lE-OeM"/> + <constraint firstItem="JGX-YY-JEn" firstAttribute="leading" secondItem="CYf-yP-dto" secondAttribute="leading" id="xBq-Ud-rTv"/> + <constraint firstAttribute="trailing" secondItem="JGX-YY-JEn" secondAttribute="trailing" id="ysH-cm-Y5T"/> + </constraints> + </view> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3xy-kK-7Dk"> <rect key="frame" x="313" y="0.0" width="42" height="22"/> - <color key="backgroundColor" red="0.29411764705882354" green="0.27450980392156865" blue="0.36078431372549019" alpha="0.16452814569536423" colorSpace="custom" customColorSpace="sRGB"/> - <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> - <color key="textColor" red="0.29411764705882354" green="0.27450980392156865" blue="0.36078431372549019" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <nil key="highlightedColor"/> - </label> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="saturday" text="SAT" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v1N-k1-2ED"> + <rect key="frame" x="0.0" y="0.0" width="42" height="22"/> + <color key="backgroundColor" red="0.29411764705882354" green="0.27450980392156865" blue="0.36078431372549019" alpha="0.16452814569536423" colorSpace="custom" customColorSpace="sRGB"/> + <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/> + <color key="textColor" red="0.29411764705882354" green="0.27450980392156865" blue="0.36078431372549019" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" restorationIdentifier="Saturday" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UMv-GG-QaF"> + <rect key="frame" x="0.0" y="0.0" width="42" height="22"/> + <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> + <connections> + <action selector="dayTapped:" destination="-1" eventType="touchUpInside" id="6hb-Zr-Qfl"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstAttribute="bottom" secondItem="v1N-k1-2ED" secondAttribute="bottom" id="CVu-Jx-AfA"/> + <constraint firstItem="v1N-k1-2ED" firstAttribute="top" secondItem="3xy-kK-7Dk" secondAttribute="top" id="GZX-Pg-Mad"/> + <constraint firstAttribute="bottom" secondItem="UMv-GG-QaF" secondAttribute="bottom" id="JJu-8V-Jow"/> + <constraint firstAttribute="trailing" secondItem="UMv-GG-QaF" secondAttribute="trailing" id="XiJ-tf-JEV"/> + <constraint firstItem="v1N-k1-2ED" firstAttribute="leading" secondItem="3xy-kK-7Dk" secondAttribute="leading" id="Zpx-Va-ygc"/> + <constraint firstItem="UMv-GG-QaF" firstAttribute="top" secondItem="3xy-kK-7Dk" secondAttribute="top" id="juo-eU-TaI"/> + <constraint firstItem="UMv-GG-QaF" firstAttribute="leading" secondItem="3xy-kK-7Dk" secondAttribute="leading" id="vkO-eu-5BL"/> + <constraint firstAttribute="trailing" secondItem="v1N-k1-2ED" secondAttribute="trailing" id="xps-E6-8wK"/> + </constraints> + </view> </subviews> <constraints> <constraint firstAttribute="height" constant="22" id="q6b-Kc-6wU"/> diff --git a/TraccarClient/MainViewController/CustomViews/TrackingView/TrackingView.swift b/TraccarClient/MainViewController/CustomViews/TrackingView/TrackingView.swift index 83ad8dcceba5df9707536b68560a41be10cd9913..e294cc39314d045f4d486e84ff684f8eb8707e57 100644 --- a/TraccarClient/MainViewController/CustomViews/TrackingView/TrackingView.swift +++ b/TraccarClient/MainViewController/CustomViews/TrackingView/TrackingView.swift @@ -92,14 +92,14 @@ final class TrackingView: KNComponentView { } func configureSlider(model: ShiftModel) { - self.startTimeLabel.text = model.timings[0].startsAt - self.endTimeLabel.text = model.timings[0].endsAt + self.startTimeLabel.text = model.getStartTimeForToday() + self.endTimeLabel.text = model.getEndTimeForToday() let dateFormatter = DateFormatter() dateFormatter.dateFormat = timeFormat - guard let startDate = dateFormatter.date(from: model.timings[0].startsAt), - let endDate = dateFormatter.date(from: model.timings[0].endsAt) else { + guard let startDate = dateFormatter.date(from: model.getStartTimeForToday()), + let endDate = dateFormatter.date(from: model.getEndTimeForToday()) else { return } @@ -145,31 +145,6 @@ final class TrackingView: KNComponentView { timer = Timer.scheduledTimer(timeInterval: interval, target: self, selector: #selector(updateSlider), userInfo: nil, repeats: true) } - // @objc func updateSlider() { - // timeSlider.value += 1 - // - // guard let currentValue = currentTime else { - // return - // } - // - // let updatedTime = currentValue.addingTimeInterval(interval) - // - // if updatedTime <= endTimeDate { - // currentTime = updatedTime - // - // let dateFormatter = DateFormatter() - // dateFormatter.dateFormat = timeFormat - // - // let timeString = dateFormatter.string(from: updatedTime) - // print(timeString) // You can use this time string as per your requirement - // - // } else { - // timer.invalidate() - // delegate?.endtime() - // - // } - // } - @objc func updateSlider() { timeSlider.value += 1 @@ -204,8 +179,9 @@ final class TrackingView: KNComponentView { let nowComponents = calendar.dateComponents([.year, .month, .day], from: now) var end: Date = endTimeDate + print(end) - guard let endDate = dateFormatter.date(from: shift?.timings[0].endsAt ?? "") else { + guard let endDate = dateFormatter.date(from: shift?.getEndTimeForToday() ?? "") else { return } var endComponents = calendar.dateComponents([.hour, .minute, .second], from: endDate) diff --git a/TraccarClient/ShiftsModel.swift b/TraccarClient/ShiftsModel.swift index ee6040eab08eb87a2fcf02c085e2a6279e43b4c4..55f9f93cc1f8df41873162c84e3b3b90336a00bc 100644 --- a/TraccarClient/ShiftsModel.swift +++ b/TraccarClient/ShiftsModel.swift @@ -45,6 +45,40 @@ final class ShiftModel: KNObject { timings = timingsArray.map { TimingModel($0) } } } + + func getStartTimeForToday(dayName: String = "") -> String { + for item in timings { + for day in item.daysOfWeek { + if dayName == "" { + if getDayName().lowercased() == day.lowercased() { + return item.startsAt + } + } else { + if dayName.lowercased() == day.lowercased() { + return item.startsAt + } + } + } + } + return "Weekend" + } + + func getEndTimeForToday(dayName: String = "") -> String { + for item in timings { + for day in item.daysOfWeek { + if dayName == "" { + if getDayName().lowercased() == day.lowercased() { + return item.endsAt + } + } else { + if dayName.lowercased() == day.lowercased() { + return item.endsAt + } + } + } + } + return "Weekend" + } } final class TimingModel: KNObject {