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

Fix #2378: iOS DB Migration & Rebase to brave-core master #2389

Merged
merged 1 commit into from
Mar 10, 2020
Merged
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
Binary file modified BraveRewards/BraveRewards.framework/BraveRewards
Binary file not shown.
39 changes: 39 additions & 0 deletions BraveRewards/BraveRewards.framework/Headers/BATAdNotification.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, BATAdsConfirmationType) {
BATAdsConfirmationTypeNone, // = ads::ConfirmationType::kNone
BATAdsConfirmationTypeClick, // = ads::ConfirmationType::kClicked
BATAdsConfirmationTypeDismiss, // = ads::ConfirmationType::kDismissed
BATAdsConfirmationTypeView, // = ads::ConfirmationType::kViewed
BATAdsConfirmationTypeLanded, // = ads::ConfirmationType::kLanded
BATAdsConfirmationTypeFlagged, // = ads::ConfirmationType::kFlagged
BATAdsConfirmationTypeUpvoted, // = ads::ConfirmationType::kUpvoted
BATAdsConfirmationTypeDownvoted, // = ads::ConfirmationType::kDownvoted
BATAdsConfirmationTypeConversion // = ads::ConfirmationType::kConversion
} NS_SWIFT_NAME(ConfirmationType);

NS_SWIFT_NAME(AdsNotification)
@interface BATAdNotification : NSObject
@property (nonatomic, readonly, copy) NSString *uuid;
@property (nonatomic, readonly, copy) NSString *parentUuid;
@property (nonatomic, readonly, copy) NSString *creativeInstanceID;
@property (nonatomic, readonly, copy) NSString *creativeSetID;
@property (nonatomic, readonly, copy) NSString *category;
@property (nonatomic, readonly, copy) NSString *title;
@property (nonatomic, readonly, copy) NSString *body;
@property (nonatomic, readonly, copy) NSURL *targetURL;
@end

@interface BATAdNotification (MyFirstAd)
+ (instancetype)customAdWithTitle:(NSString *)title
body:(NSString *)body
url:(NSURL *)url NS_SWIFT_NAME(customAd(title:body:url:));
@end

NS_ASSUME_NONNULL_END

This file was deleted.

29 changes: 16 additions & 13 deletions BraveRewards/BraveRewards.framework/Headers/BATBraveAds.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
#import <Foundation/Foundation.h>
#import <UserNotifications/UserNotifications.h>

typedef NS_ENUM(NSInteger, BATAdsNotificationEventType) {
BATAdsNotificationEventTypeViewed, // = ads::NotificationEventType::VIEWED
BATAdsNotificationEventTypeClicked, // = ads::NotificationEventType::CLICKED
BATAdsNotificationEventTypeDismissed, // = ads::NotificationEventType::DISMISSED
BATAdsNotificationEventTypeTimedOut // = ads::NotificationEventType::TIMEOUT
} NS_SWIFT_NAME(NotificationEventType);
typedef NS_ENUM(NSInteger, BATAdNotificationEventType) {
BATAdNotificationEventTypeViewed, // = ads::AdNotificationEventType::kViewed
BATAdNotificationEventTypeClicked, // = ads::AdNotificationEventType::kClicked
BATAdNotificationEventTypeDismissed, // = ads::AdNotificationEventType::kDismissed
BATAdNotificationEventTypeTimedOut // = ads::AdNotificationEventType::kTimedOut
} NS_SWIFT_NAME(AdNotificationEventType);

NS_ASSUME_NONNULL_BEGIN

@class BATAdsNotification, BATBraveAds, BATBraveLedger;
@class BATAdNotification, BATBraveAds, BATBraveLedger;

NS_SWIFT_NAME(BraveAdsNotificationHandler)
@protocol BATBraveAdsNotificationHandler
Expand All @@ -23,7 +23,7 @@ NS_SWIFT_NAME(BraveAdsNotificationHandler)
/// to the user.
- (BOOL)shouldShowNotifications;
/// Show the given notification to the user (or add it to the queue)
- (void)showNotification:(BATAdsNotification *)notification;
- (void)showNotification:(BATAdNotification *)notification;
/// Remove a pending notification from the queue or remove an already shown
/// notification from view
- (void)clearNotificationWithIdentifier:(NSString *)identifier;
Expand Down Expand Up @@ -76,6 +76,9 @@ NS_SWIFT_NAME(BraveAds)
/// Whether or not Brave Ads is enabled
@property (nonatomic, assign, getter=isEnabled) BOOL enabled;

/// Whether or not the user has opted out of conversion tracking
@property (nonatomic, assign, getter=shouldAllowAdConversionTracking) BOOL allowAdConversionTracking;

/// The max number of ads the user can see in an hour
@property (nonatomic, assign) NSInteger numberOfAllowableAdsPerHour NS_SWIFT_NAME(adsPerHour);

Expand All @@ -99,7 +102,7 @@ NS_SWIFT_NAME(BraveAds)

#pragma mark - Notificiations

- (nullable BATAdsNotification *)adsNotificationForIdentifier:(NSString *)identifier;
- (nullable BATAdNotification *)adsNotificationForIdentifier:(NSString *)identifier;

#pragma mark - History

Expand Down Expand Up @@ -128,15 +131,15 @@ NS_SWIFT_NAME(BraveAds)
- (void)reportTabClosedWithTabId:(NSInteger)tabId NS_SWIFT_NAME(reportTabClosed(tabId:));

/// Report that a notification event type was triggered for a given id
- (void)reportNotificationEvent:(NSString *)notificationId
eventType:(BATAdsNotificationEventType)eventType;
- (void)reportAdNotificationEvent:(NSString *)notificationUuid
eventType:(BATAdNotificationEventType)eventType;

/// Toggle that the user liked the given ad and more like it should be shown
- (void)toggleThumbsUpForAd:(NSString *)identifier
- (void)toggleThumbsUpForAd:(NSString *)creativeInstanceId
creativeSetID:(NSString *)creativeSetID;

/// Toggle that the user disliked the given ad and it shouldn't be shown again
- (void)toggleThumbsDownForAd:(NSString *)identifier
- (void)toggleThumbsDownForAd:(NSString *)creativeInstanceId
creativeSetID:(NSString *)creativeSetID;

#pragma mark -
Expand Down
39 changes: 26 additions & 13 deletions BraveRewards/BraveRewards.framework/Headers/BATBraveLedger.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ NS_SWIFT_NAME(BraveLedger)

- (instancetype)init NS_UNAVAILABLE;

#pragma mark - Initialization

/// Whether or not the ledger service has been initialized already
@property (nonatomic, readonly, getter=isInitialized) BOOL initialized;

/// Whether or not the ledger service is currently initializing
@property (nonatomic, readonly, getter=isInitializing) BOOL initializing;

/// The result when initializing the ledger service. Should be
/// `BATResultLedgerOk` if `initialized` is `true`
///
/// If this is not `BATResultLedgerOk`, rewards is not usable for the user
@property (nonatomic, readonly) BATResult initializationResult;

/// Whether or not data migration failed when initializing and the user should
/// be notified.
@property (nonatomic, readonly) BOOL dataMigrationFailed;

#pragma mark - Observers

/// Add an interface to the list of observers
Expand Down Expand Up @@ -96,7 +114,7 @@ NS_SWIFT_NAME(BraveLedger)
- (void)hasSufficientBalanceToReconcile:(void (^)(BOOL sufficient))completion;

/// Returns reserved amount of pending contributions to publishers.
@property (nonatomic, readonly) double reservedAmount;
- (void)pendingContributionsTotal:(void (^)(double amount))completion NS_SWIFT_NAME(pendingContributionsTotal(completion:));

#pragma mark - User Wallets

Expand Down Expand Up @@ -126,7 +144,7 @@ NS_SWIFT_NAME(BraveLedger)
- (void)listActivityInfoFromStart:(unsigned int)start
limit:(unsigned int)limit
filter:(BATActivityInfoFilter *)filter
completion:(void (NS_NOESCAPE ^)(NSArray<BATPublisherInfo *> *))completion;
completion:(void (^)(NSArray<BATPublisherInfo *> *))completion;

/// Start a fetch to get a publishers activity information given a URL
///
Expand All @@ -136,9 +154,6 @@ NS_SWIFT_NAME(BraveLedger)
publisherBlob:(nullable NSString *)publisherBlob
tabId:(uint64_t)tabId;

/// Returns activity info for current reconcile stamp.
- (nullable BATPublisherInfo *)currentActivityInfoWithPublisherId:(NSString *)publisherId;

/// Update a publishers exclusion state
- (void)updatePublisherExclusionState:(NSString *)publisherId
state:(BATPublisherExclude)state
Expand All @@ -147,16 +162,14 @@ NS_SWIFT_NAME(BraveLedger)
/// Restore all sites which had been previously excluded
- (void)restoreAllExcludedPublishers;

@property (nonatomic, readonly) NSUInteger numberOfExcludedPublishers;

/// Get the publisher banner given some publisher key
///
/// This key is _not_ always the URL's host. Use `publisherActivityFromURL`
/// instead when obtaining a publisher given a URL
///
/// @note `completion` callback is called synchronously
- (void)publisherBannerForId:(NSString *)publisherId
completion:(void (NS_NOESCAPE ^)(BATPublisherBanner * _Nullable banner))completion;
completion:(void (^)(BATPublisherBanner * _Nullable banner))completion;

/// Refresh a publishers verification status
- (void)refreshPublisherWithId:(NSString *)publisherId
Expand All @@ -167,7 +180,7 @@ NS_SWIFT_NAME(BraveLedger)
/// Get a list of publishers who the user has recurring tips on
///
/// @note `completion` callback is called synchronously
- (void)listRecurringTips:(void (NS_NOESCAPE ^)(NSArray<BATPublisherInfo *> *))completion;
- (void)listRecurringTips:(void (^)(NSArray<BATPublisherInfo *> *))completion;

- (void)addRecurringTipToPublisherWithId:(NSString *)publisherId
amount:(double)amount
Expand All @@ -178,7 +191,7 @@ NS_SWIFT_NAME(BraveLedger)
/// Get a list of publishers who the user has made direct tips too
///
/// @note `completion` callback is called synchronously
- (void)listOneTimeTips:(void (NS_NOESCAPE ^)(NSArray<BATPublisherInfo *> *))completion;
- (void)listOneTimeTips:(void (^)(NSArray<BATPublisherInfo *> *))completion;

- (void)tipPublisherDirectly:(BATPublisherInfo *)publisher
amount:(double)amount
Expand Down Expand Up @@ -211,7 +224,7 @@ NS_SWIFT_NAME(BraveLedger)
- (void)removePendingContribution:(BATPendingContributionInfo *)info
completion:(void (^)(BATResult result))completion;

- (void)deleteAllPendingContributions:(void (^)(BATResult result))completion;
- (void)removeAllPendingContributions:(void (^)(BATResult result))completion;

#pragma mark - History

Expand Down Expand Up @@ -275,10 +288,10 @@ NS_SWIFT_NAME(BraveLedger)
#pragma mark - Ads & Confirmations

/// Confirm an ad and update confirmations (called from the ads layer)
- (void)confirmAd:(NSString *)info;
- (void)confirmAd:(NSString *)json confirmationType:(NSString *)confirmationType;

/// Confirm an action on an ad and update confirmations was sustained (called from ads layer)
- (void)confirmAction:(NSString *)uuid creativeSetID:(NSString *)creativeSetID type:(NSString *)type;
- (void)confirmAction:(NSString *)creativeInstanceId creativeSetID:(NSString *)creativeSetID confirmationType:(NSString *)confirmationType;

/// Set catalog issuers ad and update confirmations (called from the ads layer)
- (void)setCatalogIssuers:(NSString *)issuers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ NS_SWIFT_NAME(LedgerObserver)
/// The publisher list was normalized and saved
@property (nonatomic, copy, nullable) void (^publisherListNormalized)(NSArray<BATPublisherInfo *> *normalizedList);

@property (nonatomic, copy, nullable) void (^pendingContributionAdded)(NSString *publisherKey);
@property (nonatomic, copy, nullable) void (^pendingContributionAdded)();

@property (nonatomic, copy, nullable) void (^pendingContributionsRemoved)(NSArray<NSString *> *publisherKeys);

Expand All @@ -88,6 +88,9 @@ NS_SWIFT_NAME(LedgerObserver)

@property (nonatomic, copy, nullable) void (^externalWalletDisconnected)(BATWalletType type);

/// The reconcile stamp reset
@property (nonatomic, copy, nullable) void (^reconcileStampReset)();

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ FOUNDATION_EXPORT const unsigned char BraveRewardsVersionString[];
#import <BraveRewards/RewardsLogger.h>

// Ads
#import <BraveRewards/BATAdsNotification.h>
#import <BraveRewards/BATAdNotification.h>

// Ledger
#import <BraveRewards/Enums.h>
Expand Down
Loading