diff --git a/BraveRewards/BraveRewards.framework/BraveRewards b/BraveRewards/BraveRewards.framework/BraveRewards index dde3523e96f..f3c87050f91 100755 Binary files a/BraveRewards/BraveRewards.framework/BraveRewards and b/BraveRewards/BraveRewards.framework/BraveRewards differ diff --git a/BraveRewards/BraveRewards.framework/Headers/BATBraveAds.h b/BraveRewards/BraveRewards.framework/Headers/BATBraveAds.h index 9b8fa1bd167..cae8f772acd 100644 --- a/BraveRewards/BraveRewards.framework/Headers/BATBraveAds.h +++ b/BraveRewards/BraveRewards.framework/Headers/BATBraveAds.h @@ -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; diff --git a/BraveRewards/BraveRewards.framework/Headers/BATBraveLedger.h b/BraveRewards/BraveRewards.framework/Headers/BATBraveLedger.h index 133393a8420..b2c81daf940 100644 --- a/BraveRewards/BraveRewards.framework/Headers/BATBraveLedger.h +++ b/BraveRewards/BraveRewards.framework/Headers/BATBraveLedger.h @@ -45,8 +45,8 @@ 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 -@property (nonatomic, class, getter=isProduction) BOOL production; +/// 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; /// Number of minutes between reconciles override. Defaults to 0 (no override) diff --git a/BraveRewards/BraveRewards.framework/Headers/BATBraveRewards.h b/BraveRewards/BraveRewards.framework/Headers/BATBraveRewards.h index 3021465459f..0fcb90de251 100644 --- a/BraveRewards/BraveRewards.framework/Headers/BATBraveRewards.h +++ b/BraveRewards/BraveRewards.framework/Headers/BATBraveRewards.h @@ -15,8 +15,9 @@ NS_SWIFT_NAME(BraveRewardsConfiguration) /// Whether or not rewards is being tested @property (nonatomic, getter=isTesting) BOOL testing; -/// Whether or not rewards is in production -@property (nonatomic, getter=isProduction) BOOL production; +//@property (nonatomic, getter=isDebug) BOOL debug; +/// The rewards environment +@property (nonatomic) BATEnvironment environment; /// Where ledger and ads should save their state @property (nonatomic, copy) NSString *stateStoragePath; /// The number of seconds between overrides. Defaults to 0 (no override) which means reconciles @@ -25,16 +26,20 @@ NS_SWIFT_NAME(BraveRewardsConfiguration) /// Whether or not to enable short retries between contribution attempts @property (nonatomic) BOOL useShortRetries; -/// The default configuration. Channel is debug, no changes to ledger configuration +/// The default configuration. Environment is dev, no changes to ledger configuration /// /// State is stored in Application Support @property (nonatomic, class, readonly) BATBraveRewardsConfiguration *defaultConfiguration NS_SWIFT_NAME(default); -/// The production configuration. Channel is production, no changes to ledger configuration +/// The staging configuration. Environment is staging, no changes to ledger configuration +/// +/// State is stored in Application Support +@property (nonatomic, class, readonly) BATBraveRewardsConfiguration *stagingConfiguration NS_SWIFT_NAME(staging); +/// The production configuration. Environment is production, no changes to ledger configuration /// /// State is stored in Application Support @property (nonatomic, class, readonly) BATBraveRewardsConfiguration *productionConfiguration NS_SWIFT_NAME(production); -/// The testing configuration. Channel is debug & testing. Short retries are enabled, number of -/// seconds between reconciles is set to 30 seconds instead of 30 days. +/// The testing configuration. Environment is development & is_testing is set to true. Short retries are enabled, +/// number of seconds between reconciles is set to 30 seconds instead of 30 days. /// /// State is saved to a directory created in /tmp @property (nonatomic, class, readonly) BATBraveRewardsConfiguration *testingConfiguration NS_SWIFT_NAME(testing); diff --git a/BraveRewards/BraveRewards.framework/Headers/ledger.mojom.objc.h b/BraveRewards/BraveRewards.framework/Headers/ledger.mojom.objc.h index 85ef2001baa..c247c00bd30 100644 --- a/BraveRewards/BraveRewards.framework/Headers/ledger.mojom.objc.h +++ b/BraveRewards/BraveRewards.framework/Headers/ledger.mojom.objc.h @@ -134,8 +134,15 @@ typedef NS_ENUM(NSInteger, BATWalletStatus) { } NS_SWIFT_NAME(WalletStatus); +typedef NS_ENUM(NSInteger, BATEnvironment) { + BATEnvironmentStaging = 0, + BATEnvironmentProduction = 1, + BATEnvironmentDevelopment = 2, +} NS_SWIFT_NAME(Environment); -@class BATContributionInfo, BATPublisherInfo, BATPublisherBanner, BATPendingContribution, BATPendingContributionInfo, BATVisitData, BATGrant, BATWalletProperties, BATBalance, BATAutoContributeProps, BATMediaEventInfo, BATExternalWallet, BATBalanceReportInfo, BATActivityInfoFilterOrderPair, BATActivityInfoFilter, BATReconcileInfo, BATRewardsInternalsInfo, BATServerPublisherInfo, BATTransferFee; + + +@class BATContributionInfo, BATPublisherInfo, BATPublisherBanner, BATPendingContribution, BATPendingContributionInfo, BATVisitData, BATGrant, BATWalletProperties, BATBalance, BATAutoContributeProps, BATMediaEventInfo, BATExternalWallet, BATBalanceReportInfo, BATActivityInfoFilterOrderPair, BATActivityInfoFilter, BATReconcileInfo, BATRewardsInternalsInfo, BATServerPublisherInfo, BATTransferFee, BATContributionQueue, BATContributionQueuePublisher; NS_ASSUME_NONNULL_BEGIN @@ -336,4 +343,19 @@ NS_SWIFT_NAME(TransferFee) @property (nonatomic) uint32_t executionId; @end +NS_SWIFT_NAME(ContributionQueue) +@interface BATContributionQueue : NSObject +@property (nonatomic) uint64_t id; +@property (nonatomic) BATRewardsType type; +@property (nonatomic) double amount; +@property (nonatomic) bool partial; +@property (nonatomic, copy) NSArray * publishers; +@end + +NS_SWIFT_NAME(ContributionQueuePublisher) +@interface BATContributionQueuePublisher : NSObject +@property (nonatomic, copy) NSString * publisherKey; +@property (nonatomic) double amountPercent; +@end + NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/BraveRewards/BraveRewards.framework/Model.momd/Model.mom b/BraveRewards/BraveRewards.framework/Model.momd/Model.mom index 88376907c1c..35030b6f7ed 100644 Binary files a/BraveRewards/BraveRewards.framework/Model.momd/Model.mom and b/BraveRewards/BraveRewards.framework/Model.momd/Model.mom differ diff --git a/BraveRewards/BraveRewards.framework/Model.momd/VersionInfo.plist b/BraveRewards/BraveRewards.framework/Model.momd/VersionInfo.plist index e72970cf536..803d49bb6b8 100644 Binary files a/BraveRewards/BraveRewards.framework/Model.momd/VersionInfo.plist and b/BraveRewards/BraveRewards.framework/Model.momd/VersionInfo.plist differ diff --git a/BraveRewardsUI/QA Settings/QASettingsViewController.swift b/BraveRewardsUI/QA Settings/QASettingsViewController.swift index 3f6d1b55e4b..92d15d5d152 100644 --- a/BraveRewardsUI/QA Settings/QASettingsViewController.swift +++ b/BraveRewardsUI/QA Settings/QASettingsViewController.swift @@ -25,7 +25,7 @@ public class QASettingsViewController: TableViewController { fatalError() } - private let segmentedControl = UISegmentedControl(items: EnvironmentOverride.allCases.map { $0.name }) + private let segmentedControl = UISegmentedControl(items: EnvironmentOverride.sortedCases.map { $0.name }) @objc private func environmentChanged() { let value = segmentedControl.selectedSegmentIndex @@ -168,7 +168,14 @@ public class QASettingsViewController: TableViewController { } @objc private func tappedRestoreWallet() { - let environment = BraveLedger.isProduction ? "production" : "staging" + let environment: String = { + switch BraveLedger.environment { + case .production: return "production" + case .staging: return "staging" + case .development: return "development" + default: return "(unknown)" + } + }() let alert = UIAlertController(title: "Restore Wallet", message: "Enter the recovery key for the wallet (must be a \(environment) wallet). Your existing wallet will be overwritten.", preferredStyle: .alert) alert.addTextField { textField in textField.returnKeyType = .done diff --git a/BraveRewardsUI/README.md b/BraveRewardsUI/README.md index 74feda33d17..53757e84b0a 100644 --- a/BraveRewardsUI/README.md +++ b/BraveRewardsUI/README.md @@ -5,6 +5,6 @@ A UI framework for consuming Brave Rewards. The core logic around BraveRewards r The latest BraveRewards.framework was built on: ``` -brave-browser/51350aa972b4df31081360db71bc7cb4f36275b7 -brave-core/dc5776e4409cf53d2a19357d8a546f59a961ceaa +brave-browser/61bfb8840c2cfa2b0dd9d9443198470d8c2849c0 +brave-core/aa7d1dc81fe055b05f75b606817bed2a209a689f ``` diff --git a/BraveShared/Preferences.swift b/BraveShared/Preferences.swift index 81f57f99220..f3ab6c6989d 100644 --- a/BraveShared/Preferences.swift +++ b/BraveShared/Preferences.swift @@ -92,18 +92,24 @@ extension Preferences { public static let myFirstAdShown = Option(key: "rewards.ads.my-first-ad-shown", default: false) public static let hideRewardsIcon = Option(key: "rewards.hide-rewards-icon", default: false) - public enum EnvironmentOverride: Int, CaseIterable { + public enum EnvironmentOverride: Int { case none case staging case prod + case dev public var name: String { switch self { case .none: return "None" case .staging: return "Staging" case .prod: return "Prod" + case .dev: return "Dev" } } + + public static var sortedCases: [EnvironmentOverride] { + return [.none, .dev, .staging, .prod] + } } /// In debug/beta, this is the overriden environment. public static let environmentOverride = Option(key: "rewards.environment-override", diff --git a/Client/Frontend/Browser/BrowserViewController.swift b/Client/Frontend/Browser/BrowserViewController.swift index 0aec1c8072e..78ded05a60b 100644 --- a/Client/Frontend/Browser/BrowserViewController.swift +++ b/Client/Frontend/Browser/BrowserViewController.swift @@ -158,9 +158,18 @@ class BrowserViewController: UIViewController { configuration = .production } else { if let override = Preferences.Rewards.EnvironmentOverride(rawValue: Preferences.Rewards.environmentOverride.value), override != .none { - configuration = override == .prod ? .production : .default + switch override { + case .dev: + configuration = .default + case .staging: + configuration = .staging + case .prod: + configuration = .production + default: + configuration = .staging + } } else { - configuration = AppConstants.BuildChannel == .developer ? .default : .production + configuration = AppConstants.BuildChannel == .developer ? .staging : .production } } rewards = BraveRewards(configuration: configuration)