-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from decentralised-dataexchange/feature/123-M…
…ake-PrivacyDashboard-sdk-exposed-variables-aligned Feature/123 make privacy dashboard sdk exposed variables aligned
- Loading branch information
Showing
5 changed files
with
90 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// PrivacyDashboard.swift | ||
// PrivacyDashboardiOS | ||
// | ||
// Created by Mumthasir mohammed on 06/11/23. | ||
// | ||
|
||
import Foundation | ||
|
||
public class PrivacyDashboard { | ||
// MARK: - Invoking 'PrivacyDashboard' iOS SDK | ||
public static func showPrivacyDashboard(withApiKey: String, withUserId: String, withOrgId: String, withBaseUrl: String, turnOnAske: Bool, turnOnUserRequest: Bool, turnOnAttributeDetail: Bool) { | ||
BBConsentPrivacyDashboardiOS.shared.turnOnUserRequests = turnOnUserRequest | ||
BBConsentPrivacyDashboardiOS.shared.turnOnAskMeSection = turnOnAske | ||
BBConsentPrivacyDashboardiOS.shared.turnOnAttributeDetailScreen = turnOnAttributeDetail | ||
BBConsentPrivacyDashboardiOS.shared.baseUrl = withBaseUrl | ||
BBConsentPrivacyDashboardiOS.shared.show(organisationId: withOrgId, apiKey: withApiKey, userId: withUserId) | ||
} | ||
|
||
// MARK: - 'Individual' related api calls | ||
public static func createAnIndividual(id:String?, externalId:String?, externalIdType: String?, identityProviderId: String?, name: String, iamId: String?, email: String, phone:String, completionBlock:@escaping (_ success: Bool, _ resultVal: [String: Any]) -> Void) { | ||
let individual = Individual(id: id, externalID: externalId, externalIDType: externalId, identityProviderID: identityProviderId, name: name, iamID: iamId, email: email, phone: phone) | ||
let record = IndividualRecord(individual: individual) | ||
let data = try! JSONEncoder.init().encode(record) | ||
let dictionary = try! JSONSerialization.jsonObject(with: data) as! [String: Any] | ||
|
||
BBConsentBaseWebService.shared.makeAPICall(urlString: Constant.URLStrings.createIndividual, parameters: dictionary, method: .post) { success, resultVal in | ||
if success { | ||
debugPrint(resultVal) | ||
completionBlock(true, resultVal) | ||
|
||
} else { | ||
debugPrint(resultVal) | ||
completionBlock(false, resultVal) | ||
} | ||
} | ||
} | ||
|
||
public static func readAnIndividual(individualId: String, completionBlock:@escaping (_ success: Bool, _ resultVal: [String: Any]) -> Void) { | ||
BBConsentBaseWebService.shared.makeAPICall(urlString: Constant.URLStrings.readIndividual + individualId, parameters: [:], method: .get) { success, resultVal in | ||
if success { | ||
debugPrint(resultVal) | ||
completionBlock(true, resultVal) | ||
} else { | ||
debugPrint(resultVal) | ||
completionBlock(false, resultVal) | ||
} | ||
} | ||
} | ||
|
||
public static func updateAnIndividual(individualId: String, externalId:String?, externalIdType: String?, identityProviderId: String?, name: String, iamId: String?, email: String, phone:String, completionBlock:@escaping (_ success: Bool, _ resultVal: [String: Any]) -> Void) { | ||
let individual = Individual(id: individualId, externalID: externalId, externalIDType: externalId, identityProviderID: identityProviderId, name: name, iamID: iamId, email: email, phone: phone) | ||
let record = IndividualRecord(individual: individual) | ||
let data = try! JSONEncoder.init().encode(record) | ||
let dictionary = try! JSONSerialization.jsonObject(with: data) as! [String: Any] | ||
|
||
BBConsentBaseWebService.shared.makeAPICall(urlString: Constant.URLStrings.readIndividual + individualId, parameters: dictionary ,method: .put) { success, resultVal in | ||
if success { | ||
debugPrint(resultVal) | ||
completionBlock(true, resultVal) | ||
} else { | ||
debugPrint(resultVal) | ||
completionBlock(false, resultVal) | ||
} | ||
} | ||
} | ||
|
||
public static func fetchAllIndividuals(completionBlock:@escaping (_ success: Bool, _ resultVal: [String: Any]) -> Void) { | ||
BBConsentBaseWebService.shared.makeAPICall(urlString: Constant.URLStrings.fetchAllIndividuals, parameters: [:] ,method: .get) { success, resultVal in | ||
if success { | ||
debugPrint(resultVal) | ||
completionBlock(true, resultVal) | ||
} else { | ||
debugPrint(resultVal) | ||
completionBlock(false, resultVal) | ||
} | ||
} | ||
} | ||
} |
6 changes: 5 additions & 1 deletion
6
PrivacyDashboardiOS/Example/Pods/Pods.xcodeproj/project.pbxproj
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters