Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
mvn-hieunguyen-hn committed Dec 7, 2023
1 parent bb92f54 commit f3d4742
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions ios/Classes/BetterPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ - (instancetype)initWithFrame:(CGRect)frame {
self = [super init];
[self initBlackCoverView];
[self initLimitedPlanCoverView];
[self initLimitedBlackCoverView];
NSAssert(self, @"super init cannot be nil");
_isInitialized = false;
_isPlaying = false;
Expand Down Expand Up @@ -837,18 +838,35 @@ - (void)setIsDisplayPipButtons:(BOOL) isDisplay {
[_pipController setValue:[NSNumber numberWithInt:isDisplay ? 0 : 1] forKey:@"controlsStyle"];
}

- (void) initLimitedBlackCoverView {
_limitedBlackCoverView = NULL;
_limitedBlackCoverView = [[UIView alloc] init];
_limitedBlackCoverView.translatesAutoresizingMaskIntoConstraints = false;
_limitedBlackCoverView.backgroundColor = [UIColor blackColor];
}

- (void) showLimitedBlackCoverView {
[self._betterPlayerView addSubview:_limitedBlackCoverView];
[NSLayoutConstraint activateConstraints:@[
[_limitedBlackCoverView.topAnchor constraintEqualToAnchor:self._betterPlayerView.topAnchor],
[_limitedBlackCoverView.bottomAnchor constraintEqualToAnchor:self._betterPlayerView.bottomAnchor],
[_limitedBlackCoverView.leadingAnchor constraintEqualToAnchor:self._betterPlayerView.leadingAnchor],
[_limitedBlackCoverView.trailingAnchor constraintEqualToAnchor:self._betterPlayerView.trailingAnchor],
]];
}

- (void) hideLimitedBlackCoverView {
if (_limitedBlackCoverView) {
[_limitedBlackCoverView removeFromSuperview];
}
}

- (void)setIsPremiumBannerDisplay:(BOOL) isDisplay {
_isPremiumBannerDisplay = isDisplay;
if (isDisplay) {
[self._betterPlayerView addSubview:_blackCoverView];
[NSLayoutConstraint activateConstraints:@[
[_blackCoverView.topAnchor constraintEqualToAnchor:self._betterPlayerView.topAnchor],
[_blackCoverView.bottomAnchor constraintEqualToAnchor:self._betterPlayerView.bottomAnchor],
[_blackCoverView.leadingAnchor constraintEqualToAnchor:self._betterPlayerView.leadingAnchor],
[_blackCoverView.trailingAnchor constraintEqualToAnchor:self._betterPlayerView.trailingAnchor],
]];
} else if (_blackCoverView) {
[_blackCoverView removeFromSuperview];
[self showLimitedBlackCoverView];
} else {
[self hideLimitedBlackCoverView];
}
}

Expand Down

0 comments on commit f3d4742

Please sign in to comment.