Skip to content

Commit 3b8ff01

Browse files
committed
Merge branch 'Wtrwx/main'
2 parents 6ab43cd + a645fbf commit 3b8ff01

39 files changed

+3995
-3904
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.theos
22
packages
3-
.DS_Store
3+
.DS_Store
4+
Aweme
5+
Makefile.local

AWMSafeDispatchTimer.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#import <Foundation/Foundation.h>
2+
3+
NS_ASSUME_NONNULL_BEGIN
4+
5+
@interface AWMSafeDispatchTimer : NSObject
6+
7+
- (void)startWithInterval:(NSTimeInterval)interval
8+
leeway:(NSTimeInterval)leeway
9+
queue:(dispatch_queue_t)queue
10+
repeats:(BOOL)repeats
11+
handler:(dispatch_block_t)handler;
12+
13+
- (void)cancel;
14+
15+
@property (nonatomic, readonly, getter=isRunning) BOOL running;
16+
17+
@end
18+
19+
NS_ASSUME_NONNULL_END

AWMSafeDispatchTimer.m

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#import "AWMSafeDispatchTimer.h"
2+
3+
4+
static const void *kAWMSafeDispatchTimerSpecificKey = &kAWMSafeDispatchTimerSpecificKey;
5+
6+
@interface AWMSafeDispatchTimer ()
7+
@property (nonatomic, strong, nullable) dispatch_source_t internalTimer;
8+
@property (nonatomic, assign) BOOL resumed;
9+
@property (nonatomic, copy, nullable) dispatch_block_t internalHandler;
10+
@property (nonatomic, strong) dispatch_queue_t synchronizationQueue;
11+
@property (nonatomic, assign, getter=isRunning) BOOL running;
12+
@end
13+
14+
@implementation AWMSafeDispatchTimer
15+
16+
- (instancetype)init {
17+
self = [super init];
18+
if (self) {
19+
_synchronizationQueue = dispatch_queue_create("com.dyyy.safeDispatchTimer", DISPATCH_QUEUE_SERIAL);
20+
dispatch_queue_set_specific(_synchronizationQueue, kAWMSafeDispatchTimerSpecificKey, (__bridge void *)self, NULL);
21+
}
22+
return self;
23+
}
24+
25+
- (void)startWithInterval:(NSTimeInterval)interval
26+
leeway:(NSTimeInterval)leeway
27+
queue:(dispatch_queue_t)queue
28+
repeats:(BOOL)repeats
29+
handler:(dispatch_block_t)handler {
30+
if (interval <= 0.0) {
31+
interval = 0.1;
32+
}
33+
dispatch_time_t startTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(interval * NSEC_PER_SEC));
34+
uint64_t repeatInterval = repeats ? (uint64_t)(interval * NSEC_PER_SEC) : DISPATCH_TIME_FOREVER;
35+
uint64_t tolerance = leeway > 0 ? (uint64_t)(leeway * NSEC_PER_SEC) : (uint64_t)(0.1 * NSEC_PER_SEC);
36+
37+
__weak __typeof(self) weakSelf = self;
38+
dispatch_async(self.synchronizationQueue, ^{
39+
__strong __typeof(weakSelf) strongSelf = weakSelf;
40+
if (!strongSelf) {
41+
return;
42+
}
43+
44+
[strongSelf cancelLocked];
45+
46+
dispatch_queue_t targetQueue = queue ?: dispatch_get_main_queue();
47+
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, targetQueue);
48+
if (!timer) {
49+
return;
50+
}
51+
52+
strongSelf.internalTimer = timer;
53+
strongSelf.internalHandler = handler;
54+
55+
dispatch_source_set_timer(timer, startTime, repeatInterval, tolerance);
56+
dispatch_source_set_event_handler(timer, ^{
57+
__strong __typeof(weakSelf) innerSelf = weakSelf;
58+
if (!innerSelf) {
59+
return;
60+
}
61+
dispatch_block_t block = innerSelf.internalHandler;
62+
if (block) {
63+
block();
64+
}
65+
if (!repeats) {
66+
[innerSelf cancel];
67+
}
68+
});
69+
70+
if (!strongSelf.resumed) {
71+
dispatch_resume(timer);
72+
strongSelf.resumed = YES;
73+
}
74+
75+
strongSelf.running = YES;
76+
});
77+
}
78+
79+
- (void)cancel {
80+
dispatch_async(self.synchronizationQueue, ^{
81+
[self cancelLocked];
82+
});
83+
}
84+
85+
- (void)cancelLocked {
86+
if (!self.internalTimer) {
87+
return;
88+
}
89+
90+
dispatch_source_t timer = self.internalTimer;
91+
self.internalHandler = nil;
92+
self.internalTimer = nil;
93+
94+
dispatch_source_set_event_handler(timer, ^{});
95+
96+
if (self.resumed) {
97+
dispatch_source_cancel(timer);
98+
self.resumed = NO;
99+
}
100+
101+
self.running = NO;
102+
}
103+
104+
- (BOOL)isRunning {
105+
if (dispatch_get_specific(kAWMSafeDispatchTimerSpecificKey) == (__bridge void *)self) {
106+
return _running;
107+
}
108+
109+
__block BOOL runningState = NO;
110+
dispatch_sync(self.synchronizationQueue, ^{
111+
runningState = _running;
112+
});
113+
return runningState;
114+
}
115+
116+
- (void)dealloc {
117+
if (self.synchronizationQueue) {
118+
dispatch_queue_set_specific(self.synchronizationQueue, kAWMSafeDispatchTimerSpecificKey, NULL, NULL);
119+
}
120+
[self cancel];
121+
}
122+
123+
@end

