From 516f8e41524f0ec9aec9e49e1df5a35d6208ee8d Mon Sep 17 00:00:00 2001 From: Yishai Date: Thu, 15 Feb 2018 13:16:15 +0000 Subject: [PATCH] TransitInformation - Updated handleTransitInfo method name and updated change log --- CHANGELOG.md | 3 +++ Sources/Views/MessageLabel.swift | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d95b5b9..685698dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,9 @@ The changelog for `MessageKit`. Also see the [releases](https://github.com/Messa - `layoutBottomLabel(with attributes: MessagesCollectionViewLayoutAttributes)` [#491](https://github.com/MessageKit/MessageKit/pull/491) by [@SD10](https://github.com/SD10). +- **Breaking Change** Adds new `DetectorType` called `TransitInformation` to message label. +[#520](https://github.com/MessageKit/MessageKit/pull/520) by [@nosarj](https://github.com/nosarj). + ### [[Prerelease] 0.13.1](https://github.com/MessageKit/MessageKit/releases/tag/0.13.1) ### Fixed diff --git a/Sources/Views/MessageLabel.swift b/Sources/Views/MessageLabel.swift index 561e136f..0f12f719 100644 --- a/Sources/Views/MessageLabel.swift +++ b/Sources/Views/MessageLabel.swift @@ -335,7 +335,7 @@ open class MessageLabel: UILabel { rangesForDetectors.updateValue(ranges, forKey: .url) case .transitInformation: var ranges = rangesForDetectors[.transitInformation] ?? [] - let tuple: (NSRange, MessageTextCheckingType) = (result.range, .transitInformationComponents(result.components)) + let tuple: (NSRange, MessageTextCheckingType) = (result.range, .transitInfoComponents(result.components)) ranges.append(tuple) rangesForDetectors.updateValue(ranges, forKey: .transitInformation) @@ -406,7 +406,7 @@ open class MessageLabel: UILabel { case let .link(url): guard let url = url else { return } handleURL(url) - case let .transitInformationComponents(transitInformation): + case let .transitInfoComponents(transitInformation): var transformedTransitInformation = [String: String]() guard let transitInformation = transitInformation else { return } transitInformation.forEach { (key, value) in @@ -432,8 +432,8 @@ open class MessageLabel: UILabel { delegate?.didSelectPhoneNumber(phoneNumber) } - private func handleTransitInformation(_ transitInformationComponents: [String: String]) { - delegate?.didSelectTransitInformation(transitInformationComponents) + private func handleTransitInformation(_ components: [String: String]) { + delegate?.didSelectTransitInformation(components) } } @@ -443,5 +443,5 @@ private enum MessageTextCheckingType { case date(Date?) case phoneNumber(String?) case link(URL?) - case transitInformationComponents([NSTextCheckingKey: String]?) + case transitInfoComponents([NSTextCheckingKey: String]?) }