From eda545c8432fe3f5e844f601e37053ecc924c38c Mon Sep 17 00:00:00 2001 From: Stephenie Harris Date: Thu, 24 May 2018 17:04:33 -0600 Subject: [PATCH 1/8] Adding tracks for Zendesk new tickets. --- WordPressShared/Core/Analytics/WPAnalytics.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WordPressShared/Core/Analytics/WPAnalytics.h b/WordPressShared/Core/Analytics/WPAnalytics.h index 3a6d404..1eb4719 100644 --- a/WordPressShared/Core/Analytics/WPAnalytics.h +++ b/WordPressShared/Core/Analytics/WPAnalytics.h @@ -371,6 +371,8 @@ typedef NS_ENUM(NSUInteger, WPAnalyticsStat) { WPAnalyticsStatSupportHelpCenterViewed, WPAnalyticsStatSupportNewRequestViewed, WPAnalyticsStatSupportTicketListViewed, + WPAnalyticsStatSupportNewRequestCreated, + WPAnalyticsStatSupportNewRequestFailed, WPAnalyticsStatSupportNewRequestFileAttached, WPAnalyticsStatSupportNewRequestFileAttachmentFailed, WPAnalyticsStatSupportTicketUserReplied, From b8d340d3b740f6ea548b9e948a8d20849715be7e Mon Sep 17 00:00:00 2001 From: James Frost Date: Fri, 25 May 2018 00:05:56 +0100 Subject: [PATCH 2/8] Add accessibility label override to no results view --- WordPressShared/Core/Views/WPNoResultsView.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/WordPressShared/Core/Views/WPNoResultsView.m b/WordPressShared/Core/Views/WPNoResultsView.m index c0a2305..278db53 100644 --- a/WordPressShared/Core/Views/WPNoResultsView.m +++ b/WordPressShared/Core/Views/WPNoResultsView.m @@ -208,6 +208,14 @@ - (NSAttributedString *)applyMessageStylesToAttributedString:(NSAttributedString #pragma mark - Properties +- (void)setAccessibilityLabel:(NSString *)accessibilityLabel { + [super setAccessibilityLabel:accessibilityLabel]; + + // If an accessibility label is set, use it to override the displayed + // title and message. + self.isAccessibilityElement = (accessibilityLabel) ? YES : NO; +} + - (NSString *)titleText { return _titleLabel.text; } From fd11b1da835e241d70061b20a9698226b398bbde Mon Sep 17 00:00:00 2001 From: James Frost Date: Fri, 25 May 2018 15:09:47 +0100 Subject: [PATCH 3/8] Bumped to version 1.0.4 --- WordPressShared.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressShared.podspec b/WordPressShared.podspec index 9648aa5..93ea90a 100644 --- a/WordPressShared.podspec +++ b/WordPressShared.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressShared" - s.version = "1.0.3" + s.version = "1.0.4" s.summary = "Shared components used in building the WordPress iOS apps and other library components." s.description = <<-DESC From 290dc1fb11f8cc37d34a6a4f746c40f8e35e5000 Mon Sep 17 00:00:00 2001 From: aerych Date: Tue, 29 May 2018 15:27:53 -0500 Subject: [PATCH 4/8] Treat Gutenberg comments as forbidden tags. --- WordPressShared/Core/Utility/RichContentFormatter.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/WordPressShared/Core/Utility/RichContentFormatter.swift b/WordPressShared/Core/Utility/RichContentFormatter.swift index 8e9feac..820c86a 100644 --- a/WordPressShared/Core/Utility/RichContentFormatter.swift +++ b/WordPressShared/Core/Utility/RichContentFormatter.swift @@ -11,6 +11,7 @@ import Foundation static let styleTags = try! NSRegularExpression(pattern: "]*?>[\\s\\S]*?", options: .caseInsensitive) static let scriptTags = try! NSRegularExpression(pattern: "]*?>[\\s\\S]*?", options: .caseInsensitive) static let tableTags = try! NSRegularExpression(pattern: "]*?>[\\s\\S]*?", options: .caseInsensitive) + static let gutenbergComments = try! NSRegularExpression(pattern: "

", options: .caseInsensitive) // Normalizaing Paragraphs static let divTagsStart = try! NSRegularExpression(pattern: "]*>", options: .caseInsensitive) @@ -84,6 +85,11 @@ import Foundation range: NSRange(location: 0, length: content.count), withTemplate: "") + content = RegEx.gutenbergComments.stringByReplacingMatches(in: content, + options: .reportCompletion, + range: NSRange(location: 0, length: content.count), + withTemplate: "") + return content } From aa7a34d4b6cfaa4804761dddedf6ffa4259eb6ee Mon Sep 17 00:00:00 2001 From: aerych Date: Tue, 29 May 2018 17:18:57 -0500 Subject: [PATCH 5/8] Tweak regex to catch gutenberg attributes. --- WordPressShared/Core/Utility/RichContentFormatter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressShared/Core/Utility/RichContentFormatter.swift b/WordPressShared/Core/Utility/RichContentFormatter.swift index 820c86a..58d6a85 100644 --- a/WordPressShared/Core/Utility/RichContentFormatter.swift +++ b/WordPressShared/Core/Utility/RichContentFormatter.swift @@ -11,7 +11,7 @@ import Foundation static let styleTags = try! NSRegularExpression(pattern: "]*?>[\\s\\S]*?", options: .caseInsensitive) static let scriptTags = try! NSRegularExpression(pattern: "]*?>[\\s\\S]*?", options: .caseInsensitive) static let tableTags = try! NSRegularExpression(pattern: "]*?>[\\s\\S]*?", options: .caseInsensitive) - static let gutenbergComments = try! NSRegularExpression(pattern: "

", options: .caseInsensitive) + static let gutenbergComments = try! NSRegularExpression(pattern: "

[\\n]?", options: .caseInsensitive) // Normalizaing Paragraphs static let divTagsStart = try! NSRegularExpression(pattern: "]*>", options: .caseInsensitive) From afee0e92d755f1a4fe9c4761414a70bf9a509cc8 Mon Sep 17 00:00:00 2001 From: aerych Date: Tue, 29 May 2018 17:19:13 -0500 Subject: [PATCH 6/8] Update test. --- WordPressSharedTests/RichContentFormatterTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WordPressSharedTests/RichContentFormatterTests.swift b/WordPressSharedTests/RichContentFormatterTests.swift index c6197d6..c96ff3d 100644 --- a/WordPressSharedTests/RichContentFormatterTests.swift +++ b/WordPressSharedTests/RichContentFormatterTests.swift @@ -12,8 +12,8 @@ class RichContentFormatterTests: XCTestCase { func testRemoveForbiddenTags() { - let str = "

test

test

" - let styleStr = "

test

test

" + let str = "

test

test

" + let styleStr = "

test

test

\n" let sanitizedStr = RichContentFormatter.removeForbiddenTags(styleStr) XCTAssertTrue(str == sanitizedStr, "The forbidden tags were not removed.") } From 0c1d2341bcf38b73beb4100b1ee5847e831dcd6b Mon Sep 17 00:00:00 2001 From: aerych Date: Tue, 29 May 2018 20:57:06 -0500 Subject: [PATCH 7/8] Handle self-closing gutenberg tags. --- WordPressShared/Core/Utility/RichContentFormatter.swift | 2 +- WordPressSharedTests/RichContentFormatterTests.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WordPressShared/Core/Utility/RichContentFormatter.swift b/WordPressShared/Core/Utility/RichContentFormatter.swift index 58d6a85..4736ccb 100644 --- a/WordPressShared/Core/Utility/RichContentFormatter.swift +++ b/WordPressShared/Core/Utility/RichContentFormatter.swift @@ -11,7 +11,7 @@ import Foundation static let styleTags = try! NSRegularExpression(pattern: "]*?>[\\s\\S]*?", options: .caseInsensitive) static let scriptTags = try! NSRegularExpression(pattern: "]*?>[\\s\\S]*?", options: .caseInsensitive) static let tableTags = try! NSRegularExpression(pattern: "]*?>[\\s\\S]*?", options: .caseInsensitive) - static let gutenbergComments = try! NSRegularExpression(pattern: "

[\\n]?", options: .caseInsensitive) + static let gutenbergComments = try! NSRegularExpression(pattern: "

[\\n]?", options: .caseInsensitive) // Normalizaing Paragraphs static let divTagsStart = try! NSRegularExpression(pattern: "]*>", options: .caseInsensitive) diff --git a/WordPressSharedTests/RichContentFormatterTests.swift b/WordPressSharedTests/RichContentFormatterTests.swift index c96ff3d..76273a4 100644 --- a/WordPressSharedTests/RichContentFormatterTests.swift +++ b/WordPressSharedTests/RichContentFormatterTests.swift @@ -13,7 +13,7 @@ class RichContentFormatterTests: XCTestCase { func testRemoveForbiddenTags() { let str = "

test

test

" - let styleStr = "

test

test

\n" + let styleStr = "

test

test

\n

" let sanitizedStr = RichContentFormatter.removeForbiddenTags(styleStr) XCTAssertTrue(str == sanitizedStr, "The forbidden tags were not removed.") } From e87e600a8247bb7f17928135b93a550f899e7fed Mon Sep 17 00:00:00 2001 From: aerych Date: Tue, 29 May 2018 20:57:14 -0500 Subject: [PATCH 8/8] Bumps pod version. --- WordPressShared.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressShared.podspec b/WordPressShared.podspec index 93ea90a..26144a5 100644 --- a/WordPressShared.podspec +++ b/WordPressShared.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressShared" - s.version = "1.0.4" + s.version = "1.0.5" s.summary = "Shared components used in building the WordPress iOS apps and other library components." s.description = <<-DESC