AwemeHeaders.h

Lines changed: 61 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,20 @@
77
#define DYYYGetInteger(key) [[NSUserDefaults standardUserDefaults] integerForKey:key]
88
#define DYYYGetString(key) [[NSUserDefaults standardUserDefaults] stringForKey:key]
99
#define DYYY_IGNORE_GLOBAL_ALPHA_TAG 114514
10+
1011
typedef NS_ENUM(NSInteger, MediaType) { MediaTypeVideo, MediaTypeImage, MediaTypeAudio, MediaTypeHeic };
1112

12-
static __weak UICollectionView *gFeedCV = nil;
13+
// 调节模式&全局状态
14+
typedef NS_ENUM(NSUInteger, DYEdgeMode) {
15+
DYEdgeModeNone = 0,
16+
DYEdgeModeBrightness = 1,
17+
DYEdgeModeVolume = 2,
18+
};
19+
20+
@interface UIView (DYYYGlobalAlpha)
21+
- (void)dyyy_applyGlobalTransparency;
22+
@end
23+
1324
// 音量控制
1425
@interface AVSystemController : NSObject
1526
+ (instancetype)sharedAVSystemController;
@@ -21,15 +32,6 @@ static __weak UICollectionView *gFeedCV = nil;
2132
+ (instancetype)sharedInstance;
2233
- (void)presentHUDWithIcon:(NSString *)name level:(float)level;
2334
@end
24-
// 调节模式&全局状态
25-
typedef NS_ENUM(NSUInteger, DYEdgeMode) {
26-
DYEdgeModeNone = 0,
27-
DYEdgeModeBrightness = 1,
28-
DYEdgeModeVolume = 2,
29-
};
30-
static DYEdgeMode gMode = DYEdgeModeNone;
31-
static CGFloat gStartY = 0.0;
32-
static CGFloat gStartVal = 0.0;
3335

3436
@interface URLModel : NSObject
3537
@property(nonatomic, strong) NSArray *originURLList;
@@ -122,6 +124,7 @@ static CGFloat gStartVal = 0.0;
122124
@property(nonatomic, assign) BOOL isAds;
123125
@property(nonatomic, assign) BOOL isLive;
124126
@property(nonatomic, assign) BOOL isLivePhoto;
127+
@property(nonatomic, assign) BOOL isNewTextMode; // 文字图文专有属性
125128
@property(nonatomic, strong) NSString *shareURL;
126129
@property(nonatomic, strong) id hotSpotLynxCardModel;
127130
@property(nonatomic, strong) AWELiveFollowFeedCellModel *cellRoom;
@@ -136,6 +139,7 @@ static CGFloat gStartVal = 0.0;
136139
@property(nonatomic, strong) AWEAwemeStatisticsModel *statistics;
137140
@property(nonatomic, strong) AWEPropGuideV2Model *propGuideV2;
138141
@property(nonatomic, strong) AWEECommerceLabel *ecommerceBelowLabel;
142+
@property(nonatomic, assign) BOOL isShowLandscapeEntryView;
139143
- (BOOL)isLive;
140144
- (BOOL)contentFilter;
141145
- (AWESearchAwemeExtraModel *)searchExtraModel;
@@ -148,6 +152,25 @@ static CGFloat gStartVal = 0.0;
148152
- (void)setListenVideoStatus:(NSInteger)status;
149153
@end
150154

