Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated year of birth, age, and gender functions. #1048

Open
wants to merge 1 commit into
base: 3.0.0-official-branch
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -29,6 +29,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 @@ -41,6 +42,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
4 changes: 4 additions & 0 deletions PrebidMobile/ConfigurationAndTargeting/Targeting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class Targeting: NSObject {
/**
Indicates user birth year.
*/
@available(*, deprecated, message: "Deprecated by ORTB")
public var yearOfBirth: Int {
get { yearofbirth }
set { setYearOfBirth(yob: newValue) }
Expand All @@ -46,6 +47,7 @@ public class Targeting: NSObject {
/**
* 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 @@ -55,6 +57,7 @@ public class Targeting: NSObject {
}

// Objective C API
@available(*, deprecated, message: "Deprecated by ORTB")
public func getYearOfBirth() -> NSNumber {
NSNumber(value: yearOfBirth)
}
Expand All @@ -69,6 +72,7 @@ public class Targeting: NSObject {
/**
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