Skip to content

Commit

Permalink
fix case go to pip when full screen
Browse files Browse the repository at this point in the history
  • Loading branch information
mvn-hieunguyen-hn committed Jan 17, 2024
1 parent 2a71f08 commit ba79acc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions ios/Classes/BetterPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -852,11 +852,7 @@ - (void) showLimitedBlackCoverView {

[self._betterPlayerView addSubview:_limitedBlackCoverView];

NSArray *commonConstraints = [self._betterPlayerView.constraints filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSLayoutConstraint *constraint, NSDictionary *bindings) {
return [constraint.secondItem isEqual:_limitedBlackCoverView] || [constraint.firstItem isEqual:_limitedBlackCoverView];
}]];

if (commonConstraints.count > 0) {
if ([self hasCommonConstraintsBetweenTwoViews:self._betterPlayerView andView2:_limitedBlackCoverView]) {
return;
}

Expand All @@ -868,6 +864,14 @@ - (void) showLimitedBlackCoverView {
]];
}

- (BOOL)hasCommonConstraintsBetweenTwoViews:(UIView *)view1 andView2:(UIView *)view2 {
NSArray *commonConstraints = [view1.constraints filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSLayoutConstraint *constraint, NSDictionary *bindings) {
return [constraint.firstItem isEqual:view2] || [constraint.secondItem isEqual:view2];
}]];

return commonConstraints.count > 0;
}

- (void) hideLimitedBlackCoverView {
if (_limitedBlackCoverView) {
[_limitedBlackCoverView removeFromSuperview];
Expand Down Expand Up @@ -947,11 +951,7 @@ - (void) showLimitedPlanCoverViewInPIP {
if (window && _isPipMode) {
[window addSubview:_limitedPlanCoverView];

NSArray *commonConstraints = [window.constraints filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSLayoutConstraint *constraint, NSDictionary *bindings) {
return [constraint.secondItem isEqual:_limitedPlanCoverView] || [constraint.firstItem isEqual:_limitedPlanCoverView];
}]];

if (commonConstraints.count > 0) {
if ([self hasCommonConstraintsBetweenTwoViews:window andView2:_limitedPlanCoverView]) {
return;
}

Expand Down

0 comments on commit ba79acc

Please sign in to comment.