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

PLAYRTS-5578 - iOS 18 Update #512

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
21 changes: 14 additions & 7 deletions Application/Sources/Content/PageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ final class PageViewController: UIViewController {

self.updateLayoutConfiguration()
self.updateTopicGradientLayout()
self.updateNavigationBar(animated: false)
}
}
#endif
Expand Down Expand Up @@ -335,13 +336,19 @@ final class PageViewController: UIViewController {
view.addSubview(googleCastButton)
self.googleCastButton = googleCastButton

// Place the button where it would appear if a navigation bar was available. An offset is needed on iPads for a perfect
// result (might be fragile but should be enough).
let topOffset: CGFloat = (UIDevice.current.userInterfaceIdiom == .pad) ? 3 : 0
NSLayoutConstraint.activate([
googleCastButton.topAnchor.constraint(equalTo: view.layoutMarginsGuide.topAnchor, constant: topOffset),
googleCastButton.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.trailingAnchor)
])
// Place the button where it would appear if a navigation bar was available.
if traitCollection.horizontalSizeClass == .regular {
Comment on lines +339 to +340
Copy link
Member

@pyby pyby Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep the same previous offset for iPadOS previous 18 and introduce an os version check?
The new condition should be only for iPadOS 18 and more.

UI change: no more top and right "look like" same margin on the GoogleCast floating button above the heart stage card.

IMG_0659

// Try to match the vertical alignment of the new floating UITabBar
NSLayoutConstraint.activate([
googleCastButton.topAnchor.constraint(equalTo: view.topAnchor, constant: 28),
googleCastButton.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.trailingAnchor)
])
} else {
NSLayoutConstraint.activate([
googleCastButton.topAnchor.constraint(equalTo: view.layoutMarginsGuide.topAnchor),
googleCastButton.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.trailingAnchor)
])
}
}
} else {
googleCastButton?.removeFromSuperview()
Expand Down
35 changes: 25 additions & 10 deletions Application/Sources/UI/Controllers/TabBarController.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ @interface TabBarController ()
@property (nonatomic, readonly) NSLayoutConstraint *playerLeadingConstraint;
@property (nonatomic, readonly) NSLayoutConstraint *playerTrailingConstraint;
@property (nonatomic, readonly) NSLayoutConstraint *playerHeightConstraint;
@property (nonatomic, readonly) NSLayoutConstraint *playerBottomConstraint;
@property (nonatomic, readonly) NSLayoutConstraint *playerBottomToViewConstraint;
@property (nonatomic, readonly) NSLayoutConstraint *playerBottomToSafeAreaConstraint;

@end

Expand All @@ -43,7 +44,8 @@ @implementation TabBarController
@synthesize playerLeadingConstraint = _playerLeadingConstraint;
@synthesize playerTrailingConstraint = _playerTrailingConstraint;
@synthesize playerHeightConstraint = _playerHeightConstraint;
@synthesize playerBottomConstraint = _playerBottomConstraint;
@synthesize playerBottomToViewConstraint = _playerBottomToViewConstraint;
@synthesize playerBottomToSafeAreaConstraint = _playerBottomToSafeAreaConstraint;

#pragma mark Object lifecycle

Expand Down Expand Up @@ -124,12 +126,21 @@ - (NSLayoutConstraint *)playerHeightConstraint
return _playerHeightConstraint;
}

- (NSLayoutConstraint *)playerBottomConstraint
- (NSLayoutConstraint *)playerBottomToViewConstraint
{
if (! _playerBottomConstraint) {
_playerBottomConstraint = [self.miniPlayerView.bottomAnchor constraintEqualToAnchor:self.tabBar.topAnchor];
if (! _playerBottomToViewConstraint) {
_playerBottomToViewConstraint = [self.miniPlayerView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor];
Comment on lines +131 to +132
Copy link
Member

@pyby pyby Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running on iPadOS less than 18.0, the mini player is now not visible, as displayed below the bottom tab bar.

The new condition should be only for iPadOS 18 and more.

IMG_0662

}
return _playerBottomConstraint;
_playerBottomToViewConstraint.constant = -self.tabBar.bounds.size.height;
return _playerBottomToViewConstraint;
}

- (NSLayoutConstraint *)playerBottomToSafeAreaConstraint
{
if (! _playerBottomToSafeAreaConstraint) {
_playerBottomToSafeAreaConstraint = [self.miniPlayerView.bottomAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.bottomAnchor];
}
return _playerBottomToSafeAreaConstraint;
}

#pragma mark View lifecycle
Expand Down Expand Up @@ -400,16 +411,20 @@ - (void)updateLayoutAnimated:(BOOL)animated

if (self.miniPlayerView.active) {
self.playerHeightConstraint.constant = MiniPlayerHeight;
self.playerBottomConstraint.constant = -self.miniPlayerOffset;
self.playerBottomToSafeAreaConstraint.constant = -self.miniPlayerOffset;
}
else {
self.playerHeightConstraint.constant = 0.f;
self.playerBottomConstraint.constant = 0.f;
self.playerBottomToSafeAreaConstraint.constant = 0.f;
}

self.playerHeightConstraint.active = YES;
self.playerBottomConstraint.active = YES;

if (self.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular) {
self.playerBottomToSafeAreaConstraint.active = YES;
} else {
self.playerBottomToViewConstraint.active = YES;
}
Comment on lines +422 to +426
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the two contraints compatible in the same time as they are link both to self.miniPlayerView.bottomAnchor?
Do we expect to set active = NO to one, and active = YES to the other one?


CALayer *miniPlayerLayer = self.miniPlayerView.layer;
if (UIAccessibilityIsVoiceOverRunning()) {
miniPlayerLayer.cornerRadius = 0.f;
Expand Down