Skip to content

Commit

Permalink
Merge pull request #150 from decentralised-dataexchange/feature/148-U…
Browse files Browse the repository at this point in the history
…pdate-new-data-sharing-UI-Flow
  • Loading branch information
georgepadayatti authored Nov 14, 2023
2 parents 0c7f2e2 + b7e0b9c commit 0190c76
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 16 deletions.
25 changes: 24 additions & 1 deletion PrivacyDashboardiOS/Classes/PrivacyDashboard.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,10 @@
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_between_logo" translatesAutoresizingMaskIntoConstraints="NO" id="Eet-Mu-igi">
<rect key="frame" x="145.33333333333334" y="0.0" width="62.333333333333343" height="80"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="keyPath" value="YES"/>
<userDefinedRuntimeAttribute type="image" keyPath="image"/>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="bQA-Vk-k7D">
<rect key="frame" x="217.66666666666666" y="0.0" width="62.666666666666657" height="80"/>
Expand Down Expand Up @@ -1262,6 +1266,9 @@
</fragment>
</attributedString>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="text" value=""/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
Expand All @@ -1280,6 +1287,9 @@
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="text" value=""/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
Expand All @@ -1301,6 +1311,9 @@
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="text" value=""/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
Expand All @@ -1320,6 +1333,9 @@
<color key="textColor" systemColor="labelColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="text" value=""/>
</userDefinedRuntimeAttributes>
</textView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
Expand Down Expand Up @@ -1354,6 +1370,12 @@
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Authorise"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="keyPath" value="YES"/>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="tapOnAuthoriseButton:" destination="Px2-MR-0WT" eventType="touchUpInside" id="a99-bj-tAy"/>
</connections>
Expand Down Expand Up @@ -1391,7 +1413,8 @@
</constraints>
</view>
<connections>
<outlet property="betweenLogosImageView" destination="Eet-Mu-igi" id="ovS-Jf-npA"/>
<outlet property="authoriseButton" destination="RdQ-wY-Q1B" id="JMb-QT-RCV"/>
<outlet property="betweenLogosImageView" destination="Eet-Mu-igi" id="il7-lq-rFa"/>
<outlet property="cancelButton" destination="xo6-bB-sML" id="C3N-la-snf"/>
<outlet property="dataAgreementTextView" destination="LMM-9V-pEM" id="ibt-zz-k2k"/>
<outlet property="labelStackView" destination="VHX-og-DaS" id="t0r-VY-mRD"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Kingfisher

class BBConsentDataSharingVC: BBConsentBaseViewController, WebServiceTaskManagerProtocol, UITextViewDelegate {
// MARK: IBOutlets
@IBOutlet weak var authoriseButton: UIButton!
@IBOutlet weak var cancelButton: UIButton!
@IBOutlet weak var labelStackView: UIStackView!
@IBOutlet weak var ourLogoImageView: UIImageView!
Expand All @@ -35,7 +36,6 @@ class BBConsentDataSharingVC: BBConsentBaseViewController, WebServiceTaskManager
override func viewDidLoad() {
super.viewDidLoad()
self.setUI()
self.callOrganizationApi()
self.callOrganisationDetailsApi()
}

Expand All @@ -44,6 +44,8 @@ class BBConsentDataSharingVC: BBConsentBaseViewController, WebServiceTaskManager
cancelButton.layer.borderWidth = 1
cancelButton.layer.borderColor = UIColor.black.cgColor
cancelButton.setTitle(cancelButtonText, for: .normal)
cancelButton.isHidden = true
authoriseButton.isHidden = true
}

func setOrganisationInfo() {
Expand Down Expand Up @@ -73,7 +75,7 @@ class BBConsentDataSharingVC: BBConsentBaseViewController, WebServiceTaskManager
return r
}

