WIP: Fixing issue where system tint color applies to cell nodes

This commit is contained in:
Rahul Malik
2019-09-11 14:39:53 -07:00
parent c99bcb02f8
commit aad2ed3864
9 changed files with 62 additions and 13 deletions
+9
View File
@@ -321,6 +321,15 @@
withCellFrame:cellFrame];
}
- (UIColor *)tintColor
{
if (self.supernode == nil && self.scrollView != nil) {
return self.scrollView.tintColor;
} else {
return [super tintColor];
}
}
- (NSMutableArray<NSDictionary *> *)propertiesForDebugDescription
{
NSMutableArray *result = [super propertiesForDebugDescription];
+9 -1
View File
@@ -188,7 +188,6 @@ typedef void (^ASImageNodeDrawParametersBlock)(ASWeakMapEntry *entry);
_cropDisplayBounds = CGRectNull;
_placeholderColor = ASDisplayNodeDefaultPlaceholderColor();
_animatedImageRunLoopMode = ASAnimatedImageDefaultRunLoopMode;
return self;
}
@@ -297,6 +296,15 @@ typedef void (^ASImageNodeDrawParametersBlock)(ASWeakMapEntry *entry);
#pragma mark - Drawing
//- (void)didEnterHierarchy
//{
// [super didEnterHierarchy];
// if (self.interfaceState & ASInterfaceStateDisplay) {
// [self tintColorDidChange];
// }
//}
- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer
{
ASLockScopeSelf();
+1 -1
View File
@@ -113,7 +113,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
self.selectionStyle = node.selectionStyle;
self.focusStyle = node.focusStyle;
self.accessoryType = node.accessoryType;
self.tintColor = node.tintColor;
// self.tintColor = node.tintColor;
// the following ensures that we clip the entire cell to it's bounds if node.clipsToBounds is set (the default)
// This is actually a workaround for a bug we are seeing in some rare cases (selected background view
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
@@ -30,6 +40,16 @@
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
@@ -64,6 +84,11 @@
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
+10 -9
View File
@@ -35,7 +35,7 @@
@implementation PhotoCellNode
{
PhotoModel *_photoModel;
ASNetworkImageNode *_userAvatarImageNode;
ASImageNode *_userAvatarImageNode;
ASNetworkImageNode *_photoImageNode;
ASTextNode *_userNameLabel;
ASTextNode *_photoLocationLabel;
@@ -54,15 +54,16 @@
_photoModel = photo;
_userAvatarImageNode = [[ASNetworkImageNode alloc] init];
_userAvatarImageNode.URL = photo.ownerUserProfile.userPicURL; // FIXME: make round
// FIXME: autocomplete for this line seems broken
[_userAvatarImageNode setImageModificationBlock:^UIImage *(UIImage *image) {
CGSize profileImageSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT);
return [image makeCircularImageWithSize:profileImageSize backgroundColor:nil];
}];
_userAvatarImageNode = [[ASImageNode alloc] init];
// _userAvatarImageNode.URL = photo.ownerUserProfile.userPicURL; // FIXME: make round
// FIXME: autocomplete for this line seems broken
// [_userAvatarImageNode setImageModificationBlock:^UIImage *(UIImage *image) {
// CGSize profileImageSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT);
// return [[image makeCircularImageWithSize:profileImageSize backgroundColor:nil] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
// }];
//
_userAvatarImageNode.image = [[UIImage as_imageNamed:@"profile"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
_photoImageNode = [[ASNetworkImageNode alloc] init];
_photoImageNode.delegate = self;
_photoImageNode.URL = photo.URL;
@@ -74,6 +74,10 @@ static NSString *TableViewCellIdentifier = @"PhotoCell";
#pragma mark - UITableViewDataSource methods
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.photoFeed numberOfItemsInFeed];
@@ -435,7 +435,7 @@ static NSURL *UserProfileURLForPhotoModel(PhotoModel *photoModel) {
}
CGSize profileImageSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT);
_userAvatarImageView.image = [image makeCircularImageWithSize:profileImageSize backgroundColor:[UIColor backgroundColor]];
_userAvatarImageView.image = [[image makeCircularImageWithSize:profileImageSize backgroundColor:[UIColor backgroundColor]] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
}];
}
@@ -17,7 +17,8 @@
+ (ASConfiguration *)textureConfiguration
{
ASConfiguration *config = [[ASConfiguration alloc] init];
config.experimentalFeatures = ASExperimentalTextNode;
config.experimentalFeatures = ASExperimentalTextNode | ASExperimentalTraitCollectionDidChangeWithPreviousCollection;
config.delegate = [[TextureConfigDelegate alloc] init];
return config;
}
@@ -22,6 +22,7 @@
_statusBarOpaqueUnderlayView = [[UIView alloc] init];
_statusBarOpaqueUnderlayView.backgroundColor = [UIColor darkBlueColor];
[self addSubview:_statusBarOpaqueUnderlayView];
self.tintColor = [UIColor systemRedColor];
}
return self;
}