Skip to content

Commit

Permalink
Save GET responce to state and remove unnecessary condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevazhnovu committed Jul 29, 2024
1 parent 06e6214 commit 640916d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions ConsentViewController/Classes/Consents/SPUSNatConsent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Foundation
public var applies: Bool

/// The consent strings related to this user profile
public let consentStrings: [ConsentString]
public var consentStrings: [ConsentString]

/// A series of statuses (`Bool?`) regarding GPP and user consent
/// - SeeAlso: `SPUSNatConsent.Statuses`
Expand Down Expand Up @@ -141,7 +141,7 @@ extension SPUSNatConsent {

extension SPUSNatConsent {
struct UserConsents: Codable, Equatable {
let vendors, categories: [SPConsentable]
var vendors, categories: [SPConsentable]
}
}

Expand Down Expand Up @@ -179,7 +179,7 @@ extension SPUSNatConsent {

public extension SPUSNatConsent {
struct Statuses: CustomStringConvertible, Equatable {
public let rejectedAny, consentedToAll, consentedToAny,
public var rejectedAny, consentedToAll, consentedToAny,
hasConsentData, sellStatus, shareStatus,
sensitiveDataStatus, gpcStatus: Bool?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,17 +771,15 @@ class SourcepointClientCoordinator: SPClientCoordinator {
state.usnat?.expirationDate = usnat.expirationDate
state.usnat?.consentStatus = usnat.consentStatus
state.usnat?.GPPData = usnat.GPPData
// state.usnat?.categories = usnat.сategories
// state.usnat?.consentStrings = usnat.consentStrings
// state.usnat?.statuses.consentedToAll = usnat.consentedToAll
// state.usnat?.consentStatus.rejectedAny = usnat.rejectedAny
// state.usnat?.statuses.gpcStatus = usnat.gpcEnabled
state.usnat?.consentStrings = usnat.consentStrings
state.usnat?.consentStatus.consentedToAll = usnat.consentedToAll
state.usnat?.consentStatus.rejectedAny = usnat.rejectedAny
state.usnat?.consentStatus.granularStatus?.gpcStatus = usnat.gpcEnabled
}
storage.spState = state
}

func shouldCallGetChoice(for action: SPAction) -> Bool {
(action.campaignType == .ccpa || action.campaignType == .gdpr || action.campaignType == .usnat) &&
(action.type == .AcceptAll || action.type == .RejectAll)
}

Expand Down

0 comments on commit 640916d

Please sign in to comment.