Skip to content

Commit

Permalink
Fix iOS build for ads dev environment
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehickinson committed Oct 21, 2019
1 parent c3641c8 commit 38038f7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
5 changes: 3 additions & 2 deletions vendor/brave-ios/Ads/BATBraveAds.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ NS_SWIFT_NAME(BraveAds)

/// Whether or not to use staging servers. Defaults to false
@property (nonatomic, class, getter=isDebug) BOOL debug;
/// Whether or not to use production servers. Defaults to true
@property (nonatomic, class, getter=isProduction) BOOL production;
/// The environment that ads is communicating with. See ledger's BATEnvironment
/// for appropriate values.
@property (nonatomic, class) int environment;
/// Marks if this is being ran in a test environment. Defaults to false
@property (nonatomic, class, getter=isTesting) BOOL testing;

Expand Down
11 changes: 10 additions & 1 deletion vendor/brave-ios/Ads/BATBraveAds.mm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,16 @@ + (BOOL)isCurrentRegionSupported

BATClassAdsBridge(BOOL, isDebug, setDebug, _is_debug)
BATClassAdsBridge(BOOL, isTesting, setTesting, _is_testing)
BATClassAdsBridge(BOOL, isProduction, setProduction, _is_production)

+ (int)environment
{
return static_cast<int>(ads::_environment);
}

+ (void)setEnvironment:(int)environment
{
ads::_environment = static_cast<ads::Environment>(environment);
}

#pragma mark - Configuration

Expand Down
2 changes: 1 addition & 1 deletion vendor/brave-ios/BATBraveRewards.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ - (instancetype)initWithConfiguration:(BATBraveRewardsConfiguration *)configurat
self.adsClass = adsClass ?: BATBraveAds.class;

BATBraveAds.debug = configuration.environment != BATEnvironmentProduction;
BATBraveAds.production = configuration.environment == BATEnvironmentProduction;
BATBraveAds.environment = configuration.environment;
BATBraveAds.testing = configuration.testing;

BATBraveLedger.debug = configuration.environment != BATEnvironmentProduction;
Expand Down
2 changes: 1 addition & 1 deletion vendor/brave-ios/Ledger/BATBraveLedger.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ NS_SWIFT_NAME(BraveLedger)

/// Whether or not to use staging servers. Defaults to false
@property (nonatomic, class, getter=isDebug) BOOL debug;
/// Whether or not to use production servers. Defaults to true
/// The environment that ledger is communicating with
@property (nonatomic, class) BATEnvironment environment;
/// Marks if this is being ran in a test environment. Defaults to false
@property (nonatomic, class, getter=isTesting) BOOL testing;
Expand Down

0 comments on commit 38038f7

Please sign in to comment.