From 46046c729a3a94fd056b4fd5f66b14f542e3f2e6 Mon Sep 17 00:00:00 2001
From: Ali <>
Date: Thu, 13 Feb 2020 02:29:16 +0100
Subject: [PATCH] Temp
---
Wallet/BUILD | 22 +-
build-system/bazel-rules/rules_apple | 2 +-
build-system/bazel-rules/rules_swift | 2 +-
submodules/AnimatedStickerNode/BUILD | 20 +
submodules/AsyncDisplayKit/BUILD | 8 +-
.../AsyncDisplayKit/Source/ASControlNode.mm | 8 +-
.../Source/ASControlTargetAction.mm | 2 +-
.../Source/ASDisplayNode+Ancestry.mm | 2 +-
.../Source/ASDisplayNode+Convenience.mm | 2 +-
.../Source/ASDisplayNodeExtras.mm | 2 +-
.../Source/ASGraphicsContext.mm | 2 +-
.../Source/ASImageNode+CGExtras.h | 31 -
.../Source/ASImageNode+CGExtras.mm | 123 ---
.../Source/ASImageNode+Private.h | 17 -
.../AsyncDisplayKit/Source/ASImageNode.mm | 744 ------------------
.../Source/ASInternalHelpers.mm | 2 +-
.../AsyncDisplayKit/Source/ASLayoutElement.mm | 2 +-
.../Source/ASMainSerialQueue.mm | 2 +-
.../Source/ASMainThreadDeallocation.mm | 2 +-
.../Source/ASRecursiveUnfairLock.mm | 2 +-
.../AsyncDisplayKit/Source/ASScrollNode.mm | 2 +-
.../AsyncDisplayKit/ASImageNode.h | 219 ------
.../AsyncDisplayKit/AsyncDisplayKit.h | 1 -
.../Source/UIResponder+AsyncDisplayKit.mm | 2 +-
.../Source/_ASDisplayViewAccessiblity.mm | 2 +-
.../Source/_ASTransitionContext.mm | 2 +-
submodules/BuildConfig/BUILD | 5 -
submodules/Camera/BUILD | 17 +
submodules/Display/BUILD | 10 +-
.../Display/Source/Nodes/ASImageNode.swift | 2 +
submodules/GlassButtonNode/BUILD | 16 +
.../Sources/GlassButtonNode.swift | 6 +-
submodules/LocalAuth/BUILD | 15 +
submodules/MergeLists/BUILD | 12 +
submodules/NumberPluralizationForm/BUILD | 21 +
.../NumberPluralizationForm.h | 0
.../Sources/NumberPluralizationForm.m | 2 +-
submodules/OpenSSLEncryptionProvider/BUILD | 5 -
submodules/ProgressNavigationButtonNode/BUILD | 17 +
submodules/QrCode/BUILD | 16 +
submodules/ScreenCaptureDetection/BUILD | 15 +
.../Sources/SolidRoundedButtonNode.swift | 2 -
submodules/StringPluralization/BUILD | 16 +
.../Sources/StringPluralization.swift | 1 +
submodules/TonBinding/BUILD | 8 +-
submodules/UrlEscaping/BUILD | 12 +
submodules/WalletCore/BUILD | 7 +-
submodules/WalletUI/BUILD | 4 +-
submodules/WalletUrl/BUILD | 12 +
submodules/YuvConversion/BUILD | 21 +
submodules/YuvConversion/Info.plist | 22 -
.../YuvConversion}/YUV.h | 0
submodules/YuvConversion/Sources/YUV.m | 2 +-
.../YuvConversion/Sources/YuvConversion.h | 11 -
submodules/openssl/BUILD | 8 +-
submodules/rlottie/BUILD | 36 +
submodules/rlottie/LottieInstance.mm | 2 +-
.../RLottieBinding}/LottieInstance.h | 0
submodules/ton/BUILD | 5 -
59 files changed, 307 insertions(+), 1246 deletions(-)
create mode 100644 submodules/AnimatedStickerNode/BUILD
delete mode 100644 submodules/AsyncDisplayKit/Source/ASImageNode+CGExtras.h
delete mode 100644 submodules/AsyncDisplayKit/Source/ASImageNode+CGExtras.mm
delete mode 100644 submodules/AsyncDisplayKit/Source/ASImageNode+Private.h
delete mode 100644 submodules/AsyncDisplayKit/Source/ASImageNode.mm
delete mode 100644 submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/ASImageNode.h
create mode 100644 submodules/Camera/BUILD
create mode 100644 submodules/GlassButtonNode/BUILD
create mode 100644 submodules/LocalAuth/BUILD
create mode 100644 submodules/MergeLists/BUILD
create mode 100644 submodules/NumberPluralizationForm/BUILD
rename submodules/{StringPluralization/Sources => NumberPluralizationForm/PublicHeaders/NumberPluralizationForm}/NumberPluralizationForm.h (100%)
rename submodules/{StringPluralization => NumberPluralizationForm}/Sources/NumberPluralizationForm.m (99%)
create mode 100644 submodules/ProgressNavigationButtonNode/BUILD
create mode 100644 submodules/QrCode/BUILD
create mode 100644 submodules/ScreenCaptureDetection/BUILD
create mode 100644 submodules/StringPluralization/BUILD
create mode 100644 submodules/UrlEscaping/BUILD
create mode 100644 submodules/WalletUrl/BUILD
create mode 100644 submodules/YuvConversion/BUILD
delete mode 100644 submodules/YuvConversion/Info.plist
rename submodules/YuvConversion/{Sources => PublicHeaders/YuvConversion}/YUV.h (100%)
delete mode 100644 submodules/YuvConversion/Sources/YuvConversion.h
create mode 100644 submodules/rlottie/BUILD
rename submodules/rlottie/{ => PublicHeaders/RLottieBinding}/LottieInstance.h (100%)
diff --git a/Wallet/BUILD b/Wallet/BUILD
index b3b5c2150f..e80c0c5046 100644
--- a/Wallet/BUILD
+++ b/Wallet/BUILD
@@ -8,13 +8,13 @@ echo \
'' \
'' \
' CFBundleShortVersionString' \
-' %s' \
+' {}' \
' CFBundleVersion' \
-' %s' \
+' {}' \
'' \
'' \
> "$@"
-""" % ("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",
],
)
diff --git a/build-system/bazel-rules/rules_apple b/build-system/bazel-rules/rules_apple
index 53282252b3..77b9c3cd97 160000
--- a/build-system/bazel-rules/rules_apple
+++ b/build-system/bazel-rules/rules_apple
@@ -1 +1 @@
-Subproject commit 53282252b393e451634d4f410d555df3f295c00e
+Subproject commit 77b9c3cd975272f37856ee0ccca8c96d986bf85f
diff --git a/build-system/bazel-rules/rules_swift b/build-system/bazel-rules/rules_swift
index 657eda57a0..c81e80f899 160000
--- a/build-system/bazel-rules/rules_swift
+++ b/build-system/bazel-rules/rules_swift
@@ -1 +1 @@
-Subproject commit 657eda57a097980848dbb3c880b94faeddaa3cd1
+Subproject commit c81e80f899e261e35f6f48646906e0bb3712ce7b
diff --git a/submodules/AnimatedStickerNode/BUILD b/submodules/AnimatedStickerNode/BUILD
new file mode 100644
index 0000000000..bf1ba42bdd
--- /dev/null
+++ b/submodules/AnimatedStickerNode/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/AsyncDisplayKit/BUILD b/submodules/AsyncDisplayKit/BUILD
index 1a152cde4a..6d054283b8 100644
--- a/submodules/AsyncDisplayKit/BUILD
+++ b/submodules/AsyncDisplayKit/BUILD
@@ -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",
diff --git a/submodules/AsyncDisplayKit/Source/ASControlNode.mm b/submodules/AsyncDisplayKit/Source/ASControlNode.mm
index 7a44591394..dcdb9ec829 100644
--- a/submodules/AsyncDisplayKit/Source/ASControlNode.mm
+++ b/submodules/AsyncDisplayKit/Source/ASControlNode.mm
@@ -11,8 +11,7 @@
#import "ASControlNode+Private.h"
#import
#import
-#import
-#import "ASInternalHelpers.h"
+#import
#import
#import
#import
@@ -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
diff --git a/submodules/AsyncDisplayKit/Source/ASControlTargetAction.mm b/submodules/AsyncDisplayKit/Source/ASControlTargetAction.mm
index 49c2314fcc..41cc113314 100644
--- a/submodules/AsyncDisplayKit/Source/ASControlTargetAction.mm
+++ b/submodules/AsyncDisplayKit/Source/ASControlTargetAction.mm
@@ -7,7 +7,7 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//
-#import "ASControlTargetAction.h"
+#import
@implementation ASControlTargetAction
{
diff --git a/submodules/AsyncDisplayKit/Source/ASDisplayNode+Ancestry.mm b/submodules/AsyncDisplayKit/Source/ASDisplayNode+Ancestry.mm
index 7003064c70..ea1376ed54 100644
--- a/submodules/AsyncDisplayKit/Source/ASDisplayNode+Ancestry.mm
+++ b/submodules/AsyncDisplayKit/Source/ASDisplayNode+Ancestry.mm
@@ -7,7 +7,7 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//
-#import "ASDisplayNode+Ancestry.h"
+#import
#import
#import
diff --git a/submodules/AsyncDisplayKit/Source/ASDisplayNode+Convenience.mm b/submodules/AsyncDisplayKit/Source/ASDisplayNode+Convenience.mm
index a7b7519bab..29d761be5a 100644
--- a/submodules/AsyncDisplayKit/Source/ASDisplayNode+Convenience.mm
+++ b/submodules/AsyncDisplayKit/Source/ASDisplayNode+Convenience.mm
@@ -7,7 +7,7 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//
-#import "ASDisplayNode+Convenience.h"
+#import
#import
diff --git a/submodules/AsyncDisplayKit/Source/ASDisplayNodeExtras.mm b/submodules/AsyncDisplayKit/Source/ASDisplayNodeExtras.mm
index de08b03c43..b3a56f4697 100644
--- a/submodules/AsyncDisplayKit/Source/ASDisplayNodeExtras.mm
+++ b/submodules/AsyncDisplayKit/Source/ASDisplayNodeExtras.mm
@@ -9,7 +9,7 @@
#import
#import "ASDisplayNodeInternal.h"
-#import "ASDisplayNode+FrameworkPrivate.h"
+#import
#import
#import
diff --git a/submodules/AsyncDisplayKit/Source/ASGraphicsContext.mm b/submodules/AsyncDisplayKit/Source/ASGraphicsContext.mm
index 82f7c4730c..b181ee2728 100644
--- a/submodules/AsyncDisplayKit/Source/ASGraphicsContext.mm
+++ b/submodules/AsyncDisplayKit/Source/ASGraphicsContext.mm
@@ -10,7 +10,7 @@
#import "ASCGImageBuffer.h"
#import
#import
-#import "ASInternalHelpers.h"
+#import
#import
#import
#import
diff --git a/submodules/AsyncDisplayKit/Source/ASImageNode+CGExtras.h b/submodules/AsyncDisplayKit/Source/ASImageNode+CGExtras.h
deleted file mode 100644
index 01b546443b..0000000000
--- a/submodules/AsyncDisplayKit/Source/ASImageNode+CGExtras.h
+++ /dev/null
@@ -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
-#import
-
-/**
- @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
- );
diff --git a/submodules/AsyncDisplayKit/Source/ASImageNode+CGExtras.mm b/submodules/AsyncDisplayKit/Source/ASImageNode+CGExtras.mm
deleted file mode 100644
index 40b331fb32..0000000000
--- a/submodules/AsyncDisplayKit/Source/ASImageNode+CGExtras.mm
+++ /dev/null
@@ -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
-
-// 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);
-}
diff --git a/submodules/AsyncDisplayKit/Source/ASImageNode+Private.h b/submodules/AsyncDisplayKit/Source/ASImageNode+Private.h
deleted file mode 100644
index 8de78c8784..0000000000
--- a/submodules/AsyncDisplayKit/Source/ASImageNode+Private.h
+++ /dev/null
@@ -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
diff --git a/submodules/AsyncDisplayKit/Source/ASImageNode.mm b/submodules/AsyncDisplayKit/Source/ASImageNode.mm
deleted file mode 100644
index ddd9fe68c7..0000000000
--- a/submodules/AsyncDisplayKit/Source/ASImageNode.mm
+++ /dev/null
@@ -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
-
-#import
-
-#import
-#import
-#import
-#import "ASDisplayNode+FrameworkPrivate.h"
-#import
-#import
-#import
-#import
-#import "ASImageNode+CGExtras.h"
-#import
-#import
-#import
-#import "ASWeakMap.h"
-#import
-#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)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 *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 *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;
- };
-}
diff --git a/submodules/AsyncDisplayKit/Source/ASInternalHelpers.mm b/submodules/AsyncDisplayKit/Source/ASInternalHelpers.mm
index d3dd743b7c..a9926ccca4 100644
--- a/submodules/AsyncDisplayKit/Source/ASInternalHelpers.mm
+++ b/submodules/AsyncDisplayKit/Source/ASInternalHelpers.mm
@@ -7,7 +7,7 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//
-#import "ASInternalHelpers.h"
+#import
#import
diff --git a/submodules/AsyncDisplayKit/Source/ASLayoutElement.mm b/submodules/AsyncDisplayKit/Source/ASLayoutElement.mm
index 61f61e7514..887f609e99 100644
--- a/submodules/AsyncDisplayKit/Source/ASLayoutElement.mm
+++ b/submodules/AsyncDisplayKit/Source/ASLayoutElement.mm
@@ -7,7 +7,7 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//
-#import "ASDisplayNode+FrameworkPrivate.h"
+#import
#import
#import
#import
diff --git a/submodules/AsyncDisplayKit/Source/ASMainSerialQueue.mm b/submodules/AsyncDisplayKit/Source/ASMainSerialQueue.mm
index 81a3116c81..60bf8d7f67 100644
--- a/submodules/AsyncDisplayKit/Source/ASMainSerialQueue.mm
+++ b/submodules/AsyncDisplayKit/Source/ASMainSerialQueue.mm
@@ -10,7 +10,7 @@
#import "ASMainSerialQueue.h"
#import
-#import "ASInternalHelpers.h"
+#import
@interface ASMainSerialQueue ()
{
diff --git a/submodules/AsyncDisplayKit/Source/ASMainThreadDeallocation.mm b/submodules/AsyncDisplayKit/Source/ASMainThreadDeallocation.mm
index cb6dee7641..4b16c932d2 100644
--- a/submodules/AsyncDisplayKit/Source/ASMainThreadDeallocation.mm
+++ b/submodules/AsyncDisplayKit/Source/ASMainThreadDeallocation.mm
@@ -10,7 +10,7 @@
#import
#import
-#import "ASInternalHelpers.h"
+#import
#import
#import
diff --git a/submodules/AsyncDisplayKit/Source/ASRecursiveUnfairLock.mm b/submodules/AsyncDisplayKit/Source/ASRecursiveUnfairLock.mm
index 9e4a29d47a..e44eec76d1 100644
--- a/submodules/AsyncDisplayKit/Source/ASRecursiveUnfairLock.mm
+++ b/submodules/AsyncDisplayKit/Source/ASRecursiveUnfairLock.mm
@@ -6,7 +6,7 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//
-#import "ASRecursiveUnfairLock.h"
+#import
#import
diff --git a/submodules/AsyncDisplayKit/Source/ASScrollNode.mm b/submodules/AsyncDisplayKit/Source/ASScrollNode.mm
index 9a6af0725c..08fd82da80 100644
--- a/submodules/AsyncDisplayKit/Source/ASScrollNode.mm
+++ b/submodules/AsyncDisplayKit/Source/ASScrollNode.mm
@@ -9,7 +9,7 @@
#import
#import
-#import "ASDisplayNode+FrameworkPrivate.h"
+#import
#import
#import
#import
diff --git a/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/ASImageNode.h b/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/ASImageNode.h
deleted file mode 100644
index 902591c4f6..0000000000
--- a/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/ASImageNode.h
+++ /dev/null
@@ -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
-#import
-
-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 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 )newAnimatedImage previousAnimatedImage:(nullable id )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
- *
- * @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
- *
- * @return An ASImageNode image modification block.
- */
-AS_EXTERN asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color);
-
-NS_ASSUME_NONNULL_END
diff --git a/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/AsyncDisplayKit.h b/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/AsyncDisplayKit.h
index c84f8a9821..26a43685f1 100644
--- a/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/AsyncDisplayKit.h
+++ b/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/AsyncDisplayKit.h
@@ -22,7 +22,6 @@
#import
#import
-#import
#import
#import
diff --git a/submodules/AsyncDisplayKit/Source/UIResponder+AsyncDisplayKit.mm b/submodules/AsyncDisplayKit/Source/UIResponder+AsyncDisplayKit.mm
index 0655f06503..9365fba5e0 100644
--- a/submodules/AsyncDisplayKit/Source/UIResponder+AsyncDisplayKit.mm
+++ b/submodules/AsyncDisplayKit/Source/UIResponder+AsyncDisplayKit.mm
@@ -7,7 +7,7 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//
-#import "UIResponder+AsyncDisplayKit.h"
+#import
#import
#import
diff --git a/submodules/AsyncDisplayKit/Source/_ASDisplayViewAccessiblity.mm b/submodules/AsyncDisplayKit/Source/_ASDisplayViewAccessiblity.mm
index 44941a0673..b24e8e9f58 100644
--- a/submodules/AsyncDisplayKit/Source/_ASDisplayViewAccessiblity.mm
+++ b/submodules/AsyncDisplayKit/Source/_ASDisplayViewAccessiblity.mm
@@ -12,7 +12,7 @@
#import
#import
#import
-#import "ASDisplayNode+FrameworkPrivate.h"
+#import
#import "ASDisplayNodeInternal.h"
#import
diff --git a/submodules/AsyncDisplayKit/Source/_ASTransitionContext.mm b/submodules/AsyncDisplayKit/Source/_ASTransitionContext.mm
index e4539ee20b..40a3573c15 100644
--- a/submodules/AsyncDisplayKit/Source/_ASTransitionContext.mm
+++ b/submodules/AsyncDisplayKit/Source/_ASTransitionContext.mm
@@ -7,7 +7,7 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//
-#import "_ASTransitionContext.h"
+#import
#import
#import
diff --git a/submodules/BuildConfig/BUILD b/submodules/BuildConfig/BUILD
index 13f21ea509..8f7198ad43 100644
--- a/submodules/BuildConfig/BUILD
+++ b/submodules/BuildConfig/BUILD
@@ -1,8 +1,3 @@
-load(
- "@rules_apple_extras//apple:objc_library.bzl",
- "objc_library",
-)
-
load(
"@bazel_skylib//rules:common_settings.bzl",
"string_flag",
diff --git a/submodules/Camera/BUILD b/submodules/Camera/BUILD
new file mode 100644
index 0000000000..6cced36441
--- /dev/null
+++ b/submodules/Camera/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/Display/BUILD b/submodules/Display/BUILD
index afae8b4260..277d09ae20 100644
--- a/submodules/Display/BUILD
+++ b/submodules/Display/BUILD
@@ -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",
],
diff --git a/submodules/Display/Source/Nodes/ASImageNode.swift b/submodules/Display/Source/Nodes/ASImageNode.swift
index df2fbcc5eb..69899f3c28 100644
--- a/submodules/Display/Source/Nodes/ASImageNode.swift
+++ b/submodules/Display/Source/Nodes/ASImageNode.swift
@@ -15,6 +15,8 @@ open class ASImageNode: ASDisplayNode {
}
}
+ public var displayWithoutProcessing: Bool = true
+
override public init() {
super.init()
diff --git a/submodules/GlassButtonNode/BUILD b/submodules/GlassButtonNode/BUILD
new file mode 100644
index 0000000000..7a35f60ab4
--- /dev/null
+++ b/submodules/GlassButtonNode/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/GlassButtonNode/Sources/GlassButtonNode.swift b/submodules/GlassButtonNode/Sources/GlassButtonNode.swift
index f9fd932c6a..285964e124 100644
--- a/submodules/GlassButtonNode/Sources/GlassButtonNode.swift
+++ b/submodules/GlassButtonNode/Sources/GlassButtonNode.swift
@@ -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
diff --git a/submodules/LocalAuth/BUILD b/submodules/LocalAuth/BUILD
new file mode 100644
index 0000000000..59d5f7737f
--- /dev/null
+++ b/submodules/LocalAuth/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/MergeLists/BUILD b/submodules/MergeLists/BUILD
new file mode 100644
index 0000000000..b19a43d51f
--- /dev/null
+++ b/submodules/MergeLists/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/NumberPluralizationForm/BUILD b/submodules/NumberPluralizationForm/BUILD
new file mode 100644
index 0000000000..4a690328d0
--- /dev/null
+++ b/submodules/NumberPluralizationForm/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/StringPluralization/Sources/NumberPluralizationForm.h b/submodules/NumberPluralizationForm/PublicHeaders/NumberPluralizationForm/NumberPluralizationForm.h
similarity index 100%
rename from submodules/StringPluralization/Sources/NumberPluralizationForm.h
rename to submodules/NumberPluralizationForm/PublicHeaders/NumberPluralizationForm/NumberPluralizationForm.h
diff --git a/submodules/StringPluralization/Sources/NumberPluralizationForm.m b/submodules/NumberPluralizationForm/Sources/NumberPluralizationForm.m
similarity index 99%
rename from submodules/StringPluralization/Sources/NumberPluralizationForm.m
rename to submodules/NumberPluralizationForm/Sources/NumberPluralizationForm.m
index 47f33f9224..e79cfc5381 100644
--- a/submodules/StringPluralization/Sources/NumberPluralizationForm.m
+++ b/submodules/NumberPluralizationForm/Sources/NumberPluralizationForm.m
@@ -1,4 +1,4 @@
-#import "NumberPluralizationForm.h"
+#import
NumberPluralizationForm numberPluralizationForm(unsigned int lc, int n) {
switch (lc) {
diff --git a/submodules/OpenSSLEncryptionProvider/BUILD b/submodules/OpenSSLEncryptionProvider/BUILD
index d4d99fcfe3..b6eca063e5 100644
--- a/submodules/OpenSSLEncryptionProvider/BUILD
+++ b/submodules/OpenSSLEncryptionProvider/BUILD
@@ -1,8 +1,3 @@
-load(
- "@rules_apple_extras//apple:objc_library.bzl",
- "objc_library",
-)
-
objc_library(
name = "OpenSSLEncryptionProvider",
srcs = glob([
diff --git a/submodules/ProgressNavigationButtonNode/BUILD b/submodules/ProgressNavigationButtonNode/BUILD
new file mode 100644
index 0000000000..ebf9a7e417
--- /dev/null
+++ b/submodules/ProgressNavigationButtonNode/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/QrCode/BUILD b/submodules/QrCode/BUILD
new file mode 100644
index 0000000000..4cba639671
--- /dev/null
+++ b/submodules/QrCode/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/ScreenCaptureDetection/BUILD b/submodules/ScreenCaptureDetection/BUILD
new file mode 100644
index 0000000000..81af8cfe2a
--- /dev/null
+++ b/submodules/ScreenCaptureDetection/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift b/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift
index df8a02a682..3d7de90655 100644
--- a/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift
+++ b/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift
@@ -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
diff --git a/submodules/StringPluralization/BUILD b/submodules/StringPluralization/BUILD
new file mode 100644
index 0000000000..98fb1d6975
--- /dev/null
+++ b/submodules/StringPluralization/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/StringPluralization/Sources/StringPluralization.swift b/submodules/StringPluralization/Sources/StringPluralization.swift
index 1df97f8ec7..5016d05a68 100644
--- a/submodules/StringPluralization/Sources/StringPluralization.swift
+++ b/submodules/StringPluralization/Sources/StringPluralization.swift
@@ -1,4 +1,5 @@
import Foundation
+import NumberPluralizationForm
public enum PluralizationForm: Int32 {
case zero = 0
diff --git a/submodules/TonBinding/BUILD b/submodules/TonBinding/BUILD
index d065bb070b..b3b54d2477 100644
--- a/submodules/TonBinding/BUILD
+++ b/submodules/TonBinding/BUILD
@@ -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",
diff --git a/submodules/UrlEscaping/BUILD b/submodules/UrlEscaping/BUILD
new file mode 100644
index 0000000000..9e665e590d
--- /dev/null
+++ b/submodules/UrlEscaping/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/WalletCore/BUILD b/submodules/WalletCore/BUILD
index d497c83b05..56b9d8ac32 100644
--- a/submodules/WalletCore/BUILD
+++ b/submodules/WalletCore/BUILD
@@ -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([
diff --git a/submodules/WalletUI/BUILD b/submodules/WalletUI/BUILD
index 17c9dc077b..81f0975dd4 100644
--- a/submodules/WalletUI/BUILD
+++ b/submodules/WalletUI/BUILD
@@ -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",
diff --git a/submodules/WalletUrl/BUILD b/submodules/WalletUrl/BUILD
new file mode 100644
index 0000000000..e6de266abb
--- /dev/null
+++ b/submodules/WalletUrl/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/YuvConversion/BUILD b/submodules/YuvConversion/BUILD
new file mode 100644
index 0000000000..726607e056
--- /dev/null
+++ b/submodules/YuvConversion/BUILD
@@ -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",
+ ],
+)
diff --git a/submodules/YuvConversion/Info.plist b/submodules/YuvConversion/Info.plist
deleted file mode 100644
index e1fe4cfb7b..0000000000
--- a/submodules/YuvConversion/Info.plist
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- $(PRODUCT_NAME)
- CFBundlePackageType
- FMWK
- CFBundleShortVersionString
- 1.0
- CFBundleVersion
- $(CURRENT_PROJECT_VERSION)
-
-
diff --git a/submodules/YuvConversion/Sources/YUV.h b/submodules/YuvConversion/PublicHeaders/YuvConversion/YUV.h
similarity index 100%
rename from submodules/YuvConversion/Sources/YUV.h
rename to submodules/YuvConversion/PublicHeaders/YuvConversion/YUV.h
diff --git a/submodules/YuvConversion/Sources/YUV.m b/submodules/YuvConversion/Sources/YUV.m
index 08a52aba58..d5c2f0ad16 100644
--- a/submodules/YuvConversion/Sources/YUV.m
+++ b/submodules/YuvConversion/Sources/YUV.m
@@ -1,4 +1,4 @@
-#import "YUV.h"
+#import
#import
void encodeRGBAToYUVA(uint8_t *yuva, uint8_t const *argb, int width, int height, int bytesPerRow) {
diff --git a/submodules/YuvConversion/Sources/YuvConversion.h b/submodules/YuvConversion/Sources/YuvConversion.h
deleted file mode 100644
index 4da2e49979..0000000000
--- a/submodules/YuvConversion/Sources/YuvConversion.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#import
-
-//! Project version number for YuvConversion.
-FOUNDATION_EXPORT double YuvConversionVersionNumber;
-
-//! Project version string for YuvConversion.
-FOUNDATION_EXPORT const unsigned char YuvConversionVersionString[];
-
-#import
-
-
diff --git a/submodules/openssl/BUILD b/submodules/openssl/BUILD
index 7ca85c49fd..a6bc6e5e39 100644
--- a/submodules/openssl/BUILD
+++ b/submodules/openssl/BUILD
@@ -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",
],
diff --git a/submodules/rlottie/BUILD b/submodules/rlottie/BUILD
new file mode 100644
index 0000000000..57f4ea5c1a
--- /dev/null
+++ b/submodules/rlottie/BUILD
@@ -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"],
+)
diff --git a/submodules/rlottie/LottieInstance.mm b/submodules/rlottie/LottieInstance.mm
index a5750c075a..86b43dc706 100755
--- a/submodules/rlottie/LottieInstance.mm
+++ b/submodules/rlottie/LottieInstance.mm
@@ -1,4 +1,4 @@
-#import "LottieInstance.h"
+#import
#include "rlottie.h"
diff --git a/submodules/rlottie/LottieInstance.h b/submodules/rlottie/PublicHeaders/RLottieBinding/LottieInstance.h
similarity index 100%
rename from submodules/rlottie/LottieInstance.h
rename to submodules/rlottie/PublicHeaders/RLottieBinding/LottieInstance.h
diff --git a/submodules/ton/BUILD b/submodules/ton/BUILD
index 2ba9031fa3..88fd81982a 100644
--- a/submodules/ton/BUILD
+++ b/submodules/ton/BUILD
@@ -1,8 +1,3 @@
-load(
- "@rules_apple_extras//apple:objc_library.bzl",
- "objc_library",
-)
-
ton_headers = [
"auto/tl/tonlib_api.h",
"tl/TlObject.h",