Skip to content

Commit

Permalink
fix(ios): deprecate selectedBackgroundGradient
Browse files Browse the repository at this point in the history
  • Loading branch information
garymathews authored and sgtcoolguy committed Mar 10, 2021
1 parent dc07aeb commit 9cf10cd
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
23 changes: 19 additions & 4 deletions iphone/Classes/TiUIListItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ - (void)setBackgroundGradient_:(id)value
}
}

- (void)setSelectedBackgroundGradient_:(id)value
- (void)setBackgroundSelectedGradient_:(id)value
{
TiGradient *newGradient = [TiGradient gradientFromObject:value proxy:_proxy];
if (newGradient == selectedBackgroundGradient) {
Expand All @@ -243,6 +243,11 @@ - (void)setSelectedBackgroundGradient_:(id)value
[self updateGradientLayer:YES withAnimation:NO];
}
}
- (void)setSelectedBackgroundGradient_:(id)value
{
DEPRECATED_REPLACED(@"selectedBackgroundGradient", @"10.0.0", @"backgroundSelectedGradient");
[self setBackgroundSelectedGradient_:value];
}

- (void)setPosition:(int)position isGrouped:(BOOL)grouped
{
Expand Down Expand Up @@ -535,11 +540,21 @@ - (void)setDataItem:(NSDictionary *)dataItem
}
[self setBackgroundGradient_:backgroundGradientValue];

id selectedBackgroundGradientValue = [properties objectForKey:@"selectedBackgroundGradient"];
id selectedBackgroundGradientValue = [properties objectForKey:@"backgroundSelectedGradient"];
if (IS_NULL_OR_NIL(selectedBackgroundGradientValue)) {
selectedBackgroundGradientValue = [_proxy valueForKey:@"selectedBackgroundGradient"];
selectedBackgroundGradientValue = [_proxy valueForKey:@"backgroundSelectedGradient"];
}
if (IS_NULL_OR_NIL(selectedBackgroundGradientValue)) {
selectedBackgroundGradientValue = [properties valueForKey:@"selectedBackgroundGradient"];

if (IS_NULL_OR_NIL(selectedBackgroundGradientValue)) {
selectedBackgroundGradientValue = [_proxy valueForKey:@"selectedBackgroundGradient"];
}
if (!IS_NULL_OR_NIL(selectedBackgroundGradientValue)) {
DEPRECATED_REPLACED(@"selectedBackgroundGradient", @"10.0.0", @"backgroundSelectedGradient");
}
}
[self setSelectedBackgroundGradient_:selectedBackgroundGradientValue];
[self setBackgroundSelectedGradient_:selectedBackgroundGradientValue];

id selectedbackgroundColorValue = [properties objectForKey:@"backgroundSelectedColor"];
if (IS_NULL_OR_NIL(selectedbackgroundColorValue)) {
Expand Down
1 change: 1 addition & 0 deletions iphone/Classes/TiUITableView.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- (void)handleEvent:(NSString *)type;

- (void)setBackgroundGradient_:(TiGradient *)newGradient;
- (void)setBackgroundSelectedGradient_:(TiGradient *)newGradient;
- (void)setSelectedBackgroundGradient_:(TiGradient *)newGradient;

- (void)updateGradientLayer:(BOOL)useSelected withAnimation:(BOOL)animated;
Expand Down
7 changes: 6 additions & 1 deletion iphone/Classes/TiUITableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ - (void)setBackgroundGradient_:(TiGradient *)newGradient
}
}

- (void)setSelectedBackgroundGradient_:(TiGradient *)newGradient
- (void)setBackgroundSelectedGradient_:(TiGradient *)newGradient
{
if (newGradient == selectedBackgroundGradient) {
return;
Expand All @@ -274,6 +274,11 @@ - (void)setSelectedBackgroundGradient_:(TiGradient *)newGradient
[self updateGradientLayer:YES withAnimation:NO];
}
}
- (void)setSelectedBackgroundGradient_:(TiGradient *)newGradient
{
DEPRECATED_REPLACED(@"selectedBackgroundGradient", @"10.0.0", @"backgroundSelectedGradient");
[self setBackgroundSelectedGradient_:newGradient];
}

- (NSMutableDictionary *)payloadWithTouch:(UITouch *)touch
{
Expand Down
12 changes: 12 additions & 0 deletions iphone/Classes/TiUITableViewRowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ - (void)configureBackground:(UITableViewCell *)cell

[(TiUITableViewCell *)cell setBackgroundGradient_:[self valueForKey:@"backgroundGradient"]];
[(TiUITableViewCell *)cell setSelectedBackgroundGradient_:[self valueForKey:@"selectedBackgroundGradient"]];
[(TiUITableViewCell *)cell setBackgroundSelectedGradient_:[self valueForKey:@"backgroundSelectedGradient"]];

id bgImage = [self valueForKey:@"backgroundImage"];
id selBgColor = [self valueForKey:@"backgroundSelectedColor"];
Expand Down Expand Up @@ -945,8 +946,19 @@ - (void)setBackgroundGradient:(id)arg
NO);
}

- (void)setBackgroundSelectedGradient:(id)arg
{
TiGradient *newGradient = [TiGradient gradientFromObject:arg proxy:self];
[self replaceValue:newGradient forKey:@"backgroundSelectedGradient" notification:NO];
TiThreadPerformOnMainThread(
^{
[callbackCell setBackgroundSelectedGradient_:newGradient];
},
NO);
}
- (void)setSelectedBackgroundGradient:(id)arg
{
DEPRECATED_REPLACED(@"selectedBackgroundGradient", @"10.0.0", @"backgroundSelectedGradient");
TiGradient *newGradient = [TiGradient gradientFromObject:arg proxy:self];
[self replaceValue:newGradient forKey:@"selectedBackgroundGradient" notification:NO];
TiThreadPerformOnMainThread(
Expand Down

0 comments on commit 9cf10cd

Please sign in to comment.