From 68f7450255809d7f78540a02239f14992bd2a7ac Mon Sep 17 00:00:00 2001 From: vasavk Date: Mon, 6 May 2024 16:11:54 +0530 Subject: [PATCH] Digital ACT-191 ONEAPP-7016 story: hide/show current date indicator --- .../CalendarViewController.swift | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/VDSSample/ViewControllers/CalendarViewController.swift b/VDSSample/ViewControllers/CalendarViewController.swift index a2ae7a7..4506ffd 100644 --- a/VDSSample/ViewControllers/CalendarViewController.swift +++ b/VDSSample/ViewControllers/CalendarViewController.swift @@ -14,8 +14,8 @@ import VDSTokens class CalendarViewController: BaseViewController { var containerBorderSwitch = Toggle() - var dateIndicatorSwitch = Toggle() - var transparentSwitch = Toggle() + var hideCurrentDateIndicatorSwitch = Toggle() + var transparentBgSwitch = Toggle() var indicatorOneSwitch = Toggle() var indicatorTwoSwitch = Toggle() var indicatorThreeSwitch = Toggle() @@ -57,10 +57,10 @@ class CalendarViewController: BaseViewController { //add form rows addFormRow(label: "Surface", view: surfacePickerSelectorView) addFormRow(label: "Hide Container Border", view: containerBorderSwitch) - addFormRow(label: "Hide Current Date Indicator", view: dateIndicatorSwitch) + addFormRow(label: "Hide Current Date Indicator", view: hideCurrentDateIndicatorSwitch) addFormRow(label: "Min Date", view: minDateField) addFormRow(label: "Max Date", view: maxDateField) - addFormRow(label: "Transparent Background", view: transparentSwitch) + addFormRow(label: "Transparent Background", view: transparentBgSwitch) addFormRow(label: "Indicator One", view: indicatorOneSwitch) addFormRow(label: "Indicator Two", view: indicatorTwoSwitch) addFormRow(label: "Indicator Three", view: indicatorThreeSwitch) @@ -76,6 +76,16 @@ class CalendarViewController: BaseViewController { component.hideContainerBorder = sender.isOn } + hideCurrentDateIndicatorSwitch.onChange = { [weak self] sender in + guard let self else { return } + component.hideCurrentDateIndicator = sender.isOn + } + + transparentBgSwitch.onChange = { [weak self] sender in + guard let self else { return } + component.transparentBackground = sender.isOn + } + legendOneField .textPublisher .sink { @@ -148,6 +158,7 @@ class CalendarViewController: BaseViewController { indicatorOneSwitch.isOn = true indicatorTwoSwitch.isOn = true indicatorThreeSwitch.isOn = true + hideCurrentDateIndicatorSwitch.isOn = false } func updateIndicatorData(label: String = "", date: Date?, index:Int) {