Skip to content

Commit 3a94680

Browse files
committed
Merge branch 'release/1.7.1'
2 parents cfe47c2 + df9b4c6 commit 3a94680

39 files changed

+242
-32
lines changed

Adamant.xcodeproj/project.pbxproj

Lines changed: 31 additions & 17 deletions
Large diffs are not rendered by default.
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
{
2+
"images" : [
3+
{
4+
"size" : "20x20",
5+
"idiom" : "iphone",
6+
"filename" : "Icon_debug-20@2x.png",
7+
"scale" : "2x"
8+
},
9+
{
10+
"size" : "20x20",
11+
"idiom" : "iphone",
12+
"filename" : "Icon_debug-20@3x.png",
13+
"scale" : "3x"
14+
},
15+
{
16+
"size" : "29x29",
17+
"idiom" : "iphone",
18+
"filename" : "Icon_debug-29@2x.png",
19+
"scale" : "2x"
20+
},
21+
{
22+
"size" : "29x29",
23+
"idiom" : "iphone",
24+
"filename" : "Icon_debug-29@3x.png",
25+
"scale" : "3x"
26+
},
27+
{
28+
"size" : "40x40",
29+
"idiom" : "iphone",
30+
"filename" : "Icon_debug-40@2x.png",
31+
"scale" : "2x"
32+
},
33+
{
34+
"size" : "40x40",
35+
"idiom" : "iphone",
36+
"filename" : "Icon_debug-40@3x.png",
37+
"scale" : "3x"
38+
},
39+
{
40+
"size" : "60x60",
41+
"idiom" : "iphone",
42+
"filename" : "Icon_debug-60@2x.png",
43+
"scale" : "2x"
44+
},
45+
{
46+
"size" : "60x60",
47+
"idiom" : "iphone",
48+
"filename" : "Icon_debug-60@3x.png",
49+
"scale" : "3x"
50+
},
51+
{
52+
"size" : "20x20",
53+
"idiom" : "ipad",
54+
"filename" : "Icon_debug-20.png",
55+
"scale" : "1x"
56+
},
57+
{
58+
"size" : "20x20",
59+
"idiom" : "ipad",
60+
"filename" : "Icon_debug-20@2x-1.png",
61+
"scale" : "2x"
62+
},
63+
{
64+
"size" : "29x29",
65+
"idiom" : "ipad",
66+
"filename" : "Icon_debug-29.png",
67+
"scale" : "1x"
68+
},
69+
{
70+
"size" : "29x29",
71+
"idiom" : "ipad",
72+
"filename" : "Icon_debug-29@2x-1.png",
73+
"scale" : "2x"
74+
},
75+
{
76+
"size" : "40x40",
77+
"idiom" : "ipad",
78+
"filename" : "Icon_debug-40.png",
79+
"scale" : "1x"
80+
},
81+
{
82+
"size" : "40x40",
83+
"idiom" : "ipad",
84+
"filename" : "Icon_debug-40@2x-1.png",
85+
"scale" : "2x"
86+
},
87+
{
88+
"size" : "76x76",
89+
"idiom" : "ipad",
90+
"filename" : "Icon_debug-76.png",
91+
"scale" : "1x"
92+
},
93+
{
94+
"size" : "76x76",
95+
"idiom" : "ipad",
96+
"filename" : "Icon_debug-76@2x.png",
97+
"scale" : "2x"
98+
},
99+
{
100+
"size" : "83.5x83.5",
101+
"idiom" : "ipad",
102+
"filename" : "Icon_debug-83.5@2x.png",
103+
"scale" : "2x"
104+
},
105+
{
106+
"size" : "1024x1024",
107+
"idiom" : "ios-marketing",
108+
"filename" : "Icon_debug.png",
109+
"scale" : "1x"
110+
}
111+
],
112+
"info" : {
113+
"version" : 1,
114+
"author" : "xcode"
115+
}
116+
}
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}

Adamant/Debug.entitlements

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>aps-environment</key>
6+
<string>development</string>
7+
<key>keychain-access-groups</key>
8+
<array>
9+
<string>$(AppIdentifierPrefix)im.adamant.messenger-dev</string>
10+
</array>
11+
</dict>
12+
</plist>

Adamant/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.7</string>
20+
<string>1.7.1</string>
2121
<key>CFBundleVersion</key>
22-
<string>84</string>
22+
<string>85</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>NSAppTransportSecurity</key>
File renamed without changes.

AdamantShared/RichMessageProviders/TransferBaseProvider.swift

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