155+
@interface AWEABTestManager : NSObject
156+
@property(retain, nonatomic) NSMutableDictionary *consistentABTestDic;
157+
@property(copy, nonatomic) NSDictionary *abTestData;
158+
@property(copy, nonatomic) NSDictionary *performanceReversalDic;
159+
@property(nonatomic) BOOL performanceReversalEnabled;
160+
@property(nonatomic) BOOL handledNetFirstBackNotification;
161+
@property(nonatomic) BOOL lastUpdateByIncrement;
162+
@property(nonatomic) BOOL shouldPrintLog;
163+
@property(nonatomic) BOOL localABSettingEnabled;
164+
- (void)fetchConfiguration:(id)arg1;
165+
- (void)fetchConfigurationWithRetry:(BOOL)arg1 completion:(id)arg2;
166+
- (void)incrementalUpdateData:(id)arg1 unchangedKeyList:(id)arg2;
167+
- (void)overrideABTestData:(id)arg1 needCleanCache:(BOOL)arg2;
168+
- (void)setAbTestData:(id)arg1;
169+
- (void)_saveABTestData:(id)arg1;
170+
- (id)getValueOfConsistentABTestWithKey:(id)arg1;
171+
+ (id)sharedManager;
172+
@end
173+
151174
@interface AWELongPressPanelBaseViewModel : NSObject
152175
@property(nonatomic, copy) NSString *describeString;
153176
@property(nonatomic, assign) NSInteger enterMethod;
@@ -162,6 +185,10 @@ static CGFloat gStartVal = 0.0;
162185
- (void)setAction:(void (^)(void))action;
163186
@end
164187

188+
@interface AWEPlayVideoViewController : UIViewController
189+
@property(nonatomic, strong) AWEAwemeModel *model;
190+
@end
191+
165192
@interface AWELongPressPanelViewGroupModel : NSObject
166193
@property(nonatomic) unsigned long long groupType;
167194
@property(nonatomic) NSArray *groupArr;
@@ -205,6 +232,9 @@ static CGFloat gStartVal = 0.0;
205232
@interface AWEFeedContainerContentView : UIView
206233
@end
207234

235+
@interface TTMetalView : UIView
236+
@end
237+
208238
@interface AWELeftSideBarEntranceView : UIView
209239
- (void)setNumericalRedDot:(id)numericalRedDot;
210240
- (void)setRedDot:(id)redDot;
@@ -352,6 +382,9 @@ static CGFloat gStartVal = 0.0;
352382
@interface AWENormalModeTabBar : UIView
353383
@property(nonatomic, assign, readonly) UITabBarController *yy_viewController;
354384
@property(retain, nonatomic) AWETabBarSkinContainerView *skinContainerView;
385+
- (void)initializeOriginalTabBarHeight;
386+
- (void)calculateTabBarHeight;
387+
- (BOOL)applyTabBarHeight;
355388
@end
356389

357390
@interface AWEPlayInteractionListenFeedView : UIView
@@ -494,8 +527,15 @@ static CGFloat gStartVal = 0.0;
494527
@property(nonatomic, copy) NSString *accessibilityLabel;
495528
@end
496529

530+
// 评论区实况照片模型
531+
@interface AWECommentLivePhotoModel : NSObject
532+
@property(nonatomic, copy) NSArray *videoUrl;
533+
@end
534+
497535
@interface AWECommentImageModel : NSObject
498-
@property(nonatomic, copy) NSString *originUrl;
536+
@property(nonatomic, strong) AWEURLModel *originUrl;
537+
@property(nonatomic, strong) AWEURLModel *mediumUrl;
538+
@property(nonatomic, strong) AWECommentLivePhotoModel *livePhotoModel;
499539
@end
500540

501541
@class AWECommentModel;
@@ -510,11 +550,13 @@ static CGFloat gStartVal = 0.0;
510550

511551
@interface AWECommentLongPressPanelParam : NSObject
512552
- (AWECommentModel *)selectdComment;
553+
- (NSDictionary *)extraParams;
513554
@end
514555

515556
@interface AWECommentModel : NSObject
516557
- (AWEIMStickerModel *)sticker;
517558
- (NSString *)content;
559+
- (NSArray<AWECommentImageModel *> *)imageList;
518560
@end
519561

520562
@interface AWEIMStickerModel : NSObject
@@ -572,6 +614,10 @@ static CGFloat gStartVal = 0.0;
572614
@property(nonatomic, assign, getter=isHidden) BOOL hidden;
573615
@end
574616

617+
@interface AWEIMMessageTabSideBarView : UIView
618+
@property(nonatomic, strong, readonly) UIView *superview;
619+
@end
620+
575621
@interface AWEECommerceEntryView : UIView
576622
@property(nonatomic, strong, readonly) UIView *superview;
577623
@property(nonatomic, assign, getter=isHidden) BOOL hidden;
@@ -1360,4 +1406,7 @@ static CGFloat gStartVal = 0.0;
13601406
@end
13611407

13621408
@interface AWEListKitMagicCollectionView : UICollectionView
1363-
@end
1409+
@end
1410+
1411+
@interface TTPlayerView : UIView
1412+
@end

0 commit comments

Comments
 (0)