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

Deprecate methods and properties for 3.0 #1109

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 14 additions & 0 deletions PrebidMobile/AdUnits/AdUnit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -305,22 +305,26 @@ public class AdUnit: NSObject, DispatcherDelegate {

/// This method obtains the ext data keyword & value for adunit targeting.
/// If the key already exists the value will be appended to the list. No duplicates will be added
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to clearly indicate in the message which alternative method should be used in place of the deprecated one. This could be achieved either through a global-level method from the Targeting class or by using the setImpORTBConfig/setGlobalORTBConfig methods.

public func addExtData(key: String, value: String) {
adUnitConfig.addExtData(key: key, value: value)
}

/// This method obtains the ext data keyword & values for adunit targeting
/// The values if the key already exist will be replaced with the new set of values
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func updateExtData(key: String, value: Set<String>) {
adUnitConfig.updateExtData(key: key, value: value)
}

/// This method allows to remove specific ext data keyword & values set from adunit targeting
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func removeExtData(forKey: String) {
adUnitConfig.removeExtData(for: forKey)
}

/// This method allows to remove all ext data set from adunit targeting
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearExtData() {
adUnitConfig.clearExtData()
}
Expand Down Expand Up @@ -385,37 +389,43 @@ public class AdUnit: NSObject, DispatcherDelegate {
/// Sets the app content object, replacing any existing content.
///
/// - Parameter appContentObject: The `PBMORTBAppContent` object representing the app's content.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func setAppContent(_ appContentObject: PBMORTBAppContent) {
adUnitConfig.setAppContent(appContentObject)
}

/// Retrieves the current app content object.
///
/// - Returns: The current `PBMORTBAppContent` object, or `nil` if no content is set.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func getAppContent() -> PBMORTBAppContent? {
return adUnitConfig.getAppContent()
}

/// Clears the current app content object.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearAppContent() {
adUnitConfig.clearAppContent()
}

/// Adds an array of content data objects to the app content.
///
/// - Parameter dataObjects: An array of `PBMORTBContentData` objects to add.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func addAppContentData(_ dataObjects: [PBMORTBContentData]) {
adUnitConfig.addAppContentData(dataObjects)
}

/// Removes a specific content data object from the app content.
///
/// - Parameter dataObject: The `PBMORTBContentData` object to remove.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func removeAppContentData(_ dataObject: PBMORTBContentData) {
adUnitConfig.removeAppContentData(dataObject)
}

/// Clears all content data objects from the app content.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearAppContentData() {
adUnitConfig.clearAppContentData()
}
Expand All @@ -425,25 +435,29 @@ public class AdUnit: NSObject, DispatcherDelegate {
/// Retrieves the current user data.
///
/// - Returns: An array of `PBMORTBContentData` objects representing the user data, or `nil` if no data is available.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func getUserData() -> [PBMORTBContentData]? {
return adUnitConfig.getUserData()
}

/// Adds an array of user data objects.
///
/// - Parameter userDataObjects: An array of `PBMORTBContentData` objects to add to the user data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func addUserData(_ userDataObjects: [PBMORTBContentData]) {
adUnitConfig.addUserData(userDataObjects)
}

/// Removes a specific user data object.
///
/// - Parameter userDataObject: The `PBMORTBContentData` object to remove from the user data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func removeUserData(_ userDataObject: PBMORTBContentData) {
adUnitConfig.removeUserData(userDataObject)
}

/// Clears all user data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearUserData() {
adUnitConfig.clearUserData()
}
Expand Down
6 changes: 6 additions & 0 deletions PrebidMobile/ConfigurationAndTargeting/Targeting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ public class Targeting: NSObject {
/// - Parameters:
/// - key: The key for the user data.
/// - value: The value to add for the specified key.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func addUserData(key: String, value: String) {
var values = rawUserDataDictionary[key] ?? Set<String>()
values.insert(value)
Expand All @@ -479,32 +480,37 @@ public class Targeting: NSObject {
/// - Parameters:
/// - key: The key for the user data.
/// - value: The set of values to update for the specified key.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func updateUserData(key: String, value: Set<String>) {
rawUserDataDictionary[key] = value
}

/// Removes user data for a specified key.
///
/// - Parameter key: The key for the user data to remove.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func removeUserData(for key: String) {
rawUserDataDictionary.removeValue(forKey: key)
}

/// Clears all user data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearUserData() {
rawUserDataDictionary.removeAll()
}

/// Retrieves all user data.
///
/// - Returns: A dictionary mapping keys to arrays of values.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func getUserData() -> [String: [String]] {
rawUserDataDictionary.mapValues { Array($0) }
}

