mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Temporarily disable ripple on protected contents
This commit is contained in:
parent
7313e25029
commit
127fdcbfbf
4 changed files with 90 additions and 0 deletions
|
|
@ -32,4 +32,6 @@ NSObject * _Nullable makeLuminanceToAlphaFilter();
|
|||
NSObject * _Nullable makeMonochromeFilter();
|
||||
|
||||
void setLayerDisableScreenshots(CALayer * _Nonnull layer, bool disableScreenshots);
|
||||
bool getLayerDisableScreenshots(CALayer * _Nonnull layer);
|
||||
|
||||
void setLayerContentsMaskMode(CALayer * _Nonnull layer, bool maskMode);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#import "UIKitUtils.h"
|
||||
|
||||
#import <ObjCRuntimeUtils/RuntimeUtils.h>
|
||||
|
||||
#import <objc/runtime.h>
|
||||
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
|
|
@ -236,6 +238,7 @@ NSObject * _Nullable makeMonochromeFilter() {
|
|||
return [(id<GraphicsFilterProtocol>)NSClassFromString(@"CAFilter") filterWithName:@"colorMonochrome"];
|
||||
}
|
||||
|
||||
static const void *layerDisableScreenshotsKey = &layerDisableScreenshotsKey;
|
||||
|
||||
void setLayerDisableScreenshots(CALayer * _Nonnull layer, bool disableScreenshots) {
|
||||
static UITextField *textField = nil;
|
||||
|
|
@ -264,6 +267,17 @@ void setLayerDisableScreenshots(CALayer * _Nonnull layer, bool disableScreenshot
|
|||
textField.secureTextEntry = false;
|
||||
}
|
||||
[secureView setValue:previousLayer forKey:@"layer"];
|
||||
|
||||
[layer setAssociatedObject:@(disableScreenshots) forKey:layerDisableScreenshotsKey associationPolicy:NSObjectAssociationPolicyRetain];
|
||||
}
|
||||
|
||||
bool getLayerDisableScreenshots(CALayer * _Nonnull layer) {
|
||||
id result = [layer associatedObjectForKey:layerDisableScreenshotsKey];
|
||||
if ([result respondsToSelector:@selector(boolValue)]) {
|
||||
return [(NSNumber *)result boolValue];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void setLayerContentsMaskMode(CALayer * _Nonnull layer, bool maskMode) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue