Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

(FEAT) Sets GADRewardBasedVideoAd.userIdentifier= AdExtras.userId val… #394

Open
wants to merge 1 commit into
base: master
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
1 change: 1 addition & 0 deletions src/ios/CDVAdMob.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

@property (nonatomic, retain) NSString* gender;
@property (nonatomic, retain) NSString* forChild;
@property(nonatomic, copy, nullable) NSString *userId;

- (void) setOptions:(CDVInvokedUrlCommand *)command;

Expand Down
10 changes: 9 additions & 1 deletion src/ios/CDVAdMob.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ @implementation CDVAdMob

@synthesize publisherId, interstitialAdId, rewardVideoId, adSize;
@synthesize bannerAtTop, bannerOverlap, offsetTopBar;
@synthesize isTesting, adExtras;
@synthesize isTesting, adExtras,userId;

@synthesize bannerIsVisible, bannerIsInitialized;
@synthesize bannerShow, autoShow, autoShowBanner, autoShowInterstitial, autoShowRewardVideo;
Expand Down Expand Up @@ -98,6 +98,7 @@ - (void)pluginInitialize {

gender = nil;
forChild = nil;
userId = @"";

isRewardedVideoLoading = false;
rewardedVideoLock = nil;
Expand Down Expand Up @@ -404,6 +405,8 @@ - (void) __cycleRewardVideo {
self.rewardVideoView = [GADRewardBasedVideoAd sharedInstance];
self.rewardVideoView.delegate = self;

NSString* myNewString = [NSString stringWithFormat:@"%@", self.userId];
[GADRewardBasedVideoAd sharedInstance].userIdentifier = myNewString;
[self.rewardVideoView loadRequest:[GADRequest request] withAdUnitID:self.rewardVideoId];
}
}
Expand Down Expand Up @@ -506,6 +509,11 @@ - (void) __setOptions:(NSDictionary*) options {
NSDictionary* dict = [options objectForKey:OPT_AD_EXTRAS];
if (dict) {
adExtras = dict;
NSString* str2 = nil;
str2 = [adExtras objectForKey:@"userId"];
if (str2) {
self.userId = str2;
}
}

str = [options objectForKey:OPT_AUTO_SHOW];
Expand Down