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

[IOS-2992]Set CCPA status at adapter level #25

Open
wants to merge 8 commits into
base: 6.7.x_pre_release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions adapters/Vungle/Public/Headers/VungleRouterConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, GADMAdapterVungleCCPAStatus) {
GADMAdapterVungleCCPAAccepted = 1,
GADMAdapterVungleCCPADenied,
};

@interface VungleRouterConfiguration : NSObject
+ (void)setPublishIDFV:(BOOL)publish;
+ (void)setCCPAStatus:(GADMAdapterVungleCCPAStatus)ccpaStatus;
+ (GADMAdapterVungleCCPAStatus)getCCPAStatus;
+ (void)setMinSpaceForInit:(int)size;
+ (void)setMinSpaceForAdLoad:(int)size;
@end
Expand Down
8 changes: 0 additions & 8 deletions adapters/Vungle/VungleAdapter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
/* End PBXAggregateTarget section */

/* Begin PBXBuildFile section */
4075428E2418E7B500DF2AAD /* GADMAdapterVungleBannerRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 4075428C2418E7B500DF2AAD /* GADMAdapterVungleBannerRequest.h */; };
4075428F2418E7B500DF2AAD /* GADMAdapterVungleBannerRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4075428D2418E7B500DF2AAD /* GADMAdapterVungleBannerRequest.m */; };
407621A123F140B800C18557 /* VungleRouterConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 4076219F23F140B800C18557 /* VungleRouterConfiguration.m */; };
407621A223F140B800C18557 /* VungleRouterConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 407621A023F140B800C18557 /* VungleRouterConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
4552392A20B6381E0081388F /* VungleRouterConsent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4552392720B6381D0081388F /* VungleRouterConsent.m */; };
Expand Down Expand Up @@ -89,8 +87,6 @@

