mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Temp
This commit is contained in:
parent
97caa448c2
commit
46046c729a
22
Wallet/BUILD
22
Wallet/BUILD
@ -8,13 +8,13 @@ echo \
|
||||
'<plist version="1.0">' \
|
||||
'<dict>' \
|
||||
' <key>CFBundleShortVersionString</key>' \
|
||||
' <string>%s</string>' \
|
||||
' <string>{}</string>' \
|
||||
' <key>CFBundleVersion</key>' \
|
||||
' <string>%s</string>' \
|
||||
' <string>{}</string>' \
|
||||
'</dict>' \
|
||||
'</plist>' \
|
||||
> "$@"
|
||||
""" % ("1.0", "30")
|
||||
""".format("1.0", "30")
|
||||
|
||||
genrule(
|
||||
name = "VersionInfoPlist",
|
||||
@ -51,7 +51,21 @@ swift_library(
|
||||
"//submodules/BuildConfig:BuildConfig",
|
||||
"//submodules/AppBundle:AppBundle",
|
||||
"//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode",
|
||||
#"//submodules/WalletUI:WalletUI",
|
||||
"//submodules/Camera:Camera",
|
||||
"//submodules/QrCode:QrCode",
|
||||
"//submodules/MergeLists:MergeLists",
|
||||
"//submodules/GlassButtonNode:GlassButtonNode",
|
||||
"//submodules/UrlEscaping:UrlEscaping",
|
||||
"//submodules/LocalAuth:LocalAuth",
|
||||
"//submodules/ScreenCaptureDetection:ScreenCaptureDetection",
|
||||
"//submodules/WalletUrl:WalletUrl",
|
||||
"//submodules/ProgressNavigationButtonNode:ProgressNavigationButtonNode",
|
||||
"//submodules/Markdown:Markdown",
|
||||
"//submodules/StringPluralization:StringPluralization",
|
||||
"//submodules/YuvConversion:YuvConversion",
|
||||
"//submodules/rlottie:RLottieBinding",
|
||||
"//submodules/AnimatedStickerNode:AnimatedStickerNode",
|
||||
"//submodules/WalletUI:WalletUI",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 53282252b393e451634d4f410d555df3f295c00e
|
||||
Subproject commit 77b9c3cd975272f37856ee0ccca8c96d986bf85f
|
@ -1 +1 @@
|
||||
Subproject commit 657eda57a097980848dbb3c880b94faeddaa3cd1
|
||||
Subproject commit c81e80f899e261e35f6f48646906e0bb3712ce7b
|
20
submodules/AnimatedStickerNode/BUILD
Normal file
20
submodules/AnimatedStickerNode/BUILD
Normal file
@ -0,0 +1,20 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "AnimatedStickerNode",
|
||||
module_name = "AnimatedStickerNode",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/YuvConversion:YuvConversion",
|
||||
"//submodules/GZip:GZip",
|
||||
"//submodules/rlottie:RLottieBinding",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
8
submodules/AsyncDisplayKit/BUILD
vendored
8
submodules/AsyncDisplayKit/BUILD
vendored
@ -1,8 +1,3 @@
|
||||
load(
|
||||
"@rules_apple_extras//apple:objc_library.bzl",
|
||||
"objc_library",
|
||||
)
|
||||
|
||||
public_headers = glob([
|
||||
"Source/PublicHeaders/AsyncDisplayKit/*.h",
|
||||
])
|
||||
@ -23,6 +18,9 @@ objc_library(
|
||||
defines = [
|
||||
"MINIMAL_ASDK",
|
||||
],
|
||||
includes = [
|
||||
"Source/PublicHeaders",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Foundation",
|
||||
"UIKit",
|
||||
|
@ -11,8 +11,7 @@
|
||||
#import "ASControlNode+Private.h"
|
||||
#import <AsyncDisplayKit/ASControlNode+Subclasses.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
|
||||
#import <AsyncDisplayKit/ASImageNode.h>
|
||||
#import "ASInternalHelpers.h"
|
||||
#import <AsyncDisplayKit/ASInternalHelpers.h>
|
||||
#import <AsyncDisplayKit/ASControlTargetAction.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
|
||||
#import <AsyncDisplayKit/ASThread.h>
|
||||
@ -72,7 +71,6 @@ CGRect _ASControlNodeGetExpandedBounds(ASControlNode *controlNode);
|
||||
|
||||
@implementation ASControlNode
|
||||
{
|
||||
ASImageNode *_debugHighlightOverlay;
|
||||
}
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
@ -494,8 +492,8 @@ CGRect _ASControlNodeGetExpandedBounds(ASControlNode *controlNode) {
|
||||
}
|
||||
|
||||
#pragma mark - Debug
|
||||
- (ASImageNode *)debugHighlightOverlay
|
||||
- (ASDisplayNode *)debugHighlightOverlay
|
||||
{
|
||||
return _debugHighlightOverlay;
|
||||
return nil;
|
||||
}
|
||||
@end
|
||||
|
@ -7,7 +7,7 @@
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import "ASControlTargetAction.h"
|
||||
#import <AsyncDisplayKit/ASControlTargetAction.h>
|
||||
|
||||
@implementation ASControlTargetAction
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import "ASDisplayNode+Ancestry.h"
|
||||
#import <AsyncDisplayKit/ASDisplayNode+Ancestry.h>
|
||||
#import <AsyncDisplayKit/ASThread.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import "ASDisplayNode+Convenience.h"
|
||||
#import <AsyncDisplayKit/ASDisplayNode+Convenience.h>
|
||||
|
||||
#import <UIKit/UIViewController.h>
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
|
||||
#import "ASDisplayNodeInternal.h"
|
||||
#import "ASDisplayNode+FrameworkPrivate.h"
|
||||
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNode+Ancestry.h>
|
||||
|
||||
#import <queue>
|
||||
|
@ -10,7 +10,7 @@
|
||||
#import "ASCGImageBuffer.h"
|
||||
#import <AsyncDisplayKit/ASAssert.h>
|
||||
#import <AsyncDisplayKit/ASConfigurationInternal.h>
|
||||
#import "ASInternalHelpers.h"
|
||||
#import <AsyncDisplayKit/ASInternalHelpers.h>
|
||||
#import <UIKit/UIGraphics.h>
|
||||
#import <UIKit/UIImage.h>
|
||||
#import <objc/runtime.h>
|
||||
|
@ -1,31 +0,0 @@
|
||||
//
|
||||
// ASImageNode+CGExtras.h
|
||||
// Texture
|
||||
//
|
||||
// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
|
||||
// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved.
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <AsyncDisplayKit/ASBaseDefines.h>
|
||||
|
||||
/**
|
||||
@abstract Decides how to scale and crop an image to fit in the provided size, while not wasting memory by upscaling images
|
||||
@param sourceImageSize The size of the encoded image.
|
||||
@param boundsSize The bounds in which the image will be displayed.
|
||||
@param contentMode The mode that defines how image will be scaled and cropped to fit. Supported values are UIViewContentModeScaleToAspectFill and UIViewContentModeScaleToAspectFit.
|
||||
@param cropRect A rectangle that is to be featured by the cropped image. The rectangle is specified as a "unit rectangle," using fractions of the source image's width and height, e.g. CGRectMake(0.5, 0, 0.5, 1.0) will feature the full right half a photo. If the cropRect is empty, the contentMode will be used to determine the drawRect's size, and only the cropRect's origin will be used for positioning.
|
||||
@param forceUpscaling A boolean that indicates you would *not* like the backing size to be downscaled if the image is smaller than the destination size. Setting this to YES will result in higher memory usage when images are smaller than their destination.
|
||||
@param forcedSize A CGSize, that if non-CGSizeZero, indicates that the backing size should be forcedSize and not calculated based on boundsSize.
|
||||
@discussion If the image is smaller than the size and UIViewContentModeScaleToAspectFill is specified, we suggest the input size so it will be efficiently upscaled on the GPU by the displaying layer at composite time.
|
||||
*/
|
||||
AS_EXTERN void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize,
|
||||
CGSize boundsSize,
|
||||
UIViewContentMode contentMode,
|
||||
CGRect cropRect,
|
||||
BOOL forceUpscaling,
|
||||
CGSize forcedSize,
|
||||
CGSize *outBackingSize,
|
||||
CGRect *outDrawRect
|
||||
);
|
@ -1,123 +0,0 @@
|
||||
//
|
||||
// ASImageNode+CGExtras.mm
|
||||
// Texture
|
||||
//
|
||||
// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
|
||||
// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved.
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import "ASImageNode+CGExtras.h"
|
||||
|
||||
#import <cmath>
|
||||
|
||||
// TODO rewrite these to be closer to the intended use -- take UIViewContentMode as param, CGRect destinationBounds, CGSize sourceSize.
|
||||
static CGSize _ASSizeFillWithAspectRatio(CGFloat aspectRatio, CGSize constraints);
|
||||
static CGSize _ASSizeFitWithAspectRatio(CGFloat aspectRatio, CGSize constraints);
|
||||
|
||||
static CGSize _ASSizeFillWithAspectRatio(CGFloat sizeToScaleAspectRatio, CGSize destinationSize)
|
||||
{
|
||||
CGFloat destinationAspectRatio = destinationSize.width / destinationSize.height;
|
||||
if (sizeToScaleAspectRatio > destinationAspectRatio) {
|
||||
return CGSizeMake(destinationSize.height * sizeToScaleAspectRatio, destinationSize.height);
|
||||
} else {
|
||||
return CGSizeMake(destinationSize.width, round(destinationSize.width / sizeToScaleAspectRatio));
|
||||
}
|
||||
}
|
||||
|
||||
static CGSize _ASSizeFitWithAspectRatio(CGFloat aspectRatio, CGSize constraints)
|
||||
{
|
||||
CGFloat constraintAspectRatio = constraints.width / constraints.height;
|
||||
if (aspectRatio > constraintAspectRatio) {
|
||||
return CGSizeMake(constraints.width, constraints.width / aspectRatio);
|
||||
} else {
|
||||
return CGSizeMake(constraints.height * aspectRatio, constraints.height);
|
||||
}
|
||||
}
|
||||
|
||||
void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize,
|
||||
CGSize boundsSize,
|
||||
UIViewContentMode contentMode,
|
||||
CGRect cropRect,
|
||||
BOOL forceUpscaling,
|
||||
CGSize forcedSize,
|
||||
CGSize *outBackingSize,
|
||||
CGRect *outDrawRect
|
||||
)
|
||||
{
|
||||
|
||||
size_t destinationWidth = boundsSize.width;
|
||||
size_t destinationHeight = boundsSize.height;
|
||||
|
||||
// Often, an image is too low resolution to completely fill the width and height provided.
|
||||
// Per the API contract as commented in the header, we will adjust input parameters (destinationWidth, destinationHeight) to ensure that the image is not upscaled on the CPU.
|
||||
CGFloat boundsAspectRatio = (CGFloat)destinationWidth / (CGFloat)destinationHeight;
|
||||
|
||||
CGSize scaledSizeForImage = sourceImageSize;
|
||||
BOOL cropToRectDimensions = !CGRectIsEmpty(cropRect);
|
||||
|
||||
if (cropToRectDimensions) {
|
||||
scaledSizeForImage = CGSizeMake(boundsSize.width / cropRect.size.width, boundsSize.height / cropRect.size.height);
|
||||
} else {
|
||||
if (contentMode == UIViewContentModeScaleAspectFill)
|
||||
scaledSizeForImage = _ASSizeFillWithAspectRatio(boundsAspectRatio, sourceImageSize);
|
||||
else if (contentMode == UIViewContentModeScaleAspectFit)
|
||||
scaledSizeForImage = _ASSizeFitWithAspectRatio(boundsAspectRatio, sourceImageSize);
|
||||
}
|
||||
|
||||
// If fitting the desired aspect ratio to the image size actually results in a larger buffer, use the input values.
|
||||
// However, if there is a pixel savings (e.g. we would have to upscale the image), override the function arguments.
|
||||
if (CGSizeEqualToSize(CGSizeZero, forcedSize) == NO) {
|
||||
destinationWidth = (size_t)round(forcedSize.width);
|
||||
destinationHeight = (size_t)round(forcedSize.height);
|
||||
} else if (forceUpscaling == NO && (scaledSizeForImage.width * scaledSizeForImage.height) < (destinationWidth * destinationHeight)) {
|
||||
destinationWidth = (size_t)round(scaledSizeForImage.width);
|
||||
destinationHeight = (size_t)round(scaledSizeForImage.height);
|
||||
if (destinationWidth == 0 || destinationHeight == 0) {
|
||||
*outBackingSize = CGSizeZero;
|
||||
*outDrawRect = CGRectZero;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Figure out the scaled size within the destination bounds.
|
||||
CGFloat sourceImageAspectRatio = sourceImageSize.width / sourceImageSize.height;
|
||||
CGSize scaledSizeForDestination = CGSizeMake(destinationWidth, destinationHeight);
|
||||
|
||||
if (cropToRectDimensions) {
|
||||
scaledSizeForDestination = CGSizeMake(boundsSize.width / cropRect.size.width, boundsSize.height / cropRect.size.height);
|
||||
} else {
|
||||
if (contentMode == UIViewContentModeScaleAspectFill)
|
||||
scaledSizeForDestination = _ASSizeFillWithAspectRatio(sourceImageAspectRatio, scaledSizeForDestination);
|
||||
else if (contentMode == UIViewContentModeScaleAspectFit)
|
||||
scaledSizeForDestination = _ASSizeFitWithAspectRatio(sourceImageAspectRatio, scaledSizeForDestination);
|
||||
}
|
||||
|
||||
// Figure out the rectangle into which to draw the image.
|
||||
CGRect drawRect = CGRectZero;
|
||||
if (cropToRectDimensions) {
|
||||
drawRect = CGRectMake(-cropRect.origin.x * scaledSizeForDestination.width,
|
||||
-cropRect.origin.y * scaledSizeForDestination.height,
|
||||
scaledSizeForDestination.width,
|
||||
scaledSizeForDestination.height);
|
||||
} else {
|
||||
// We want to obey the origin of cropRect in aspect-fill mode.
|
||||
if (contentMode == UIViewContentModeScaleAspectFill) {
|
||||
drawRect = CGRectMake(((destinationWidth - scaledSizeForDestination.width) * cropRect.origin.x),
|
||||
((destinationHeight - scaledSizeForDestination.height) * cropRect.origin.y),
|
||||
scaledSizeForDestination.width,
|
||||
scaledSizeForDestination.height);
|
||||
|
||||
}
|
||||
// And otherwise just center it.
|
||||
else {
|
||||
drawRect = CGRectMake(((destinationWidth - scaledSizeForDestination.width) / 2.0),
|
||||
((destinationHeight - scaledSizeForDestination.height) / 2.0),
|
||||
scaledSizeForDestination.width,
|
||||
scaledSizeForDestination.height);
|
||||
}
|
||||
}
|
||||
|
||||
*outDrawRect = drawRect;
|
||||
*outBackingSize = CGSizeMake(destinationWidth, destinationHeight);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
//
|
||||
// ASImageNode+Private.h
|
||||
// Texture
|
||||
//
|
||||
// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
|
||||
// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved.
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
@interface ASImageNode (Private)
|
||||
|
||||
- (void)_locked_setImage:(UIImage *)image;
|
||||
- (UIImage *)_locked_Image;
|
||||
|
||||
@end
|
@ -1,744 +0,0 @@
|
||||
//
|
||||
// ASImageNode.mm
|
||||
// Texture
|
||||
//
|
||||
// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
|
||||
// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved.
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import <AsyncDisplayKit/ASImageNode.h>
|
||||
|
||||
#import <tgmath.h>
|
||||
|
||||
#import <AsyncDisplayKit/_ASDisplayLayer.h>
|
||||
#import <AsyncDisplayKit/ASAssert.h>
|
||||
#import <AsyncDisplayKit/ASDimension.h>
|
||||
#import "ASDisplayNode+FrameworkPrivate.h"
|
||||
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
|
||||
#import <AsyncDisplayKit/ASGraphicsContext.h>
|
||||
#import <AsyncDisplayKit/ASLayout.h>
|
||||
#import "ASImageNode+CGExtras.h"
|
||||
#import <AsyncDisplayKit/ASInternalHelpers.h>
|
||||
#import <AsyncDisplayKit/ASEqualityHelpers.h>
|
||||
#import <AsyncDisplayKit/ASHashing.h>
|
||||
#import "ASWeakMap.h"
|
||||
#import <AsyncDisplayKit/CoreGraphics+ASConvenience.h>
|
||||
#import "_ASCoreAnimationExtras.h"
|
||||
|
||||
// TODO: It would be nice to remove this dependency; it's the only subclass using more than +FrameworkSubclasses.h
|
||||
#import "ASDisplayNodeInternal.h"
|
||||
|
||||
static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0};
|
||||
|
||||
typedef void (^ASImageNodeDrawParametersBlock)(ASWeakMapEntry *entry);
|
||||
|
||||
@interface ASImageNodeDrawParameters : NSObject {
|
||||
@package
|
||||
UIImage *_image;
|
||||
BOOL _opaque;
|
||||
CGRect _bounds;
|
||||
CGFloat _contentsScale;
|
||||
UIColor *_backgroundColor;
|
||||
UIViewContentMode _contentMode;
|
||||
BOOL _cropEnabled;
|
||||
BOOL _forceUpscaling;
|
||||
CGSize _forcedSize;
|
||||
CGRect _cropRect;
|
||||
CGRect _cropDisplayBounds;
|
||||
asimagenode_modification_block_t _imageModificationBlock;
|
||||
ASDisplayNodeContextModifier _willDisplayNodeContentWithRenderingContext;
|
||||
ASDisplayNodeContextModifier _didDisplayNodeContentWithRenderingContext;
|
||||
ASImageNodeDrawParametersBlock _didDrawBlock;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation ASImageNodeDrawParameters
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Contains all data that is needed to generate the content bitmap.
|
||||
*/
|
||||
@interface ASImageNodeContentsKey : NSObject
|
||||
|
||||
@property (nonatomic) UIImage *image;
|
||||
@property CGSize backingSize;
|
||||
@property CGRect imageDrawRect;
|
||||
@property BOOL isOpaque;
|
||||
@property (nonatomic, copy) UIColor *backgroundColor;
|
||||
@property (nonatomic) ASDisplayNodeContextModifier willDisplayNodeContentWithRenderingContext;
|
||||
@property (nonatomic) ASDisplayNodeContextModifier didDisplayNodeContentWithRenderingContext;
|
||||
@property (nonatomic) asimagenode_modification_block_t imageModificationBlock;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ASImageNodeContentsKey
|
||||
|
||||
- (BOOL)isEqual:(id)object
|
||||
{
|
||||
if (self == object) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
// Optimization opportunity: The `isKindOfClass` call here could be avoided by not using the NSObject `isEqual:`
|
||||
// convention and instead using a custom comparison function that assumes all items are heterogeneous.
|
||||
// However, profiling shows that our entire `isKindOfClass` expression is only ~1/40th of the total
|
||||
// overheard of our caching, so it's likely not high-impact.
|
||||
if ([object isKindOfClass:[ASImageNodeContentsKey class]]) {
|
||||
ASImageNodeContentsKey *other = (ASImageNodeContentsKey *)object;
|
||||
return [_image isEqual:other.image]
|
||||
&& CGSizeEqualToSize(_backingSize, other.backingSize)
|
||||
&& CGRectEqualToRect(_imageDrawRect, other.imageDrawRect)
|
||||
&& _isOpaque == other.isOpaque
|
||||
&& [_backgroundColor isEqual:other.backgroundColor]
|
||||
&& _willDisplayNodeContentWithRenderingContext == other.willDisplayNodeContentWithRenderingContext
|
||||
&& _didDisplayNodeContentWithRenderingContext == other.didDisplayNodeContentWithRenderingContext
|
||||
&& _imageModificationBlock == other.imageModificationBlock;
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger)hash
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic warning "-Wpadded"
|
||||
struct {
|
||||
NSUInteger imageHash;
|
||||
CGSize backingSize;
|
||||
CGRect imageDrawRect;
|
||||
NSInteger isOpaque;
|
||||
NSUInteger backgroundColorHash;
|
||||
void *willDisplayNodeContentWithRenderingContext;
|
||||
void *didDisplayNodeContentWithRenderingContext;
|
||||
void *imageModificationBlock;
|
||||
#pragma clang diagnostic pop
|
||||
} data = {
|
||||
_image.hash,
|
||||
_backingSize,
|
||||
_imageDrawRect,
|
||||
_isOpaque,
|
||||
_backgroundColor.hash,
|
||||
(void *)_willDisplayNodeContentWithRenderingContext,
|
||||
(void *)_didDisplayNodeContentWithRenderingContext,
|
||||
(void *)_imageModificationBlock
|
||||
};
|
||||
return ASHashBytes(&data, sizeof(data));
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation ASImageNode
|
||||
{
|
||||
@private
|
||||
UIImage *_image;
|
||||
ASWeakMapEntry *_weakCacheEntry; // Holds a reference that keeps our contents in cache.
|
||||
UIColor *_placeholderColor;
|
||||
|
||||
void (^_displayCompletionBlock)(BOOL canceled);
|
||||
|
||||
// Cropping.
|
||||
BOOL _cropEnabled; // Defaults to YES.
|
||||
BOOL _forceUpscaling; //Defaults to NO.
|
||||
CGSize _forcedSize; //Defaults to CGSizeZero, indicating no forced size.
|
||||
CGRect _cropRect; // Defaults to CGRectMake(0.5, 0.5, 0, 0)
|
||||
CGRect _cropDisplayBounds; // Defaults to CGRectNull
|
||||
}
|
||||
|
||||
@synthesize image = _image;
|
||||
@synthesize imageModificationBlock = _imageModificationBlock;
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
return nil;
|
||||
|
||||
// TODO can this be removed?
|
||||
self.contentsScale = ASScreenScale();
|
||||
self.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.opaque = NO;
|
||||
self.clipsToBounds = YES;
|
||||
|
||||
// If no backgroundColor is set to the image node and it's a subview of UITableViewCell, UITableView is setting
|
||||
// the opaque value of all subviews to YES if highlighting / selection is happening and does not set it back to the
|
||||
// initial value. With setting a explicit backgroundColor we can prevent that change.
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
|
||||
_cropEnabled = YES;
|
||||
_forceUpscaling = NO;
|
||||
_cropRect = CGRectMake(0.5, 0.5, 0, 0);
|
||||
_cropDisplayBounds = CGRectNull;
|
||||
_placeholderColor = ASDisplayNodeDefaultPlaceholderColor();
|
||||
#ifndef MINIMAL_ASDK
|
||||
_animatedImageRunLoopMode = ASAnimatedImageDefaultRunLoopMode;
|
||||
#endif
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
// Invalidate all components around animated images
|
||||
#ifndef MINIMAL_ASDK
|
||||
[self invalidateAnimatedImage];
|
||||
#endif
|
||||
}
|
||||
|
||||
#pragma mark - Placeholder
|
||||
|
||||
- (UIImage *)placeholderImage
|
||||
{
|
||||
// FIXME: Replace this implementation with reusable CALayers that have .backgroundColor set.
|
||||
// This would completely eliminate the memory and performance cost of the backing store.
|
||||
CGSize size = self.calculatedSize;
|
||||
if ((size.width * size.height) < CGFLOAT_EPSILON) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
|
||||
ASGraphicsBeginImageContextWithOptions(size, NO, 1);
|
||||
[self.placeholderColor setFill];
|
||||
UIRectFill(CGRectMake(0, 0, size.width, size.height));
|
||||
UIImage *image = ASGraphicsGetImageAndEndCurrentContext();
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
#pragma mark - Layout and Sizing
|
||||
|
||||
- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
|
||||
{
|
||||
const auto image = ASLockedSelf(_image);
|
||||
|
||||
if (image == nil) {
|
||||
return [super calculateSizeThatFits:constrainedSize];
|
||||
}
|
||||
|
||||
return image.size;
|
||||
}
|
||||
|
||||
#pragma mark - Setter / Getter
|
||||
|
||||
- (void)setImage:(UIImage *)image
|
||||
{
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
[self _locked_setImage:image];
|
||||
}
|
||||
|
||||
- (void)_locked_setImage:(UIImage *)image
|
||||
{
|
||||
ASAssertLocked(__instanceLock__);
|
||||
if (ASObjectIsEqual(_image, image)) {
|
||||
return;
|
||||
}
|
||||
|
||||
UIImage *oldImage = _image;
|
||||
_image = image;
|
||||
|
||||
if (image != nil) {
|
||||
// We explicitly call setNeedsDisplay in this case, although we know setNeedsDisplay will be called with lock held.
|
||||
// Therefore we have to be careful in methods that are involved with setNeedsDisplay to not run into a deadlock
|
||||
[self setNeedsDisplay];
|
||||
|
||||
if (_displayWithoutProcessing && ASDisplayNodeThreadIsMain()) {
|
||||
BOOL stretchable = !UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero);
|
||||
if (stretchable) {
|
||||
ASDisplayNodeSetResizableContents(self, image);
|
||||
} else {
|
||||
self.contents = (id)image.CGImage;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
self.contents = nil;
|
||||
}
|
||||
|
||||
// Destruction of bigger images on the main thread can be expensive
|
||||
// and can take some time, so we dispatch onto a bg queue to
|
||||
// actually dealloc.
|
||||
CGSize oldImageSize = oldImage.size;
|
||||
BOOL shouldReleaseImageOnBackgroundThread = oldImageSize.width > kMinReleaseImageOnBackgroundSize.width
|
||||
|| oldImageSize.height > kMinReleaseImageOnBackgroundSize.height;
|
||||
if (shouldReleaseImageOnBackgroundThread) {
|
||||
ASPerformBackgroundDeallocation(&oldImage);
|
||||
}
|
||||
}
|
||||
|
||||
- (UIImage *)image
|
||||
{
|
||||
return ASLockedSelf(_image);
|
||||
}
|
||||
|
||||
- (UIColor *)placeholderColor
|
||||
{
|
||||
return ASLockedSelf(_placeholderColor);
|
||||
}
|
||||
|
||||
- (void)setPlaceholderColor:(UIColor *)placeholderColor
|
||||
{
|
||||
ASLockScopeSelf();
|
||||
if (ASCompareAssignCopy(_placeholderColor, placeholderColor)) {
|
||||
_placeholderEnabled = (placeholderColor != nil);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Drawing
|
||||
|
||||
- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer
|
||||
{
|
||||
ASLockScopeSelf();
|
||||
|
||||
ASImageNodeDrawParameters *drawParameters = [[ASImageNodeDrawParameters alloc] init];
|
||||
drawParameters->_image = _image;
|
||||
drawParameters->_bounds = [self threadSafeBounds];
|
||||
drawParameters->_opaque = self.opaque;
|
||||
drawParameters->_contentsScale = _contentsScaleForDisplay;
|
||||
drawParameters->_backgroundColor = self.backgroundColor;
|
||||
drawParameters->_contentMode = self.contentMode;
|
||||
drawParameters->_cropEnabled = _cropEnabled;
|
||||
drawParameters->_forceUpscaling = _forceUpscaling;
|
||||
drawParameters->_forcedSize = _forcedSize;
|
||||
drawParameters->_cropRect = _cropRect;
|
||||
drawParameters->_cropDisplayBounds = _cropDisplayBounds;
|
||||
drawParameters->_imageModificationBlock = _imageModificationBlock;
|
||||
drawParameters->_willDisplayNodeContentWithRenderingContext = _willDisplayNodeContentWithRenderingContext;
|
||||
drawParameters->_didDisplayNodeContentWithRenderingContext = _didDisplayNodeContentWithRenderingContext;
|
||||
|
||||
// Hack for now to retain the weak entry that was created while this drawing happened
|
||||
drawParameters->_didDrawBlock = ^(ASWeakMapEntry *entry){
|
||||
ASLockScopeSelf();
|
||||
_weakCacheEntry = entry;
|
||||
};
|
||||
|
||||
return drawParameters;
|
||||
}
|
||||
|
||||
+ (UIImage *)displayWithParameters:(id<NSObject>)parameter isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelled
|
||||
{
|
||||
ASImageNodeDrawParameters *drawParameter = (ASImageNodeDrawParameters *)parameter;
|
||||
|
||||
UIImage *image = drawParameter->_image;
|
||||
if (image == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (true) {
|
||||
return image;
|
||||
}
|
||||
|
||||
CGRect drawParameterBounds = drawParameter->_bounds;
|
||||
BOOL forceUpscaling = drawParameter->_forceUpscaling;
|
||||
CGSize forcedSize = drawParameter->_forcedSize;
|
||||
BOOL cropEnabled = drawParameter->_cropEnabled;
|
||||
BOOL isOpaque = drawParameter->_opaque;
|
||||
UIColor *backgroundColor = drawParameter->_backgroundColor;
|
||||
UIViewContentMode contentMode = drawParameter->_contentMode;
|
||||
CGFloat contentsScale = drawParameter->_contentsScale;
|
||||
CGRect cropDisplayBounds = drawParameter->_cropDisplayBounds;
|
||||
CGRect cropRect = drawParameter->_cropRect;
|
||||
asimagenode_modification_block_t imageModificationBlock = drawParameter->_imageModificationBlock;
|
||||
ASDisplayNodeContextModifier willDisplayNodeContentWithRenderingContext = drawParameter->_willDisplayNodeContentWithRenderingContext;
|
||||
ASDisplayNodeContextModifier didDisplayNodeContentWithRenderingContext = drawParameter->_didDisplayNodeContentWithRenderingContext;
|
||||
|
||||
BOOL hasValidCropBounds = cropEnabled && !CGRectIsEmpty(cropDisplayBounds);
|
||||
CGRect bounds = (hasValidCropBounds ? cropDisplayBounds : drawParameterBounds);
|
||||
|
||||
|
||||
ASDisplayNodeAssert(contentsScale > 0, @"invalid contentsScale at display time");
|
||||
|
||||
// if the image is resizable, bail early since the image has likely already been configured
|
||||
BOOL stretchable = !UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero);
|
||||
if (stretchable) {
|
||||
if (imageModificationBlock != NULL) {
|
||||
image = imageModificationBlock(image);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
CGSize imageSize = image.size;
|
||||
CGSize imageSizeInPixels = CGSizeMake(imageSize.width * image.scale, imageSize.height * image.scale);
|
||||
CGSize boundsSizeInPixels = CGSizeMake(std::floor(bounds.size.width * contentsScale), std::floor(bounds.size.height * contentsScale));
|
||||
|
||||
BOOL contentModeSupported = contentMode == UIViewContentModeScaleAspectFill ||
|
||||
contentMode == UIViewContentModeScaleAspectFit ||
|
||||
contentMode == UIViewContentModeCenter;
|
||||
|
||||
CGSize backingSize = CGSizeZero;
|
||||
CGRect imageDrawRect = CGRectZero;
|
||||
|
||||
if (boundsSizeInPixels.width * contentsScale < 1.0f || boundsSizeInPixels.height * contentsScale < 1.0f ||
|
||||
imageSizeInPixels.width < 1.0f || imageSizeInPixels.height < 1.0f) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
// If we're not supposed to do any cropping, just decode image at original size
|
||||
if (!cropEnabled || !contentModeSupported || stretchable) {
|
||||
backingSize = imageSizeInPixels;
|
||||
imageDrawRect = (CGRect){.size = backingSize};
|
||||
} else {
|
||||
if (CGSizeEqualToSize(CGSizeZero, forcedSize) == NO) {
|
||||
//scale forced size
|
||||
forcedSize.width *= contentsScale;
|
||||
forcedSize.height *= contentsScale;
|
||||
}
|
||||
ASCroppedImageBackingSizeAndDrawRectInBounds(imageSizeInPixels,
|
||||
boundsSizeInPixels,
|
||||
contentMode,
|
||||
cropRect,
|
||||
forceUpscaling,
|
||||
forcedSize,
|
||||
&backingSize,
|
||||
&imageDrawRect);
|
||||
}
|
||||
|
||||
if (backingSize.width <= 0.0f || backingSize.height <= 0.0f ||
|
||||
imageDrawRect.size.width <= 0.0f || imageDrawRect.size.height <= 0.0f) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
ASImageNodeContentsKey *contentsKey = [[ASImageNodeContentsKey alloc] init];
|
||||
contentsKey.image = image;
|
||||
contentsKey.backingSize = backingSize;
|
||||
contentsKey.imageDrawRect = imageDrawRect;
|
||||
contentsKey.isOpaque = isOpaque;
|
||||
contentsKey.backgroundColor = backgroundColor;
|
||||
contentsKey.willDisplayNodeContentWithRenderingContext = willDisplayNodeContentWithRenderingContext;
|
||||
contentsKey.didDisplayNodeContentWithRenderingContext = didDisplayNodeContentWithRenderingContext;
|
||||
contentsKey.imageModificationBlock = imageModificationBlock;
|
||||
|
||||
if (isCancelled()) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
ASWeakMapEntry<UIImage *> *entry = [self.class contentsForkey:contentsKey
|
||||
drawParameters:parameter
|
||||
isCancelled:isCancelled];
|
||||
// If nil, we were cancelled.
|
||||
if (entry == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (drawParameter->_didDrawBlock) {
|
||||
drawParameter->_didDrawBlock(entry);
|
||||
}
|
||||
|
||||
return entry.value;
|
||||
}
|
||||
|
||||
static ASWeakMap<ASImageNodeContentsKey *, UIImage *> *cache = nil;
|
||||
|
||||
+ (ASWeakMapEntry *)contentsForkey:(ASImageNodeContentsKey *)key drawParameters:(id)drawParameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelled
|
||||
{
|
||||
static dispatch_once_t onceToken;
|
||||
static AS::Mutex *cacheLock = nil;
|
||||
dispatch_once(&onceToken, ^{
|
||||
cacheLock = new AS::Mutex();
|
||||
});
|
||||
|
||||
{
|
||||
AS::MutexLocker l(*cacheLock);
|
||||
if (!cache) {
|
||||
cache = [[ASWeakMap alloc] init];
|
||||
}
|
||||
ASWeakMapEntry *entry = [cache entryForKey:key];
|
||||
if (entry != nil) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
// cache miss
|
||||
UIImage *contents = [self createContentsForkey:key drawParameters:drawParameters isCancelled:isCancelled];
|
||||
if (contents == nil) { // If nil, we were cancelled
|
||||
return nil;
|
||||
}
|
||||
|
||||
{
|
||||
AS::MutexLocker l(*cacheLock);
|
||||
return [cache setObject:contents forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
+ (UIImage *)createContentsForkey:(ASImageNodeContentsKey *)key drawParameters:(id)drawParameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelled
|
||||
{
|
||||
// The following `ASGraphicsBeginImageContextWithOptions` call will sometimes take take longer than 5ms on an
|
||||
// A5 processor for a 400x800 backingSize.
|
||||
// Check for cancellation before we call it.
|
||||
if (isCancelled()) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Use contentsScale of 1.0 and do the contentsScale handling in boundsSizeInPixels so ASCroppedImageBackingSizeAndDrawRectInBounds
|
||||
// will do its rounding on pixel instead of point boundaries
|
||||
ASGraphicsBeginImageContextWithOptions(key.backingSize, key.isOpaque, 1.0);
|
||||
|
||||
BOOL contextIsClean = YES;
|
||||
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
if (context && key.willDisplayNodeContentWithRenderingContext) {
|
||||
key.willDisplayNodeContentWithRenderingContext(context, drawParameters);
|
||||
contextIsClean = NO;
|
||||
}
|
||||
|
||||
// if view is opaque, fill the context with background color
|
||||
if (key.isOpaque && key.backgroundColor) {
|
||||
[key.backgroundColor setFill];
|
||||
UIRectFill({ .size = key.backingSize });
|
||||
contextIsClean = NO;
|
||||
}
|
||||
|
||||
// iOS 9 appears to contain a thread safety regression when drawing the same CGImageRef on
|
||||
// multiple threads concurrently. In fact, instead of crashing, it appears to deadlock.
|
||||
// The issue is present in Mac OS X El Capitan and has been seen hanging Pro apps like Adobe Premiere,
|
||||
// as well as iOS games, and a small number of ASDK apps that provide the same image reference
|
||||
// to many separate ASImageNodes. A workaround is to set .displaysAsynchronously = NO for the nodes
|
||||
// that may get the same pointer for a given UI asset image, etc.
|
||||
// FIXME: We should replace @synchronized here, probably using a global, locked NSMutableSet, and
|
||||
// only if the object already exists in the set we should create a semaphore to signal waiting threads
|
||||
// upon removal of the object from the set when the operation completes.
|
||||
// Another option is to have ASDisplayNode+AsyncDisplay coordinate these cases, and share the decoded buffer.
|
||||
// Details tracked in https://github.com/facebook/AsyncDisplayKit/issues/1068
|
||||
|
||||
UIImage *image = key.image;
|
||||
BOOL canUseCopy = (contextIsClean || ASImageAlphaInfoIsOpaque(CGImageGetAlphaInfo(image.CGImage)));
|
||||
CGBlendMode blendMode = canUseCopy ? kCGBlendModeCopy : kCGBlendModeNormal;
|
||||
|
||||
@synchronized(image) {
|
||||
[image drawInRect:key.imageDrawRect blendMode:blendMode alpha:1];
|
||||
}
|
||||
|
||||
if (context && key.didDisplayNodeContentWithRenderingContext) {
|
||||
key.didDisplayNodeContentWithRenderingContext(context, drawParameters);
|
||||
}
|
||||
|
||||
// Check cancellation one last time before forming image.
|
||||
if (isCancelled()) {
|
||||
ASGraphicsEndImageContext();
|
||||
return nil;
|
||||
}
|
||||
|
||||
UIImage *result = ASGraphicsGetImageAndEndCurrentContext();
|
||||
|
||||
if (key.imageModificationBlock) {
|
||||
result = key.imageModificationBlock(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)displayDidFinish
|
||||
{
|
||||
[super displayDidFinish];
|
||||
|
||||
__instanceLock__.lock();
|
||||
UIImage *image = _image;
|
||||
void (^displayCompletionBlock)(BOOL canceled) = _displayCompletionBlock;
|
||||
BOOL shouldPerformDisplayCompletionBlock = (image && displayCompletionBlock);
|
||||
|
||||
// Clear the ivar now. The block is retained and will be executed shortly.
|
||||
if (shouldPerformDisplayCompletionBlock) {
|
||||
_displayCompletionBlock = nil;
|
||||
}
|
||||
|
||||
__instanceLock__.unlock();
|
||||
|
||||
// If we've got a block to perform after displaying, do it.
|
||||
if (shouldPerformDisplayCompletionBlock) {
|
||||
displayCompletionBlock(NO);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setNeedsDisplayWithCompletion:(void (^ _Nullable)(BOOL canceled))displayCompletionBlock
|
||||
{
|
||||
if (self.displaySuspended) {
|
||||
if (displayCompletionBlock)
|
||||
displayCompletionBlock(YES);
|
||||
return;
|
||||
}
|
||||
|
||||
// Stash the block and call-site queue. We'll invoke it in -displayDidFinish.
|
||||
{
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
if (_displayCompletionBlock != displayCompletionBlock) {
|
||||
_displayCompletionBlock = displayCompletionBlock;
|
||||
}
|
||||
}
|
||||
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
#pragma mark Interface State
|
||||
|
||||
- (void)clearContents
|
||||
{
|
||||
[super clearContents];
|
||||
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
_weakCacheEntry = nil; // release contents from the cache.
|
||||
}
|
||||
|
||||
#pragma mark - Cropping
|
||||
|
||||
- (BOOL)isCropEnabled
|
||||
{
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
return _cropEnabled;
|
||||
}
|
||||
|
||||
- (void)setCropEnabled:(BOOL)cropEnabled
|
||||
{
|
||||
[self setCropEnabled:cropEnabled recropImmediately:NO inBounds:self.bounds];
|
||||
}
|
||||
|
||||
- (void)setCropEnabled:(BOOL)cropEnabled recropImmediately:(BOOL)recropImmediately inBounds:(CGRect)cropBounds
|
||||
{
|
||||
__instanceLock__.lock();
|
||||
if (_cropEnabled == cropEnabled) {
|
||||
__instanceLock__.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
_cropEnabled = cropEnabled;
|
||||
_cropDisplayBounds = cropBounds;
|
||||
|
||||
UIImage *image = _image;
|
||||
__instanceLock__.unlock();
|
||||
|
||||
// If we have an image to display, display it, respecting our recrop flag.
|
||||
if (image != nil) {
|
||||
ASPerformBlockOnMainThread(^{
|
||||
if (recropImmediately)
|
||||
[self displayImmediately];
|
||||
else
|
||||
[self setNeedsDisplay];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (CGRect)cropRect
|
||||
{
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
return _cropRect;
|
||||
}
|
||||
|
||||
- (void)setCropRect:(CGRect)cropRect
|
||||
{
|
||||
{
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
if (CGRectEqualToRect(_cropRect, cropRect)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_cropRect = cropRect;
|
||||
}
|
||||
|
||||
// TODO: this logic needs to be updated to respect cropRect.
|
||||
CGSize boundsSize = self.bounds.size;
|
||||
CGSize imageSize = self.image.size;
|
||||
|
||||
BOOL isCroppingImage = ((boundsSize.width < imageSize.width) || (boundsSize.height < imageSize.height));
|
||||
|
||||
// Re-display if we need to.
|
||||
ASPerformBlockOnMainThread(^{
|
||||
if (self.nodeLoaded && self.contentMode == UIViewContentModeScaleAspectFill && isCroppingImage)
|
||||
[self setNeedsDisplay];
|
||||
});
|
||||
}
|
||||
|
||||
- (BOOL)forceUpscaling
|
||||
{
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
return _forceUpscaling;
|
||||
}
|
||||
|
||||
- (void)setForceUpscaling:(BOOL)forceUpscaling
|
||||
{
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
_forceUpscaling = forceUpscaling;
|
||||
}
|
||||
|
||||
- (CGSize)forcedSize
|
||||
{
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
return _forcedSize;
|
||||
}
|
||||
|
||||
- (void)setForcedSize:(CGSize)forcedSize
|
||||
{
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
_forcedSize = forcedSize;
|
||||
}
|
||||
|
||||
- (asimagenode_modification_block_t)imageModificationBlock
|
||||
{
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
return _imageModificationBlock;
|
||||
}
|
||||
|
||||
- (void)setImageModificationBlock:(asimagenode_modification_block_t)imageModificationBlock
|
||||
{
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
_imageModificationBlock = imageModificationBlock;
|
||||
}
|
||||
|
||||
#pragma mark - Debug
|
||||
|
||||
- (void)layout
|
||||
{
|
||||
[super layout];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - Extras
|
||||
|
||||
asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor *borderColor)
|
||||
{
|
||||
return ^(UIImage *originalImage) {
|
||||
ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale);
|
||||
UIBezierPath *roundOutline = [UIBezierPath bezierPathWithOvalInRect:(CGRect){CGPointZero, originalImage.size}];
|
||||
|
||||
// Make the image round
|
||||
[roundOutline addClip];
|
||||
|
||||
// Draw the original image
|
||||
[originalImage drawAtPoint:CGPointZero blendMode:kCGBlendModeCopy alpha:1];
|
||||
|
||||
// Draw a border on top.
|
||||
if (borderWidth > 0.0) {
|
||||
[borderColor setStroke];
|
||||
[roundOutline setLineWidth:borderWidth];
|
||||
[roundOutline stroke];
|
||||
}
|
||||
|
||||
return ASGraphicsGetImageAndEndCurrentContext();
|
||||
};
|
||||
}
|
||||
|
||||
asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color)
|
||||
{
|
||||
return ^(UIImage *originalImage) {
|
||||
ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale);
|
||||
|
||||
// Set color and render template
|
||||
[color setFill];
|
||||
UIImage *templateImage = [originalImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
[templateImage drawAtPoint:CGPointZero blendMode:kCGBlendModeCopy alpha:1];
|
||||
|
||||
UIImage *modifiedImage = ASGraphicsGetImageAndEndCurrentContext();
|
||||
|
||||
// if the original image was stretchy, keep it stretchy
|
||||
if (!UIEdgeInsetsEqualToEdgeInsets(originalImage.capInsets, UIEdgeInsetsZero)) {
|
||||
modifiedImage = [modifiedImage resizableImageWithCapInsets:originalImage.capInsets resizingMode:originalImage.resizingMode];
|
||||
}
|
||||
|
||||
return modifiedImage;
|
||||
};
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import "ASInternalHelpers.h"
|
||||
#import <AsyncDisplayKit/ASInternalHelpers.h>
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import "ASDisplayNode+FrameworkPrivate.h"
|
||||
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
|
||||
#import <AsyncDisplayKit/ASAvailability.h>
|
||||
#import <AsyncDisplayKit/ASLayout.h>
|
||||
#import <AsyncDisplayKit/ASLayoutElement.h>
|
||||
|
@ -10,7 +10,7 @@
|
||||
#import "ASMainSerialQueue.h"
|
||||
|
||||
#import <AsyncDisplayKit/ASThread.h>
|
||||
#import "ASInternalHelpers.h"
|
||||
#import <AsyncDisplayKit/ASInternalHelpers.h>
|
||||
|
||||
@interface ASMainSerialQueue ()
|
||||
{
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#import <AsyncDisplayKit/ASBaseDefines.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
|
||||
#import "ASInternalHelpers.h"
|
||||
#import <AsyncDisplayKit/ASInternalHelpers.h>
|
||||
#import <AsyncDisplayKit/ASThread.h>
|
||||
|
||||
#import <objc/runtime.h>
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import "ASRecursiveUnfairLock.h"
|
||||
#import <AsyncDisplayKit/ASRecursiveUnfairLock.h>
|
||||
|
||||
#import <stdatomic.h>
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#import <AsyncDisplayKit/ASScrollNode.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
|
||||
#import "ASDisplayNode+FrameworkPrivate.h"
|
||||
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNode+Beta.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
|
||||
#import <AsyncDisplayKit/ASLayout.h>
|
||||
|
@ -1,219 +0,0 @@
|
||||
//
|
||||
// ASImageNode.h
|
||||
// Texture
|
||||
//
|
||||
// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
|
||||
// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved.
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <AsyncDisplayKit/ASControlNode.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#ifndef MINIMAL_ASDK
|
||||
@protocol ASAnimatedImageProtocol;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Image modification block. Use to transform an image before display.
|
||||
*
|
||||
* @param image The image to be displayed.
|
||||
*
|
||||
* @return A transformed image.
|
||||
*/
|
||||
typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image);
|
||||
|
||||
|
||||
/**
|
||||
* @abstract Draws images.
|
||||
* @discussion Supports cropping, tinting, and arbitrary image modification blocks.
|
||||
*/
|
||||
@interface ASImageNode : ASControlNode
|
||||
|
||||
/**
|
||||
* @abstract The image to display.
|
||||
*
|
||||
* @discussion The node will efficiently display stretchable images by using
|
||||
* the layer's contentsCenter property. Non-stretchable images work too, of
|
||||
* course.
|
||||
*/
|
||||
@property (nullable) UIImage *image;
|
||||
|
||||
/**
|
||||
@abstract The placeholder color.
|
||||
*/
|
||||
@property (nullable, copy) UIColor *placeholderColor;
|
||||
|
||||
/**
|
||||
* @abstract Indicates whether efficient cropping of the receiver is enabled.
|
||||
*
|
||||
* @discussion Defaults to YES. See -setCropEnabled:recropImmediately:inBounds: for more
|
||||
* information.
|
||||
*/
|
||||
@property (getter=isCropEnabled) BOOL cropEnabled;
|
||||
|
||||
/**
|
||||
* @abstract Indicates that efficient downsizing of backing store should *not* be enabled.
|
||||
*
|
||||
* @discussion Defaults to NO. @see ASCroppedImageBackingSizeAndDrawRectInBounds for more
|
||||
* information.
|
||||
*/
|
||||
@property BOOL forceUpscaling;
|
||||
|
||||
@property (nonatomic, assign) BOOL displayWithoutProcessing;
|
||||
|
||||
/**
|
||||
* @abstract Forces image to be rendered at forcedSize.
|
||||
* @discussion Defaults to CGSizeZero to indicate that the forcedSize should not be used.
|
||||
* Setting forcedSize to non-CGSizeZero will force the backing of the layer contents to
|
||||
* be forcedSize (automatically adjusted for contentsSize).
|
||||
*/
|
||||
@property CGSize forcedSize;
|
||||
|
||||
/**
|
||||
* @abstract Enables or disables efficient cropping.
|
||||
*
|
||||
* @param cropEnabled YES to efficiently crop the receiver's contents such that
|
||||
* contents outside of its bounds are not included; NO otherwise.
|
||||
*
|
||||
* @param recropImmediately If the receiver has an image, YES to redisplay the
|
||||
* receiver immediately; NO otherwise.
|
||||
*
|
||||
* @param cropBounds The bounds into which the receiver will be cropped. Useful
|
||||
* if bounds are to change in response to cropping (but have not yet done so).
|
||||
*
|
||||
* @discussion Efficient cropping is only performed when the receiver's view's
|
||||
* contentMode is UIViewContentModeScaleAspectFill. By default, cropping is
|
||||
* enabled. The crop alignment may be controlled via cropAlignmentFactor.
|
||||
*/
|
||||
- (void)setCropEnabled:(BOOL)cropEnabled recropImmediately:(BOOL)recropImmediately inBounds:(CGRect)cropBounds;
|
||||
|
||||
/**
|
||||
* @abstract A value that controls how the receiver's efficient cropping is aligned.
|
||||
*
|
||||
* @discussion This value defines a rectangle that is to be featured by the
|
||||
* receiver. The rectangle is specified as a "unit rectangle," using
|
||||
* fractions of the source image's width and height, e.g. CGRectMake(0.5, 0,
|
||||
* 0.5, 1.0) will feature the full right half a photo. If the cropRect is
|
||||
* empty, the content mode of the receiver will be used to determine its
|
||||
* dimensions, and only the cropRect's origin will be used for positioning. The
|
||||
* default value of this property is CGRectMake(0.5, 0.5, 0.0, 0.0).
|
||||
*/
|
||||
@property CGRect cropRect;
|
||||
|
||||
/**
|
||||
* @abstract An optional block which can perform drawing operations on image
|
||||
* during the display phase.
|
||||
*
|
||||
* @discussion Can be used to add image effects (such as rounding, adding
|
||||
* borders, or other pattern overlays) without extraneous display calls.
|
||||
*/
|
||||
@property (nullable) asimagenode_modification_block_t imageModificationBlock;
|
||||
|
||||
/**
|
||||
* @abstract Marks the receiver as needing display and performs a block after
|
||||
* display has finished.
|
||||
*
|
||||
* @param displayCompletionBlock The block to be performed after display has
|
||||
* finished. Its `canceled` property will be YES if display was prevented or
|
||||
* canceled (via displaySuspended); NO otherwise.
|
||||
*
|
||||
* @discussion displayCompletionBlock will be performed on the main-thread. If
|
||||
* `displaySuspended` is YES, `displayCompletionBlock` is will be
|
||||
* performed immediately and `YES` will be passed for `canceled`.
|
||||
*/
|
||||
- (void)setNeedsDisplayWithCompletion:(nullable void (^)(BOOL canceled))displayCompletionBlock;
|
||||
|
||||
#if TARGET_OS_TV
|
||||
/**
|
||||
* A bool to track if the current appearance of the node
|
||||
* is the default focus appearance.
|
||||
* Exposed here so the category methods can set it.
|
||||
*/
|
||||
@property BOOL isDefaultFocusAppearance;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
#if TARGET_OS_TV
|
||||
@interface ASImageNode (tvOS)
|
||||
@end
|
||||
#endif
|
||||
|
||||
#ifndef MINIMAL_ASDK
|
||||
@interface ASImageNode (AnimatedImage)
|
||||
|
||||
/**
|
||||
* @abstract The animated image to playback
|
||||
*
|
||||
* @discussion Set this to an object which conforms to ASAnimatedImageProtocol
|
||||
* to have the ASImageNode playback an animated image.
|
||||
* @warning this method should not be overridden, it may not always be called as
|
||||
* another method is used internally. If you need to know when the animatedImage
|
||||
* is set, override @c animatedImageSet:previousAnimatedImage:
|
||||
*/
|
||||
@property (nullable) id <ASAnimatedImageProtocol> animatedImage;
|
||||
|
||||
/**
|
||||
* @abstract Pause the playback of an animated image.
|
||||
*
|
||||
* @discussion Set to YES to pause playback of an animated image and NO to resume
|
||||
* playback.
|
||||
*/
|
||||
@property BOOL animatedImagePaused;
|
||||
|
||||
/**
|
||||
* @abstract The runloop mode used to animate the image.
|
||||
*
|
||||
* @discussion Defaults to NSRunLoopCommonModes. Another commonly used mode is NSDefaultRunLoopMode.
|
||||
* Setting NSDefaultRunLoopMode will cause animation to pause while scrolling (if the ASImageNode is
|
||||
* in a scroll view), which may improve scroll performance in some use cases.
|
||||
*/
|
||||
@property (copy) NSString *animatedImageRunLoopMode;
|
||||
|
||||
/**
|
||||
* @abstract Method called when animated image has been set
|
||||
*
|
||||
* @discussion This method is for subclasses to override so they can know if an animated image
|
||||
* has been set on the node.
|
||||
*/
|
||||
- (void)animatedImageSet:(nullable id <ASAnimatedImageProtocol>)newAnimatedImage previousAnimatedImage:(nullable id <ASAnimatedImageProtocol>)previousAnimatedImage ASDISPLAYNODE_REQUIRES_SUPER;
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface ASImageNode (Unavailable)
|
||||
|
||||
- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock AS_UNAVAILABLE();
|
||||
|
||||
- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock AS_UNAVAILABLE();
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* @abstract Image modification block that rounds (and optionally adds a border to) an image.
|
||||
*
|
||||
* @param borderWidth The width of the round border to draw, or zero if no border is desired.
|
||||
* @param borderColor What colour border to draw.
|
||||
*
|
||||
* @see <imageModificationBlock>
|
||||
*
|
||||
* @return An ASImageNode image modification block.
|
||||
*/
|
||||
AS_EXTERN asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor * _Nullable borderColor);
|
||||
|
||||
/**
|
||||
* @abstract Image modification block that applies a tint color à la UIImage configured with
|
||||
* renderingMode set to UIImageRenderingModeAlwaysTemplate.
|
||||
*
|
||||
* @param color The color to tint the image.
|
||||
*
|
||||
* @see <imageModificationBlock>
|
||||
*
|
||||
* @return An ASImageNode image modification block.
|
||||
*/
|
||||
AS_EXTERN asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -22,7 +22,6 @@
|
||||
#import <AsyncDisplayKit/ASConfigurationInternal.h>
|
||||
|
||||
#import <AsyncDisplayKit/ASControlNode.h>
|
||||
#import <AsyncDisplayKit/ASImageNode.h>
|
||||
#import <AsyncDisplayKit/ASEditableTextNode.h>
|
||||
|
||||
#import <AsyncDisplayKit/ASScrollNode.h>
|
||||
|
@ -7,7 +7,7 @@
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import "UIResponder+AsyncDisplayKit.h"
|
||||
#import <AsyncDisplayKit/UIResponder+AsyncDisplayKit.h>
|
||||
|
||||
#import <AsyncDisplayKit/ASAssert.h>
|
||||
#import <AsyncDisplayKit/ASBaseDefines.h>
|
||||
|
@ -12,7 +12,7 @@
|
||||
#import <AsyncDisplayKit/_ASDisplayView.h>
|
||||
#import <AsyncDisplayKit/ASAvailability.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
|
||||
#import "ASDisplayNode+FrameworkPrivate.h"
|
||||
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
|
||||
#import "ASDisplayNodeInternal.h"
|
||||
|
||||
#import <queue>
|
||||
|
@ -7,7 +7,7 @@
|
||||
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import "_ASTransitionContext.h"
|
||||
#import <AsyncDisplayKit/_ASTransitionContext.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNode.h>
|
||||
#import <AsyncDisplayKit/ASLayout.h>
|
||||
|
||||
|
@ -1,8 +1,3 @@
|
||||
load(
|
||||
"@rules_apple_extras//apple:objc_library.bzl",
|
||||
"objc_library",
|
||||
)
|
||||
|
||||
load(
|
||||
"@bazel_skylib//rules:common_settings.bzl",
|
||||
"string_flag",
|
||||
|
17
submodules/Camera/BUILD
Normal file
17
submodules/Camera/BUILD
Normal file
@ -0,0 +1,17 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "Camera",
|
||||
module_name = "Camera",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -1,9 +1,6 @@
|
||||
load(
|
||||
"@rules_apple_extras//apple:objc_library.bzl",
|
||||
"my_swift_library",
|
||||
)
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
my_swift_library(
|
||||
swift_library(
|
||||
name = "Display",
|
||||
module_name = "Display",
|
||||
srcs = glob([
|
||||
@ -17,9 +14,6 @@ my_swift_library(
|
||||
"//submodules/Markdown:Markdown",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
],
|
||||
copts = [
|
||||
"-Isubmodules/AsyncDisplayKit/Source/PublicHeaders",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
|
@ -15,6 +15,8 @@ open class ASImageNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
public var displayWithoutProcessing: Bool = true
|
||||
|
||||
override public init() {
|
||||
super.init()
|
||||
|
||||
|
16
submodules/GlassButtonNode/BUILD
Normal file
16
submodules/GlassButtonNode/BUILD
Normal file
@ -0,0 +1,16 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "GlassButtonNode",
|
||||
module_name = "GlassButtonNode",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -72,7 +72,7 @@ public final class GlassButtonNode: HighlightTrackingButtonNode {
|
||||
|
||||
private let blurView: UIVisualEffectView
|
||||
private let iconNode: ASImageNode
|
||||
private var labelNode: ASTextNode?
|
||||
private var labelNode: ImmediateTextNode?
|
||||
|
||||
public init(icon: UIImage, label: String?) {
|
||||
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
|
||||
@ -90,7 +90,7 @@ public final class GlassButtonNode: HighlightTrackingButtonNode {
|
||||
self.filledImage = generateEmptyButtonImage(icon: icon, strokeColor: nil, fillColor: invertedFill, knockout: true, buttonSize: largeButtonSize)
|
||||
|
||||
if let label = label {
|
||||
let labelNode = ASTextNode()
|
||||
let labelNode = ImmediateTextNode()
|
||||
let labelFont: UIFont
|
||||
if let image = regularImage, image.size.width < 70.0 {
|
||||
labelFont = smallLabelFont
|
||||
@ -165,7 +165,7 @@ public final class GlassButtonNode: HighlightTrackingButtonNode {
|
||||
self.iconNode.frame = self.bounds
|
||||
|
||||
if let labelNode = self.labelNode {
|
||||
let labelSize = labelNode.measure(CGSize(width: 200.0, height: 100.0))
|
||||
let labelSize = labelNode.updateLayout(CGSize(width: 200.0, height: 100.0))
|
||||
let offset: CGFloat
|
||||
if size.width < 70.0 {
|
||||
offset = 65.0
|
||||
|
15
submodules/LocalAuth/BUILD
Normal file
15
submodules/LocalAuth/BUILD
Normal file
@ -0,0 +1,15 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "LocalAuth",
|
||||
module_name = "LocalAuth",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
12
submodules/MergeLists/BUILD
Normal file
12
submodules/MergeLists/BUILD
Normal file
@ -0,0 +1,12 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "MergeLists",
|
||||
module_name = "MergeLists",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
21
submodules/NumberPluralizationForm/BUILD
Normal file
21
submodules/NumberPluralizationForm/BUILD
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
objc_library(
|
||||
name = "NumberPluralizationForm",
|
||||
enable_modules = True,
|
||||
module_name = "NumberPluralizationForm",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"PublicHeaders",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Foundation",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
#import "NumberPluralizationForm.h"
|
||||
#import <NumberPluralizationForm/NumberPluralizationForm.h>
|
||||
|
||||
NumberPluralizationForm numberPluralizationForm(unsigned int lc, int n) {
|
||||
switch (lc) {
|
@ -1,8 +1,3 @@
|
||||
load(
|
||||
"@rules_apple_extras//apple:objc_library.bzl",
|
||||
"objc_library",
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "OpenSSLEncryptionProvider",
|
||||
srcs = glob([
|
||||
|
17
submodules/ProgressNavigationButtonNode/BUILD
Normal file
17
submodules/ProgressNavigationButtonNode/BUILD
Normal file
@ -0,0 +1,17 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "ProgressNavigationButtonNode",
|
||||
module_name = "ProgressNavigationButtonNode",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/ActivityIndicator:ActivityIndicator",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
16
submodules/QrCode/BUILD
Normal file
16
submodules/QrCode/BUILD
Normal file
@ -0,0 +1,16 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "QrCode",
|
||||
module_name = "QrCode",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Display:Display",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
15
submodules/ScreenCaptureDetection/BUILD
Normal file
15
submodules/ScreenCaptureDetection/BUILD
Normal file
@ -0,0 +1,15 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "ScreenCaptureDetection",
|
||||
module_name = "ScreenCaptureDetection",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -46,7 +46,6 @@ public final class SolidRoundedButtonNode: ASDisplayNode {
|
||||
|
||||
self.buttonBackgroundNode = ASImageNode()
|
||||
self.buttonBackgroundNode.isLayerBacked = true
|
||||
self.buttonBackgroundNode.displayWithoutProcessing = true
|
||||
self.buttonBackgroundNode.displaysAsynchronously = false
|
||||
self.buttonBackgroundNode.image = generateStretchableFilledCircleImage(radius: cornerRadius, color: theme.backgroundColor)
|
||||
|
||||
@ -58,7 +57,6 @@ public final class SolidRoundedButtonNode: ASDisplayNode {
|
||||
self.labelNode.isUserInteractionEnabled = false
|
||||
|
||||
self.iconNode = ASImageNode()
|
||||
self.iconNode.displayWithoutProcessing = true
|
||||
self.iconNode.displaysAsynchronously = false
|
||||
self.iconNode.image = icon
|
||||
|
||||
|
16
submodules/StringPluralization/BUILD
Normal file
16
submodules/StringPluralization/BUILD
Normal file
@ -0,0 +1,16 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "StringPluralization",
|
||||
module_name = "StringPluralization",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/NumberPluralizationForm:NumberPluralizationForm",
|
||||
"//submodules/AppBundle:AppBundle",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -1,4 +1,5 @@
|
||||
import Foundation
|
||||
import NumberPluralizationForm
|
||||
|
||||
public enum PluralizationForm: Int32 {
|
||||
case zero = 0
|
||||
|
@ -1,8 +1,3 @@
|
||||
load(
|
||||
"@rules_apple_extras//apple:objc_library.bzl",
|
||||
"objc_library",
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "TonBinding",
|
||||
module_name = "TonBinding",
|
||||
@ -17,6 +12,9 @@ objc_library(
|
||||
copts = [
|
||||
"-std=c++14",
|
||||
],
|
||||
includes = [
|
||||
"Sources",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SSignalKit:SSignalKit",
|
||||
"//submodules/openssl:openssl",
|
||||
|
12
submodules/UrlEscaping/BUILD
Normal file
12
submodules/UrlEscaping/BUILD
Normal file
@ -0,0 +1,12 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "UrlEscaping",
|
||||
module_name = "UrlEscaping",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -1,9 +1,6 @@
|
||||
load(
|
||||
"@rules_apple_extras//apple:objc_library.bzl",
|
||||
"my_swift_library",
|
||||
)
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
my_swift_library(
|
||||
swift_library(
|
||||
name = "WalletCore",
|
||||
module_name = "WalletCore",
|
||||
srcs = glob([
|
||||
|
@ -37,13 +37,13 @@ swift_library(
|
||||
"//submodules/UrlEscaping:UrlEscaping",
|
||||
"//submodules/LocalAuth:LocalAuth",
|
||||
"//submodules/ScreenCaptureDetection:ScreenCaptureDetection",
|
||||
"//submodules/AnimatedStickerNode:AnimatedStickerNode",
|
||||
"//submodules/WalletUrl:WalletUrl",
|
||||
"//submodules/WalletCore:WalletCore",
|
||||
"//submodules/StringPluralization:StringPluralization",
|
||||
"//submodules/ActivityIndicator:ActivityIndicator",
|
||||
"//submodules/ProgressNavigationButtonNode:ProgressNavigationButtonNode",
|
||||
"//submodules/Markdown:Markdown",
|
||||
"//submodules/StringPluralization:StringPluralization",
|
||||
"//submodules/AnimatedStickerNode:AnimatedStickerNode",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
12
submodules/WalletUrl/BUILD
Normal file
12
submodules/WalletUrl/BUILD
Normal file
@ -0,0 +1,12 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "WalletUrl",
|
||||
module_name = "WalletUrl",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
21
submodules/YuvConversion/BUILD
Normal file
21
submodules/YuvConversion/BUILD
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
objc_library(
|
||||
name = "YuvConversion",
|
||||
enable_modules = True,
|
||||
module_name = "YuvConversion",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"PublicHeaders",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Foundation",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,4 +1,4 @@
|
||||
#import "YUV.h"
|
||||
#import <YuvConversion/YUV.h>
|
||||
#import <Accelerate/Accelerate.h>
|
||||
|
||||
void encodeRGBAToYUVA(uint8_t *yuva, uint8_t const *argb, int width, int height, int bytesPerRow) {
|
||||
|
@ -1,11 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for YuvConversion.
|
||||
FOUNDATION_EXPORT double YuvConversionVersionNumber;
|
||||
|
||||
//! Project version string for YuvConversion.
|
||||
FOUNDATION_EXPORT const unsigned char YuvConversionVersionString[];
|
||||
|
||||
#import <YuvConversion/YUV.h>
|
||||
|
||||
|
@ -1,8 +1,3 @@
|
||||
load(
|
||||
"@rules_apple_extras//apple:objc_library.bzl",
|
||||
"objc_library",
|
||||
)
|
||||
|
||||
openssl_headers = [
|
||||
"aes.h",
|
||||
"asn1.h",
|
||||
@ -170,6 +165,9 @@ objc_library(
|
||||
module_name = "openssl",
|
||||
enable_modules = True,
|
||||
hdrs = ["Public/openssl/" + x for x in openssl_headers],
|
||||
includes = [
|
||||
"Public",
|
||||
],
|
||||
deps = [
|
||||
":openssl_lib",
|
||||
],
|
||||
|
36
submodules/rlottie/BUILD
Normal file
36
submodules/rlottie/BUILD
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
objc_library(
|
||||
name = "RLottieBinding",
|
||||
module_name = "RLottieBinding",
|
||||
enable_modules = True,
|
||||
srcs = glob([
|
||||
"rlottie/src/**/*.cpp",
|
||||
"rlottie/src/**/*.h",
|
||||
"rlottie/inc/**/*.h",
|
||||
], exclude = [
|
||||
"rlottie/src/vector/vdrawhelper_neon.cpp",
|
||||
"rlottie/src/vector/stb/**/*",
|
||||
"rlottie/src/lottie/rapidjson/msinttypes/**/*",
|
||||
]) + [
|
||||
"LottieInstance.mm",
|
||||
"config.h",
|
||||
],
|
||||
hdrs = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"PublicHeaders",
|
||||
],
|
||||
copts = [
|
||||
"-Dpixman_region_selfcheck(x)=1",
|
||||
"-DLOTTIE_DISABLE_ARM_NEON=1",
|
||||
"-Isubmodules/rlottie",
|
||||
"-Isubmodules/rlottie/rlottie/inc",
|
||||
"-Isubmodules/rlottie/rlottie/src/vector",
|
||||
"-Isubmodules/rlottie/rlottie/src/vector/pixman",
|
||||
"-Isubmodules/rlottie/rlottie/src/vector/freetype",
|
||||
],
|
||||
deps = [
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
#import "LottieInstance.h"
|
||||
#import <RLottieBinding/LottieInstance.h>
|
||||
|
||||
#include "rlottie.h"
|
||||
|
||||
|
@ -1,8 +1,3 @@
|
||||
load(
|
||||
"@rules_apple_extras//apple:objc_library.bzl",
|
||||
"objc_library",
|
||||
)
|
||||
|
||||
ton_headers = [
|
||||
"auto/tl/tonlib_api.h",
|
||||
"tl/TlObject.h",
|
||||
|
Loading…
x
Reference in New Issue
Block a user