Skip to content

Commit c5bb799

Browse files
committed
* Markdown * fixed *
1 parent 3775cc9 commit c5bb799

File tree

10 files changed

+49
-31
lines changed

10 files changed

+49
-31
lines changed

Adamant.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,9 +1387,9 @@
13871387
"${BUILT_PRODUCTS_DIR}/Eureka/Eureka.framework",
13881388
"${BUILT_PRODUCTS_DIR}/FTIndicator/FTIndicator.framework",
13891389
"${BUILT_PRODUCTS_DIR}/FreakingSimpleRoundImageView/FreakingSimpleRoundImageView.framework",
1390-
"${BUILT_PRODUCTS_DIR}/Haring/Haring.framework",
13911390
"${BUILT_PRODUCTS_DIR}/KeychainAccess/KeychainAccess.framework",
13921391
"${BUILT_PRODUCTS_DIR}/Lisk/Lisk.framework",
1392+
"${BUILT_PRODUCTS_DIR}/MarkdownKit/MarkdownKit.framework",
13931393
"${BUILT_PRODUCTS_DIR}/MessageInputBar/MessageInputBar.framework",
13941394
"${BUILT_PRODUCTS_DIR}/MessageKit/MessageKit.framework",
13951395
"${BUILT_PRODUCTS_DIR}/MyLittlePinpad/MyLittlePinpad.framework",
@@ -1422,9 +1422,9 @@
14221422
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Eureka.framework",
14231423
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FTIndicator.framework",
14241424
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FreakingSimpleRoundImageView.framework",
1425-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Haring.framework",
14261425
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KeychainAccess.framework",
14271426
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Lisk.framework",
1427+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MarkdownKit.framework",
14281428
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MessageInputBar.framework",
14291429
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MessageKit.framework",
14301430
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MyLittlePinpad.framework",

Adamant/Services/DataProviders/AdamantChatsProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import Foundation
1010
import CoreData
11-
import Haring
11+
import MarkdownKit
1212