/// User data dictionary for external use.
///
/// - Returns: A dictionary mapping keys to arrays of values.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public var userDataDictionary: [String : [String]] {
rawUserDataDictionary.mapValues { Array($0) }
}
Expand Down
2 changes: 2 additions & 0 deletions PrebidMobile/Host.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import UIKit
@objc public enum PrebidHost: Int {

/// URL [https://ib.adnxs.com/openrtb2/prebid](URL)
@available(*, deprecated, message: "This property is deprecated. In the upcoming major release, the property will be removed.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should also deprecate Prebid.prebidServerHost ? I don't think we'll need it anymore.

case Appnexus

/// URL [https://prebid-server.rubiconproject.com/openrtb2/auction](URL)
@available(*, deprecated, message: "This property is deprecated. In the upcoming major release, the property will be removed.")
case Rubicon

/// Custom Prebid server URL. The URL for this case should be set separately.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ public class BannerView:
/// - Parameters:
/// - key: The key for the data.
/// - value: The value for the data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func addExtData(key: String, value: String) {
adUnitConfig.addExtData(key: key, value: value)
}
Expand All @@ -319,18 +320,21 @@ public class BannerView:
/// - Parameters:
/// - key: The key for the data.
/// - value: The value for the data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func updateExtData(key: String, value: Set<String>) {
adUnitConfig.updateExtData(key: key, value: value)
}

/// Removes ext data.
/// - Parameters:
/// - key: The key for the data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func removeExtData(forKey: String) {
adUnitConfig.removeExtData(for: forKey)
}

/// Clears ext data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearExtData() {
adUnitConfig.clearExtData()
}
Expand Down Expand Up @@ -391,28 +395,33 @@ public class BannerView:

/// Sets the app content data.
/// - Parameter appContent: The app content data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func setAppContent(_ appContent: PBMORTBAppContent) {
adUnitConfig.setAppContent(appContent)
}

/// Clears the app content data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearAppContent() {
adUnitConfig.clearAppContent()
}

/// Adds app content data objects.
/// - Parameter dataObjects: The data objects to be added.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func addAppContentData(_ dataObjects: [PBMORTBContentData]) {
adUnitConfig.addAppContentData(dataObjects)
}

/// Removes an app content data object.
/// - Parameter dataObject: The data object to be removed.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func removeAppContentDataObject(_ dataObject: PBMORTBContentData) {
adUnitConfig.removeAppContentData(dataObject)
}

/// Clears all app content data objects.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearAppContentDataObjects() {
adUnitConfig.clearAppContentData()
}
Expand All @@ -421,17 +430,20 @@ public class BannerView:

/// Adds user data objects.
/// - Parameter userDataObjects: The user data objects to be added.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func addUserData(_ userDataObjects: [PBMORTBContentData]) {
adUnitConfig.addUserData(userDataObjects)
}

/// Removes a user data object.
/// - Parameter userDataObject: The user data object to be removed.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func removeUserData(_ userDataObject: PBMORTBContentData) {
adUnitConfig.removeUserData(userDataObject)
}

/// Clears all user data objects.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearUserData() {
adUnitConfig.clearUserData()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ public class InterstitialRenderingAdUnit: NSObject, BaseInterstitialAdUnitProtoc
/// - Parameters:
/// - key: The key for the data.
/// - value: The value for the data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func addExtData(key: String, value: String) {
adUnitConfig.addExtData(key: key, value: value)
}
Expand All @@ -253,18 +254,21 @@ public class InterstitialRenderingAdUnit: NSObject, BaseInterstitialAdUnitProtoc
/// - Parameters:
/// - key: The key for the data.
/// - value: The value for the data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func updateExtData(key: String, value: Set<String>) {
adUnitConfig.updateExtData(key: key, value: value)
}

/// Removes ext data.
/// - Parameters:
/// - key: The key for the data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func removeExtData(forKey: String) {
adUnitConfig.removeExtData(for: forKey)
}

/// Clears ext data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearExtData() {
adUnitConfig.clearExtData()
}
Expand Down Expand Up @@ -325,28 +329,33 @@ public class InterstitialRenderingAdUnit: NSObject, BaseInterstitialAdUnitProtoc

/// Sets the app content data.
/// - Parameter appContent: The app content data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func setAppContent(_ appContent: PBMORTBAppContent) {
adUnitConfig.setAppContent(appContent)
}

/// Clears the app content data.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearAppContent() {
adUnitConfig.clearAppContent()
}

/// Adds app content data objects.
/// - Parameter dataObjects: The data objects to be added.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func addAppContentData(_ dataObjects: [PBMORTBContentData]) {
adUnitConfig.addAppContentData(dataObjects)
}

/// Removes an app content data object.
/// - Parameter dataObject: The data object to be removed.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func removeAppContentDataObject(_ dataObject: PBMORTBContentData) {
adUnitConfig.removeAppContentData(dataObject)
}

/// Clears all app content data objects.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearAppContentDataObjects() {
adUnitConfig.clearAppContentData()
}
Expand All @@ -355,17 +364,20 @@ public class InterstitialRenderingAdUnit: NSObject, BaseInterstitialAdUnitProtoc

/// Adds user data objects.
/// - Parameter userDataObjects: The user data objects to be added.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should be used instead of addUserData ?

public func addUserData(_ userDataObjects: [PBMORTBContentData]) {
adUnitConfig.addUserData(userDataObjects)
}

/// Removes a user data object.
/// - Parameter userDataObject: The user data object to be removed.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func removeUserData(_ userDataObject: PBMORTBContentData) {
adUnitConfig.removeUserData(userDataObject)
}

/// Clears all user data objects.
@available(*, deprecated, message: "This method is deprecated. In the upcoming major release, the method will be removed.")
public func clearUserData() {
adUnitConfig.clearUserData()
}
Expand Down
Loading