/* Begin PBXFileReference section */
00DD26AB22F10DD20039C1D4 /* Script_Validate.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = Script_Validate.sh; sourceTree = "<group>"; };
4075428C2418E7B500DF2AAD /* GADMAdapterVungleBannerRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GADMAdapterVungleBannerRequest.h; sourceTree = "<group>"; };
4075428D2418E7B500DF2AAD /* GADMAdapterVungleBannerRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GADMAdapterVungleBannerRequest.m; sourceTree = "<group>"; };
4076219F23F140B800C18557 /* VungleRouterConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VungleRouterConfiguration.m; sourceTree = "<group>"; };
407621A023F140B800C18557 /* VungleRouterConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VungleRouterConfiguration.h; sourceTree = "<group>"; };
4552392720B6381D0081388F /* VungleRouterConsent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VungleRouterConsent.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -137,8 +133,6 @@
7D15756E1EB7FB9200059469 /* VungleAdapter */ = {
isa = PBXGroup;
children = (
4075428C2418E7B500DF2AAD /* GADMAdapterVungleBannerRequest.h */,
4075428D2418E7B500DF2AAD /* GADMAdapterVungleBannerRequest.m */,
4076219F23F140B800C18557 /* VungleRouterConfiguration.m */,
4593F48B227CDC9300F57AE5 /* GADMAdapterVungleConstants.h */,
4557855A238DE7E700523142 /* GADMAdapterVungleDelegate.h */,
Expand Down Expand Up @@ -228,7 +222,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
4075428E2418E7B500DF2AAD /* GADMAdapterVungleBannerRequest.h in Headers */,
4593F48F227CE28A00F57AE5 /* GADMAdapterVungleUtils.h in Headers */,
407621A223F140B800C18557 /* VungleRouterConfiguration.h in Headers */,
A85428E01F11853A00C135E7 /* GADMAdapterVungleInterstitial.h in Headers */,
Expand Down Expand Up @@ -347,7 +340,6 @@
A85428E11F11853A00C135E7 /* GADMAdapterVungleInterstitial.m in Sources */,
A85428E31F11853A00C135E7 /* GADMAdapterVungleRewardBasedVideoAd.m in Sources */,
407621A123F140B800C18557 /* VungleRouterConfiguration.m in Sources */,
4075428F2418E7B500DF2AAD /* GADMAdapterVungleBannerRequest.m in Sources */,
4593F490227CE28A00F57AE5 /* GADMAdapterVungleUtils.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
27 changes: 0 additions & 27 deletions adapters/Vungle/VungleAdapter/GADMAdapterVungleBannerRequest.h

This file was deleted.

76 changes: 0 additions & 76 deletions adapters/Vungle/VungleAdapter/GADMAdapterVungleBannerRequest.m

This file was deleted.

2 changes: 1 addition & 1 deletion adapters/Vungle/VungleAdapter/GADMAdapterVungleConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

static NSString *const _Nonnull kGADMAdapterVungleVersion = @"6.5.3.0";
static NSString *const _Nonnull kGADMAdapterVungleVersion = @"6.7.0.0-early1";
static NSString *const _Nonnull kGADMAdapterVungleApplicationID = @"application_id";
static NSString *const _Nonnull kGADMAdapterVunglePlacementID = @"placementID";
static NSString *const _Nonnull kGADMAdapterVungleErrorDomain = @"com.google.mediation.vungle";
17 changes: 11 additions & 6 deletions adapters/Vungle/VungleAdapter/GADMAdapterVungleDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ typedef NS_ENUM(NSUInteger, BannerRouterDelegateState) {
BannerRouterDelegateStateClosed
};

@class GADMAdapterVungleBannerRequest;

/// Delegate for receiving state change messages from the Vungle SDK.
@protocol GADMAdapterVungleDelegate <NSObject>

Expand All @@ -48,15 +46,22 @@ typedef NS_ENUM(NSUInteger, BannerRouterDelegateState) {
- (void)adAvailable;
- (void)adNotAvailable:(nonnull NSError *)error;
- (void)willShowAd;
- (void)willCloseAd:(BOOL)completedView didDownload:(BOOL)didDownload;
- (void)didCloseAd:(BOOL)completedView didDownload:(BOOL)didDownload;
- (void)willCloseAd;
- (void)didCloseAd;
- (void)trackClick;

@optional
// Check is banner ad
- (BOOL)isBannerAd;

// Get banner request object
@property(nonatomic, nonnull) GADMAdapterVungleBannerRequest *bannerRequest;
// Differentiate two banners with same placement ID
@property(nonatomic, nullable) NSString *uniquePubRequestID;

// Reward user for watching a Rewarded Video Ad successfully
- (void)rewardUser;

// App will leave current application
- (void)willLeaveApplication;

// Vungle banner ad state.
@property(nonatomic, assign) BannerRouterDelegateState bannerState;
Expand Down
38 changes: 16 additions & 22 deletions adapters/Vungle/VungleAdapter/GADMAdapterVungleInterstitial.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#import "GADMAdapterVungleConstants.h"
#import "GADMAdapterVungleRouter.h"
#import "GADMAdapterVungleUtils.h"
#import "GADMAdapterVungleBannerRequest.h"

@interface GADMAdapterVungleInterstitial () <GADMAdapterVungleDelegate>
@end
Expand Down Expand Up @@ -96,26 +95,14 @@ - (void)getBannerWithSize:(GADAdSize)adSize {
VungleAdNetworkExtras *networkExtras = [strongConnector networkExtras];
self.desiredPlacement = [GADMAdapterVungleUtils findPlacement:[strongConnector credentials]
networkExtras:networkExtras];
self.bannerRequest = [[GADMAdapterVungleBannerRequest alloc] initWithPlacementID:self.desiredPlacement ?: @""
uniquePubRequestID:networkExtras.UUID];
if (!self.desiredPlacement) {
self.uniquePubRequestID = [networkExtras.UUID copy];
if (!self.desiredPlacement.length) {
[strongConnector adapter:self
didFailAd:GADMAdapterVungleErrorWithCodeAndDescription(
kGADErrorMediationDataError, @"Placement ID not specified.")];
return;
}

// Check if a banner or MREC ad has been initiated with the samne PlacementID
// or not. (Vungle supports 4 types of banner currently.)
if (![[GADMAdapterVungleRouter sharedInstance]
canRequestBannerAdForPlacementID:self.bannerRequest]) {
NSError *error = GADMAdapterVungleErrorWithCodeAndDescription(
kGADErrorMediationAdapterError, @"A banner ad type has already been "
@"instantiated. Multiple banner ads are not "
@"supported with Vungle iOS SDK.");
[strongConnector adapter:self didFailAd:error];
return;
}
VungleSDK *sdk = [VungleSDK sharedSDK];

if ([sdk isInitialized]) {
Expand All @@ -140,7 +127,7 @@ - (void)getInterstitial {
id<GADMAdNetworkConnector> strongConnector = _connector;
self.desiredPlacement = [GADMAdapterVungleUtils findPlacement:[strongConnector credentials]
networkExtras:[strongConnector networkExtras]];
if (!self.desiredPlacement) {
if (!self.desiredPlacement.length) {
[strongConnector adapter:self
didFailAd:GADMAdapterVungleErrorWithCodeAndDescription(
kGADErrorMediationDataError, @"Placement ID not specified.")];
Expand Down Expand Up @@ -244,7 +231,7 @@ - (BOOL)isBannerAd {
@synthesize desiredPlacement;
@synthesize adapterAdType;
@synthesize bannerState;
@synthesize bannerRequest;
@synthesize uniquePubRequestID;
@synthesize isRefreshedForBannerAd;
@synthesize isRequestingBannerAdForRefresh;

Expand Down Expand Up @@ -283,11 +270,8 @@ - (void)willShowAd {
}
}

- (void)willCloseAd:(BOOL)completedView didDownload:(BOOL)didDownload {
- (void)willCloseAd {
id<GADMAdNetworkConnector> strongConnector = _connector;
if (didDownload) {
[strongConnector adapterDidGetAdClick:self];
}
if ([self isBannerAd]) {
self.bannerState = BannerRouterDelegateStateClosing;
}
Expand All @@ -298,7 +282,7 @@ - (void)willCloseAd:(BOOL)completedView didDownload:(BOOL)didDownload {
}
}

- (void)didCloseAd:(BOOL)completedView didDownload:(BOOL)didDownload {
- (void)didCloseAd {
if ([self isBannerAd]) {
self.bannerState = BannerRouterDelegateStateClosed;
}
Expand All @@ -308,4 +292,14 @@ - (void)didCloseAd:(BOOL)completedView didDownload:(BOOL)didDownload {
}
}

- (void)trackClick {
id<GADMAdNetworkConnector> strongConnector = _connector;
[strongConnector adapterDidGetAdClick:self];
}

- (void)willLeaveApplication {
id<GADMAdNetworkConnector> strongConnector = _connector;
[strongConnector adapterWillLeaveApplication:self];
}

@end
30 changes: 17 additions & 13 deletions adapters/Vungle/VungleAdapter/GADMAdapterVungleRewardedAd.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ - (void)requestRewardedAd {
self.desiredPlacement =
[GADMAdapterVungleUtils findPlacement:_adConfiguration.credentials.settings
networkExtras:_adConfiguration.extras];
if (!self.desiredPlacement) {
if (!self.desiredPlacement.length) {
NSError *error = GADMAdapterVungleErrorWithCodeAndDescription(kGADErrorMediationDataError,
@"Placement ID not specified.");
_adLoadCompletionHandler(nil, error);
Expand Down Expand Up @@ -153,25 +153,15 @@ - (void)adAvailable {
}
}

- (void)didCloseAd:(BOOL)completedView didDownload:(BOOL)didDownload {
- (void)didCloseAd {
id<GADMediationRewardedAdEventDelegate> strongDelegate = _delegate;
if (completedView) {
[strongDelegate didEndVideo];
GADAdReward *reward =
[[GADAdReward alloc] initWithRewardType:@"vungle"
rewardAmount:[NSDecimalNumber decimalNumberWithString:@"1"]];
[strongDelegate didRewardUserWithReward:reward];
}
if (didDownload) {
[strongDelegate reportClick];
}
[strongDelegate didDismissFullScreenView];

GADMAdapterVungleRewardedAd __weak *weakSelf = self;
[[GADMAdapterVungleRouter sharedInstance] removeDelegate:weakSelf];
}

- (void)willCloseAd:(BOOL)completedView didDownload:(BOOL)didDownload {
- (void)willCloseAd {
_isRewardedAdPresenting = NO;
[_delegate willDismissFullScreenView];
}
Expand All @@ -188,4 +178,18 @@ - (void)adNotAvailable:(nonnull NSError *)error {
[[GADMAdapterVungleRouter sharedInstance] removeDelegate:self];
}

- (void)trackClick {
id<GADMediationRewardedAdEventDelegate> strongDelegate = _delegate;
[strongDelegate reportClick];
}

- (void)rewardUser {
id<GADMediationRewardedAdEventDelegate> strongDelegate = _delegate;
[strongDelegate didEndVideo];
GADAdReward *reward =
[[GADAdReward alloc] initWithRewardType:@"vungle"
rewardAmount:[NSDecimalNumber decimalNumberWithString:@"1"]];
[strongDelegate didRewardUserWithReward:reward];
}

@end
3 changes: 0 additions & 3 deletions adapters/Vungle/VungleAdapter/GADMAdapterVungleRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

extern const CGSize kVNGBannerShortSize;

@class GADMAdapterVungleBannerRequest;

@interface GADMAdapterVungleRouter : NSObject <VungleSDKDelegate>

+ (nonnull GADMAdapterVungleRouter *)sharedInstance;
Expand All @@ -39,6 +37,5 @@ extern const CGSize kVNGBannerShortSize;
extras:(nullable VungleAdNetworkExtras *)extras
forPlacementID:(nonnull NSString *)placementID;
- (void)completeBannerAdViewForPlacementID:(nonnull id<GADMAdapterVungleDelegate>)delegate;
- (BOOL)canRequestBannerAdForPlacementID:(nonnull GADMAdapterVungleBannerRequest *)bannerRequest;

@end
Loading