1313
class AdamantChatsProvider: ChatsProvider {
1414
// MARK: Dependencies

Adamant/Stories/Chats/ChatListViewController.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import UIKit
1010
import CoreData
11-
import Haring
11+
import MarkdownKit
1212

1313
extension String.adamantLocalized {
1414
struct chatList {
@@ -58,7 +58,15 @@ class ChatListViewController: UIViewController {
5858
return refreshControl
5959
}()
6060

61-
private let markdownParser = MarkdownParser(font: UIFont.systemFont(ofSize: ChatTableViewCell.shortDescriptionTextSize))
61+
private lazy var markdownParser: MarkdownParser = {
62+
let parser = MarkdownParser(font: UIFont.systemFont(ofSize: ChatTableViewCell.shortDescriptionTextSize),
63+
color: UIColor.adamant.primary,
64+
enabledElements: .disabledAutomaticLink)
65+
66+
parser.link.color = UIColor.adamant.active
67+
68+
return parser
69+
}()
6270

6371
// MARK: Busy indicator
6472

@@ -653,10 +661,6 @@ extension ChatListViewController {
653661
}
654662

655663
private func shortDescription(for transaction: ChatTransaction) -> NSAttributedString? {
656-
markdownParser.color = UIColor.adamant.primary
657-
markdownParser.link.color = UIColor.adamant.active
658-
markdownParser.automaticLinkDetectionEnabled = false
659-
660664
switch transaction {
661665
case let message as MessageTransaction:
662666
guard let text = message.message else {

Adamant/Stories/Chats/ChatViewController+MessageKit.swift

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
import MessageKit
1111
import MessageInputBar
1212
import SafariServices
13-
import Haring
13+
import MarkdownKit
1414

1515

1616
// MARK: - Tools
@@ -616,11 +616,8 @@ extension MessageTransaction: MessageType {
616616
}
617617

618618
if isMarkdown {
619-
let parser = MessageTransaction.markdownParser
620-
parser.color = UIColor.adamant.primary
621-
parser.link.color = UIColor.adamant.active
622-
parser.automaticLink.color = UIColor.adamant.active
623-
return MessageKind.attributedText(parser.parse(message))
619+
let markdown = MessageTransaction.markdownParser.parse(message)
620+
return MessageKind.attributedText(markdown)
624621
} else {
625622
return MessageKind.text(message)
626623
}
@@ -630,7 +627,13 @@ extension MessageTransaction: MessageType {
630627
return self.statusEnum
631628
}
632629

633-
private static let markdownParser = MarkdownParser(font: UIFont.adamantChatDefault)
630+
private static let markdownParser: MarkdownParser = {
631+
let parser = MarkdownParser(font: UIFont.adamantChatDefault,
632+
color: UIColor.adamant.primary)
633+
parser.link.color = UIColor.adamant.active
634+
parser.automaticLink.color = UIColor.adamant.active
635+
return parser
636+
}()
634637
}
635638

636639
// MARK: RichMessageTransaction

Adamant/Stories/Chats/SearchResultsViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import UIKit
1010
import Swinject
11-
import Haring
11+
import MarkdownKit
1212

1313
extension String.adamantLocalized {
1414
struct search {

Adamant/Stories/Login/LoginViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import UIKit
1010
import Eureka
11-
import Haring
11+
import MarkdownKit
1212

1313
// MARK: - Localization
1414
extension String.adamantLocalized {

Adamant/Stories/Settings/NotificationsViewController.swift

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import UIKit
1010
import Eureka
1111
import SafariServices
12-
import Haring
12+
import MarkdownKit
1313

1414
class NotificationsViewController: FormViewController {
1515

@@ -59,6 +59,12 @@ class NotificationsViewController: FormViewController {
5959
var dialogService: DialogService!
6060
var notificationsService: NotificationsService!
6161

62+
private lazy var markdownParser: MarkdownParser = {
63+
let parser = MarkdownParser(font: UIFont.systemFont(ofSize: UIFont.systemFontSize))
64+
parser.link.color = UIColor.adamant.secondary
65+
return parser
66+
}()
67+
6268
// MARK: - Lifecycle
6369

6470
override func viewDidLoad() {
@@ -100,14 +106,15 @@ class NotificationsViewController: FormViewController {
100106
let descriptionRow = TextAreaRow() {
101107
$0.textAreaHeight = .dynamic(initialTextViewHeight: 44)
102108
$0.tag = Rows.description.tag
103-
}.cellUpdate { (cell, _) in
109+
}.cellUpdate { [weak self] (cell, _) in
104110
cell.textView.isSelectable = false
105111
cell.textView.isEditable = false
106112

107-
let parser = MarkdownParser(font: UIFont.systemFont(ofSize: UIFont.systemFontSize))
108-
parser.color = UIColor.adamant.primary
109-
parser.link.color = UIColor.adamant.secondary
110-
cell.textView.attributedText = parser.parse(Rows.description.localized)
113+
if let parser = self?.markdownParser {
114+
cell.textView.attributedText = parser.parse(Rows.description.localized)
115+
} else {
116+
cell.textView.text = Rows.description.localized
117+
}
111118
}
112119

113120
// Github readme

Adamant/Stories/Settings/SecurityViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010
import Eureka
1111
import SafariServices
12-
import Haring
12+
import MarkdownKit
1313

1414
// MARK: - Localization
1515
extension String.adamantLocalized {

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ target 'Adamant' do
88
pod 'KeychainAccess' # Keychain
99
pod 'Swinject' # Dependency Injection
1010
pod 'ReachabilitySwift' # Network status
11-
pod 'Haring' # Markdown parser
11+
pod 'MarkdownKit', :git => 'https://github.com/RealBonus/MarkdownKit' # Markdown parser, forked fixing whitespaces '5 * 5 * 6'
1212
pod 'DateToolsSwift' # Date formatter tools
1313
pod 'ProcedureKit' # Async programming tools
1414

Podfile.lock

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ PODS:
1616
- FTIndicator/FTNotificationIndicator (1.2.9)
1717
- FTIndicator/FTProgressIndicator (1.2.9)
1818
- FTIndicator/FTToastIndicator (1.2.9)
19-
- Haring (2.1)
2019
- KeychainAccess (3.1.2)
2120
- libsodium (1.0.12)
2221
- Lisk (1.1.0):
2322
- CryptoSwift (~> 0.12.0)
2423
- libsodium (~> 1.0.12)
24+
- MarkdownKit (1.5)
2525
- MessageInputBar/Core (0.4.1)
2626
- MessageKit (2.0.0):
2727
- MessageInputBar/Core
@@ -71,10 +71,10 @@ DEPENDENCIES:
7171
- Eureka
7272
- FreakingSimpleRoundImageView
7373
- FTIndicator
74-
- Haring
7574
- KeychainAccess
7675
- libsodium
7776
- Lisk (from `https://github.com/adamant-im/lisk-swift.git`)
77+
- MarkdownKit (from `https://github.com/RealBonus/MarkdownKit`)
7878
- MessageKit
7979
- MyLittlePinpad
8080
- Parchment
@@ -98,7 +98,6 @@ SPEC REPOS:
9898
- Eureka
9999
- FreakingSimpleRoundImageView
100100
- FTIndicator
101-
- Haring
102101
- KeychainAccess
103102
- libsodium
104103
- MessageInputBar
@@ -123,6 +122,8 @@ SPEC REPOS:
123122
EXTERNAL SOURCES:
124123
Lisk:
125124
:git: https://github.com/adamant-im/lisk-swift.git
125+
MarkdownKit:
126+
:git: https://github.com/RealBonus/MarkdownKit
126127
SwiftyOnboard:
127128
:branch: feature/customStyle
128129
:git: https://github.com/RealBonus/SwiftyOnboard
@@ -131,6 +132,9 @@ CHECKOUT OPTIONS:
131132
Lisk:
132133
:commit: 154a3af05772136b776ff14ae05f92c8d844ea20
133134
:git: https://github.com/adamant-im/lisk-swift.git
135+
MarkdownKit:
136+
:commit: 2703e13ed4cfbb031713711dd5ce6a9da62a2a1c
137+
:git: https://github.com/RealBonus/MarkdownKit
134138
SwiftyOnboard:
135139
:commit: 8341eff1eb918e904a915be8dac5d5a1545887f2
136140
:git: https://github.com/RealBonus/SwiftyOnboard
@@ -145,10 +149,10 @@ SPEC CHECKSUMS:
145149
Eureka: 28ea296f06710f6745266b71f17862048941a32d
146150
FreakingSimpleRoundImageView: 0d687cb05da8684e85c4c2ae9945bafcbe89d2a2
147151
FTIndicator: f7f071fd159e5befa1d040a9ef2e3ab53fa9322c
148-
Haring: b3a8495c073a016f03296d67debc609a7ecf7710
149152
KeychainAccess: b3816fddcf28aa29d94b10ec305cd52be14c472b
150153
libsodium: 9a8faa5ef2fa0d2d57bd7f7d79bf8fb7c1a9f0ea
151154
Lisk: 2b21f9a60f4b1583349a1b1677d83781ec32ca70
155+
MarkdownKit: 379028e9cd3ebf05ccac87205cd9aead446159d4
152156
MessageInputBar: e81c7535347f1f7b923de7080409a535a004b6e4
153157
MessageKit: 29c1c87e5a396d2ca7a3f712e5171dc9aba42a1e
154158
MyLittlePinpad: 5d57cb5a092ddbeb5c4e6fa0b46df83bd3e88b0c
@@ -169,6 +173,6 @@ SPEC CHECKSUMS:
169173
Swinject: 82cdb851f63f91bba974e3eca1d69780f2f7677e
170174
web3swift: d80d1b9a3feca16e614acec9eea47ec26310d37d
171175

172-
PODFILE CHECKSUM: 1a42b369e3317521b2060baaf7b7bc56d7e6adb6
176+
PODFILE CHECKSUM: f183aea9085cd37a477cff56eb908cee1843ba18
173177

174178
COCOAPODS: 1.6.0

0 commit comments

Comments
 (0)