From b5a4b82d7829ad18ac55848ee63a9e1407414890 Mon Sep 17 00:00:00 2001 From: Gary Mathews Date: Mon, 5 Apr 2021 13:26:40 -0700 Subject: [PATCH 1/5] chore(android): deprecate TableViewRow header and footer properties --- .../src/java/ti/modules/titanium/ui/TableViewRowProxy.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/TableViewRowProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/TableViewRowProxy.java index a54de4a9fe2..52467dce345 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/TableViewRowProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/TableViewRowProxy.java @@ -318,8 +318,7 @@ public void handleCreationDict(KrollDict options) */ private void headerDeprecationLog() { - // TODO: Display deprecation warning in SDK 10.0 - // Log.w(TAG, "Usage of 'TableViewRow.header' has been deprecated, use 'TableViewRow.headerTitle' instead."); + Log.w(TAG, "Usage of 'TableViewRow.header' has been deprecated, use 'TableViewRow.headerTitle' instead."); } /** @@ -327,8 +326,7 @@ private void headerDeprecationLog() */ private void footerDeprecationLog() { - // TODO: Display deprecation warning in SDK 10.0 - // Log.w(TAG, "Usage of 'TableViewRow.footer' has been deprecated, use 'TableViewRow.footerTitle' instead."); + Log.w(TAG, "Usage of 'TableViewRow.footer' has been deprecated, use 'TableViewRow.footerTitle' instead."); } /** From 908212d32a18bc05917f207453a30e1e46e54623 Mon Sep 17 00:00:00 2001 From: Gary Mathews Date: Mon, 5 Apr 2021 13:30:36 -0700 Subject: [PATCH 2/5] docs: deprecate TableViewRow header and footer properties --- apidoc/Titanium/UI/TableViewRow.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/apidoc/Titanium/UI/TableViewRow.yml b/apidoc/Titanium/UI/TableViewRow.yml index 125df7c63d7..2a9bb29e71f 100644 --- a/apidoc/Titanium/UI/TableViewRow.yml +++ b/apidoc/Titanium/UI/TableViewRow.yml @@ -238,6 +238,18 @@ properties: the `footerTitle` property of a . type: String platforms: [iphone, ipad, android, macos] + deprecated: + since: "10.0.0" + notes: Use the property instead. + + - name: footerTitle + summary: The footer title of the row. + description: | + The `footerTitle` property is used to assign a footer title to a row. It has the same effect as setting + the `footerTitle` property of a . + type: String + platforms: [iphone, ipad, android, macos] + since: {android: "10.0.0", iphone: "10.0.0", ipad: "10.0.0", macos: "10.0.0"} - name: hasCheck summary: | @@ -285,6 +297,18 @@ properties: the `headerTitle` property of a . type: String platforms: [iphone, ipad, android, macos] + deprecated: + since: "10.0.0" + notes: Use the property instead. + + - name: headerTitle + summary: The header title of the row. + description: | + The `headerTitle` property is used to assign a header title to a row. It has the same effect as setting + the `headerTitle` property of a . + type: String + platforms: [iphone, ipad, android, macos] + since: {android: "10.0.0", iphone: "10.0.0", ipad: "10.0.0", macos: "10.0.0"} - name: indentionLevel summary: Indention level for the row. From b9eec526cd1cf552221209f2c6b1e1e329851d92 Mon Sep 17 00:00:00 2001 From: Gary Mathews Date: Mon, 5 Apr 2021 13:41:16 -0700 Subject: [PATCH 3/5] chore(ios): deprecate TableViewRow header and footer properties --- iphone/Classes/TiUITableViewRowProxy.m | 39 ++++++++++++++++++-------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/iphone/Classes/TiUITableViewRowProxy.m b/iphone/Classes/TiUITableViewRowProxy.m index a796e401055..aff5e05f323 100644 --- a/iphone/Classes/TiUITableViewRowProxy.m +++ b/iphone/Classes/TiUITableViewRowProxy.m @@ -314,18 +314,35 @@ - (void)updateRow:(NSDictionary *)data withObject:(NSDictionary *)properties modifyingRow = YES; [super _initWithProperties:data]; - // check to see if we have a section header change, too... - if ([data objectForKey:@"header"]) { - [section setValue:[data objectForKey:@"header"] forUndefinedKey:@"headerTitle"]; - // we can return since we're reloading the section, will cause the - // row to be repainted at the same time - } - if ([data objectForKey:@"footer"]) { - [section setValue:[data objectForKey:@"footer"] forUndefinedKey:@"footerTitle"]; - // we can return since we're reloading the section, will cause the - // row to be repainted at the same time + id headerTitle = [data objectForKey:@"headerTitle"]; + if (headerTitle == nil) { + headerTitle = [data objectForKey:@"header"]; + + if (headerTitle != nil) + DEPRECATED_REPLACED(@"header", @"10.0.0", @"headerTitle"); } - modifyingRow = NO; +} +if (headerTitle != nil) { + + // Update section header with new headerTitle. + [section setValue:headerTitle forUndefinedKey:@"headerTitle"]; +} + +id footerTitle = [data objectForKey:@"footerTitle"]; +if (footerTitle == nil) { + footerTitle = [data objectForKey:@"footer"]; + + if (footerTitle != nil) + DEPRECATED_REPLACED(@"footer", @"10.0.0", @"footerTitle"); +} +} +if (footerTitle != nil) { + + // Update section footer with new footerTitle. + [section setValue:footerTitle forUndefinedKey:@"footerTitle"]; +} + +modifyingRow = NO; } - (void)configureTitle:(UITableViewCell *)cell From e834737472df03dcba0ddb8a1a2c34a66fe6cab7 Mon Sep 17 00:00:00 2001 From: Gary Mathews Date: Wed, 7 Apr 2021 14:42:15 -0700 Subject: [PATCH 4/5] fix(ios): missing brackets --- iphone/Classes/TiUITableViewRowProxy.m | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/iphone/Classes/TiUITableViewRowProxy.m b/iphone/Classes/TiUITableViewRowProxy.m index aff5e05f323..e934f0e9242 100644 --- a/iphone/Classes/TiUITableViewRowProxy.m +++ b/iphone/Classes/TiUITableViewRowProxy.m @@ -318,31 +318,31 @@ - (void)updateRow:(NSDictionary *)data withObject:(NSDictionary *)properties if (headerTitle == nil) { headerTitle = [data objectForKey:@"header"]; - if (headerTitle != nil) + if (headerTitle != nil) { DEPRECATED_REPLACED(@"header", @"10.0.0", @"headerTitle"); + } } -} -if (headerTitle != nil) { + if (headerTitle != nil) { - // Update section header with new headerTitle. - [section setValue:headerTitle forUndefinedKey:@"headerTitle"]; -} + // Update section header with new headerTitle. + [section setValue:headerTitle forUndefinedKey:@"headerTitle"]; + } -id footerTitle = [data objectForKey:@"footerTitle"]; -if (footerTitle == nil) { - footerTitle = [data objectForKey:@"footer"]; + id footerTitle = [data objectForKey:@"footerTitle"]; + if (footerTitle == nil) { + footerTitle = [data objectForKey:@"footer"]; - if (footerTitle != nil) - DEPRECATED_REPLACED(@"footer", @"10.0.0", @"footerTitle"); -} -} -if (footerTitle != nil) { + if (footerTitle != nil) { + DEPRECATED_REPLACED(@"footer", @"10.0.0", @"footerTitle"); + } + } + if (footerTitle != nil) { - // Update section footer with new footerTitle. - [section setValue:footerTitle forUndefinedKey:@"footerTitle"]; -} + // Update section footer with new footerTitle. + [section setValue:footerTitle forUndefinedKey:@"footerTitle"]; + } -modifyingRow = NO; + modifyingRow = NO; } - (void)configureTitle:(UITableViewCell *)cell From d8f23d883c21742ddfeb4b93ffa0e136b4f927b2 Mon Sep 17 00:00:00 2001 From: Gary Mathews Date: Fri, 9 Apr 2021 09:47:06 -0700 Subject: [PATCH 5/5] fix(ios): additional headerTitle and footerTitle references --- iphone/Classes/TiUITableViewProxy.m | 68 ++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/iphone/Classes/TiUITableViewProxy.m b/iphone/Classes/TiUITableViewProxy.m index b920e925d63..98c78f6a097 100644 --- a/iphone/Classes/TiUITableViewProxy.m +++ b/iphone/Classes/TiUITableViewProxy.m @@ -529,9 +529,9 @@ - (void)insertRowBefore:(id)args TiUITableViewRowProxy *newrow = [self tableRowFromArg:data]; TiUITableViewActionType actionType = TiUITableViewActionInsertRowBefore; - id header = [newrow valueForKey:@"header"]; - if (header != nil) { - TiUITableViewSectionProxy *newSection = [self sectionWithHeader:header table:table]; + id headerTitle = [self getRowHeaderTitle:newrow]; + if (headerTitle != nil) { + TiUITableViewSectionProxy *newSection = [self sectionWithHeader:headerTitle table:table]; // Insert the new section into the array - but, exactly WHERE we insert depends. NSInteger sectionIndex = [sections indexOfObject:section]; @@ -600,9 +600,9 @@ - (void)insertRowAfter:(id)args TiUITableViewRowProxy *newrow = [self tableRowFromArg:data]; TiUITableViewActionType actionType = TiUITableViewActionInsertRowAfter; - id header = [newrow valueForKey:@"header"]; - if (header != nil) { - TiUITableViewSectionProxy *newSection = [self sectionWithHeader:header table:table]; + id headerTitle = [self getRowHeaderTitle:newrow]; + if (headerTitle != nil) { + TiUITableViewSectionProxy *newSection = [self sectionWithHeader:headerTitle table:table]; // Set up the new section newSection.section = section.section + 1; @@ -668,12 +668,12 @@ - (void)appendRow:(id)args [self setData:[NSArray arrayWithObject:data] withObject:anim immediate:YES]; return; } else { - id header = [row valueForKey:@"header"]; TiUITableViewActionType actionType = TiUITableViewActionAppendRow; TiUITableViewSectionProxy *section = [sections lastObject]; - if (header != nil) { + id headerTitle = [self getRowHeaderTitle:row]; + if (headerTitle != nil) { NSInteger newSectionIndex = section.section + 1; - section = [self sectionWithHeader:header table:table]; + section = [self sectionWithHeader:headerTitle table:table]; section.section = newSectionIndex; actionType = TiUITableViewActionAppendRowWithSection; } @@ -710,16 +710,16 @@ - (void)setData:(id)args withObject:(id)properties immediate:(BOOL)immediate if ([row isKindOfClass:dictionaryClass]) { NSDictionary *dict = (NSDictionary *)row; TiUITableViewRowProxy *rowProxy = [self makeTableViewRowFromDict:dict]; - NSString *header = [dict objectForKey:@"header"]; - if (section == nil || header != nil) { + id headerTitle = [self getRowHeaderTitle:dict]; + if (section == nil || headerTitle != nil) { // if we don't yet have a section, that means we need to create one // if we have a header property, that means start a new section - section = [self sectionWithHeader:header table:nil]; + section = [self sectionWithHeader:headerTitle table:nil]; [data addObject:section]; } - NSString *footer = [dict objectForKey:@"footer"]; - if (footer != nil) { - [section replaceValue:footer forKey:@"footerTitle" notification:NO]; + id footerTitle = [self getRowFooterTitle:dict]; + if (footerTitle != nil) { + [section replaceValue:footerTitle forKey:@"footerTitle" notification:NO]; } [section add:rowProxy]; } else if ([row isKindOfClass:sectionClass]) { @@ -727,15 +727,15 @@ - (void)setData:(id)args withObject:(id)properties immediate:(BOOL)immediate [self rememberProxy:row]; [data addObject:section]; } else if ([row isKindOfClass:rowClass]) { - id rowHeader = [row valueForKey:@"header"]; - id rowFooter = [row valueForKey:@"footer"]; - if (section == nil || rowHeader != nil) { - section = [self sectionWithHeader:rowHeader table:[self tableView]]; + id headerTitle = [self getRowHeaderTitle:row]; + id footerTitle = [self getRowFooterTitle:row]; + if (section == nil || headerTitle != nil) { + section = [self sectionWithHeader:headerTitle table:[self tableView]]; section.section = [data count]; [data addObject:section]; } - if (rowFooter != nil) { - [section replaceValue:rowFooter forKey:@"footerTitle" notification:NO]; + if (footerTitle != nil) { + [section replaceValue:footerTitle forKey:@"footerTitle" notification:NO]; } [section add:row]; } @@ -1162,6 +1162,32 @@ - (void)add:(id)arg NSLog(@"[ERROR] Cannot add sub-views to table views. Use \"appendRow\" or \"appendSection\" instead."); } +- (NSString *)getRowHeaderTitle:(id)row +{ + id headerTitle = [row valueForKey:@"headerTitle"]; + if (headerTitle == nil) { + headerTitle = [row valueForKey:@"header"]; + + if (headerTitle != nil) { + DEPRECATED_REPLACED(@"header", @"10.0.0", @"headerTitle"); + } + } + return headerTitle; +} + +- (NSString *)getRowFooterTitle:(id)row +{ + id footerTitle = [row valueForKey:@"footerTitle"]; + if (footerTitle == nil) { + footerTitle = [row valueForKey:@"footer"]; + + if (footerTitle != nil) { + DEPRECATED_REPLACED(@"footer", @"10.0.0", @"footerTitle"); + } + } + return footerTitle; +} + #pragma mark Accessibility Overrides - (void)setAccessibilityLabel:(NSString *)accessibilityLabel