-
Notifications
You must be signed in to change notification settings - Fork 440
Conversation
f6535f8
to
1e6db6d
Compare
.lineLimit(1) | ||
.foregroundColor(Color(Theme.of(nil).colors.tints.home)) | ||
} | ||
Text(verbatim: url.baseDomain ?? url.absoluteDisplayString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe url.baseDomain ?? url.host ?? url.absoluteDisplayString
? That way you attempt to get base domain else eTLD else display string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, absoluteDisplayString
only strips http/https so host
is probably a better fallback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found few problems in dark mode,
code looks nice overall
Client/Frontend/Browser/BrowserViewController/BrowserViewController+Menu.swift
Show resolved
Hide resolved
configuration.label | ||
.contentShape(Rectangle()) // Needed or taps don't activate on empty space | ||
.background( | ||
Color(colorScheme == .dark ? .white : .black) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not using our theme colors here? do we even have them for 'buttonstyle'
Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/MenuViewController.swift
Show resolved
Hide resolved
Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/MenuViewController.swift
Outdated
Show resolved
Hide resolved
@@ -67,9 +67,6 @@ extension Theme { | |||
InsetButton.appearance(whenContainedInInstancesOf: [SearchSuggestionPromptView.self]).appearanceTextColor = colors.tints.home | |||
|
|||
// Overrides all views inside of itself | |||
// According to docs, UIWindow override should be enough, but some labels on iOS 13 are still messed up without UIView override as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is so contradictory I wonder why did they add it to window before :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I am not sure, keeping it unfortunately completely breaks SwiftUI re-render after color scheme changes
activities = shareActivities(for: url, tab: tab, sourceView: view, sourceRect: self.view.convert(self.topToolbar.menuButton.frame, from: self.topToolbar.menuButton.superview), arrowDirection: .up) | ||
} | ||
let menuController = MenuViewController(content: { menuController in | ||
VStack(spacing: 6) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think we should start adding these values in struct or unnecessary for single instance ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is unnecessary at the moment, as it is a small computed View. If the menu grows to be larger though we can always reconsider
} | ||
|
||
struct MenuTabDetailsView: View { | ||
@SwiftUI.Environment(\.colorScheme) var colorScheme: ColorScheme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/brave/brave-ios/pull/3465/files#r605576363
Same comment applies here I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are used to force SwiftUI to recompute the body of the View when the users system theme changes (as we don't have an observable "current" theme object anywhere)
} | ||
.buttonStyle(TableCellButtonStyle()) | ||
.accentColor(Color(Theme.of(nil).colors.tints.home)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we use .accentColor
here instead of .background(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This accentColor
was to set colors of Toggle's to brave's orange, but it doesn't seem to work as Michal tested.
background
places a View
behind this view, which isn't what we wanted in this case
@available(*, unavailable) | ||
required init?(coder aDecoder: NSCoder) { | ||
fatalError() | ||
override var preferredStatusBarStyle: UIStatusBarStyle { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious do we need need to set Status bar style for this controller ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is to keep the status bar white when the user navigates to other VC's inside the menu
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
return visibleButtons.count | ||
private var isPresentingInnerMenu: Bool { | ||
if let _ = presentedViewController as? InnerMenuNavigationController { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use is here instead
presentedViewController is InnerMenuNavigationController
extension MenuViewController: PanModalPresentable { | ||
var panScrollable: UIScrollView? { | ||
// For SwiftUI: | ||
// - in iOS 13, ScrollView will exist within a host view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn thats great info here 👏
if let scrollView = view as? UIScrollView { | ||
return scrollView | ||
} | ||
if !view.subviews.isEmpty, let childScrollView = _scrollViewChild(in: view, depth: depth + 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have 2 questions here,
- First one I guess we are doing this check for iOS 13 only, If thats the case can we mark it like that
- Second question is Can there be a situation where we have a scrollview as a direct subview and also scroll view within a hostview? If yes shouldnt we pick the scrollview which exists as direct subview ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Not 13 only, 14 can also have subviews as subview of the
view
when we create custom VC's that aren't UITVC's - Yes but we always want the top-level one we find since its the one that controls whether or not panning begins to open/close the pan modal. If its the direct view it will return a few lines above, otherwise we check 1 more level deep. Any other scrolls within are assumed to function separately. I guess one improvement would be to find the first one that scrolls vertically, but Im not sure how we could go about doing that
self.panModalSetNeedsLayoutUpdate() | ||
} | ||
if expandToLongForm { | ||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we delay while xpanding to long form ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just makes the animation look nicer, I'll make a comment explaining 🙂
75ef0a5
to
6e9395d
Compare
// Have to increase the content size by the hidden nav bar height so that the size | ||
// doesn't change when the user navigates within the menu where the nav bar is visible | ||
let navBarHeight = navigationController?.navigationBar.bounds.height ?? 0 | ||
return CGSize(width: 375, height: min(max(size.height + 16, 240), 580 + navBarHeight)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see these 580 and 375 magic numbers in few places, would it be worth extracting to a constant?
4f89124
to
9adcf2d
Compare
Theme related issues will be solved in #3606 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs 1 more rebase, code looks good
Summary of Changes
This pull request fixes #3491
This also changes private mode theming to only affect the main browser toolbars
Submitter Checklist:
NSLocalizableString()
Test Plan:
Screenshots:
Reviewer Checklist:
QA/(Yes|No)
release-notes/(include|exclude)
bug
/enhancement