self.ourLogoImageView.image = UIImage(named: Constant.Images.defaultCoverImage)
self.betweenLogosImageView.image = UIImage(named: "ic_between_logo", in: Bundle(for: type(of:self)), compatibleWith: nil)
let logoUrlFromOrgData = URL(string: (organizationData?.logoImageURL ?? ""))
let placeholder = UIImage(named: Constant.Images.iGrantTick, in: Constant.getResourcesBundle(vc: BBConsentBaseViewController().classForCoder), compatibleWith: nil)
if let logoUrlFromClient = URL(string: theirLogoImageUrl ?? "") {
Expand Down Expand Up @@ -202,8 +204,16 @@ class BBConsentDataSharingVC: BBConsentBaseViewController, WebServiceTaskManager
} else if serviceManager.serviceType == .OrgDetails {
if let data = response.data?.responseModel as? OrganisationDetails {
organizationDetailsData = data
createAttributesView()
self.removeLoadingIndicator()
let dataAgreementRecord = organizationDetailsData?.purposeConsents?.filter({ $0.iD == dataAgreementId })
if dataAgreementRecord?[0].methodOfUse == "data_source" && dataAgreementRecord?[0].thirdPartyDisclosure == "true" {
callOrganizationApi()
createAttributesView()
cancelButton.isHidden = false
authoriseButton.isHidden = false
self.removeLoadingIndicator()
} else {
self.dismiss(animated: false)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ViewController: UIViewController {
}

override func viewDidAppear(_ animated: Bool) {
// 1. For showing Privacy Dashboard
// PrivacyDashboard.showPrivacyDashboard(withApiKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTY29wZXMiOlsic2VydmljZSJdLCJPcmdhbmlzYXRpb25JZCI6IjY1MjY1Nzk2OTM4MGYzNWZhMWMzMDI0NSIsIk9yZ2FuaXNhdGlvbkFkbWluSWQiOiI2NTI2NTc5NjkzODBmMzVmYTFjMzAyNDMiLCJleHAiOjE3MDA3MjkxOTF9.2rkHNiLDjQi8WOy4CWn96sMBx8KkvFCUMU0Xe6oXNbY",
// withUserId: "65378403b3f442eb9381b38d",
// withOrgId: "64f09f778e5f3800014a879a",
Expand All @@ -24,22 +25,34 @@ class ViewController: UIViewController {
// turnOnUserRequest: false,
// turnOnAttributeDetail: false)

// PrivacyDashboard.showDataSharingUI(apiKey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTY29wZXMiOlsic2VydmljZSJdLCJPcmdhbmlzYXRpb25JZCI6IjY1MjY1Nzk2OTM4MGYzNWZhMWMzMDI0NSIsIk9yZ2FuaXNhdGlvbkFkbWluSWQiOiI2NTI2NTc5NjkzODBmMzVmYTFjMzAyNDMiLCJleHAiOjE3MDA3MjkxOTF9.2rkHNiLDjQi8WOy4CWn96sMBx8KkvFCUMU0Xe6oXNbY",
// userId: "65378403b3f442eb9381b38d",
// baseUrlString: "https://staging-consent-bb-api.igrant.io/v2",
// dataAgreementId: "6551b99a7adedd223d2e61e4",
// organisationName: "My company",
// organisationLogoImageUrl: "https://www.kasandbox.org/programming-images/avatars/old-spice-man-blue.png",
// termsOfServiceText: "Terms of service.",
// termsOfServiceUrl: "http://google.com",
// cancelButtonText: "Cancel")
// 2. For showing Data sharing UI
PrivacyDashboard.showDataSharingUI(apiKey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTY29wZXMiOlsic2VydmljZSJdLCJPcmdhbmlzYXRpb25JZCI6IjY1MjY1Nzk2OTM4MGYzNWZhMWMzMDI0NSIsIk9yZ2FuaXNhdGlvbkFkbWluSWQiOiI2NTI2NTc5NjkzODBmMzVmYTFjMzAyNDMiLCJleHAiOjE3MDA3MjkxOTF9.2rkHNiLDjQi8WOy4CWn96sMBx8KkvFCUMU0Xe6oXNbY",
userId: "65378403b3f442eb9381b38d",
baseUrlString: "https://staging-consent-bb-api.igrant.io/v2",
dataAgreementId: "65522d05b792e39cff5cab2c",
organisationName: "My company",
organisationLogoImageUrl: "https://www.kasandbox.org/programming-images/avatars/old-spice-man-blue.png",
termsOfServiceText: "Terms of service.",
termsOfServiceUrl: "http://google.com",
cancelButtonText: "Cancel")


// 3. Call back method to receive response back
PrivacyDashboard.receiveDataBackFromPrivacyDashboard = { data in
debugPrint("Data receieved here:\(data)")
}

PrivacyDashboard.configure(withApiKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTY29wZXMiOlsic2VydmljZSJdLCJPcmdhbmlzYXRpb25JZCI6IjY1MjY1Nzk2OTM4MGYzNWZhMWMzMDI0NSIsIk9yZ2FuaXNhdGlvbkFkbWluSWQiOiI2NTI2NTc5NjkzODBmMzVmYTFjMzAyNDMiLCJleHAiOjE3MDA3MjkxOTF9.2rkHNiLDjQi8WOy4CWn96sMBx8KkvFCUMU0Xe6oXNbY", withUserId: "65378403b3f442eb9381b38d", withOrgId: "64f09f778e5f3800014a879a", withBaseUrl: "https://staging-consent-bb-api.igrant.io/v2")
PrivacyDashboard.updateDataAgreementStatus(dataAgreementId: "6551c9ba7654351e98a58734", status: true)

// 4. Setting API configuring params
// PrivacyDashboard.configure(withApiKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTY29wZXMiOlsic2VydmljZSJdLCJPcmdhbmlzYXRpb25JZCI6IjY1MjY1Nzk2OTM4MGYzNWZhMWMzMDI0NSIsIk9yZ2FuaXNhdGlvbkFkbWluSWQiOiI2NTI2NTc5NjkzODBmMzVmYTFjMzAyNDMiLCJleHAiOjE3MDA3MjkxOTF9.2rkHNiLDjQi8WOy4CWn96sMBx8KkvFCUMU0Xe6oXNbY", withUserId: "65378403b3f442eb9381b38d", withOrgId: "64f09f778e5f3800014a879a", withBaseUrl: "https://staging-consent-bb-api.igrant.io/v2")

// 5. Update Data agreement
// PrivacyDashboard.updateDataAgreementStatus(dataAgreementId: "6551c9ba7654351e98a58734", status: true)

// 6. Individual related API calls
// PrivacyDashboard.fetchAllIndividuals { success, resultVal in
// debugPrint(resultVal)
// }
}

override func didReceiveMemoryWarning() {
Expand Down

0 comments on commit 0190c76

Please sign in to comment.