Advertisement
weiguo

Untitled

Apr 20th, 2021
1,360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (void)updateIronSourceDelegates
  2. {
  3.     [IronSource setISDemandOnlyInterstitialDelegate: self.router];
  4.     [IronSource setISDemandOnlyRewardedVideoDelegate: self.router];
  5. }
  6.  
  7. - (void)initializeWithParameters:(id<MAAdapterInitializationParameters>)parameters completionHandler:(void (^)(MAAdapterInitializationStatus, NSString * _Nullable))completionHandler
  8. {
  9.     static dispatch_once_t onceToken;
  10.     dispatch_once(&onceToken, ^{
  11.        
  12.         NSString *appKey = [parameters.serverParameters al_stringForKey: @"app_key"];
  13.         [self log: @"Initializing IronSource SDK with app key: %@...", appKey];
  14.        
  15.         if ( [parameters isTesting] )
  16.         {
  17.             [IronSource setAdaptersDebug: YES];
  18.             [IronSource setLogDelegate: self.router];
  19.         }
  20.        
  21.         if ( [parameters.serverParameters al_numberForKey: @"set_mediation_identifier"].boolValue )
  22.         {
  23.             [IronSource setMediationType: self.mediationTag];
  24.         }
  25.        
  26.         [self setPrivacySettingsWithParameters: parameters];
  27.        
  28.         if ( ALSdk.versionCode >= 61100 )
  29.         {
  30.             NSNumber *isDoNotSell = [self privacySettingForSelector: @selector(isDoNotSell) fromParameters: parameters];
  31.             if ( isDoNotSell )
  32.             {
  33.                 // NOTE: `setMetaData` must be called _before_ initializing their SDK
  34.                 [IronSource setMetaDataWithKey: @"do_not_sell" value: isDoNotSell.boolValue ? @"YES" : @"NO"];
  35.             }
  36.         }
  37.        
  38.         NSNumber *isAgeRestrictedUser = [self privacySettingForSelector: @selector(isAgeRestrictedUser) fromParameters: parameters];
  39.         if ( isAgeRestrictedUser )
  40.         {
  41.             [IronSource setMetaDataWithKey: @"is_child_directed" value: isAgeRestrictedUser.boolValue ? @"YES" : @"NO"];
  42.         }
  43.        
  44.         [self updateIronSourceDelegates];
  45.        
  46.         [IronSource initISDemandOnly: appKey adUnits: [self adFormatsToInitializeFromParameters: parameters]];
  47.     });
  48.    
  49.     completionHandler(MAAdapterInitializationStatusDoesNotApply, nil);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement