Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2564: Update Rewards lib to include ads crash fix #2566

Merged
merged 2 commits into from May 22, 2020
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Binary file not shown.
@@ -27,14 +27,14 @@ NS_SWIFT_NAME(AdsNotification)
@property (nonatomic, readonly, copy) NSString *category;
@property (nonatomic, readonly, copy) NSString *title;
@property (nonatomic, readonly, copy) NSString *body;
@property (nonatomic, readonly, copy) NSURL *targetURL;
@property (nonatomic, readonly, copy) NSString *targetURL;
@property (nonatomic, readonly, copy) NSString *geoTarget;
@end

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

NS_ASSUME_NONNULL_END
Binary file not shown.
@@ -334,11 +334,16 @@ extension AdsViewController {
let notification = AdsNotification.customAd(
title: Strings.myFirstAdTitle,
body: Strings.myFirstAdBody,
url: URL(string: "https://brave.com/my-first-ad")!
url: "https://brave.com/my-first-ad"
)

guard let targetURL = URL(string: notification.targetURL) else {
assertionFailure("My First Ad URL is not valid: \(notification.targetURL)")
return
}

adsViewController.display(ad: notification, handler: { (notification, action) in
completion(action, notification.targetURL)
completion(action, targetURL)
}, animatedOut: {
adsViewController.view.removeFromSuperview()
})
@@ -6,5 +6,5 @@ The latest BraveRewards.framework was built on:

```
brave-browser/0d23cf11ec5dab650d71c3957b3f982d2bef3600
brave-core/3c96998389af5f49483481ddbe8deba08ff300fa
brave-core/992f93ac6f9914676de336c88059a5ec917b9c21
```
@@ -260,7 +260,17 @@ class BrowserViewController: UIViewController {
notificationsHandler?.actionOccured = { [weak self] notification, action in
guard let self = self else { return }
if action == .opened {
let request = URLRequest(url: notification.targetURL)
var url = URL(string: notification.targetURL)
if url == nil, let percentEncodedURLString =
notification.targetURL.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) {
// Try to percent-encode the string and try that
url = URL(string: percentEncodedURLString)
}
guard let targetURL = url else {
assertionFailure("Invalid target URL for creative instance id: \(notification.creativeInstanceID)")
return
}
let request = URLRequest(url: targetURL)
self.tabManager.addTabAndSelect(request, isPrivate: PrivateBrowsingManager.shared.isPrivateBrowsing)
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.