Commit 5effaab4 authored by shenyong's avatar shenyong

推送规则更改,上报完善,bug修复

parent 9779b105
......@@ -54,6 +54,16 @@
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
0436B1F42DE061E30075159B /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
04BD7A3E2DA3B8F100A24C4B /* Embed ExtensionKit Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
......@@ -139,6 +149,21 @@
};
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
/* Begin PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */
0436B1F52DE061E30075159B /* Exceptions for "PhoneManager" folder in "Embed Frameworks" phase from "PhoneManager" target */ = {
isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
attributesByRelativePath = {
FBAudienceNetwork.xcframework = (CodeSignOnCopy, RemoveHeadersOnCopy, );
MetaAdapter.xcframework = (CodeSignOnCopy, RemoveHeadersOnCopy, );
};
buildPhase = 0436B1F42DE061E30075159B /* Embed Frameworks */;
membershipExceptions = (
FBAudienceNetwork.xcframework,
MetaAdapter.xcframework,
);
};
/* End PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
0496DEF52D9E3F58005B2834 /* widget */ = {
isa = PBXFileSystemSynchronizedRootGroup;
......@@ -169,6 +194,7 @@
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
EB388E6D2D8A61AA00629B0D /* Exceptions for "PhoneManager" folder in "PhoneManager" target */,
0436B1F52DE061E30075159B /* Exceptions for "PhoneManager" folder in "Embed Frameworks" phase from "PhoneManager" target */,
);
path = PhoneManager;
sourceTree = "<group>";
......@@ -352,6 +378,7 @@
04BD916E2D9D68AF00055CEB /* Embed Foundation Extensions */,
04BD7A3E2DA3B8F100A24C4B /* Embed ExtensionKit Extensions */,
75241895C9BA1036299CA526 /* [CP] Copy Pods Resources */,
0436B1F42DE061E30075159B /* Embed Frameworks */,
);
buildRules = (
);
......
......@@ -39,8 +39,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let storage = WidgetPublicModel.UseDiskSpace() * 100
widgetAppgourp.share.PushWidgetData(battery: Int(battery), storage: Int(storage))
//初始化adjust
let yourAppToken = "6mouvwgw7ksg"
......@@ -79,32 +77,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// 设置app动态按钮
setupDynamicShortcuts()
Adjust.attribution { attribution in
Print("获取当前归因信息",attribution as Any)
// if let dic = attribution?.jsonResponse{
// let pram = self.convertToSwiftDictionary(dic as NSDictionary)
// APIReportManager.shared.startReport(type: .source_atrribute,ext: pram)
// }
// let pram = [
// "tracker_token":attribution?.trackerToken ?? "",
// "tracker_name":attribution?.trackerName ?? "",
// "network":attribution?.network ?? "",
// "campaign":attribution?.campaign ?? "",
// "adgroup":attribution?.adgroup ?? "",
// "creative":attribution?.creative ?? "",
// "click_label":attribution?.clickLabel ?? "",
// "cost_type":attribution?.costType ?? "",
// "cost_amount":attribution?.costAmount ?? "",
// "cost_currency":attribution?.costCurrency ?? "0"
// ]
// Print("归因字典",pram)
// Print("归因json",attribution?.jsonResponse)
guard let attribution = attribution else{
return
}
self.reportAdjsutADJAttribution(attribution)
}
PMLoadingHUD.share.config()
UNUserNotificationCenter.current().delegate = self
return true
}
......@@ -148,10 +130,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
postContactNotification()
}
func applicationWillEnterForeground(_ application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
Print("进入后台")
if UserDefaults.standard.value(forKey: "app_install_date_enterback") == nil{
// 第一次安装时间
UserDefaults.standard.set(Date(), forKey: "app_install_date_enterback")
// 添加首次安装完成的推送
Print("开始创建首次安装完成的推送")
NotificationManager().scheduleFirstInstallNotification()
}else{
Print("无需创建")
}
if let firstAlert = UserDefaults.standard.value(forKey: "user_click_first_install_alert") as? Bool,firstAlert == true{
Print("开始创建首次安装进入推送的推送")
NotificationManager().scheduleFirstInstallAlertClickNotification()
}
}
func applicationWillResignActive(_ application: UIApplication) {
SettingConfiguration.share.saveData()
}
......
......@@ -8,6 +8,7 @@
import Foundation
import UIKit
import AdjustSdk
import UserNotifications
extension AppDelegate{
......@@ -62,11 +63,73 @@ extension AppDelegate:AdjustDelegate{
func adjustAttributionChanged(_ attribution: ADJAttribution?) {
guard let attribution = attribution else { return }
Print("归因变化数据",attribution.jsonResponse as Any)
if let dic = attribution.jsonResponse{
let pram = self.convertToSwiftDictionary(dic as NSDictionary)
APIReportManager.shared.startReport(type: .source_atrribute,ext: pram)
reportAdjsutADJAttribution(attribution)
}
func reportAdjsutADJAttribution(_ attribution: ADJAttribution){
let cost_amount = attribution.costAmount?.intValue
let network = attribution.network
var pram = [
"tracker_token":attribution.trackerToken ?? "",
"tracker_name":attribution.trackerName ?? "",
"campaign":attribution.campaign ?? "",
"adgroup":attribution.adgroup ?? "",
"creative":attribution.creative ?? "",
"click_label":attribution.clickLabel ?? "",
"cost_type":attribution.costType ?? "",
"cost_currency":attribution.costCurrency ?? "",
"cost_amount":cost_amount ?? 0,
"network":network ?? "",
] as [String:Any]
if let json = attribution.jsonResponse as? NSDictionary{
let convertDic = self.convertToSwiftDictionary(json)
pram["first_session_time"] = convertDic["first_session_time"]
pram["is_reattributed"] = convertDic["is_reattributed"]
pram["engagement_time"] = convertDic["engagement_time"]
pram["installed_at"] = convertDic["installed_at"]
}
Print("归因变化上报",pram)
APIReportManager.shared.startReport(type: .source_atrribute,ext: pram)
}
}
extension AppDelegate:UNUserNotificationCenterDelegate{
// 当应用在前台时收到通知
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
// 允许在前台显示通知
completionHandler([.banner, .sound])
}
// 处理通知点击事件
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
// 获取通知的标识符
let identifier = response.notification.request.identifier
// 根据不同的通知类型执行不同的操作
switch identifier {
case "notification_24h", "notification_72h":
print("用户点击了首次安装通知")
// 这里可以跳转到相应的页面
case "weekly_sunday":
print("用户点击了每周通知")
case "inactive_8d", "inactive_10d":
print("用户点击了未活跃通知")
case "first_install":
print("用户点击了首次安装通知")
UserDefaults.standard.set(true, forKey: "user_click_first_install_alert")
default:
break
}
// 完成处理
completionHandler()
}
}
......@@ -83,7 +83,6 @@ class GroupDatabase {
print("插入数据失败")
}
}
sqlite3_finalize(insertStatement)
return false
}
......@@ -104,7 +103,6 @@ class GroupDatabase {
print("删除数据失败")
}
}
sqlite3_finalize(deleteStatement)
return false
}
......
......@@ -126,7 +126,6 @@ class TrashDatabase {
print("更新数据失败")
}
}
sqlite3_finalize(updateStatement)
return false
}
......
......@@ -6,7 +6,7 @@
//
import Foundation
import DeviceKit
struct APIReportManager{
......@@ -14,7 +14,7 @@ struct APIReportManager{
let bundleId = "com.app.phonemanager"
let hostUrl = "https://rp.sayyedandroid.online/phonemanagersp?pkg=com.app.phonemanager"
let DEBUG = true
// let DEBUG = true
// 开始上报
......@@ -68,14 +68,19 @@ struct APIReportManager{
}
private func getbpBody() ->[String:String]{
var DEBUG = true
#if DEBUG
DEBUG = true
#else
DEBUG = false
#endif
let body = [
"\(bundleId)_3": UIDevice.current.model, //手机型号
"\(bundleId)_3": "\(Device.current)", //手机型号
"\(bundleId)_4": "Apple", // 手机厂商
"\(bundleId)_5": UIDevice.current.systemVersion, //系统版本号
"\(bundleId)_8": Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "", // APP版本号
"\(bundleId)_9": DeviceIDManager.shared.deviceID, //UUID
"\(bundleId)_10":AdvManager.shared.getIDFA(), //iafa
"\(bundleId)_13": "iOS", // platform
"\(bundleId)_14": Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "", //版本号
"\(bundleId)_15": "AppStore", //渠道标识
......
......@@ -158,6 +158,10 @@ class PhotoManager{
func getBaseAssetGroup() {
baseDataLoadingState = .loading
trash = TrashDatabase.shared.queryAll().compactMap{$0.localIdentifier}
keep = GroupDatabase.shared.queryAll().compactMap{$0.localIdentifier}
DispatchQueue.global(qos: .background).async {[weak self] in
......@@ -182,8 +186,6 @@ class PhotoManager{
let otherArray = photoAssetsArray.filter {!screenShotArray.contains($0) }
weakSelf.allAssets = photoAssetsArray + videoAssetsArray
// print("基本数据执行完毕")
// 在主线程更新状态
DispatchQueue.main.async {
......@@ -193,7 +195,8 @@ class PhotoManager{
weakSelf.otherAssets = otherArray
weakSelf.baseDataLoadingState = .loaded
print("基本数据执行完毕")
NotificationManager().scheduleInactiveNotification(days: 8, identifier: "inactive_8d")
NotificationManager().scheduleInactiveNotification(days: 10, identifier: "inactive_10d")
NotificationCenter.default.post(name: .getBaseAssetsSuccess, object: nil)
}
}
......@@ -776,6 +779,7 @@ extension PhotoManager{
await VideoSimilarJSONManager.shared.removeLocalFileWithIds(for: deletes)
await PhotoDuplicateManager.shared.removeLocalFileWithIds(for: deletes)
filterResource()
completionHandler?()
}
}
......@@ -808,7 +812,7 @@ extension PhotoManager{
// 基本资源过滤保留和垃圾桶资源
func filterResource(){
let filterArray = trash + keep
let others = removeAssets(withIdentifiers: filterArray, from: otherModels)
......@@ -827,7 +831,6 @@ extension PhotoManager{
filterSimilarModels = similarPhotos
filterSimilarVideoModels = similarVideos
filterSimilarScreenShotModels = similarShots
}
}
......@@ -11,6 +11,7 @@ import UserMessagingPlatform
import AppTrackingTransparency
import AdSupport
import AppLovinSDK
import FBAudienceNetwork
enum AdvertisementType {
case rewardedInterstitialType
......@@ -27,11 +28,10 @@ class AdvManager : NSObject, FullScreenContentDelegate {
private static let REWARDED_INTERSTITIALAD_KEY : String = "ca-app-pub-3940256099942544/6978759866"
private static let INTERSTITIALAD_KEY : String = "ca-app-pub-3940256099942544/4411468910"
static let shared : AdvManager = AdvManager()
var currentVCName:String = ""
var adFromName:String = ""
// 看完广告的回调
var finisedCallBack:()->Void = {}
......@@ -96,7 +96,7 @@ class AdvManager : NSObject, FullScreenContentDelegate {
/// 初始化SDK
func initAdertisementSDK() {
ALPrivacySettings.setDoNotSell(true)
FBAdSettings.setAdvertiserTrackingEnabled(true)
MobileAds.shared.start { status in
let adapterStatuses = status.adapterStatusesByClassName
for adapter in adapterStatuses {
......@@ -215,7 +215,7 @@ class AdvManager : NSObject, FullScreenContentDelegate {
/// 开始显示
/// - Parameter completed: 准备完成后回调
func showRewardedInterstitialAd(vc:UIViewController) {
func showRewardedInterstitialAd(vc:UIViewController,from:String = "") {
guard let ad = self.rewardedInterstitialAd else {
Task {
// 同时重新load两个广告内容
......@@ -231,26 +231,26 @@ class AdvManager : NSObject, FullScreenContentDelegate {
}
return
}
self.currentVCName = NSStringFromClass(type(of: vc))
self.adFromName = from
APIReportManager.shared.startReport(
type: .ad_prepare_show,
ext: ["ad_type": "rewardAd","from":self.currentVCName])
ext: ["ad_type": "rewardAd","from":self.adFromName])
ad.present(from: vc) {}
}
/// 开始显示
/// - Parameter completed: 准备完成后回调
func showInterstitialAd(vc:UIViewController) {
func showInterstitialAd(vc:UIViewController,from:String = "") {
guard let ad = self.interstitial else {
self.currentAdvType = .rewardedInterstitialType
self.showRewardedInterstitialAd(vc: vc)
return
}
self.currentAdvType = .interstitialType
self.currentVCName = NSStringFromClass(type(of: vc))
self.adFromName = from
APIReportManager.shared.startReport(
type: .ad_prepare_show,
ext: ["ad_type": "interAd","from":currentVCName])
ext: ["ad_type": "interAd","from":adFromName])
ad.present(from: vc)
}
......@@ -264,7 +264,7 @@ class AdvManager : NSObject, FullScreenContentDelegate {
}
APIReportManager.shared.startReport(
type: .ad_show,
ext: ["ad_type": ad_type,"from":currentVCName])
ext: ["ad_type": ad_type,"from":adFromName])
}
......@@ -277,7 +277,7 @@ class AdvManager : NSObject, FullScreenContentDelegate {
}
APIReportManager.shared.startReport(
type: .ad_show_error,
ext: ["ad_type": ad_type,"from":currentVCName,"reason":error.localizedDescription])
ext: ["ad_type": ad_type,"from":adFromName,"reason":error.localizedDescription])
self.rewardedInterstitialAd = nil
......@@ -378,7 +378,7 @@ extension AdvManager{
}
var pram = [
"from":currentVCName,
"from":adFromName,
"networkname":adNetworkName,
"adSourceName":adSourceName,
"adSourceInstanceName":adSourceInstanceName,
......
......@@ -233,7 +233,7 @@ class ChargeInfoViewController:BaseViewController {
/// 弹出广告
func popAdverTisement(){
AdvManager.shared.showInterstitialAd(vc: self)
AdvManager.shared.showInterstitialAd(vc: self,from:"charge")
}
}
......@@ -316,7 +316,7 @@ class CompressQualityController : BaseViewController{
}
/// 弹出广告
func popAdverTisement(){
AdvManager.shared.showInterstitialAd(vc: self)
AdvManager.shared.showInterstitialAd(vc: self,from:"compress")
}
}
......@@ -64,7 +64,7 @@ extension MergeButtonView {
// 添加的时候需要先弹出广告
if AdvManager.shared.advTimeAfterInAPP <= 0{
if let vc = self.responderViewController() {
AdvManager.shared.showInterstitialAd(vc: vc)
AdvManager.shared.showInterstitialAd(vc: vc,from:"merge")
AdvManager.shared.finisedCallBack = {
self.alertWhenMergeContact()
}
......
......@@ -765,7 +765,7 @@ extension HomePhotosDetailViewController:WaterfallMutiSectionDelegate,UICollecti
/// 弹出广告
func popAdverTisement(){
AdvManager.shared.showInterstitialAd(vc: self)
AdvManager.shared.showInterstitialAd(vc: self,from:self.mediaType?.rawValue ?? "")
}
func deleteAction(count:Int,isAfterAdv:Bool){
......
......@@ -671,7 +671,7 @@ extension HomeVideoDetailController:WaterfallMutiSectionDelegate,UICollectionVie
/// 弹出广告
func popAdverTisement(){
AdvManager.shared.showInterstitialAd(vc: self)
AdvManager.shared.showInterstitialAd(vc: self,from: "video_delete")
}
func deleteAction(count:Int,isAfterAdv:Bool){
......
......@@ -182,7 +182,7 @@ class HomeViewController:BaseViewController {
// 先走广告策略
if AdvManager.shared.advTimeAfterInAPP <= 0{
if IAPManager.share.isSubscribed == false {
AdvManager.shared.showInterstitialAd(vc: self)
AdvManager.shared.showInterstitialAd(vc: self,from: cIndex)
}else{
junmToModule(cIndex, self)
}
......@@ -251,7 +251,7 @@ class HomeViewController:BaseViewController {
DispatchQueue.main.async {
if !IAPManager.share.showYearPage{
HomePayViewController.show {
// NotificationManager().configNotifications()
NotificationManager().configNotifications()
}
}
}
......@@ -278,8 +278,7 @@ class HomeViewController:BaseViewController {
isShowCharge = true
}
homeView?.viewModel.reloadTrashAndKeep()
homeView?.collectionView.reloadData()
}
override func viewDidAppear(_ animated: Bool) {
......@@ -291,7 +290,7 @@ class HomeViewController:BaseViewController {
Singleton.shared.startCountdown {}
if !isShowCharge {
// NotificationManager().configNotifications()
NotificationManager().configNotifications()
return
}
......
......@@ -49,8 +49,9 @@ class HomeView:UIView {
sview.delegate = self
sview.showsVerticalScrollIndicator = false
sview.register(HomeTitleCollectionCell.self, forCellWithReuseIdentifier: HomeTitleCollectionCell.identifiers)
sview.register(HomeOtherCollectionCell.self, forCellWithReuseIdentifier: HomeOtherCollectionCell.identifier)
sview.register(HomeTitleCollectionCell.classForCoder(), forCellWithReuseIdentifier:"HomeTitleCollectionCell0")
sview.register(HomeTitleCollectionCell.classForCoder(), forCellWithReuseIdentifier:"HomeTitleCollectionCell1")
sview.register(HomeOtherCollectionCell.classForCoder(), forCellWithReuseIdentifier:HomeOtherCollectionCell.identifier)
sview.register(HomeVideoCoverCell.classForCoder(), forCellWithReuseIdentifier: "HomeVideoCoverCell")
sview.register(HomeCollectionViewHeader.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "HomeCollectionViewHeader")
sview.register(UICollectionReusableView.self,forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter,withReuseIdentifier: "HomeCollectionViewFooter")
......@@ -74,47 +75,31 @@ class HomeView:UIView {
override init(frame: CGRect) {
super.init(frame: frame)
// viewModel = HomeViewModel()
setupUI()
viewModel.setupBindings()
viewModel.homeDataChanged = {[weak self] section,row in
collectionView.reloadData()
viewModel.homeDataChanged = {[weak self] section,row,needReloadAll in
guard let weakSelf = self else { return }
DispatchQueue.main.async {
// if let cell = weakSelf.collectionView.cellForItem(at: IndexPath(row: row, section: section)) as? HomeTitleCollectionCell {
// // 只更新需要改变的内容
// let model = weakSelf.viewModel.headerGroup[row]
// cell.reloadUIWithModel(model: model)
// }
// if let cell = weakSelf.collectionView.cellForItem(at: IndexPath(row: row, section: section)) as? HomeOtherCollectionCell {
// // 只更新需要改变的内容
// let model = weakSelf.viewModel.cardGroup[row]
// cell.reloadUIWithModel(model: model)
// }
weakSelf.collectionView.reloadData()
DispatchQueue.main.async {
if needReloadAll{
weakSelf.collectionView.reloadData()
}else{
if let cell = weakSelf.collectionView.cellForItem(at: IndexPath(row: row, section: section)) as? HomeTitleCollectionCell {
// 只更新需要改变的内容
let model = weakSelf.viewModel.headerGroup[row]
cell.reloadUIWithModel(model: model)
}
if let cell = weakSelf.collectionView.cellForItem(at: IndexPath(row: row, section: section)) as? HomeOtherCollectionCell {
// 只更新需要改变的内容
let model = weakSelf.viewModel.cardGroup[row]
cell.reloadUIWithModel(model: model)
}
}
weakSelf.homeHeader?.progressBar.chaoticProgress = CGFloat(weakSelf.viewModel.totalSize)
weakSelf.reloadHeadSize()
}
}
viewModel.reloadCellHeight = {[weak self] in
guard let weakSelf = self else { return }
DispatchQueue.main.async {
weakSelf.collectionView.reloadData()
}
}
// viewModel.coverHadChange = { [weak self] in
// guard let weakSelf = self else { return }
// print("刷新一次封面")
// weakSelf.collectionView.reloadData()
// }
collectionView.reloadData()
}
func reloadHeadSize(){
......@@ -244,7 +229,7 @@ extension HomeView:WaterfallMutiSectionDelegate,UICollectionViewDataSource,UICol
return viewModel.headerGroup.count// model?.titleModelArray.count ?? 0
case 1:
return viewModel.cardGroup.count//model?.otherModelArray.count ?? 0
return viewModel.cardGroup.count//model?.otherModelArray.count ?? 0
default:
return 0
......@@ -258,9 +243,10 @@ extension HomeView:WaterfallMutiSectionDelegate,UICollectionViewDataSource,UICol
switch section {
case 0:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: HomeTitleCollectionCell.identifiers, for: indexPath) as! HomeTitleCollectionCell
let cell = collectionView.dequeueReusableCell(withReuseIdentifier:"HomeTitleCollectionCell\(indexPath.row)", for: indexPath) as! HomeTitleCollectionCell
let model = viewModel.headerGroup[indexPath.row]
cell.reloadUIWithModel(model: model)
cell.reloadCoverData(viewModel.coverAssets[indexPath.row])
cell.homeTititlAction = {[weak self] idx in
guard let self = self else { return }
if indexPath.row == 0 {
......@@ -306,7 +292,7 @@ extension HomeView:WaterfallMutiSectionDelegate,UICollectionViewDataSource,UICol
return (model.assets.first?.count ?? 0) > 2 ? ((collection.width - marginLR - 20) / 2.2) + 64 : ((collection.width - 2 * marginLR - 10) / 2) + 64
}else{
return 38
return 40
}
......@@ -406,10 +392,10 @@ extension HomeView:WaterfallMutiSectionDelegate,UICollectionViewDataSource,UICol
// 设置头部视图的大小
func referenceSizeForHeader(collectionView collection: UICollectionView, layout: WaterfallMutiSectionFlowLayout, section: Int) -> CGSize {
if section == 0 {
if PhotoManager.shared.permissionStatus == .authorized{
return CGSize(width:ScreenW-(marginLR*2), height: 76 + (self.homeNavView?.height ?? 0))
}else{
if PhotoManager.shared.permissionStatus == .denied{
return CGSize(width:ScreenW-(marginLR*2), height: 450)
}else{
return CGSize(width:ScreenW-(marginLR*2), height: 76 + (self.homeNavView?.height ?? 0))
}
}
return CGSize.zero
......
......@@ -109,7 +109,7 @@ extension TrashSubView {
// 添加的时候需要先弹出广告
if AdvManager.shared.advTimeAfterInAPP <= 0{
if let vc = self.responderViewController() {
AdvManager.shared.showInterstitialAd(vc: vc)
AdvManager.shared.showInterstitialAd(vc: vc,from:"emptyTrash")
AdvManager.shared.finisedCallBack = {
self.clearTashDataCallBack()
}
......
......@@ -86,29 +86,23 @@ class HomeTitleCollectionCell:UICollectionViewCell {
}
var model:HomePhotosModel? {
didSet {
guard let model = model else{
return
}
// guard let model else {return}
//
// titleLabel?.text = model.folderName
// titleLabel?.sizeToFit()
//
// var count = 0
//
// for array in model.assets {
//
// count += array.count
// }
//
// fileLabel?.text = "\(count)" + " Photos " + (model.allFileSize > 0 ? "(\(formatFileSize(model.allFileSize)))" : "(Calculating...)")
// fileLabel?.sizeToFit()
//
// assetsModels = model.homeAssetModel.map({ asset in
// return ImageCollectionModel(asset: asset)
// })
//
// collectionView?.reloadData()
titleLabel.text = model.folderName
titleLabel.sizeToFit()
var count = 0
for array in model.assets {
count += array.count
}
fileLabel?.text = "\(count)" + " Photos " + (model.allFileSize > 0 ? "(\(formatFileSize(model.allFileSize)))" : "(Calculating...)")
fileLabel?.sizeToFit()
}
}
......@@ -117,39 +111,17 @@ class HomeTitleCollectionCell:UICollectionViewCell {
guard let model = model else { return }
self.model = model
titleLabel.text = model.folderName
titleLabel.sizeToFit()
var count = 0
for array in model.assets {
count += array.count
}
fileLabel?.text = "\(count)" + " Photos " + (model.allFileSize > 0 ? "(\(formatFileSize(model.allFileSize)))" : "(Calculating...)")
fileLabel?.sizeToFit()
}
func reloadCoverData(_ assets:[AssetModel]){
assetsModels.removeAll()
if let assets = model.assets.first{
assetsModels = assets.compactMap({ model in
return ImageCollectionModel.init(asset: model)
})
}
assetsModels = assets.compactMap({ model in
return ImageCollectionModel.init(asset: model)
})
Print("刷新头部封面\(self)",assets.count)
collectionView?.reloadData()
}
// func reloadCoverData(_ assets:[AssetModel]){
// assetsModels.removeAll()
// assetsModels = assets.compactMap({ model in
// return ImageCollectionModel.init(asset: model)
// })
// Print("刷新头部封面\(self)",assets.count)
// collectionView?.reloadData()
// }
override func layoutSubviews() {
super.layoutSubviews()
......
......@@ -9,33 +9,7 @@ class HomeViewModel {
private init(){}
func config(){}
// 封面图片资源缓存
// actor CoverCacheActor {
//
// private var cardCoverImage:[UIImage?] = [
// UIImage.init(named: "videosmoren"),
// UIImage.init(named: "photosmoren"),
// UIImage.init(named: "photosmoren"),
// UIImage.init(named: "videosmoren"),
// UIImage.init(named: "othermoren")
// ]
//
// func getImage(index:Int) ->UIImage?{
// return cardCoverImage.safeGet(index: index) ?? nil
// }
//
//
// func setImage(index:Int,image:UIImage?) {
// guard let image = image else{
// return
// }
// if cardCoverImage.count > index{
// cardCoverImage[index] = image
// }
// }
// }
private var photoManager = PhotoManager.shared
// 相册资源总大小
......@@ -97,10 +71,14 @@ class HomeViewModel {
var hadLoad = false
// 数据获取回调
var homeDataChanged:((_ section:Int,_ row:Int) ->Void)?
var coverAssets:[[AssetModel]]{
return [
photoManager.duplicateModels.first ?? [],
photoManager.filterSimilarModels.first ?? []
]
}
var reloadCellHeight:(() ->Void)?
var homeDataChanged:((_ section:Int,_ row:Int,_ needReloadCol:Bool) ->Void)?
func setupBindings() {
......@@ -128,11 +106,12 @@ class HomeViewModel {
totalFilesCount = photoManager.allAssets.count
hadLoad = true
photoManager.convertScreenShotModels {[weak self] screens, size in
guard let weakSelf = self else { return }
let type = HomeUIEnum.Screensshots
weakSelf.filterResource()
weakSelf.homeDataChanged?(1,type.index)
weakSelf.homeDataChanged?(1,type.index,true)
}
photoManager.convertOtherPhotoModels {[weak self] others, size in
......@@ -140,7 +119,7 @@ class HomeViewModel {
let type = HomeUIEnum.Other
weakSelf.filterResource()
weakSelf.homeDataChanged?(1,type.index)
weakSelf.homeDataChanged?(1,type.index,true)
}
photoManager.convertVideoModels {[weak self] videos, size in
......@@ -148,8 +127,9 @@ class HomeViewModel {
let type = HomeUIEnum.Videos
weakSelf.filterResource()
weakSelf.homeDataChanged?(1,type.index)
weakSelf.homeDataChanged?(1,type.index,true)
}
startMainTask()
}
......@@ -166,26 +146,25 @@ class HomeViewModel {
let type = HomeUIEnum.Similar
var hadblock = false
var needReloadAll = true
PhotoSimilarManager.shared.findSimilarAssets(in: photoManager.otherAssets) {[weak self] group in
guard let weakSelf = self else { return }
weakSelf.photoManager.similarModels.append(group)
if !hadblock{
weakSelf.reloadCellHeight?()
hadblock = true
}
weakSelf.homeDataChanged?(0,type.index)
weakSelf.filterResource()
weakSelf.homeDataChanged?(0,type.index,needReloadAll)
needReloadAll = false
} completionHandler: {[weak self] totalGroup in
guard let weakSelf = self else { return }
print("获取相似图片完成",totalGroup.count)
weakSelf.photoManager.similarModels = totalGroup
weakSelf.filterResource()
weakSelf.homeDataChanged?(0,type.index)
weakSelf.homeDataChanged?(0,type.index,true)
NotificationManager().scheduleOneTimeNotification(afterHours: 24, identifier: "notification_24h")
NotificationManager().scheduleOneTimeNotification(afterHours: 72, identifier: "notification_72h")
}
}
......@@ -198,13 +177,15 @@ class HomeViewModel {
guard let weakSelf = self else { return }
weakSelf.photoManager.similarScreenShotModels.append(group)
weakSelf.homeDataChanged?(1,type.index)
weakSelf.filterResource()
weakSelf.homeDataChanged?(1,type.index,false)
} completionHandler: {[weak self] totalGroup in
guard let weakSelf = self else { return }
print("获取相似截图完成",totalGroup.count)
weakSelf.filterResource()
weakSelf.photoManager.similarScreenShotModels = totalGroup
weakSelf.filterResource()
weakSelf.homeDataChanged?(1,type.index,false)
}
}
......@@ -216,13 +197,15 @@ class HomeViewModel {
VideoSimilarJSONManager.shared.findSimilarVideos(in: photoManager.videoAssets) {[weak self] group in
guard let weakSelf = self else { return }
weakSelf.photoManager.similarVideoModels.append(group)
weakSelf.homeDataChanged?(1,type.index)
weakSelf.filterResource()
weakSelf.homeDataChanged?(1,type.index,false)
} completionHandler: {[weak self] totalGroup in
print("获取相似视频完成",totalGroup.count)
guard let weakSelf = self else { return }
weakSelf.filterResource()
weakSelf.photoManager.similarVideoModels = totalGroup
weakSelf.filterResource()
weakSelf.homeDataChanged?(1,type.index,false)
}
}
......@@ -236,15 +219,16 @@ class HomeViewModel {
guard let weakSelf = self else { return }
weakSelf.photoManager.duplicateModels = groups
weakSelf.filterResource()
let currentThread = Thread.current
if currentThread.isMainThread {
print("在主线程执行")
} else {
print("在后台线程执行")
}
weakSelf.reloadCellHeight?()
weakSelf.homeDataChanged?(0,type.index)
// weakSelf.reloadCellHeight?()
weakSelf.homeDataChanged?(0,type.index,true)
} progressHandler: {group in
......@@ -259,17 +243,16 @@ class HomeViewModel {
print("在后台线程执行")
}
weakSelf.photoManager.duplicateModels = totalGroup
weakSelf.reloadCellHeight?()
weakSelf.homeDataChanged?(0,type.index)
weakSelf.filterResource()
// weakSelf.reloadCellHeight?()
weakSelf.homeDataChanged?(0,type.index,true)
}
}
func reloadTrashAndKeep(){
photoManager.reloadTrashAndKeep()
reloadCellHeight?()
}
func filterResource(){
photoManager.filterResource()
}
......
......@@ -58,7 +58,7 @@ class MaintaiDetailViewController: BaseViewController {
}
removeBtn = UIButton()
removeBtn.setTitle("Not-keep All", for: .normal)
removeBtn.setTitle("Not keep All", for: .normal)
removeBtn.addTarget(self, action: #selector(removeAll), for: .touchUpInside)
removeBtn.setTitleColor(.black, for: .normal)
removeBtn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .semibold)
......
......@@ -54,7 +54,7 @@ class MaintainViewListController: BaseViewController {
}
removeBtn = UIButton()
removeBtn.setTitle("Not-keep All", for: .normal)
removeBtn.setTitle("Not keep All", for: .normal)
removeBtn.addTarget(self, action: #selector(removeAll), for: .touchUpInside)
removeBtn.setTitleColor(.black, for: .normal)
removeBtn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .semibold)
......@@ -81,6 +81,7 @@ class MaintainViewListController: BaseViewController {
if GroupDatabase.shared.batchDelete(localIdentifiers: ids){
getData()
selectAsset.removeAll()
dealBottomView()
}
isSelectAll = false
}else{
......@@ -89,8 +90,11 @@ class MaintainViewListController: BaseViewController {
if GroupDatabase.shared.batchDelete(localIdentifiers: ids){
getData()
selectAsset.removeAll()
dealBottomView()
}
}
}
func getData(){
......
......@@ -148,7 +148,7 @@ extension MaintaiDetailTableViewCell:UIScrollViewDelegate{
Print("小图滑动到下标\(index)")
let space:CGFloat = (self.smallW + 12) * CGFloat(index)
UIView.animate(withDuration: 0.3) {
self.pageCollectionView.contentOffset = CGPoint(x:space, y: 0)
self.pageCollectionView.contentOffset = CGPoint(x:space + 2, y: 0)
}
}
}
......@@ -197,7 +197,7 @@ extension MaintaiDetailTableViewCell:UIScrollViewDelegate{
Print("大图滑动到下标\(index)")
let space:CGFloat = (self.smallW + 12) * CGFloat(index)
UIView.animate(withDuration: 0.3) {
self.pageCollectionView.contentOffset = CGPoint(x: space, y: 0)
self.pageCollectionView.contentOffset = CGPoint(x: space + 2, y: 0)
}
self.mainCollectionView.contentOffset = CGPoint(x: index * Int(self.bigW), y: 0)
draggView = .null
......
......@@ -29,6 +29,18 @@ class NewGuideViewController: UIViewController {
startTimer()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// 禁用滑动返回手势
navigationController?.interactivePopGestureRecognizer?.isEnabled = false
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// 恢复滑动返回手势,避免影响其他视图控制器
navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}
func configUI(){
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
......@@ -111,7 +123,7 @@ class NewGuideViewController: UIViewController {
func startTimer() {
// 创建定时器,每隔 3 秒调用一次
// timer = Timer.scheduledTimer(timeInterval: 3.5, target: self, selector: #selector(advanceToNextItem), userInfo: nil, repeats: true)
timer = Timer.scheduledTimer(timeInterval: 3.5, target: self, selector: #selector(advanceToNextItem), userInfo: nil, repeats: true)
}
@objc func advanceToNextItem() {
......
......@@ -34,7 +34,7 @@ class PermissionVC:UIViewController {
}
return animationView
}()
override func viewDidLoad() {
super.viewDidLoad()
......@@ -46,7 +46,8 @@ class PermissionVC:UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
navigationController?.interactivePopGestureRecognizer?.isEnabled = false
isPPClick = false
......@@ -59,7 +60,7 @@ class PermissionVC:UIViewController {
titleLabel.textColor = UIColor.colorWithHex(hexStr: black3Color)
titleLabel.width = 183
titleLabel.numberOfLines = 2
titleLabel.text = "Welcome to Cleanup"
titleLabel.text = "Welcome to PhoneManager"
// 创建 NSMutableAttributedString
......@@ -101,7 +102,7 @@ class PermissionVC:UIViewController {
bottomTextView.delegate = self
let fullText = "Cleanup needs access to your Photos to free up storage. We intend to provide transparency and protect your privacy. By starting you accept our Terms of Use and Privacy Policy."
let fullText = "PhoneManager needs access to your Photos to free up storage. We intend to provide transparency and protect your privacy. By starting you accept our Terms of Use and Privacy Policy."
let termsText = "Terms of Use"
let privacyText = "Privacy Policy"
......
......@@ -245,7 +245,7 @@ class PayDistanceViewController: UIViewController {
self.distanceL.frame = CGRect(x: (ScreenW - CGFloat(300.RW())) / 2,
y: kSafeAreaInsets.top + CGFloat(129.RH()) + dropH + CGFloat(40.RH()),
width: CGFloat(300.RW()),
width: 300,
height: CGFloat(40.RW()))
self.annual.frame = CGRect(x: (ScreenW - 150) / 2,
......
......@@ -304,7 +304,7 @@ class SecretViewController: BaseViewController {
}
func popAdverTisement(){
AdvManager.shared.showInterstitialAd(vc: self)
AdvManager.shared.showInterstitialAd(vc: self,from:"Secret")
}
// 临时方法
......
......@@ -183,7 +183,7 @@ class SettingViewController : BaseViewController , UITableViewDelegate, UITableV
}
if AdvManager.shared.advTimeAfterInAPP <= 0{
if IAPManager.share.isSubscribed == false {
AdvManager.shared.showInterstitialAd(vc: self)
AdvManager.shared.showInterstitialAd(vc: self,from: "Widgets")
}else{
callblock()
}
......@@ -335,7 +335,7 @@ class SettingViewController : BaseViewController , UITableViewDelegate, UITableV
}
if AdvManager.shared.advTimeAfterInAPP <= 0{
if IAPManager.share.isSubscribed == false {
AdvManager.shared.showInterstitialAd(vc: self)
AdvManager.shared.showInterstitialAd(vc: self,from: "emailLoginSignOut")
}else{
callblock()
}
......
......@@ -192,7 +192,7 @@ extension TrashViewController:UIScrollViewDelegate{
HomePayViewController.show {
// 添加的时候需要先弹出广告
if AdvManager.shared.advTimeAfterInAPP <= 0{
AdvManager.shared.showInterstitialAd(vc: self)
AdvManager.shared.showInterstitialAd(vc: self,from: "trash")
AdvManager.shared.finisedCallBack = {
self.delMethod()
}
......
......@@ -155,7 +155,7 @@ extension EmailCleanListView : UITableViewDataSource,UITableViewDelegate {
// 广告
func popAdverTisement(){
AdvManager.shared.showInterstitialAd(vc: UIViewController.topMostViewController() ?? UIViewController())
AdvManager.shared.showInterstitialAd(vc: UIViewController.topMostViewController() ?? UIViewController(),from: "email")
}
private func selectSet(_ indexPath:IndexPath) -> Void {
......
......@@ -19,4 +19,7 @@ extension NSNotification.Name {
//首次打开引导页关闭
static let guidePageClose: NSNotification.Name = NSNotification.Name(rawValue: "guidePageClose")
//数据变化通知
static let photoManagerReloadData: NSNotification.Name = NSNotification.Name(rawValue: "photoManagerReloadData")
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>FBAudienceNetwork.framework/FBAudienceNetwork</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>FBAudienceNetwork.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>FBAudienceNetwork.framework/FBAudienceNetwork</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>FBAudienceNetwork.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
/***
* This is a bridge file for Audience Network Unity SDK.
*
* This file may be used to build your own Audience Network iOS SDK wrapper,
* but note that we don't support customisations of the Audience Network codebase.
*
***/
#import <UIKit/UIKit.h>
#import <FBAudienceNetwork/FBAdBridgeContainer.h>
#import "FBAdDefines.h"
FB_EXTERN_C_BEGIN
// External to this project
typedef NS_ENUM(NSInteger, FBGLViewController) {
FBGLViewControllerNone,
FBGLViewControllerUnity,
FBGLViewControllerCocos2D,
};
__attribute__((weak)) extern UIViewController *UnityGetGLViewController(void);
__attribute__((__always_inline__)) extern FBGLViewController fbad_Cocos2DGetGLViewController(
UIViewController **glViewController);
__attribute__((__always_inline__)) extern UIViewController *fbad_GetGLViewController(void);
__attribute__((__always_inline__)) extern FBGLViewController fbad_UnityGetGLViewController(
UIViewController **glViewController);
FB_EXTERN_C_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
/***
* This is a bridge file for Audience Network Unity SDK.
*
* This file may be used to build your own Audience Network iOS SDK wrapper,
* but note that we don't support customisations of the Audience Network codebase.
*
***/
#import <Foundation/Foundation.h>
#import <FBAudienceNetwork/FBAdBridgeCommon.h>
#import <FBAudienceNetwork/FBAdView.h>
#import <FBAudienceNetwork/FBInterstitialAd.h>
#import <FBAudienceNetwork/FBRewardedVideoAd.h>
typedef void (*FBAdBridgeCallback)(uint32_t uniqueId);
typedef void (*FBAdBridgeErrorCallback)(uint32_t uniqueId, char const *error);
@interface FBAdBridgeContainer : NSObject
@property (nonatomic, assign) int32_t uniqueId;
/**
This method explicitly removes added callbacks. When the instance is deallocated, it is called automatically by SDK
*/
- (void)dispose;
@end
@interface FBAdViewBridgeContainer : FBAdBridgeContainer <FBAdViewDelegate>
@property (nonatomic, strong) FBAdView *adView;
@property (nonatomic, assign) FBAdBridgeCallback adViewDidClickCallback;
@property (nonatomic, assign) FBAdBridgeCallback adViewDidFinishHandlingClickCallback;
@property (nonatomic, assign) FBAdBridgeCallback adViewDidLoadCallback;
@property (nonatomic, assign) FBAdBridgeErrorCallback adViewDidFailWithErrorCallback;
@property (nonatomic, assign) FBAdBridgeCallback adViewWillLogImpressionCallback;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)initWithAdView:(FBAdView *)adView withUniqueId:(int32_t)uniqueId NS_DESIGNATED_INITIALIZER;
@end
@interface FBInterstitialAdBridgeContainer : FBAdBridgeContainer <FBInterstitialAdDelegate>
@property (nonatomic, strong) FBInterstitialAd *interstitialAd;
@property (nonatomic, assign) FBAdBridgeCallback interstitialAdDidClickCallback;
@property (nonatomic, assign) FBAdBridgeCallback interstitialAdDidCloseCallback;
@property (nonatomic, assign) FBAdBridgeCallback interstitialAdWillCloseCallback;
@property (nonatomic, assign) FBAdBridgeCallback interstitialAdDidLoadCallback;
@property (nonatomic, assign) FBAdBridgeErrorCallback interstitialAdDidFailWithErrorCallback;
@property (nonatomic, assign) FBAdBridgeCallback interstitialAdWillLogImpressionCallback;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)initWithInterstitialAd:(FBInterstitialAd *)interstitialAd
withUniqueId:(int32_t)uniqueId NS_DESIGNATED_INITIALIZER;
@end
@interface FBRewardedVideoAdBridgeContainer : FBAdBridgeContainer <FBRewardedVideoAdDelegate>
@property (nonatomic, strong) FBRewardedVideoAd *rewardedVideoAd;
@property (nonatomic, assign) FBAdBridgeCallback rewardedVideoAdDidClickCallback;
@property (nonatomic, assign) FBAdBridgeCallback rewardedVideoAdDidCloseCallback;
@property (nonatomic, assign) FBAdBridgeCallback rewardedVideoAdWillCloseCallback;
@property (nonatomic, assign) FBAdBridgeCallback rewardedVideoAdDidLoadCallback;
@property (nonatomic, assign) FBAdBridgeErrorCallback rewardedVideoAdDidFailWithErrorCallback;
@property (nonatomic, assign) FBAdBridgeCallback rewardedVideoAdWillLogImpressionCallback;
@property (nonatomic, assign) FBAdBridgeCallback rewardedVideoAdVideoCompleteCallback;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)initWithRewardedVideoAd:(FBRewardedVideoAd *)rewardedVideoAd
withUniqueId:(int32_t)uniqueId NS_DESIGNATED_INITIALIZER;
@end
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <FBAudienceNetwork/UIView+FBNativeAdViewTag.h>
#import "FBAdDefines.h"
NS_ASSUME_NONNULL_BEGIN
@class FBAdImage;
@class FBNativeAdBase;
@class FBNativeAdViewAttributes;
/**
FBAdChoicesView offers a simple way to display a sponsored or AdChoices icon.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBAdChoicesView : UIView
/**
Access to the text label contained in this view.
*/
@property (nonatomic, weak, readonly, nullable) UILabel *label;
/**
Determines whether the background mask is shown, or a transparent mask is used.
*/
@property (nonatomic, assign, getter=isBackgroundShown) BOOL backgroundShown;
/**
Determines whether the view can be expanded upon being tapped, or defaults to fullsize. Defaults to NO.
*/
@property (nonatomic, assign, readonly, getter=isExpandable) BOOL expandable;
/**
The native ad that provides AdChoices info, such as the image url, and click url. Setting this property updates the
nativeAd.
*/
@property (nonatomic, weak, readwrite, nullable) FBNativeAdBase *nativeAd;
/**
Affects background mask rendering. Setting this property updates the rendering.
*/
@property (nonatomic, assign, readwrite) UIRectCorner corner;
/**
Affects background mask rendering. Setting this property updates the rendering.
*/
@property (nonatomic, assign, readwrite) UIEdgeInsets insets;
/**
The view controller to present the ad choices info from. If nil, the top view controller is used.
*/
@property (nonatomic, weak, readwrite, null_resettable) UIViewController *rootViewController;
/**
The tag for AdChoices view. Value of this property is always equal to FBNativeAdViewTagChoicesIcon.
*/
@property (nonatomic, assign, readonly) FBNativeAdViewTag nativeAdViewTag;
/**
Initializes this view with a given native ad. Configuration is pulled from the provided native ad.
@param nativeAd The native ad to initialize with
*/
- (instancetype)initWithNativeAd:(FBNativeAdBase *)nativeAd;
/**
Initializes this view with a given native ad. Configuration is pulled from the provided native ad.
@param nativeAd The native ad to initialize with
@param expandable Controls whether view defaults to expanded or not, see ``expandable`` property documentation
*/
- (instancetype)initWithNativeAd:(FBNativeAdBase *)nativeAd expandable:(BOOL)expandable;
/**
Initializes this view with a given native ad. Configuration is pulled from the native ad.
@param nativeAd The native ad to initialize with
@param expandable Controls whether view defaults to expanded or not, see ``expandable`` property documentation
@param attributes Attributes to configure look and feel.
*/
- (instancetype)initWithNativeAd:(FBNativeAdBase *)nativeAd
expandable:(BOOL)expandable
attributes:(nullable FBNativeAdViewAttributes *)attributes;
/**
This method updates the frame of this view using the superview, positioning the icon in the top right corner by
default.
*/
- (void)updateFrameFromSuperview;
/**
This method updates the frame of this view using the superview, positioning the icon in the corner specified.
UIRectCornerAllCorners not supported.
@param corner The corner to display this view from.
*/
- (void)updateFrameFromSuperview:(UIRectCorner)corner;
/**
This method updates the frame of this view using the superview, positioning the icon in the corner specified with
provided insets. UIRectCornerAllCorners not supported.
@param corner The corner to display this view from.
@param insets Insets to take into account when positioning the view. Only respective insets are applied to corners.
*/
- (void)updateFrameFromSuperview:(UIRectCorner)corner insets:(UIEdgeInsets)insets;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "FBAdDefines.h"
@class FBDisplayAdController;
@protocol FBAdCompanionViewDelegate;
NS_ASSUME_NONNULL_BEGIN
/**
This class is experimental and should not be used in production versions of your application
*/
FB_CLASS_EXPORT
@interface FBAdCompanionView : UIView
@property (nonatomic, weak, nullable) id<FBAdCompanionViewDelegate> delegate;
@end
/**
Methods declared by the FBAdCompanionViewDelegate protocol are experimental
and should not be used in production versions of your application
*/
@protocol FBAdCompanionViewDelegate <NSObject>
@optional
/**
This method is experimental and should not be used in production versions of your application
*/
- (void)companionViewDidLoad:(FBAdCompanionView *)companionView;
/**
This method is experimental and should not be used in production versions of your application
*/
- (void)companionViewWillClose:(FBAdCompanionView *)companionView;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#ifndef FBAudienceNetwork_FBAdDefines_h
#define FBAudienceNetwork_FBAdDefines_h
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmacro-redefined"
#ifdef __cplusplus
#define FB_EXTERN_C_BEGIN extern "C" {
#define FB_EXTERN_C_END }
#else
#define FB_EXTERN_C_BEGIN
#define FB_EXTERN_C_END
#endif
#ifdef __cplusplus
#define FB_EXPORT extern "C" __attribute__((visibility("default")))
#else
#define FB_EXPORT extern __attribute__((visibility("default")))
#endif
#define FB_CLASS_EXPORT __attribute__((visibility("default")))
#define FB_DEPRECATED __attribute__((deprecated))
#define FB_DEPRECATED_WITH_MESSAGE(M) __attribute__((deprecated(M)))
#if __has_feature(objc_generics)
#define FB_NSArrayOf(x) NSArray<x>
#define FB_NSMutableArrayOf(x) NSMutableArray<x>
#define FB_NSDictionaryOf(x, y) NSDictionary<x, y>
#define FB_NSMutableDictionaryOf(x, y) NSMutableDictionary<x, y>
#define FB_NSSetOf(x) NSSet<x>
#define FB_NSMutableSetOf(x) NSMutableSet<x>
#else
#define FB_NSArrayOf(x) NSArray
#define FB_NSMutableArrayOf(x) NSMutableArray
#define FB_NSDictionaryOf(x, y) NSDictionary
#define FB_NSMutableDictionaryOf(x, y) NSMutableDictionary
#define FB_NSSetOf(x) NSSet
#define FB_NSMutableSetOf(x) NSMutableSet
#define __covariant
#endif
#if !__has_feature(nullability)
#define NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_END
#define nullable
#define __nullable
#endif
#ifndef FB_SUBCLASSING_RESTRICTED
#if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)
#define FB_SUBCLASSING_RESTRICTED __attribute__((objc_subclassing_restricted))
#else
#define FB_SUBCLASSING_RESTRICTED
#endif
#endif
#pragma GCC diagnostic pop
#endif // FBAudienceNetwork_FBAdDefines_h
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import "FBAdDefines.h"
NS_ASSUME_NONNULL_BEGIN
typedef NSString *FBAdExperienceType NS_STRING_ENUM;
FB_EXPORT FBAdExperienceType const FBAdExperienceTypeRewarded;
FB_EXPORT FBAdExperienceType const FBAdExperienceTypeInterstitial;
FB_EXPORT FBAdExperienceType const FBAdExperienceTypeRewardedInterstitial;
FB_CLASS_EXPORT
/**
FBAdExperienceConfig is a class used to add configurations to thead experience
*/
@interface FBAdExperienceConfig : NSObject <NSCopying>
/**
Ad experience type to set up
*/
@property (nonatomic, strong, readwrite, nonnull) FBAdExperienceType adExperienceType;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/**
Creates an FBAdExperienceConfig with a specified type of experience
*/
- (instancetype)initWithAdExperienceType:(FBAdExperienceType)adExperienceType NS_DESIGNATED_INITIALIZER;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import "FBAdDefines.h"
NS_ASSUME_NONNULL_BEGIN
typedef NSString *FBAdExtraHintKeyword NS_STRING_ENUM;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordAccessories;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordArtHistory;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordAutomotive;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordBeauty;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordBiology;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordBoardGames;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordBusinessSoftware;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordBuyingSellingHomes;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordCats;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordCelebrities;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordClothing;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordComicBooks;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordDesktopVideo;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordDogs;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordEducation;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordEmail;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordEntertainment;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordFamilyParenting;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordFashion;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordFineArt;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordFoodDrink;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordFrenchCuisine;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordGovernment;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordHealthFitness;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordHobbies;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordHomeGarden;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordHumor;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordInternetTechnology;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordLargeAnimals;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordLaw;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordLegalIssues;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordLiterature;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordMarketing;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordMovies;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordMusic;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordNews;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordPersonalFinance;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordPets;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordPhotography;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordPolitics;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordRealEstate;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordRoleplayingGames;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordScience;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordShopping;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordSociety;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordSports;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordTechnology;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordTelevision;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordTravel;
extern FBAdExtraHintKeyword const FBAdExtraHintKeywordVideoComputerGames;
FB_CLASS_EXPORT
@interface FBAdExtraHint : NSObject
@property (nonatomic, copy, nullable)
NSString *contentURL FB_DEPRECATED_WITH_MESSAGE("Extra hints are no longer used in Audience Network");
@property (nonatomic, copy, nullable)
NSString *extraData FB_DEPRECATED_WITH_MESSAGE("Extra hints are no longer used in Audience Network");
@property (nonatomic, copy, nullable)
NSString *mediationData FB_DEPRECATED_WITH_MESSAGE("Extra hints are no longer used in Audience Network");
- (instancetype)initWithKeywords:(NSArray<FBAdExtraHintKeyword> *)keywords
FB_DEPRECATED_WITH_MESSAGE("Keywords are no longer used in Audience Network");
- (void)addKeyword:(FBAdExtraHintKeyword)keyword
FB_DEPRECATED_WITH_MESSAGE("Keywords are no longer used in Audience Network");
- (void)removeKeyword:(FBAdExtraHintKeyword)keyword
FB_DEPRECATED_WITH_MESSAGE("Keywords are no longer used in Audience Network");
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <FBAudienceNetwork/FBMediaView.h>
#import <FBAudienceNetwork/UIView+FBNativeAdViewTag.h>
#import <Foundation/Foundation.h>
#import "FBAdDefines.h"
NS_ASSUME_NONNULL_BEGIN
FB_CLASS_EXPORT
FB_DEPRECATED_WITH_MESSAGE("This class will be removed in a future release. Use FBMediaView instead.")
@interface FBAdIconView : FBMediaView
/**
The tag for the icon view. Value of this property is always equal to FBNativeAdViewTagIcon.
*/
@property (nonatomic, assign, readonly) FBNativeAdViewTag nativeAdViewTag;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import "FBAdDefines.h"
NS_ASSUME_NONNULL_BEGIN
/**
Represents an image creative.
*/
FB_CLASS_EXPORT
@interface FBAdImage : NSObject
/**
Typed access to the image url.
*/
@property (nonatomic, copy, readonly) NSURL *url;
/**
Typed access to the image width.
*/
@property (nonatomic, assign, readonly) CGFloat width;
/**
Typed access to the image height.
*/
@property (nonatomic, assign, readonly) CGFloat height;
/**
Initializes FBAdImage instance with given parameters.
@param url the image url.
@param width the image width.
@param height the image height.
*/
- (instancetype)initWithURL:(NSURL *)url width:(CGFloat)width height:(CGFloat)height NS_DESIGNATED_INITIALIZER;
/**
Loads an image from self.url over the network, or returns the cached image immediately.
@param block Block that is calledn upon completion of image loading
*/
- (void)loadImageAsyncWithBlock:(nullable void (^)(UIImage *__nullable image))block;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class FBNativeAdBase;
/**
Minimum dimensions of the view - width
*/
extern const CGFloat FBAdOptionsViewWidth;
/**
Minimum dimensions of the view - height
*/
extern const CGFloat FBAdOptionsViewHeight;
@interface FBAdOptionsView : UIView
/**
The native ad that provides AdOptions info, such as click url. Setting this updates the nativeAd.
*/
@property (nonatomic, weak, readwrite, nullable) FBNativeAdBase *nativeAd;
/**
The color to be used when drawing the AdOptions view.
*/
@property (nonatomic, strong, nullable) UIColor *foregroundColor;
/**
Only show the ad choices triangle icon. Default is NO.
Sizing note:
- Single icon is rendered in a square frame, it will default to the smallest dimension.
- Non single icon requires aspect ratio of the view to be 2.4 or less.
*/
@property (nonatomic, assign) BOOL useSingleIcon;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol FBAdSDKNotificationListener <NSObject>
/**
Method to be called when some specific SDK event will happens
@param event event type. Currently suuported following events:
"impression" happens every time when AD got an inpression recorded on the SDK
@param eventData is a payload associated with the event.
Method would be called on the main queue when the SDK event happens.
*/
- (void)onFBAdEvent:(NSString *)event eventData:(NSDictionary<NSString *, NSString *> *)eventData;
@end
@interface FBAdSDKNotificationManager : NSObject
/**
Adds a listener to SDK events
@param listener The listener to receive notification when the event happens
Note that SDK will hold a weak reference to listener object
*/
+ (void)addFBAdSDKNotificationListener:(id<FBAdSDKNotificationListener>)listener;
/**
Adds a listener to SDK events
@param listener The listener to be removed from notification list.
You can call this method when you no longer want to receive SDK notifications.
*/
+ (void)removeFBAdSDKNotificationListener:(id<FBAdSDKNotificationListener>)listener;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import "FBAdDefines.h"
NS_ASSUME_NONNULL_BEGIN
/**
Audience Network error domain
*/
FB_EXPORT NSString *const FBAudienceNetworkErrorDomain;
/**
Audience Network error FBMediaView error domain
*/
FB_EXPORT NSString *const FBAudienceNetworkMediaViewErrorDomain;
/**
Audience Network SDK logging levels
*/
typedef NS_ENUM(NSInteger, FBAdLogLevel) {
/// No logging
FBAdLogLevelNone,
/// Notifications
FBAdLogLevelNotification,
/// Errors only
FBAdLogLevelError,
/// Warnings only
FBAdLogLevelWarning,
/// Standard log level
FBAdLogLevelLog,
/// Debug logging
FBAdLogLevelDebug,
/// Log everything (verbose)
FBAdLogLevelVerbose
};
/**
Test Ad type to be injected when test mode is on
*/
typedef NS_ENUM(NSInteger, FBAdTestAdType) {
/// This will return a random ad type when test mode is on.
FBAdTestAdType_Default,
/// 16x9 image ad with app install CTA option
FBAdTestAdType_Img_16_9_App_Install,
/// 16x9 image ad with link CTA option
FBAdTestAdType_Img_16_9_Link,
/// 16x9 HD video 46 sec ad with app install CTA option
FBAdTestAdType_Vid_HD_16_9_46s_App_Install,
/// 16x9 HD video 46 sec ad with link CTA option
FBAdTestAdType_Vid_HD_16_9_46s_Link,
/// 16x9 HD video 15 sec ad with app install CTA option
FBAdTestAdType_Vid_HD_16_9_15s_App_Install,
/// 16x9 HD video 15 sec ad with link CTA option
FBAdTestAdType_Vid_HD_16_9_15s_Link,
/// 9x16 HD video 39 sec ad with app install CTA option
FBAdTestAdType_Vid_HD_9_16_39s_App_Install,
/// 9x16 HD video 39 sec ad with link CTA option
FBAdTestAdType_Vid_HD_9_16_39s_Link,
/// carousel ad with square image and app install CTA option
FBAdTestAdType_Carousel_Img_Square_App_Install,
/// carousel ad with square image and link CTA option
FBAdTestAdType_Carousel_Img_Square_Link,
/// carousel ad with square video and link CTA option
FBAdTestAdType_Carousel_Vid_Square_Link,
/// sample playable ad with app install CTA
FBAdTestAdType_Playable,
/// Redirect to Facebok - Facebook Rewarded Video experience
FBAdTestAdType_FBRV
};
@protocol FBAdLoggingDelegate;
/**
AdSettings contains global settings for all ad controls.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBAdSettings : NSObject
/**
Controls support for audio-only video playback when the app is backgrounded. Note that this is only supported
when using FBMediaViewVideoRenderer, and requires corresponding support for background audio to be added to
the app. Check Apple documentation at
https://developer.apple.com/documentation/avfoundation/media_playback_and_selection/creating_a_basic_video_player_ios_and_tvos/enabling_background_audio
Default value is NO.
*/
@property (class, nonatomic, assign, getter=isBackgroundVideoPlaybackAllowed) BOOL backgroundVideoPlaybackAllowed;
/**
When test mode is on, setting a non default value for testAdType will
requests the specified type of ad.
*/
@property (class, nonatomic, assign) FBAdTestAdType testAdType;
/**
When this delegate is set, logs will be redirected to the delegate instead of being logged directly to the console with
NSLog. This can be used in combination with external logging frameworks.
*/
@property (class, nonatomic, weak, nullable) id<FBAdLoggingDelegate> loggingDelegate;
/**
Generates bidder token that needs to be included in the server side bid request to Facebook endpoint.
*/
@property (class, nonatomic, copy, readonly) NSString *bidderToken;
/**
Generates routing token needed for requests routing in reverse-proxy, since we don't have cookies in app environments.
*/
@property (class, nonatomic, copy, readonly) NSString *routingToken;
/**
User's consent for advertiser tracking.
*/
+ (void)setAdvertiserTrackingEnabled:(BOOL)advertiserTrackingEnabled
NS_DEPRECATED_IOS(
12_0,
17_0,
"The setter for advertiserTrackingEnabled flag is deprecated: The setAdvertiserTrackingEnabled flag is not used for Audience Network SDK 6.15.0+ on iOS 17+ as the Audience Network SDK 6.15.0+ on iOS 17+ now relies on [ATTrackingManager trackingAuthorizationStatus] to accurately represent ATT permission for users of your app");
/*
Returns test mode on/off.
*/
+ (BOOL)isTestMode;
/**
Returns the hash value of the device to use test mode on.
*/
+ (NSString *)testDeviceHash;
/**
Adds a test device.
@param deviceHash The id of the device to use test mode, can be obtained from debug log or `+(NSString
*)testDeviceHash` method
Copy the current device Id from debug log and add it as a test device to get test ads. Apps
running on Simulator will automatically get test ads. Test devices should be added before loadAdWithBidPayload: is
called.
*/
+ (void)addTestDevice:(NSString *)deviceHash;
/**
Add a collection of test devices. See `+addTestDevices:` for details.
@param devicesHash The array of the device id to use test mode, can be obtained from debug log or testDeviceHash
*/
+ (void)addTestDevices:(FB_NSArrayOf(NSString *) *)devicesHash;
/**
Clears all the added test devices
*/
+ (void)clearTestDevices;
/**
Clears previously added test device
@param deviceHash The id of the device using test mode, can be obtained from debug log or testDeviceHash
*/
+ (void)clearTestDevice:(NSString *)deviceHash;
/**
Configures the ad control for treatment as child-directed.
@param isChildDirected Indicates whether you would like your ad control to be treated as child-directed
Note that you may have other legal obligations under the Children's Online Privacy Protection Act (COPPA).
Please review the FTC's guidance and consult with your own legal counsel.
*/
+ (void)setIsChildDirected:(BOOL)isChildDirected
FB_DEPRECATED_WITH_MESSAGE(
"isChildDirected method is no longer supported in Audience Network. Use +mixedAudience instead");
/**
Configures the ad control for treatment as mixed audience directed.
Information for Mixed Audience Apps and Services: https://developers.facebook.com/docs/audience-network/coppa
*/
@property (class, nonatomic, assign, getter=isMixedAudience) BOOL mixedAudience;
/**
Sets the name of the mediation service.
If an ad provided service is mediating Audience Network in their sdk, it is required to set the name of the mediation
service
@param service Representing the name of the mediation that is mediation Audience Network
*/
+ (void)setMediationService:(NSString *)service;
/**
Gets the url prefix to use when making ad requests.
This method should never be used in production versions of your application.
*/
+ (nullable NSString *)urlPrefix;
/**
Sets the url prefix to use when making ad requests.
This method should never be used in production versions of your application.
*/
+ (void)setUrlPrefix:(nullable NSString *)urlPrefix;
/**
Gets the current SDK logging level
*/
+ (FBAdLogLevel)getLogLevel;
/**
Sets the current SDK logging level
*/
+ (void)setLogLevel:(FBAdLogLevel)level;
/// Data processing options.
/// Please read more details at https://developers.facebook.com/docs/marketing-apis/data-processing-options
///
/// @param options Processing options you would like to enable for a specific event. Current accepted value is LDU for
/// Limited Data Use.
/// @param country A country that you want to associate to this data processing option. Current accepted values are 1,
/// for the United States of America, or 0, to request that we geolocate that event.
/// @param state A state that you want to associate with this data processing option. Current accepted values are 1000,
/// for California, or 0, to request that we geolocate that event.
+ (void)setDataProcessingOptions:(NSArray<NSString *> *)options country:(NSInteger)country state:(NSInteger)state;
/// Data processing options.
/// Please read more details at https://developers.facebook.com/docs/marketing-apis/data-processing-options
///
/// @param options Processing options you would like to enable for a specific event. Current accepted value is LDU for
/// Limited Data Use.
+ (void)setDataProcessingOptions:(NSArray<NSString *> *)options;
@end
@protocol FBAdLoggingDelegate <NSObject>
- (void)logAtLevel:(FBAdLogLevel)level
withFileName:(NSString *)fileName
withLineNumber:(int)lineNumber
withThreadId:(long)threadId
withBody:(NSString *)body;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
/***
* This is a bridge file for Audience Network Unity SDK.
*
* Please refer to FBAdSettings.h for full documentation of the API.
*
* This file may be used to build your own Audience Network iOS SDK wrapper,
* but note that we don't support customisations of the Audience Network codebase.
*
***/
#import <FBAudienceNetwork/FBAdBridgeCommon.h>
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
FB_EXTERN_C_BEGIN
FB_EXPORT void FBAdSettingsBridgeAddTestDevice(char const *deviceID);
FB_EXPORT void FBAdSettingsBridgeSetURLPrefix(char const *urlPrefix);
FB_EXPORT void FBAdSettingsBridgeSetMixedAudience(bool mixedAudience);
FB_EXPORT void FBAdSettingsBridgeSetAdvertiserTrackingEnabled(bool advertiserTrackingEnabled);
FB_EXPORT void FBAdSettingsBridgeSetDataProcessingOptions(char const *_Nonnull options[_Nonnull], int length);
FB_EXPORT void FBAdSettingsBridgeSetDetailedDataProcessingOptions(char const *_Nonnull options[_Nonnull],
int length,
int country,
int state);
FB_EXPORT char const *__nullable FBAdSettingsBridgeGetBidderToken(void);
FB_EXTERN_C_END
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import "FBAdDefines.h"
NS_ASSUME_NONNULL_BEGIN
/// Represents the ad size.
struct FBAdSize {
/// Internal size
CGSize size;
};
/// Represents the ad size.
typedef struct FBAdSize FBAdSize;
/**
DEPRECATED - Represents the fixed banner ad size - 320pt by 50pt.
*/
FB_EXPORT FBAdSize const kFBAdSize320x50 FB_DEPRECATED_WITH_MESSAGE("This adSize is DEPRECATED and will be removed.");
/**
Represents the flexible banner ad size, where banner width depends on
its container width, and banner height is fixed as 50pt.
*/
FB_EXPORT FBAdSize const kFBAdSizeHeight50Banner;
/**
Represents the flexible banner ad size, where banner width depends on
its container width, and banner height is fixed as 90pt.
*/
FB_EXPORT FBAdSize const kFBAdSizeHeight90Banner;
/**
Represents the flexible dynamic banner ad size, where banner width depends on
its container width, and banner height is set by the backend.
*/
FB_EXPORT FBAdSize const kFBAdDynamicSizeHeightBanner;
/**
Represents the interstitial ad size.
*/
FB_EXPORT FBAdSize const kFBAdSizeInterstitial;
/**
Represents the flexible rectangle ad size, where width depends on
its container width, and height is fixed as 250pt.
*/
FB_EXPORT FBAdSize const kFBAdSizeHeight250Rectangle;
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
/***
* This is a bridge file for Audience Network Unity SDK.
*
* Please refer to FBAdScreen.h for full documentation of the API.
*
* This file may be used to build your own Audience Network iOS SDK wrapper,
* but note that we don't support customisations of the Audience Network codebase.
*
***/
#import <FBAudienceNetwork/FBAdBridgeCommon.h>
FB_EXTERN_C_BEGIN
FB_EXPORT double FBAdUtilityBridgeGetDeviceWidth(void);
FB_EXPORT double FBAdUtilityBridgeGetDeviceHeight(void);
FB_EXPORT double FBAdUtilityBridgeGetWidth(void);
FB_EXPORT double FBAdUtilityBridgeGetHeight(void);
FB_EXPORT double FBAdUtilityBridgeConvertFromDeviceSize(double deviceSize);
FB_EXTERN_C_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <FBAudienceNetwork/FBAdExtraHint.h>
#import <FBAudienceNetwork/FBAdSize.h>
#import "FBAdDefines.h"
NS_ASSUME_NONNULL_BEGIN
@protocol FBAdViewDelegate;
/**
A customized UIView to represent a Facebook ad (a.k.a. banner ad).
*/
FB_CLASS_EXPORT
@interface FBAdView : UIView
/**
Initializes an instance of FBAdView matching the given placement id.
@param placementID The id of the ad placement. You can create your placement id from Facebook developers page.
@param adSize The size of the ad; for example, kFBAdSizeHeight50Banner or kFBAdSizeHeight90Banner.
@param rootViewController The view controller that will be used to present the ad and the app store view.
*/
- (instancetype)initWithPlacementID:(NSString *)placementID
adSize:(FBAdSize)adSize
rootViewController:(nullable UIViewController *)rootViewController NS_DESIGNATED_INITIALIZER;
/**
Initializes an instance of FBAdView matching the given placement id with a given bidding payload.
@param placementID The id of the ad placement. You can create your placement id from Facebook developers page.
@param bidPayload The bid payload sent from the server.
@param rootViewController The view controller that will be used to present the ad and the app store view.
@param error An out value that returns any error encountered during init.
*/
- (nullable instancetype)initWithPlacementID:(NSString *)placementID
bidPayload:(NSString *)bidPayload
rootViewController:(nullable UIViewController *)rootViewController
error:(NSError *__autoreleasing *)error;
/**
Begins loading the FBAdView content.
You can implement `adViewDidLoad:` and `adView:didFailWithError:` methods
of `FBAdViewDelegate` if you would like to be notified as loading succeeds or fails.
*/
- (void)loadAd FB_DEPRECATED_WITH_MESSAGE(
"This method will be removed in future version. Use -loadAdWithBidPayload instead."
"See https://www.facebook.com/audiencenetwork/resources/blog/bidding-moves-from-priority-to-imperative-for-app-monetization"
"for more details.");
/**
Begins loading the FBAdView content from a bid payload attained through a server side bid.
You can implement `adViewDidLoad:` and `adView:didFailWithError:` methods
of `FBAdViewDelegate` if you would like to be notified as loading succeeds or fails.
@param bidPayload The payload of the ad bid. You can get your bid id from Facebook bidder endpoint.
*/
- (void)loadAdWithBidPayload:(NSString *)bidPayload;
/**
Disables auto-refresh for the ad view. There is no reason to call this method anymore. Autorefresh is disabled by
default.
*/
- (void)disableAutoRefresh FB_DEPRECATED;
/**
Sets the rootViewController.
*/
- (void)setRootViewController:(UIViewController *)rootViewController;
/**
Typed access to the id of the ad placement.
*/
@property (nonatomic, copy, readonly) NSString *placementID;
/**
Typed access to the app's root view controller.
*/
@property (nonatomic, weak, readonly, nullable) UIViewController *rootViewController;
/**
Call isAdValid to check whether ad is valid
*/
@property (nonatomic, getter=isAdValid, readonly) BOOL adValid;
/**
the delegate
*/
@property (nonatomic, weak, nullable) id<FBAdViewDelegate> delegate;
/**
FBAdExtraHint to provide extra info. Note: FBAdExtraHint is deprecated in AudienceNetwork. See FBAdExtraHint for more
details
*/
@property (nonatomic, strong, nullable) FBAdExtraHint *extraHint;
@end
/**
The methods declared by the FBAdViewDelegate protocol allow the adopting delegate to respond
to messages from the FBAdView class and thus respond to operations such as whether the ad has
been loaded, the person has clicked the ad.
*/
@protocol FBAdViewDelegate <NSObject>
@optional
/**
Sent after an ad has been clicked by the person.
@param adView An FBAdView object sending the message.
*/
- (void)adViewDidClick:(FBAdView *)adView;
/**
When an ad is clicked, the modal view will be presented. And when the user finishes the
interaction with the modal view and dismiss it, this message will be sent, returning control
to the application.
@param adView An FBAdView object sending the message.
*/
- (void)adViewDidFinishHandlingClick:(FBAdView *)adView;
/**
Sent when an ad has been successfully loaded.
@param adView An FBAdView object sending the message.
*/
- (void)adViewDidLoad:(FBAdView *)adView;
/**
Sent after an FBAdView fails to load the ad.
@param adView An FBAdView object sending the message.
@param error An error object containing details of the error.
*/
- (void)adView:(FBAdView *)adView didFailWithError:(NSError *)error;
/**
Sent immediately before the impression of an FBAdView object will be logged.
@param adView An FBAdView object sending the message.
*/
- (void)adViewWillLogImpression:(FBAdView *)adView;
/**
Sent when the dynamic height of an FBAdView is set dynamically.
@param adView An FBAdView object sending the message.
@param dynamicHeight The height that needs to be set dynamically.
*/
- (void)adView:(FBAdView *)adView setDynamicHeight:(double)dynamicHeight;
/**
Sent when the position of an FBAdView is set dynamically.
@param adView An FBAdView object sending the message.
@param dynamicPosition CGPoint that indicates the new point of origin for the adView.
*/
- (void)adView:(FBAdView *)adView setDynamicPosition:(CGPoint)dynamicPosition;
/**
Sent when the origin of an FBAdView is to be changed during an animation lasting a specific
amount of time.
@param position CGPoint specifying the new origin of the FBAdView
@param duration CGFloat specifying the duration in seconds of the animation.
*/
- (void)adView:(FBAdView *)controller animateToPosition:(CGPoint)position withDuration:(CGFloat)duration;
/**
Sent after an FBAdView fails to load the fullscreen view of an ad.
@param adView An FBAdView object sending the message.
@param error An error object containing details of the error.
*/
- (void)adView:(FBAdView *)adView fullscreenDidFailWithError:(NSError *)error;
/**
Asks the delegate for a view controller to present modal content, such as the in-app
browser that can appear when an ad is clicked.
@return A view controller that is used to present modal content.
*/
@property (nonatomic, readonly, strong) UIViewController *viewControllerForPresentingModalView;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
/***
* This is a bridge file for Audience Network Unity SDK.
*
* Please refer to FBAdView.h and FBAdExtraHint.h for full documentation of the API.
*
* This file may be used to build your own Audience Network iOS SDK wrapper,
* but note that we don't support customisations of the Audience Network codebase.
*
***/
#import <FBAudienceNetwork/FBAdBridgeCommon.h>
#import <Foundation/Foundation.h>
FB_EXTERN_C_BEGIN
typedef NS_ENUM(int32_t, FBAdViewBridgeSize) {
FBAdViewBridgeSizeHeight50BannerKey,
FBAdViewBridgeSizeHeight90BannerKey,
FBAdViewBridgeSizeInterstitalKey,
FBAdViewBridgeSizeHeight250RectangleKey
};
FB_EXPORT int32_t FBAdViewBridgeSizeHeight50Banner(void);
FB_EXPORT int32_t FBAdViewBridgeSizeHeight90Banner(void);
FB_EXPORT int32_t FBAdViewBridgeSizeInterstital(void);
FB_EXPORT int32_t FBAdViewBridgeSizeHeight250Rectangle(void);
FB_EXPORT int32_t FBAdViewBridgeCreate(char const *placementID, FBAdViewBridgeSize size);
FB_EXPORT int32_t FBAdViewBridgeLoad(int32_t uniqueId);
FB_EXPORT int32_t FBAdViewBridgeLoadWithBidPayload(int32_t uniqueId, char *bidPayload);
FB_EXPORT bool FBAdViewBridgeIsValid(int32_t uniqueId);
FB_EXPORT void FBAdViewBridgeShow(int32_t uniqueId, double x, double y, double width, double height);
FB_EXPORT char const *FBAdViewBridgeGetPlacementId(int32_t uniqueId);
FB_EXPORT void FBAdViewBridgeDisableAutoRefresh(int32_t uniqueId);
FB_EXPORT void FBAdViewBridgeSetExtraHints(int32_t uniqueId, char const *extraHints);
FB_EXPORT void FBAdViewBridgeRelease(int32_t uniqueId);
FB_EXPORT void FBAdViewBridgeOnLoad(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBAdViewBridgeOnImpression(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBAdViewBridgeOnClick(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBAdViewBridgeOnError(int32_t uniqueId, FBAdBridgeErrorCallback callback);
FB_EXPORT void FBAdViewBridgeOnFinishedClick(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXTERN_C_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <FBAudienceNetwork/FBAdChoicesView.h>
#import <FBAudienceNetwork/FBAdDefines.h>
#import <FBAudienceNetwork/FBAdExperienceConfig.h>
#import <FBAudienceNetwork/FBAdExtraHint.h>
#import <FBAudienceNetwork/FBAdIconView.h>
#import <FBAudienceNetwork/FBAdOptionsView.h>
#import <FBAudienceNetwork/FBAdSDKNotificationManager.h>
#import <FBAudienceNetwork/FBAdSettings.h>
#import <FBAudienceNetwork/FBAdView.h>
#import <FBAudienceNetwork/FBAudienceNetworkAds.h>
#import <FBAudienceNetwork/FBDynamicBannerAd.h>
#import <FBAudienceNetwork/FBInterstitialAd.h>
#import <FBAudienceNetwork/FBMediaView.h>
#import <FBAudienceNetwork/FBMediaViewVideoRenderer.h>
#import <FBAudienceNetwork/FBNativeAd.h>
#import <FBAudienceNetwork/FBNativeAdCollectionViewAdProvider.h>
#import <FBAudienceNetwork/FBNativeAdCollectionViewCellProvider.h>
#import <FBAudienceNetwork/FBNativeAdScrollView.h>
#import <FBAudienceNetwork/FBNativeAdTableViewAdProvider.h>
#import <FBAudienceNetwork/FBNativeAdTableViewCellProvider.h>
#import <FBAudienceNetwork/FBNativeAdView.h>
#import <FBAudienceNetwork/FBNativeAdsManager.h>
#import <FBAudienceNetwork/FBNativeBannerAd.h>
#import <FBAudienceNetwork/FBNativeBannerAdView.h>
#import <FBAudienceNetwork/FBRewardedInterstitialAd.h>
#import <FBAudienceNetwork/FBRewardedVideoAd.h>
#import <FBAudienceNetwork/UIView+FBNativeAdViewTag.h>
// Unity Bridge
#import <FBAudienceNetwork/FBAdBridgeCommon.h>
#import <FBAudienceNetwork/FBAdBridgeContainer.h>
#import <FBAudienceNetwork/FBAdSettingsBridge.h>
#import <FBAudienceNetwork/FBAdUtilityBridge.h>
#import <FBAudienceNetwork/FBAdViewBridge.h>
#import <FBAudienceNetwork/FBInterstitialAdBridge.h>
#import <FBAudienceNetwork/FBRewardedVideoAdBridge.h>
// NOTE: Any changes should also be made to the module.modulemap
// to ensure comptability with Swift apps using Cocoapods
#define FB_AD_SDK_VERSION @"6.17.1"
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import "FBAdDefines.h"
NS_ASSUME_NONNULL_BEGIN
/**
FBAdInitSettings is an object to incapsulate all the settings you can pass to SDK on initialization call.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBAdInitSettings : NSObject
/**
Designated initializer for FBAdInitSettings
If an ad provided service is mediating Audience Network in their sdk, it is required to set the name of the mediation
service
@param placementIDs An array of placement identifiers.
@param mediationService String to identify mediation provider.
*/
- (instancetype)initWithPlacementIDs:(NSArray<NSString *> *)placementIDs mediationService:(NSString *)mediationService;
/**
An array of placement identifiers.
*/
@property (nonatomic, copy, readonly) NSArray<NSString *> *placementIDs;
/**
String to identify mediation provider.
*/
@property (nonatomic, copy, readonly) NSString *mediationService;
@end
/**
FBAdInitResults is an object to incapsulate all the results you'll get as a result of SDK initialization call.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBAdInitResults : NSObject
/**
Boolean which says whether initialization was successful
*/
@property (nonatomic, assign, readonly, getter=isSuccess) BOOL success;
/**
Message which provides more details about initialization result
*/
@property (nonatomic, copy, readonly) NSString *message;
@end
/**
FBAudienceNetworkAds is an entry point to AN SDK.
*/
typedef NS_ENUM(NSInteger, FBAdFormatTypeName) {
FBAdFormatTypeNameUnknown = 0,
FBAdFormatTypeNameBanner,
FBAdFormatTypeNameInterstitial,
FBAdFormatTypeNameNative,
FBAdFormatTypeNameNativeBanner,
FBAdFormatTypeNameRewardedVideo,
};
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBAudienceNetworkAds : NSObject
/**
Initialize Audience Network SDK at any given point of time. It will be called automatically with default settigs when
you first touch AN related code otherwise.
@param settings The settings to initialize with
@param completionHandler The block which will be called when initialization finished
*/
+ (void)initializeWithSettings:(nullable FBAdInitSettings *)settings
completionHandler:(nullable void (^)(FBAdInitResults *results))completionHandler;
+ (void)handleDeeplink:(NSURL *)deeplink;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
/***
* This is a bridge file for Audience Network Unity SDK.
*
* Please refer to FBInterstitialAd.h and FBAdExtraHint.h for full documentation of the API.
*
* This file may be used to build your own Audience Network iOS SDK wrapper,
* but note that we don't support customisations of the Audience Network codebase.
*
***/
#import <FBAudienceNetwork/FBAdBridgeCommon.h>
FB_EXTERN_C_BEGIN
FB_EXPORT int32_t FBInterstitialAdBridgeCreate(char const *placementID);
FB_EXPORT int32_t FBInterstitialAdBridgeLoad(int32_t uniqueId);
FB_EXPORT int32_t FBInterstitialAdBridgeLoadWithBidPayload(int32_t uniqueId, char *bidPayload);
FB_EXPORT bool FBInterstitialAdBridgeIsValid(int32_t uniqueId);
FB_EXPORT char const *FBInterstitialAdBridgeGetPlacementId(int32_t uniqueId);
FB_EXPORT bool FBInterstitialAdBridgeShow(int32_t uniqueId);
FB_EXPORT void FBInterstitialAdBridgeSetExtraHints(int32_t uniqueId, char const *extraHints);
FB_EXPORT void FBInterstitialAdBridgeRelease(int32_t uniqueId);
FB_EXPORT void FBInterstitialAdBridgeOnLoad(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBInterstitialAdBridgeOnImpression(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBInterstitialAdBridgeOnClick(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBInterstitialAdBridgeOnError(int32_t uniqueId, FBAdBridgeErrorCallback callback);
FB_EXPORT void FBInterstitialAdBridgeOnDidClose(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXPORT void FBInterstitialAdBridgeOnWillClose(int32_t uniqueId, FBAdBridgeCallback callback);
FB_EXTERN_C_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <FBAudienceNetwork/FBNativeAd.h>
#import "FBAdDefines.h"
NS_ASSUME_NONNULL_BEGIN
@class FBNativeAdViewAttributes;
/**
The FBNativeAdBaseView creates prebuilt native ad base template views and manages native ads.
*/
FB_CLASS_EXPORT
@interface FBNativeAdBaseView : UIView
/**
A view controller that is used to present modal content. If nil, the view searches for a view controller.
*/
@property (nonatomic, weak, nullable) UIViewController *rootViewController;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/**
Determines the possible tags for native ad views.
*/
typedef NS_ENUM(NSUInteger, FBNativeAdViewTag) {
FBNativeAdViewTagIcon = 5,
FBNativeAdViewTagTitle,
FBNativeAdViewTagCoverImage,
FBNativeAdViewTagSubtitle,
FBNativeAdViewTagBody,
FBNativeAdViewTagCallToAction,
FBNativeAdViewTagSocialContext,
FBNativeAdViewTagChoicesIcon,
FBNativeAdViewTagMedia,
};
/**
Use this category to set tags for views you are using for native ad.
This will enable better analytics.
*/
@interface UIView (FBNativeAdViewTag)
@property (nonatomic, assign) FBNativeAdViewTag nativeAdViewTag;
@end
NS_ASSUME_NONNULL_END
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment