From 8705696a4f5ce370165dfbb39c905073566a348c Mon Sep 17 00:00:00 2001 From: Mumthasir mohammed Date: Fri, 3 Nov 2023 15:05:05 +0530 Subject: [PATCH] Fix #115: Some consent type data agreement showing in disabled mode --- .../BBConsentDashboardUsagePurposeCell.swift | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/PrivacyDashboardiOS/Classes/ViewControllers/DashBoardViewController/Cell/BBConsentDashboardUsagePurposeCell.swift b/PrivacyDashboardiOS/Classes/ViewControllers/DashBoardViewController/Cell/BBConsentDashboardUsagePurposeCell.swift index a6cac37..e3a000b 100644 --- a/PrivacyDashboardiOS/Classes/ViewControllers/DashBoardViewController/Cell/BBConsentDashboardUsagePurposeCell.swift +++ b/PrivacyDashboardiOS/Classes/ViewControllers/DashBoardViewController/Cell/BBConsentDashboardUsagePurposeCell.swift @@ -32,32 +32,25 @@ class BBConsentDashboardUsagePurposeCell: UITableViewCell { } func showData() { - if self.swictOn == true { - self.statusSwitch.isOn = true - self.statusSwitch.isEnabled = false - } else { - self.statusSwitch.isEnabled = true - } + self.statusSwitch.isOn = self.swictOn ? true : false + self.statusSwitch.isEnabled = consentInfo?.lawfulUsage ?? false ? true : false + self.titleLbl.text = self.consentInfo?.name var valueString = "Allow " - - if consentedCount ?? 0 > 0 { - self.statusSwitch.isOn = true - valueString.append(": ") - let consentedStr = String(consentedCount ?? 0) - valueString.append(consentedStr) - if let total = totalCount { - if total > 0 { - let totalStr = String(total) - valueString.append(" of ") - valueString.append(totalStr) - } + + if consentedCount ?? 0 > 0 { + valueString.append(": ") + let consentedStr = String(consentedCount ?? 0) + valueString.append(consentedStr) + if let total = totalCount { + if total > 0 { + let totalStr = String(total) + valueString.append(" of ") + valueString.append(totalStr) } - self.dataLbl.text = valueString - } else { - self.statusSwitch.isOn = false - self.dataLbl.text = "Disallow" } + self.dataLbl.text = valueString + } } @IBAction func switchValueChanged(sender: UISwitch) {