Skip to content

Commit

Permalink
Changed UTF8String to SysNSStringToUTF8 calls
Browse files Browse the repository at this point in the history
  • Loading branch information
aseren committed Oct 15, 2024
1 parent abdf5da commit fe56aaf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion ios/browser/api/ads/brave_ads.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ OBJC_EXPORT
completion:(void (^)(BOOL success))completion;

- (void)maybeGetNotificationAd:(NSString*)identifier
completion:(void (^)(NotificationAdIOS*))completion;
completion:
(void (^)(NotificationAdIOS* _Nullable))completion;

- (void)triggerNotificationAdEvent:(NSString*)placementId
eventType:(BraveAdsNotificationAdEventType)eventType
Expand Down
19 changes: 11 additions & 8 deletions ios/browser/api/ads/brave_ads.mm
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,9 @@ - (void)downloadAdsResource:(NSString*)folderName
return;
}

[strongSelf.commonOps saveContents:response
name:adsResourceId.UTF8String];
[strongSelf.commonOps
saveContents:response
name:base::SysNSStringToUTF8(adsResourceId)];
BLOG(1, @"Cached %@ ads resource version %@", adsResourceId,
version);

Expand Down Expand Up @@ -1385,7 +1386,7 @@ - (void)loadResourceComponent:(const std::string&)id

BLOG(1, @"Loading %@ ads resource descriptor", nsFilePath);

base::FilePath file_path(nsFilePath.UTF8String);
base::FilePath file_path(base::SysNSStringToUTF8(nsFilePath));
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock()}, base::BindOnce(^base::File {
return base::File(file_path,
Expand All @@ -1408,7 +1409,7 @@ - (void)loadResourceComponent:(const std::string&)id
if (!contents || error) {
return "";
}
return std::string(contents.UTF8String);
return base::SysNSStringToUTF8(contents);
}

- (void)showScheduledCaptcha:(const std::string&)payment_id
Expand Down Expand Up @@ -1532,8 +1533,9 @@ - (void)getStatementOfAccounts:(void (^)(NSInteger adsReceived,
}

- (void)maybeServeInlineContentAd:(NSString*)dimensionsArg
completion:(void (^)(NSString* dimensions,
InlineContentAdIOS* ad))completion {
completion:
(void (^)(NSString* dimensions,
InlineContentAdIOS* _Nullable))completion {
if (![self isServiceRunning]) {
return;
}
Expand Down Expand Up @@ -1588,14 +1590,15 @@ - (void)triggerNewTabPageAdEvent:(NSString*)wallpaperId
}

- (void)maybeGetNotificationAd:(NSString*)identifier
completion:(void (^)(NotificationAdIOS*))completion {
completion:
(void (^)(NotificationAdIOS* _Nullable))completion {
if (![self isServiceRunning]) {
completion(nil);
return;
}

ads->MaybeGetNotificationAd(
identifier.UTF8String,
base::SysNSStringToUTF8(identifier),
base::BindOnce(^(const std::optional<brave_ads::NotificationAdInfo>& ad) {
if (!ad) {
completion(nil);
Expand Down

0 comments on commit fe56aaf

Please sign in to comment.