Skip to content

Commit

Permalink
Deprecated year of birth, age, and gender functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsligh authored and mdanylov-sigma committed Jan 29, 2025
1 parent 9e6e610 commit 937c383
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion PrebidMobile/ConfigurationAndTargeting/AgeUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import Foundation
@objc(PBMAgeUtils) @objcMembers
public class AgeUtils: NSObject {

static func isYOBValid(_ yob: Int) -> Bool {
@available(*, deprecated, message: "Deprecated by ORTB")
static func isYOBValid(_ yob: Int) -> Bool {
let date = Date()
let calendar = Calendar.current

Expand Down
2 changes: 2 additions & 0 deletions PrebidMobile/ConfigurationAndTargeting/Gender.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ enum GenderDescription : String {
case other = "O"
}

@available(*, deprecated, message: "Deprecated by ORTB")
func GenderFromDescription(_ genderDescription: String) -> Gender {
guard let knownGender = GenderDescription(rawValue: genderDescription) else {
return .unknown
Expand All @@ -56,6 +57,7 @@ func GenderFromDescription(_ genderDescription: String) -> Gender {
}
}

@available(*, deprecated, message: "Deprecated by ORTB")
func DescriptionOfGender(_ gender: Gender) -> String? {
switch gender {
case .unknown: return nil
Expand Down
18 changes: 14 additions & 4 deletions PrebidMobile/ConfigurationAndTargeting/Targeting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ public class Targeting: NSObject {

// MARK: - User Information

/// Indicates user birth year.
/**
Indicates user birth year.
*/
@available(*, deprecated, message: "Deprecated by ORTB")
public var yearOfBirth: Int {
get { yearofbirth }
set { setYearOfBirth(yob: newValue) }
}

/// This method set the year of birth value
/**
* This method set the year of birth value
*/
@available(*, deprecated, message: "Deprecated by ORTB")
public func setYearOfBirth(yob: Int) {
if AgeUtils.isYOBValid(yob) {
yearofbirth = yob
Expand All @@ -61,7 +67,8 @@ public class Targeting: NSObject {
}
}

/// Objective C API
// Objective C API
@available(*, deprecated, message: "Deprecated by ORTB")
public func getYearOfBirth() -> NSNumber {
NSNumber(value: yearOfBirth)
}
Expand All @@ -71,7 +78,10 @@ public class Targeting: NSObject {
yearofbirth = 0
}

/// Indicates the end-user's gender.
/**
Indicates the end-user's gender.
*/
@available(*, deprecated, message: "Deprecated by ORTB")
public var userGender: Gender {
get {
guard let currentValue = parameterDictionary[PrebidTargetingKey_GENDER] else {
Expand Down

0 comments on commit 937c383

Please sign in to comment.