Skip to content

Commit 8f5bdd1

Browse files
Merge pull request #77 from Adamant-im/develop
ADAMANT QR codes & Fixed a bug with static chat names & Recovered a buy adm row
2 parents 2bc1c64 + 20cd76b commit 8f5bdd1

28 files changed

+424
-181
lines changed

Adamant.xcodeproj/project.pbxproj

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,7 +2877,7 @@
28772877
CODE_SIGN_ENTITLEMENTS = MessageNotificationContentExtension/Debug.entitlements;
28782878
CODE_SIGN_IDENTITY = "iPhone Developer";
28792879
CODE_SIGN_STYLE = Manual;
2880-
CURRENT_PROJECT_VERSION = 169;
2880+
CURRENT_PROJECT_VERSION = 173;
28812881
DEVELOPMENT_TEAM = J2L77FMN46;
28822882
INFOPLIST_FILE = MessageNotificationContentExtension/Info.plist;
28832883
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -2886,7 +2886,7 @@
28862886
"@executable_path/Frameworks",
28872887
"@executable_path/../../Frameworks",
28882888
);
2889-
MARKETING_VERSION = 2.1.7;
2889+
MARKETING_VERSION = 2.3.0;
28902890
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
28912891
MTL_FAST_MATH = YES;
28922892
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger-dev.MessageNotificationContentExtension";
@@ -2906,7 +2906,7 @@
29062906
CODE_SIGN_IDENTITY = "Apple Development";
29072907
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
29082908
CODE_SIGN_STYLE = Manual;
2909-
CURRENT_PROJECT_VERSION = 169;
2909+
CURRENT_PROJECT_VERSION = 173;
29102910
DEVELOPMENT_TEAM = J2L77FMN46;
29112911
INFOPLIST_FILE = MessageNotificationContentExtension/Info.plist;
29122912
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -2915,7 +2915,7 @@
29152915
"@executable_path/Frameworks",
29162916
"@executable_path/../../Frameworks",
29172917
);
2918-
MARKETING_VERSION = 2.1.7;
2918+
MARKETING_VERSION = 2.3.0;
29192919
MTL_FAST_MATH = YES;
29202920
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger.MessageNotificationContentExtension";
29212921
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -3053,7 +3053,7 @@
30533053
CODE_SIGN_ENTITLEMENTS = Adamant/Debug.entitlements;
30543054
CODE_SIGN_IDENTITY = "iPhone Developer";
30553055
CODE_SIGN_STYLE = Manual;
3056-
CURRENT_PROJECT_VERSION = 169;
3056+
CURRENT_PROJECT_VERSION = 173;
30573057
DEVELOPMENT_TEAM = J2L77FMN46;
30583058
DISPLAY_NAME = ADM.Dev;
30593059
EXCLUDED_SOURCE_FILE_NAMES = "";
@@ -3063,7 +3063,7 @@
30633063
"$(inherited)",
30643064
"@executable_path/Frameworks",
30653065
);
3066-
MARKETING_VERSION = 2.1.7;
3066+
MARKETING_VERSION = 2.3.0;
30673067
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger-dev";
30683068
PRODUCT_NAME = "$(TARGET_NAME)";
30693069
PROVISIONING_PROFILE = "e4233bbf-3705-44fe-95b0-e77475672c60";
@@ -3082,7 +3082,7 @@
30823082
CODE_SIGN_IDENTITY = "Apple Development";
30833083
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
30843084
CODE_SIGN_STYLE = Manual;
3085-
CURRENT_PROJECT_VERSION = 169;
3085+
CURRENT_PROJECT_VERSION = 173;
30863086
DEVELOPMENT_TEAM = J2L77FMN46;
30873087
DISPLAY_NAME = Adamant;
30883088
EXCLUDED_SOURCE_FILE_NAMES = Debug.xcassets;
@@ -3092,7 +3092,7 @@
30923092
"$(inherited)",
30933093
"@executable_path/Frameworks",
30943094
);
3095-
MARKETING_VERSION = 2.1.7;
3095+
MARKETING_VERSION = 2.3.0;
30963096
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger";
30973097
PRODUCT_NAME = "$(TARGET_NAME)";
30983098
PROVISIONING_PROFILE = "bedd1b75-2f23-4a85-a0b2-14c424fcff42";
@@ -3110,7 +3110,7 @@
31103110
CODE_SIGN_ENTITLEMENTS = TransferNotificationContentExtension/Debug.entitlements;
31113111
CODE_SIGN_IDENTITY = "iPhone Developer";
31123112
CODE_SIGN_STYLE = Manual;
3113-
CURRENT_PROJECT_VERSION = 169;
3113+
CURRENT_PROJECT_VERSION = 173;
31143114
DEVELOPMENT_TEAM = J2L77FMN46;
31153115
INFOPLIST_FILE = TransferNotificationContentExtension/Info.plist;
31163116
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -3119,7 +3119,7 @@
31193119
"@executable_path/Frameworks",
31203120
"@executable_path/../../Frameworks",
31213121
);
3122-
MARKETING_VERSION = 2.1.7;
3122+
MARKETING_VERSION = 2.3.0;
31233123
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
31243124
MTL_FAST_MATH = YES;
31253125
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger-dev.TransferNotificationContentExtension";
@@ -3139,7 +3139,7 @@
31393139
CODE_SIGN_IDENTITY = "Apple Development";
31403140
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
31413141
CODE_SIGN_STYLE = Manual;
3142-
CURRENT_PROJECT_VERSION = 169;
3142+
CURRENT_PROJECT_VERSION = 173;
31433143
DEVELOPMENT_TEAM = J2L77FMN46;
31443144
INFOPLIST_FILE = TransferNotificationContentExtension/Info.plist;
31453145
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -3148,11 +3148,11 @@
31483148
"@executable_path/Frameworks",
31493149
"@executable_path/../../Frameworks",
31503150
);
3151-
MARKETING_VERSION = 2.1.7;
3151+
MARKETING_VERSION = 2.3.0;
31523152
MTL_FAST_MATH = YES;
31533153
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger.TransferNotificationContentExtension";
31543154
PRODUCT_NAME = "$(TARGET_NAME)";
3155-
PROVISIONING_PROFILE_SPECIFIER = "ADAMANT Messenger ext TransferNotification";
3155+
PROVISIONING_PROFILE_SPECIFIER = "ADAMANT Messenger dist ext TransferNotification NE";
31563156
SKIP_INSTALL = YES;
31573157
SWIFT_COMPILATION_MODE = singlefile;
31583158
SWIFT_OPTIMIZATION_LEVEL = "-O";
@@ -3168,7 +3168,7 @@
31683168
CODE_SIGN_ENTITLEMENTS = NotificationServiceExtension/Debug.entitlements;
31693169
CODE_SIGN_IDENTITY = "iPhone Developer";
31703170
CODE_SIGN_STYLE = Manual;
3171-
CURRENT_PROJECT_VERSION = 169;
3171+
CURRENT_PROJECT_VERSION = 173;
31723172
DEVELOPMENT_TEAM = J2L77FMN46;
31733173
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
31743174
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -3177,7 +3177,7 @@
31773177
"@executable_path/Frameworks",
31783178
"@executable_path/../../Frameworks",
31793179
);
3180-
MARKETING_VERSION = 2.1.7;
3180+
MARKETING_VERSION = 2.3.0;
31813181
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
31823182
MTL_FAST_MATH = YES;
31833183
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger-dev.NotificationServiceExtension";
@@ -3197,7 +3197,7 @@
31973197
CODE_SIGN_IDENTITY = "Apple Development";
31983198
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
31993199
CODE_SIGN_STYLE = Manual;
3200-
CURRENT_PROJECT_VERSION = 169;
3200+
CURRENT_PROJECT_VERSION = 173;
32013201
DEVELOPMENT_TEAM = J2L77FMN46;
32023202
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
32033203
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -3206,7 +3206,7 @@
32063206
"@executable_path/Frameworks",
32073207
"@executable_path/../../Frameworks",
32083208
);
3209-
MARKETING_VERSION = 2.1.7;
3209+
MARKETING_VERSION = 2.3.0;
32103210
MTL_FAST_MATH = YES;
32113211
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger.NotificationServiceExtension";
32123212
PRODUCT_NAME = "$(TARGET_NAME)";

Adamant/AppDelegate.swift

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,3 +504,61 @@ extension AppDelegate {
504504
*/
505505
}
506506
}
507+
508+
// MARK: - Universal Links
509+
extension AppDelegate {
510+
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
511+
if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
512+
let url = userActivity.webpageURL
513+
if let adamantAdr = url?.absoluteString.getAdamantAddress() {
514+
if let tabbar = window?.rootViewController as? UITabBarController,
515+
let chats = tabbar.viewControllers?.first as? UISplitViewController,
516+
let chatList = chats.viewControllers.first as? UINavigationController,
517+
let router = container.resolve(Router.self),
518+
let list = chatList.viewControllers.first as? ChatListViewController {
519+
520+
switch list.accountService.state {
521+
case .loggedIn:
522+
self.openDialog(chatList: chatList, tabbar: tabbar, router: router, list: list, adamantAdr: adamantAdr)
523+
case .notLogged:
524+
break
525+
case .isLoggingIn:
526+
break
527+
case .updating:
528+
break
529+
}
530+
531+
// if not logged in
532+
list.didLoadedMessages = {
533+
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
534+
self.openDialog(chatList: chatList, tabbar: tabbar, router: router, list: list, adamantAdr: adamantAdr)
535+
}
536+
}
537+
}
538+
539+
}
540+
}
541+
return true
542+
}
543+
544+
func openDialog(chatList: UINavigationController, tabbar: UITabBarController, router: Router, list: ChatListViewController, adamantAdr: AdamantAddress){
545+
chatList.popToRootViewController(animated: false)
546+
chatList.dismiss(animated: false, completion: nil)
547+
tabbar.selectedIndex = 0
548+
549+
let controller = router.get(scene: AdamantScene.Chats.newChat)
550+
guard let nav = controller as? UINavigationController,
551+
let c = nav.viewControllers.last as? NewChatViewController else {
552+
return
553+
}
554+
555+
c.delegate = list.self
556+
557+
if let split = list.splitViewController {
558+
split.showDetailViewController(controller, sender: list.self)
559+
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
560+
c.startNewChat(with: adamantAdr.address, name: adamantAdr.name, message: adamantAdr.message)
561+
}
562+
}
563+
}
564+
}

Adamant/Assets/l18n/de.lproj/Localizable.strings

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"AccountTab.Row.Balance" = "Kontostand";
123123

124124
/* Account tab: 'Buy tokens' button */
125-
"AccountTab.Row.BuyTokens" = "Token kaufen & verkaufen";
125+
"AccountTab.Row.BuyTokens" = "Token tauschen";
126126

127127
/* Account tab: 'Logout' button */
128128
"AccountTab.Row.Logout" = "Ausloggen";
@@ -152,7 +152,10 @@
152152
"AccountTab.Row.SendToken" = "%@ senden";
153153

154154
/* Account tab: Anonymously buy ADM tokens */
155-
"AccountTab.Row.AnonymouslyBuyADM" = "Kaufen Sie ADM anonym";
155+
"AccountTab.Row.AnonymouslyBuyADM" = "Ändern Sie ADM anonym";
156+
157+
/* Account tab: Exchange ADM tokens in chat */
158+
"AccountTab.Row.ExchangeADMInChat" = "Austauscher im Chat";
156159

157160
/* Account tab: 'Address' row */
158161
"AccountTab.Row.Address" = "Addresse";

Adamant/Assets/l18n/en.lproj/Localizable.strings

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"AccountTab.Row.Balance" = "Balance";
123123

124124
/* Account tab: 'Buy tokens' button */
125-
"AccountTab.Row.BuyTokens" = "Buy & Sell tokens";
125+
"AccountTab.Row.BuyTokens" = "Exchange tokens";
126126

127127
/* Account tab: 'Logout' button */
128128
"AccountTab.Row.Logout" = "Logout";
@@ -152,7 +152,10 @@
152152
"AccountTab.Row.SendToken" = "Send %@";
153153

154154
/* Account tab: Anonymously buy ADM tokens */
155-
"AccountTab.Row.AnonymouslyBuyADM" = "Buy ADM anonymously";
155+
"AccountTab.Row.AnonymouslyBuyADM" = "Change ADM anonymously";
156+
157+
/* Account tab: Exchange ADM tokens in chat */
158+
"AccountTab.Row.ExchangeADMInChat" = "In-chat Exchanger";
156159

157160
/* Account tab: 'Address' row */
158161
"AccountTab.Row.Address" = "Address";

Adamant/Assets/l18n/ru.lproj/Localizable.strings

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"AccountTab.Row.Balance" = "Баланс";
120120

121121
/* Account tab: 'Buy tokens' button */
122-
"AccountTab.Row.BuyTokens" = "Купить и продать токены";
122+
"AccountTab.Row.BuyTokens" = "Обменять токены";
123123

124124
/* Account tab: 'Logout' button */
125125
"AccountTab.Row.Logout" = "Выход";
@@ -149,7 +149,10 @@
149149
"AccountTab.Row.SendToken" = "Отправить %@";
150150

151151
/* Account tab: Anonymously buy ADM tokens */
152-
"AccountTab.Row.AnonymouslyBuyADM" = "Купить ADM анонимно";
152+
"AccountTab.Row.AnonymouslyBuyADM" = "Обменять ADM анонимно";
153+
154+
/* Account tab: Exchange ADM tokens in chat */
155+
"AccountTab.Row.ExchangeADMInChat" = "Обменник в чате";
153156

154157
/* Account tab: 'Address' row */
155158
"AccountTab.Row.Address" = "Адрес";

Adamant/Debug.entitlements

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
<dict>
55
<key>aps-environment</key>
66
<string>development</string>
7+
<key>com.apple.developer.associated-domains</key>
8+
<array>
9+
<string>applinks:msg.adamant.im</string>
10+
</array>
711
<key>keychain-access-groups</key>
812
<array>
913
<string>$(AppIdentifierPrefix)im.adamant.messenger-dev</string>

Adamant/Helpers/String+adamant.swift

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,44 @@ import UIKit
1212
struct AdamantAddress {
1313
let address: String
1414
let name: String?
15-
let amount: String?
15+
let amount: Double?
16+
let message: String?
1617
}
1718

1819
extension String {
1920
func getAdamantAddress() -> AdamantAddress? {
2021
guard
2122
let urlString = self.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed),
2223
let components = URLComponents(string: urlString),
23-
components.host == "msg.adamant.im",
2424
let queryItems = components.queryItems,
2525
let address = queryItems.filter({$0.name == "address"}).first?.value else {
2626
return nil
2727
}
28-
29-
let name = queryItems.filter({$0.name == "label"}).first?.value
30-
let amount = queryItems.filter({$0.name == "amount"}).first?.value
3128

32-
return AdamantAddress(address: address, name: name, amount: amount)
29+
let name = queryItems.filter({$0.name == "label"}).first?.value?.replacingOccurrences(of: "+", with: " ").replacingOccurrences(of: "%20", with: " ")
30+
let amount = queryItems.filter({$0.name == "amount"}).first?.value
31+
let message = queryItems.filter({$0.name == "message"}).first?.value?.replacingOccurrences(of: "+", with: " ").replacingOccurrences(of: "%20", with: " ")
32+
return AdamantAddress(address: address, name: name, amount: amount?.double, message: message)
3333
}
3434

3535
func getLegacyAdamantAddress() -> AdamantAddress? {
3636
let address: String?
3737
var name: String? = nil
38+
var message: String? = nil
3839

3940
if let uri = AdamantUriTools.decode(uri: self) {
4041
switch uri {
4142
case .address(address: let addr, params: let params):
4243
address = addr
43-
4444
if let params = params {
4545
for param in params {
4646
switch param {
4747
case .address:
4848
break
4949
case .label(let label):
5050
name = label
51-
break
51+
case .message(let urlMessage):
52+
message = urlMessage
5253
}
5354
}
5455
}
@@ -67,7 +68,7 @@ extension String {
6768
}
6869

6970
if let address = address {
70-
return AdamantAddress(address: address, name: name, amount: "")
71+
return AdamantAddress(address: address, name: name, amount: nil, message: message)
7172
} else {
7273
return nil
7374
}
@@ -103,3 +104,20 @@ public extension NSMutableAttributedString {
103104
}
104105

105106
}
107+
108+
extension String {
109+
func checkAndReplaceSystemWallets() -> String {
110+
switch self {
111+
case "chats.virtual.bounty_wallet_title":
112+
return AdamantContacts.adamantNewBountyWallet.name
113+
case "chats.virtual.bitcoin_bet_title":
114+
return AdamantContacts.betOnBitcoin.name
115+
case "chats.virtual.donate_bot_title":
116+
return AdamantContacts.donate.name
117+
case "chats.virtual.exchange_bot_title":
118+
return AdamantContacts.adamantExchange.name
119+
default:
120+
return self
121+
}
122+
}
123+
}

Adamant/Info.plist

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,23 @@
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
2020
<string>$(MARKETING_VERSION)</string>
21+
<key>CFBundleURLTypes</key>
22+
<array>
23+
<dict>
24+
<key>CFBundleTypeRole</key>
25+
<string>Editor</string>
26+
<key>CFBundleURLName</key>
27+
<string>adm.idnt</string>
28+
<key>CFBundleURLSchemes</key>
29+
<array>
30+
<string>adm</string>
31+
</array>
32+
</dict>
33+
</array>
2134
<key>CFBundleVersion</key>
2235
<string>$(CURRENT_PROJECT_VERSION)</string>
2336
<key>ITSAppUsesNonExemptEncryption</key>
24-
<true/>
37+
<false/>
2538
<key>LSRequiresIPhoneOS</key>
2639
<true/>
2740
<key>NSAppTransportSecurity</key>

0 commit comments

Comments
 (0)