Skip to content

Commit

Permalink
[iOS] - Fix Translate Crash on iPad (#27857)
Browse files Browse the repository at this point in the history
* Use phoneWidth for translate onboarding on iPad.
* Fix button not working due to status being pending
  • Loading branch information
Brandon-T committed Feb 28, 2025
1 parent 98f7520 commit ee7a7ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ class BraveTranslateTabHelper: NSObject {
// Cache CSS and JS requests
Self.requestCache[request.url] = (data, response)

if isTranslationRequest && canShowToast {
canShowToast = false
if isTranslationRequest {
delegate?.updateTranslateURLBar(tab: tab, state: .active)

Task { @MainActor in
self.delegate?.updateTranslateURLBar(tab: tab, state: .active)
self.delegate?.presentToast(tab: tab, languageInfo: currentLanguageInfo)
if canShowToast {
canShowToast = false
delegate?.presentToast(tab: tab, languageInfo: currentLanguageInfo)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ extension BrowserViewController: BraveTranslateScriptHandlerDelegate {
completion(false)
}
),
autoLayoutConfiguration: .init(preferredWidth: self.view.bounds.width - (32.0 * 2.0))
autoLayoutConfiguration: .phoneWidth
)

popover.arrowDistance = 10.0
popover.outerMargins = UIEdgeInsets(equalInset: 16.0)

popover.previewForOrigin = .init(
view: self.topToolbar.locationView.translateButton.then {
Expand Down

0 comments on commit ee7a7ba

Please sign in to comment.