99
import UIKit
1010
import UserNotifications
11+
import MarkdownKit
1112

1213
class TransferBaseProvider: TransferNotificationContentProvider {
14+
15+
/// Create notification content for Rich messages
1316
func notificationContent(for transaction: Transaction, partnerAddress: String, partnerName: String?, richContent: [String:String]) -> NotificationContent? {
1417
guard let amountRaw = richContent[RichContentKeys.transfer.amount], let amount = Decimal(string: amountRaw) else {
1518
return nil
@@ -25,12 +28,15 @@ class TransferBaseProvider: TransferNotificationContentProvider {
2528
return notificationContent(partnerAddress: partnerAddress, partnerName: partnerName, amount: amount, comment: comment)
2629
}
2730

31+
32+
/// Create notification content for rich transfers with comments, such as ADM transfer
2833
func notificationContent(partnerAddress: String, partnerName: String?, amount: Decimal, comment: String?) -> NotificationContent? {
2934
let amountFormated = AdamantBalanceFormat.full.format(amount, withCurrencySymbol: currencySymbol)
3035
var body = String.adamantLocalized.notifications.yourTransferBody(with: amountFormated)
3136

3237
if let comment = comment {
33-
body = "\(body)\n\(comment)"
38+
let stripped = MarkdownParser().parse(comment).string
39+
body = "\(body)\n\(stripped)"
3440
}
3541

3642
let identifier = type(of: self).richMessageType
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>keychain-access-groups</key>
6+
<array>
7+
<string>$(AppIdentifierPrefix)im.adamant.messenger-dev</string>
8+
</array>
9+
</dict>
10+
</plist>

MessageNotificationContentExtension/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<key>CFBundlePackageType</key>
1818
<string>XPC!</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.7</string>
20+
<string>1.7.1</string>
2121
<key>CFBundleVersion</key>
22-
<string>84</string>
22+
<string>85</string>
2323
<key>NSExtension</key>
2424
<dict>
2525
<key>NSExtensionAttributes</key>

MessageNotificationContentExtension/NotificationViewController.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import UIKit
1010
import UserNotifications
1111
import UserNotificationsUI
12+
import MarkdownKit
1213

1314
class NotificationViewController: UIViewController, UNNotificationContentExtension {
1415

@@ -140,7 +141,14 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
140141
}
141142

142143
senderAvatarImageView.image = avatarService.avatar(for: transaction.senderPublicKey, size: Double(senderAvatarImageView.frame.height))
143-
messageLabel.text = message
144+
145+
let parsed = MarkdownParser(font: messageLabel.font).parse(message)
146+
if parsed.string.count != message.count {
147+
messageLabel.attributedText = parsed
148+
} else {
149+
messageLabel.text = message
150+
}
151+
144152
dateLabel.text = transaction.date.humanizedDateTime()
145153

146154
// MARK: 4. View size
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>keychain-access-groups</key>
6+
<array>
7+
<string>$(AppIdentifierPrefix)im.adamant.messenger-dev</string>
8+
</array>
9+
</dict>
10+
</plist>

NotificationServiceExtension/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<key>CFBundlePackageType</key>
1818
<string>XPC!</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.7</string>
20+
<string>1.7.1</string>
2121
<key>CFBundleVersion</key>
22-
<string>84</string>
22+
<string>85</string>
2323
<key>NSExtension</key>
2424
<dict>
2525
<key>NSExtensionPointIdentifier</key>

NotificationServiceExtension/NotificationService.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import UserNotifications
10+
import MarkdownKit
1011

1112
class NotificationService: UNNotificationServiceExtension {
1213
private let passphraseStoreKey = "accountService.passphrase"
@@ -100,11 +101,13 @@ class NotificationService: UNNotificationServiceExtension {
100101
case .messageOld:
101102
fallthrough
102103
case .message:
104+
// Strip markdown symbols
103105
if transaction.amount > 0 { // ADM Transfer with comments
106+
// Also will strip markdown
104107
handleAdamantTransfer(notificationContent: bestAttemptContent, partnerAddress: partnerAddress, partnerName: partnerName, amount: transaction.amount, comment: message)
105108
} else { // Message
106109
bestAttemptContent.title = partnerName ?? partnerAddress
107-
bestAttemptContent.body = message
110+
bestAttemptContent.body = MarkdownParser().parse(message).string // Strip markdown
108111
bestAttemptContent.categoryIdentifier = AdamantNotificationCategories.message
109112
}
110113

@@ -143,7 +146,7 @@ class NotificationService: UNNotificationServiceExtension {
143146
// MARK: 6. Other configurations
144147
bestAttemptContent.threadIdentifier = partnerAddress
145148

146-
// Caching downloaded transaction, to avoid downloading ang decoding it in ContentExtensions
149+
// MARK: 7. Caching downloaded transaction, to avoid downloading ang decoding it in ContentExtensions
147150
if let data = try? JSONEncoder().encode(transaction), let transactionRaw = String(data: data, encoding: .utf8) {
148151
bestAttemptContent.userInfo[AdamantNotificationUserInfoKeys.transaction] = transactionRaw
149152
}

Podfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ def core_pods
1414
pod 'libsodium' # Sodium crypto library
1515
end
1616

17+
# Markdown parser, forked with fixed whitespaces. '5 * 5 * 6'
18+
def markdown_pods
19+
pod 'MarkdownKit', :git => 'https://github.com/RealBonus/MarkdownKit'
20+
end
21+
1722
# ADAMANT Messenger iOS app
1823
target 'Adamant' do
1924
use_frameworks!
2025

2126
pod 'Alamofire' # Network
2227
pod 'Swinject' # Dependency Injection
2328
pod 'ReachabilitySwift' # Network status
24-
pod 'MarkdownKit', :git => 'https://github.com/RealBonus/MarkdownKit' # Markdown parser, forked fixing whitespaces '5 * 5 * 6'
2529
pod 'DateToolsSwift' # Date formatter tools
2630
pod 'ProcedureKit' # Async programming tools
2731

@@ -47,6 +51,7 @@ target 'Adamant' do
4751
# Shared
4852
keychain_pods
4953
core_pods
54+
markdown_pods
5055
end
5156

5257
target 'AdamantTests' do
@@ -59,13 +64,15 @@ target 'NotificationServiceExtension' do
5964
use_frameworks!
6065
keychain_pods
6166
core_pods
67+
markdown_pods
6268
end
6369

6470
# Adamant TransferNotificationContentExtension - Notification Content Extension for transfers
6571
target 'TransferNotificationContentExtension' do
6672
use_frameworks!
6773
keychain_pods
6874
core_pods
75+
markdown_pods
6976
pod 'DateToolsSwift' # Date formatter tools
7077
end
7178

@@ -74,5 +81,6 @@ target 'MessageNotificationContentExtension' do
7481
use_frameworks!
7582
keychain_pods
7683
core_pods
84+
markdown_pods
7785
pod 'DateToolsSwift' # Date formatter tools
7886
end

Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,6 @@ SPEC CHECKSUMS:
204204
Swinject: 82cdb851f63f91bba974e3eca1d69780f2f7677e
205205
web3swift: d80d1b9a3feca16e614acec9eea47ec26310d37d
206206

207-
PODFILE CHECKSUM: 3e8a43c238a3ec1b7e8509d6cd102d80eef12777
207+
PODFILE CHECKSUM: 0bf602086adfe27d6043b83dcfd57b5bcc8a03ab
208208

209209
COCOAPODS: 1.6.2
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>keychain-access-groups</key>
6+
<array>
7+
<string>$(AppIdentifierPrefix)im.adamant.messenger-dev</string>
8+
</array>
9+
</dict>
10+
</plist>

TransferNotificationContentExtension/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<key>CFBundlePackageType</key>
1818
<string>XPC!</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.7</string>
20+
<string>1.7.1</string>
2121
<key>CFBundleVersion</key>
22-
<string>84</string>
22+
<string>85</string>
2323
<key>NSExtension</key>
2424
<dict>
2525
<key>NSExtensionAttributes</key>

TransferNotificationContentExtension/NotificationViewController.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import UIKit
1010
import UserNotifications
1111
import UserNotificationsUI
12+
import MarkdownKit
1213

1314
class NotificationViewController: UIViewController, UNNotificationContentExtension {
1415
private let passphraseStoreKey = "accountService.passphrase"
@@ -227,7 +228,13 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
227228
currencySymbolLabel.text = provider.currencySymbol
228229

229230
if let comments = comments {
230-
commentLabel.text = comments
231+
let parsed = MarkdownParser(font: commentLabel.font).parse(comments)
232+
233+
if parsed.string.count != comments.count {
234+
commentLabel.attributedText = parsed
235+
} else {
236+
commentLabel.text = comments
237+
}
231238
} else {
232239
commentLabel.isHidden = true
233240
}

0 commit comments

Comments
 (0)