mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Dust effect improvements
This commit is contained in:
parent
e25f926342
commit
c89c1363ca
14 changed files with 291 additions and 238 deletions
|
|
@ -24,6 +24,8 @@ void applySmoothRoundedCornersImpl(CALayer * _Nonnull layer);
|
|||
@end
|
||||
|
||||
UIView<UIKitPortalViewProtocol> * _Nullable makePortalView(bool matchPosition);
|
||||
bool isViewPortalView(UIView * _Nonnull view);
|
||||
UIView * _Nullable getPortalViewSourceView(UIView * _Nonnull portalView);
|
||||
|
||||
NSObject * _Nullable makeBlurFilter();
|
||||
NSObject * _Nullable makeLuminanceToAlphaFilter();
|
||||
|
|
|
|||
|
|
@ -171,34 +171,51 @@ void applySmoothRoundedCornersImpl(CALayer * _Nonnull layer) {
|
|||
}
|
||||
|
||||
UIView<UIKitPortalViewProtocol> * _Nullable makePortalView(bool matchPosition) {
|
||||
if (@available(iOS 12.0, *)) {
|
||||
static Class portalViewClass = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
portalViewClass = NSClassFromString([@[@"_", @"UI", @"Portal", @"View"] componentsJoinedByString:@""]);
|
||||
});
|
||||
if (!portalViewClass) {
|
||||
return nil;
|
||||
}
|
||||
UIView<UIKitPortalViewProtocol> *view = [[portalViewClass alloc] init];
|
||||
if (!view) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (@available(iOS 14.0, *)) {
|
||||
view.forwardsClientHitTestingToSourceView = false;
|
||||
}
|
||||
view.matchesPosition = matchPosition;
|
||||
view.matchesTransform = matchPosition;
|
||||
view.matchesAlpha = false;
|
||||
if (@available(iOS 14.0, *)) {
|
||||
view.allowsHitTesting = false;
|
||||
}
|
||||
|
||||
return view;
|
||||
} else {
|
||||
static Class portalViewClass = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
portalViewClass = NSClassFromString([@[@"_", @"UI", @"Portal", @"View"] componentsJoinedByString:@""]);
|
||||
});
|
||||
if (!portalViewClass) {
|
||||
return nil;
|
||||
}
|
||||
UIView<UIKitPortalViewProtocol> *view = [[portalViewClass alloc] init];
|
||||
if (!view) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (@available(iOS 14.0, *)) {
|
||||
view.forwardsClientHitTestingToSourceView = false;
|
||||
}
|
||||
view.matchesPosition = matchPosition;
|
||||
view.matchesTransform = matchPosition;
|
||||
view.matchesAlpha = false;
|
||||
if (@available(iOS 14.0, *)) {
|
||||
view.allowsHitTesting = false;
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
bool isViewPortalView(UIView * _Nonnull view) {
|
||||
static Class portalViewClass = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
portalViewClass = NSClassFromString([@[@"_", @"UI", @"Portal", @"View"] componentsJoinedByString:@""]);
|
||||
});
|
||||
if ([view isKindOfClass:portalViewClass]) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
UIView * _Nullable getPortalViewSourceView(UIView * _Nonnull portalView) {
|
||||
if (!isViewPortalView(portalView)) {
|
||||
return nil;
|
||||
}
|
||||
UIView<UIKitPortalViewProtocol> *view = (UIView<UIKitPortalViewProtocol> *)portalView;
|
||||
return view.sourceView;
|
||||
}
|
||||
|
||||
@protocol GraphicsFilterProtocol <NSObject>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue