Skip to content

Commit

Permalink
Add #110: Make baseUrl configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Mumthasir mohammed authored and georgepadayatti committed Oct 31, 2023
1 parent df68483 commit 856f270
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public class BBConsentPrivacyDashboardiOS: UIViewController {
public var turnOnUserRequests = false
public var turnOnAskMeSection = false
public var turnOnAttributeDetailScreen = false

// Demo server by default
public var baseUrl = "https://demo-consent-bb-api.igrant.io/v2"

var orgId: String?
var userId: String?
var hideBackButton = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class BBConsentOrganisationViewController: BBConsentBaseViewController {
// Create an action
let firstAction: UIAlertAction = UIAlertAction(title: NSLocalizedString(Constant.Strings.privacyPolicy, comment: ""), style: .default) { action -> Void in

if let privacyPolicy = self.organisaionDeatils?.organization?.privacyPolicy {
if let privacyPolicy = self.organization?.privacyPolicy {
if self.verifyUrl(urlString: privacyPolicy) {
let webviewVC = self.storyboard?.instantiateViewController(withIdentifier: Constant.ViewControllerID.webViewVC) as! BBConsentWebViewViewController
webviewVC.urlString = privacyPolicy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class BBConsentDashboardHeaderCell: UITableViewCell {
@IBOutlet weak var gradiantViewTop: UIView!

var orgData : Organization?
var baseUrl = BBConsentPrivacyDashboardiOS.shared.baseUrl

override func awakeFromNib() {
super.awakeFromNib()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit

class LoginWebService: BBConsentBaseWebService {
func callLoginService(){
self.url = baseUrl_V1 + "users/login"
self.url = baseUrl + "users/login"
postServiceCall()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class OrganisationWebServiceManager: WebServiceTaskManager {
var requestId = ""
var requestType = RequestType.DownloadData
var isLoadMore = false
var baseUrl = BBConsentPrivacyDashboardiOS.shared.baseUrl

func refreshToken(){
let service = BBConsentBaseWebService()
Expand Down Expand Up @@ -116,7 +117,7 @@ class OrganisationWebServiceManager: WebServiceTaskManager {
serviceType = .PurposeList
DispatchQueue.global().async {
self.searchService.delegate = self
self.searchService.url = baseUrl + "/service/data-agreement/" + dataAgreementId + "/data-attributes?"
self.searchService.url = self.baseUrl + "/service/data-agreement/" + dataAgreementId + "/data-attributes?"
self.searchService.getServiceCall()
}
}
Expand Down Expand Up @@ -152,7 +153,7 @@ class OrganisationWebServiceManager: WebServiceTaskManager {
// }
let userID = BBConsentPrivacyDashboardiOS.shared.userId ?? ""
let urlPart = "/consents/" + consentID + "/purposes/" + purposeId + "/attributes/" + attributeId
self.searchService.url = baseUrl + "organizations/" + orgId + "/users/" + userID + urlPart
self.searchService.url = self.baseUrl + "organizations/" + orgId + "/users/" + userID + urlPart
self.searchService.parameters = valuesDict
self.searchService.patchServiceCall()
// self.searchService.changeConsent(orgId: orgId, consentID: consentID, parameter: valuesDict)
Expand All @@ -163,7 +164,7 @@ class OrganisationWebServiceManager: WebServiceTaskManager {
func updatePurpose(dataAgreementRecordId: String, dataAgreementId: String, status: Bool) {
serviceType = .AllowAlConsent
DispatchQueue.global().async {
self.searchService.url = baseUrl + "/service/individual/record/data-agreement-record/" + dataAgreementRecordId + "?dataAgreementId=" + dataAgreementId
self.searchService.url = self.baseUrl + "/service/individual/record/data-agreement-record/" + dataAgreementRecordId + "?dataAgreementId=" + dataAgreementId
self.searchService.parameters = ["optIn" : status]
self.searchService.putServiceCall()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ import Foundation
import Alamofire
import SwiftyJSON

//Production Url
//var baseUrl = "https://api.igrant.io/v1/"

// Staging Url
var baseUrl = "https://staging-consent-bb-api.igrant.io/v2"
var baseUrl_V1 = "https://staging-api.igrant.io/v1.1/"

// Demo Url
// var baseUrl = "https://demo-consent-bb-api.igrant.io/v1/"
// var baseUrl_v2 = "https://demo-consent-bb-api.igrant.io/v2/"

class RestResponse : NSObject {
var response : JSON?
var responseModel : AnyObject?
Expand Down Expand Up @@ -68,6 +57,7 @@ class BBConsentBaseWebService: NSObject {
var header:[String : String]?
var requestInfo : [String:String]?
var errorMsg : String?
var baseUrl = BBConsentPrivacyDashboardiOS.shared.baseUrl


func refreshToken() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class ViewController: UIViewController {

override func viewDidAppear(_ animated: Bool) {
// Invoking 'BBConsentPrivacyDashboardiOS' SDK
BBConsentPrivacyDashboardiOS.shared.turnOnUserRequests = false
BBConsentPrivacyDashboardiOS.shared.turnOnAskMeSection = false
BBConsentPrivacyDashboardiOS.shared.turnOnAttributeDetailScreen = false
BBConsentPrivacyDashboardiOS.shared.baseUrl = "https://demo-consent-bb-api.igrant.io/v2"
BBConsentPrivacyDashboardiOS.shared.show(organisationId: "64f09f778e5f3800014a879a", apiKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTY29wZXMiOlsic2VydmljZSJdLCJPcmdhbmlzYXRpb25JZCI6IjY1MjY1Nzk2OTM4MGYzNWZhMWMzMDI0NSIsIk9yZ2FuaXNhdGlvbkFkbWluSWQiOiI2NTI2NTc5NjkzODBmMzVmYTFjMzAyNDMiLCJleHAiOjE3MDA3MjkxOTF9.2rkHNiLDjQi8WOy4CWn96sMBx8KkvFCUMU0Xe6oXNbY", userId: "65378403b3f442eb9381b38d")
// BBConsentPrivacyDashboardiOS.shared.show(organisationId: "64f09f778e5f3800014a879a", apiKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyaWQiOiI2NGYwYTYxZThlNWYzODAwMDE0YTg3YTYiLCJvcmdpZCI6IiIsImVudiI6IiIsImV4cCI6MTcyNDU5Njk2MX0.M3I6hJWtOyqbZXQwEGCK43AvROaoR_zncItmULpbFYE", userId: "64f0a61e8e5f3800014a87a6")

BBConsentPrivacyDashboardiOS.shared.turnOnUserRequests = true
BBConsentPrivacyDashboardiOS.shared.turnOnAskMeSection = true
}

override func didReceiveMemoryWarning() {
Expand Down
2 changes: 1 addition & 1 deletion PrivacyDashboardiOS/PrivacyDashboardiOS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'PrivacyDashboardiOS'
s.version = '2023.10.7'
s.version = '2023.10.9'
s.summary = 'A short description of PrivacyDashboardiOS.'

# This description is used to generate tags and improve search results.
Expand Down

0 comments on commit 856f270

Please sign in to comment.