Skip to content

Commit

Permalink
Merge pull request #132 from decentralised-dataexchange/fix/125-Attri…
Browse files Browse the repository at this point in the history
…bute-list-UI-issues
  • Loading branch information
georgepadayatti authored Nov 8, 2023
2 parents a973c3f + 625ac8e commit fc896a3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 39 deletions.
50 changes: 23 additions & 27 deletions PrivacyDashboardiOS/Classes/PrivacyDashboard.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -521,27 +521,26 @@
<rect key="frame" x="0.0" y="0.0" width="393" height="70"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Phone number" textAlignment="natural" lineBreakMode="tailTruncation" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kRm-cn-3Nr">
<rect key="frame" x="15" y="11" width="363" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="4u5-Su-DiL"/>
</constraints>
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizableString" value="Phone number"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="8086644704" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CeQ-4q-4JM">
<rect key="frame" x="15" y="38.666666666666664" width="363" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="71G-yK-NxP"/>
</constraints>
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="15"/>
<color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="whO-My-fYr">
<rect key="frame" x="15" y="17.333333333333332" width="363" height="35.333333333333343"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Phone number" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kRm-cn-3Nr">
<rect key="frame" x="0.0" y="0.0" width="363" height="17.666666666666668"/>
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizableString" value="Phone number"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="8086644704" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CeQ-4q-4JM">
<rect key="frame" x="0.0" y="17.666666666666664" width="363" height="17.666666666666664"/>
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="15"/>
<color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Allow" textAlignment="right" lineBreakMode="tailTruncation" numberOfLines="0" minimumFontSize="14" translatesAutoresizingMaskIntoConstraints="NO" id="DuO-9q-KSK">
<rect key="frame" x="264" y="23" width="92" height="24"/>
<constraints>
Expand Down Expand Up @@ -575,19 +574,16 @@
</subviews>
<constraints>
<constraint firstItem="yc0-U9-Nkd" firstAttribute="leading" secondItem="DuO-9q-KSK" secondAttribute="trailing" constant="13" id="B7t-nj-Eee"/>
<constraint firstItem="kRm-cn-3Nr" firstAttribute="top" secondItem="szl-In-VDo" secondAttribute="top" constant="11" id="G8G-hh-gwJ"/>
<constraint firstAttribute="trailing" secondItem="CeQ-4q-4JM" secondAttribute="trailing" constant="15" id="Kue-fN-zJU"/>
<constraint firstItem="whO-My-fYr" firstAttribute="leading" secondItem="szl-In-VDo" secondAttribute="leading" constant="15" id="PHh-RG-zpy"/>
<constraint firstItem="rGq-7f-Ef0" firstAttribute="leading" secondItem="szl-In-VDo" secondAttribute="leading" constant="15" id="RsS-26-v5e"/>
<constraint firstItem="DuO-9q-KSK" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="szl-In-VDo" secondAttribute="leading" constant="20" symbolic="YES" id="Ufu-QQ-6Bh"/>
<constraint firstItem="kRm-cn-3Nr" firstAttribute="leading" secondItem="szl-In-VDo" secondAttribute="leading" constant="15" id="WfG-Kj-wEs"/>
<constraint firstAttribute="trailing" secondItem="yc0-U9-Nkd" secondAttribute="trailing" constant="15" id="XEd-zh-i54"/>
<constraint firstAttribute="trailing" secondItem="rGq-7f-Ef0" secondAttribute="trailing" id="Zxu-yq-CZK"/>
<constraint firstItem="whO-My-fYr" firstAttribute="centerX" secondItem="szl-In-VDo" secondAttribute="centerX" id="czJ-ML-gqc"/>
<constraint firstItem="yc0-U9-Nkd" firstAttribute="centerY" secondItem="szl-In-VDo" secondAttribute="centerY" id="gFF-ca-FV0"/>
<constraint firstItem="DuO-9q-KSK" firstAttribute="centerY" secondItem="szl-In-VDo" secondAttribute="centerY" id="mAw-eB-ZMC"/>
<constraint firstItem="CeQ-4q-4JM" firstAttribute="leading" secondItem="szl-In-VDo" secondAttribute="leading" constant="15" id="mDQ-ge-GMK"/>
<constraint firstItem="rGq-7f-Ef0" firstAttribute="top" secondItem="CeQ-4q-4JM" secondAttribute="bottom" constant="11" id="o7x-3j-3WP"/>
<constraint firstAttribute="bottom" secondItem="rGq-7f-Ef0" secondAttribute="bottom" id="qvH-IN-AMB"/>
<constraint firstAttribute="trailing" secondItem="kRm-cn-3Nr" secondAttribute="trailing" constant="15" id="v85-SE-2dw"/>
<constraint firstItem="whO-My-fYr" firstAttribute="centerY" secondItem="DuO-9q-KSK" secondAttribute="centerY" id="sPF-RW-NHV"/>
</constraints>
</tableViewCellContentView>
<connections>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class BBConsentAttributesViewController: BBConsentBaseViewController {
var consentslistInfo : ConsentListingResponse?
var dataAttributes: [DataAttribute]?
var count: Count?
var consents: [Bool]?
var consentVal: Bool?
var isNeedToRefresh = false
var isFromQR = false

Expand Down Expand Up @@ -214,8 +214,8 @@ extension BBConsentAttributesViewController : UITableViewDelegate,UITableViewDa
// orgOverViewCell.overViewLbl.numberOfLines = 0
}
orgOverViewCell.overViewLbl.textReplacementType = .word
if self.consentslistInfo?.consents?.purpose?.descriptionField != nil {
let desc = (self.consentslistInfo?.consents?.purpose?.descriptionField)!
if purposeInfo?.descriptionField != nil {
let desc = purposeInfo?.descriptionField
orgOverViewCell.overViewLbl.text = desc
}
return orgOverViewCell
Expand All @@ -241,8 +241,9 @@ extension BBConsentAttributesViewController : UITableViewDelegate,UITableViewDa
}

let consentCell = tableView.dequeueReusableCell(withIdentifier:Constant.CustomTabelCell.consentCell ,for: indexPath) as! BBConsentAttributeTableViewCell
consentCell.rightArrow.isHidden = BBConsentPrivacyDashboardiOS.shared.turnOnAttributeDetailScreen == true ? false : true
consentCell.consentInfo = dataAttributes?[indexPath.row]
consentCell.consent = consents?[indexPath.row]
consentCell.consent = consentVal
consentCell.showData()
if isFromQR {
consentCell.consentTypeLbl.text = NSLocalizedString(Constant.Alert.allow, comment: "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ extension BBConsentOrganisationViewController: UITableViewDelegate, UITableViewD

var consentedCount = organisaionDeatils?.purposeConsents?[indexPath.row].dataAttributes?.count
let totalCount = organisaionDeatils?.purposeConsents?[indexPath.row].dataAttributes?.count

if record?.count ?? 0 > 0, record?[0].optIn == false {
consentedCount = 0
}
Expand All @@ -346,13 +346,11 @@ extension BBConsentOrganisationViewController: UITableViewDelegate, UITableViewD
consentVC.organisaionDeatils = self.organisaionDeatils
consentVC.organization = self.organization
consentVC.purposeInfo = organisaionDeatils?.purposeConsents?[indexPath.row]

// let filteredRecord = records?.dataAgreementRecords?.map({ $0 }).filter({ $0.dataAgreementId == organisaionDeatils?.purposeConsents?[indexPath.row].iD })
// if filteredRecord?.count ?? 0 > 0 {
let consents = organisaionDeatils?.purposeConsents?[indexPath.row].dataAttributes?.map({ $0.sensitivity ?? false })
// filteredRecord?[0].dataAttributes?.map({ $0.optIn ?? false })
consentVC.consents = consents
// }

// Note: filtering dataAgreement from records to check 'optIn' value (both are getting from different api's)
let dataAgreementIdsFromOrg = organisaionDeatils?.purposeConsents?.map({ $0.iD ?? ""})
let record = records?.consentRecords?.filter({ $0.dataAgreementId == dataAgreementIdsFromOrg?[indexPath.row]})
consentVC.consentVal = record?[0].optIn ?? false
self.navigationController?.pushViewController(consentVC, animated: true)
}
}
Expand Down

0 comments on commit fc896a3

Please sign in to comment.