Skip to content

Commit 2715b43

Browse files
committed
处理TTPlayerView
1 parent 2b88885 commit 2715b43

File tree

2 files changed

+33
-34
lines changed

2 files changed

+33
-34
lines changed

AwemeHeaders.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,3 +1364,6 @@ typedef NS_ENUM(NSUInteger, DYEdgeMode) {
13641364

13651365
@interface AWEListKitMagicCollectionView : UICollectionView
13661366
@end
1367+
1368+
@interface TTPlayerView : UIView
1369+
@end

DYYY.xm

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4495,7 +4495,7 @@ static BOOL DYYYIsLandscapeVideoBounds(CGSize size) {
44954495
CGFloat viewWidth = CGRectGetWidth(self.bounds);
44964496
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
44974497

4498-
if (viewWidth < screenWidth * 0.995f) {
4498+
if (viewWidth < screenWidth) {
44994499
return;
45004500
}
45014501

@@ -5175,26 +5175,23 @@ static void *DYYYTabBarHeightContext = &DYYYTabBarHeightContext;
51755175
[[NSUserDefaults standardUserDefaults] removeObserver:self forKeyPath:kDYYYTabBarHeightKey context:DYYYTabBarHeightContext];
51765176
} @catch (NSException *exception) {
51775177
NSLog(@"[DYYY] KVO removeObserver failed: %@", exception);
5178-
}
5178+
}
51795179
%orig;
51805180
}
51815181

5182-
- (void)observeValueForKeyPath:(NSString *)keyPath
5183-
ofObject:(id)object
5184-
change:(NSDictionary<NSKeyValueChangeKey, id> *)change
5185-
context:(void *)context {
5182+
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey, id> *)change context:(void *)context {
51865183
if (context == DYYYTabBarHeightContext) {
51875184
__weak __typeof(self) weakSelf = self;
51885185
dispatch_async(dispatch_get_main_queue(), ^{
5189-
__strong __typeof(weakSelf) strongSelf = weakSelf;
5190-
if (strongSelf) {
5191-
NSLog(@"[DYYY] observeValueForKeyPath: %@ has new value: '%@'", kDYYYTabBarHeightKey, change[NSKeyValueChangeNewKey]);
5192-
if (originalTabBarHeight == kInvalidHeight) {
5193-
[strongSelf initializeOriginalTabBarHeight];
5194-
}
5195-
[strongSelf calculateTabBarHeight];
5196-
[strongSelf applyTabBarHeight];
5197-
}
5186+
__strong __typeof(weakSelf) strongSelf = weakSelf;
5187+
if (strongSelf) {
5188+
NSLog(@"[DYYY] observeValueForKeyPath: %@ has new value: '%@'", kDYYYTabBarHeightKey, change[NSKeyValueChangeNewKey]);
5189+
if (originalTabBarHeight == kInvalidHeight) {
5190+
[strongSelf initializeOriginalTabBarHeight];
5191+
}
5192+
[strongSelf calculateTabBarHeight];
5193+
[strongSelf applyTabBarHeight];
5194+
}
51985195
});
51995196
}
52005197
}
@@ -5909,14 +5906,15 @@ static void *DYYYTabBarHeightContext = &DYYYTabBarHeightContext;
59095906
if ([NSThread isMainThread]) {
59105907
if (self.window && self.tag != DYYY_IGNORE_GLOBAL_ALPHA_TAG) {
59115908
if (gGlobalTransparency != kInvalidAlpha && fabs(self.alpha - gGlobalTransparency) >= 0.01) {
5912-
[UIView animateWithDuration:0.2 animations:^{
5913-
self.alpha = gGlobalTransparency;
5914-
}];
5909+
[UIView animateWithDuration:0.2
5910+
animations:^{
5911+
self.alpha = gGlobalTransparency;
5912+
}];
59155913
}
59165914
}
59175915
} else {
59185916
dispatch_async(dispatch_get_main_queue(), ^{
5919-
[self dyyy_applyGlobalTransparency];
5917+
[self dyyy_applyGlobalTransparency];
59205918
});
59215919
}
59225920
}
@@ -6452,10 +6450,7 @@ static void DYYYRemoveKeyboardObserver(void) {
64526450

64536451
updateGlobalTransparencyCache();
64546452

6455-
[[NSUserDefaults standardUserDefaults] addObserver:(NSObject *)self
6456-
forKeyPath:kDYYYGlobalTransparencyKey
6457-
options:NSKeyValueObservingOptionNew
6458-
context:DYYYGlobalTransparencyContext];
6453+
[[NSUserDefaults standardUserDefaults] addObserver:(NSObject *)self forKeyPath:kDYYYGlobalTransparencyKey options:NSKeyValueObservingOptionNew context:DYYYGlobalTransparencyContext];
64596454

64606455
BOOL isEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"DYYYEnableFloatClearButton"];
64616456
if (isEnabled) {
@@ -6521,23 +6516,18 @@ static void DYYYRemoveKeyboardObserver(void) {
65216516
DYYYRemoveAppLifecycleObservers();
65226517
DYYYRemoveKeyboardObserver();
65236518
@try {
6524-
[[NSUserDefaults standardUserDefaults] removeObserver:(NSObject *)self
6525-
forKeyPath:kDYYYGlobalTransparencyKey
6526-
context:DYYYGlobalTransparencyContext];
6519+
[[NSUserDefaults standardUserDefaults] removeObserver:(NSObject *)self forKeyPath:kDYYYGlobalTransparencyKey context:DYYYGlobalTransparencyContext];
65276520
} @catch (NSException *exception) {
65286521
NSLog(@"[DYYY] KVO removeObserver failed: %@", exception);
6529-
}
6522+
}
65306523
%orig;
65316524
}
65326525

6533-
- (void)observeValueForKeyPath:(NSString *)keyPath
6534-
ofObject:(id)object
6535-
change:(NSDictionary<NSKeyValueChangeKey,id> *)change
6536-
context:(void *)context {
6526+
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey, id> *)change context:(void *)context {
65376527
if (context == DYYYGlobalTransparencyContext) {
65386528
dispatch_async(dispatch_get_main_queue(), ^{
6539-
updateGlobalTransparencyCache();
6540-
[[NSNotificationCenter defaultCenter] postNotificationName:kDYYYGlobalTransparencyDidChangeNotification object:nil];
6529+
updateGlobalTransparencyCache();
6530+
[[NSNotificationCenter defaultCenter] postNotificationName:kDYYYGlobalTransparencyDidChangeNotification object:nil];
65416531
});
65426532
} else {
65436533
%orig(keyPath, object, change, context);
@@ -7009,7 +6999,13 @@ static Class TagViewClass = nil;
70096999
%hook TTPlayerView
70107000

70117001
- (void)setFrame:(CGRect)frame {
7012-
if (DYYYGetBool(@"DYYYEnableFullScreen") && gCurrentTabBarHeight > 0.0f) {
7002+
7003+
CGFloat viewWidth = CGRectGetWidth(self.bounds);
7004+
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
7005+
7006+
if (viewWidth < screenWidth) {
7007+
%orig(frame);
7008+
} else if (DYYYGetBool(@"DYYYEnableFullScreen") && gCurrentTabBarHeight > 0.0f) {
70137009
frame.size.height += 25.0f;
70147010
}
70157011
%orig(frame);

0 commit comments

Comments
 (0)