diff --git a/PrivacyDashboardiOS/Classes/PrivacyDashboard.storyboard b/PrivacyDashboardiOS/Classes/PrivacyDashboard.storyboard index bae9642..eadbd82 100644 --- a/PrivacyDashboardiOS/Classes/PrivacyDashboard.storyboard +++ b/PrivacyDashboardiOS/Classes/PrivacyDashboard.storyboard @@ -1219,6 +1219,10 @@ + + + + @@ -1262,6 +1266,9 @@ + + + @@ -1280,6 +1287,9 @@ + + + @@ -1301,6 +1311,9 @@ + + + @@ -1320,6 +1333,9 @@ + + + @@ -1354,6 +1370,12 @@ + + + + + + @@ -1391,7 +1413,8 @@ - + + diff --git a/PrivacyDashboardiOS/Classes/ViewControllers/DataSharingViewController/BBConsentDataSharingVC.swift b/PrivacyDashboardiOS/Classes/ViewControllers/DataSharingViewController/BBConsentDataSharingVC.swift index 1e72bc5..c8577c7 100644 --- a/PrivacyDashboardiOS/Classes/ViewControllers/DataSharingViewController/BBConsentDataSharingVC.swift +++ b/PrivacyDashboardiOS/Classes/ViewControllers/DataSharingViewController/BBConsentDataSharingVC.swift @@ -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! @@ -35,7 +36,6 @@ class BBConsentDataSharingVC: BBConsentBaseViewController, WebServiceTaskManager override func viewDidLoad() { super.viewDidLoad() self.setUI() - self.callOrganizationApi() self.callOrganisationDetailsApi() } @@ -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() { @@ -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 ?? "") { @@ -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) + } } } } diff --git a/PrivacyDashboardiOS/Example/PrivacyDashboardiOS/ViewController.swift b/PrivacyDashboardiOS/Example/PrivacyDashboardiOS/ViewController.swift index c11b231..4fc030f 100644 --- a/PrivacyDashboardiOS/Example/PrivacyDashboardiOS/ViewController.swift +++ b/PrivacyDashboardiOS/Example/PrivacyDashboardiOS/ViewController.swift @@ -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", @@ -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() {