mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
[ASDisplayNode] Add support for setting non-fatal error block (#2993)
* Add support for setting non-fatal error block * Better documentation and fix typos * Added ASDisplayNodeAssertNonFatal macro that asserts in dev and call block in prod * Make non fatal error code equals to 1 * Add support for condition in ASDisplayNodeAssertNonFatal * Only call non fatal block if condition isn’t satisfied
This commit is contained in:
committed by
Garrett Moon
parent
f21254593d
commit
b33cced1eb
@@ -56,6 +56,12 @@ typedef void (^ASDisplayNodeContextModifier)(CGContextRef context);
|
||||
*/
|
||||
typedef ASLayoutSpec * _Nonnull(^ASLayoutSpecBlock)(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize);
|
||||
|
||||
/**
|
||||
* AsyncDisplayKit non-fatal error block. This block can be used for handling non-fatal errors. Useful for reporting
|
||||
* errors that happens in production.
|
||||
*/
|
||||
typedef void (^ASDisplayNodeNonFatalErrorBlock)(__kindof NSError * _Nonnull error);
|
||||
|
||||
/**
|
||||
* Interface state is available on ASDisplayNode and ASViewController, and
|
||||
* allows checking whether a node is in an interface situation where it is prudent to trigger certain
|
||||
@@ -253,6 +259,16 @@ extern NSInteger const ASDefaultDrawingPriority;
|
||||
*/
|
||||
@property (readonly) ASInterfaceState interfaceState;
|
||||
|
||||
/**
|
||||
* @abstract Class property that allows to set a block that can be called on non-fatal errors. This
|
||||
* property can be useful for cases when Async Display Kit can recover from an abnormal behavior, but
|
||||
* still gives the opportunity to use a reporting mechanism to catch occurrences in production. In
|
||||
* development, Async Display Kit will assert instead of calling this block.
|
||||
*
|
||||
* @warning This method is not thread-safe.
|
||||
*/
|
||||
@property (nonatomic, class, copy) ASDisplayNodeNonFatalErrorBlock nonFatalErrorBlock;
|
||||
|
||||
|
||||
/** @name Managing dimensions */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user