Skip to content

Commit 097ca63

Browse files
committed
[trello.com/c/R42vd9hV]
1 parent 5b1723e commit 097ca63

30 files changed

+381
-285
lines changed

Adamant.xcodeproj/project.pbxproj

+8-12
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,7 @@
264264
64F085D920E2D7600006DE68 /* AdmTransactionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F085D820E2D7600006DE68 /* AdmTransactionsViewController.swift */; };
265265
64FA53CD20E1300B006783C9 /* EthTransactionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64FA53CC20E1300A006783C9 /* EthTransactionsViewController.swift */; };
266266
64FA53D120E24942006783C9 /* TransactionDetailsViewControllerBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64FA53D020E24941006783C9 /* TransactionDetailsViewControllerBase.swift */; };
267-
6F1B8BC92D4285A7004E902F /* AlertFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F1B8BC82D4285A7004E902F /* AlertFactory.swift */; };
268-
6F1B8BCB2D4298BD004E902F /* FreeTokensAlertManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F1B8BCA2D4298BD004E902F /* FreeTokensAlertManager.swift */; };
267+
6F1B8E7E2D4575FD004E902F /* AdmDialogServiceExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F1B8E7D2D4575E0004E902F /* AdmDialogServiceExtension.swift */; };
269268
85B405022D3012D5000AB744 /* AccountViewController+Form.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85B405012D3012C7000AB744 /* AccountViewController+Form.swift */; };
270269
9300F94629D0149100FEDDB8 /* RichMessageProviderWithStatusCheck.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9300F94529D0149100FEDDB8 /* RichMessageProviderWithStatusCheck.swift */; };
271270
9304F8BE292F88F900173F18 /* ANSPayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9304F8BD292F88F900173F18 /* ANSPayload.swift */; };
@@ -944,8 +943,7 @@
944943
64F085D820E2D7600006DE68 /* AdmTransactionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdmTransactionsViewController.swift; sourceTree = "<group>"; };
945944
64FA53CC20E1300A006783C9 /* EthTransactionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthTransactionsViewController.swift; sourceTree = "<group>"; };
946945
64FA53D020E24941006783C9 /* TransactionDetailsViewControllerBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionDetailsViewControllerBase.swift; sourceTree = "<group>"; };
947-
6F1B8BC82D4285A7004E902F /* AlertFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertFactory.swift; sourceTree = "<group>"; };
948-
6F1B8BCA2D4298BD004E902F /* FreeTokensAlertManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FreeTokensAlertManager.swift; sourceTree = "<group>"; };
946+
6F1B8E7D2D4575E0004E902F /* AdmDialogServiceExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdmDialogServiceExtension.swift; sourceTree = "<group>"; };
949947
74D5744703A7ECC98E244B14 /* Pods-AdmCore.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AdmCore.debug.xcconfig"; path = "Target Support Files/Pods-AdmCore/Pods-AdmCore.debug.xcconfig"; sourceTree = "<group>"; };
950948
85B405012D3012C7000AB744 /* AccountViewController+Form.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AccountViewController+Form.swift"; sourceTree = "<group>"; };
951949
9300F94529D0149100FEDDB8 /* RichMessageProviderWithStatusCheck.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RichMessageProviderWithStatusCheck.swift; sourceTree = "<group>"; };
@@ -1753,13 +1751,13 @@
17531751
path = Doge;
17541752
sourceTree = "<group>";
17551753
};
1756-
6F1B8BC72D428589004E902F /* AlertsFactory */ = {
1754+
6F1B8E7C2D4575B0004E902F /* AdmDialogService */ = {
17571755
isa = PBXGroup;
17581756
children = (
1759-
6F1B8BC82D4285A7004E902F /* AlertFactory.swift */,
1760-
6F1B8BCA2D4298BD004E902F /* FreeTokensAlertManager.swift */,
1757+
E9E7CD8E20026CD300DFC4DB /* AdamantDialogService.swift */,
1758+
6F1B8E7D2D4575E0004E902F /* AdmDialogServiceExtension.swift */,
17611759
);
1762-
path = AlertsFactory;
1760+
path = AdmDialogService;
17631761
sourceTree = "<group>";
17641762
};
17651763
85B405002D3012BD000AB744 /* AccountViewController */ = {
@@ -2355,11 +2353,11 @@
23552353
41C1698A29E7F2EE00FEB3CB /* RichTransactionReplyService */,
23562354
3AA2D5F8280EAF49000ED971 /* SocketService */,
23572355
E9B3D39F201FA2090019EB36 /* DataProviders */,
2356+
6F1B8E7C2D4575B0004E902F /* AdmDialogService */,
23582357
E9E7CD922002740500DFC4DB /* AdamantAccountService.swift */,
23592358
6455E9F221075D8000B2E94C /* AdamantAddressBookService.swift */,
23602359
E90A494A204D9EB8009F6A65 /* AdamantAuthentication.swift */,
23612360
E9E7CDBF2003AF6D00DFC4DB /* AdamantCellFactory.swift */,
2362-
E9E7CD8E20026CD300DFC4DB /* AdamantDialogService.swift */,
23632361
E93D7ABF2052CF63005D19DC /* AdamantNotificationService.swift */,
23642362
41047B75294C62710039E956 /* AdamantVisibleWalletsService.swift */,
23652363
4153045829C09902000E4BEA /* AdamantIncreaseFeeService.swift */,
@@ -2475,7 +2473,6 @@
24752473
E919479920000FFD001362F8 /* Modules */ = {
24762474
isa = PBXGroup;
24772475
children = (
2478-
6F1B8BC72D428589004E902F /* AlertsFactory */,
24792476
93ED21442CC3547400AA1FC8 /* TransactionsStatusService */,
24802477
934FD99E2C783C9500336841 /* InfoService */,
24812478
3A2478AF2BB45DE2009D89E9 /* StorageUsage */,
@@ -3417,6 +3414,7 @@
34173414
41A1995829D5733D0031AD75 /* ChatMessageCell+Model.swift in Sources */,
34183415
3A299C7D2B85F98700B54C61 /* ChatFile.swift in Sources */,
34193416
932F77592989F999006D8801 /* ChatCellManager.swift in Sources */,
3417+
6F1B8E7E2D4575FD004E902F /* AdmDialogServiceExtension.swift in Sources */,
34203418
9377FBE2296C2ACA00C9211B /* ChatTransactionContentView+Model.swift in Sources */,
34213419
E933475B225539390083839E /* DogeGetTransactionsResponse.swift in Sources */,
34223420
9340078029AC341100A20622 /* ChatAction.swift in Sources */,
@@ -3498,7 +3496,6 @@
34983496
41CE153A297FF98200CC9254 /* Web3Swift+Adamant.swift in Sources */,
34993497
93CC8DC9296F01DE003772BF /* ChatTransactionContainerView+Model.swift in Sources */,
35003498
E9147B6F205088DE00145913 /* LoginViewController+Pinpad.swift in Sources */,
3501-
6F1B8BCB2D4298BD004E902F /* FreeTokensAlertManager.swift in Sources */,
35023499
934FD9B62C78519600336841 /* InfoServiceApiCommands.swift in Sources */,
35033500
E9FAE5E2203ED1AE008D3A6B /* ShareQrViewController.swift in Sources */,
35043501
E983AE2120E655C500497E1A /* AccountHeaderView.swift in Sources */,
@@ -3633,7 +3630,6 @@
36333630
E908471B2196FE590095825D /* Adamant.xcdatamodeld in Sources */,
36343631
E940087B2114ED0600CD2D67 /* EthWalletService.swift in Sources */,
36353632
93294B902AAD2C6B00911109 /* SwiftyOnboardOverlay.swift in Sources */,
3636-
6F1B8BC92D4285A7004E902F /* AlertFactory.swift in Sources */,
36373633
E948E03B20235E2300975D6B /* SettingsFactory.swift in Sources */,
36383634
4186B3302941E642006594A3 /* AdmWalletService+DynamicConstants.swift in Sources */,
36393635
E95F85852008CB3A0070534A /* ChatListViewController.swift in Sources */,

Adamant/App/DI/AppAssembly.swift

-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ struct AppAssembly: MainThreadAssembly {
251251
AdamantAccountService(
252252
apiService: r.resolve(AdamantApiServiceProtocol.self)!,
253253
adamantCore: r.resolve(AdamantCore.self)!,
254-
dialogService: r.resolve(DialogService.self)!,
255254
securedStore: r.resolve(SecuredStore.self)!,
256255
walletServiceCompose: r.resolve(WalletServiceCompose.self)!,
257256
currencyInfoService: r.resolve(InfoServiceProtocol.self)!,

Adamant/Modules/AlertsFactory/AlertFactory.swift

-50
This file was deleted.

Adamant/Modules/AlertsFactory/FreeTokensAlertManager.swift

-87
This file was deleted.

Adamant/Modules/Chat/ChatFactory.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ struct ChatFactory {
6464
let dialogManager = ChatDialogManager(
6565
viewModel: viewModel,
6666
dialogService: dialogService,
67-
emojiService: emojiService
67+
emojiService: emojiService,
68+
accountService: accountService
6869
)
6970

7071
let wallets = walletServiceCompose.getWallets()
@@ -83,9 +84,9 @@ struct ChatFactory {
8384
sendTransaction: makeSendTransactionAction(
8485
viewModel: viewModel,
8586
screensFactory: screensFactory
86-
)
87+
),
88+
dialogManager: dialogManager
8789
)
88-
8990
viewController.setupDelegates(delegates)
9091
delegates.cell.setupDelegate(
9192
collection: viewController.messagesCollectionView,

Adamant/Modules/Chat/ChatLocalization.swift

+12-6
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,20 @@ extension String.adamant {
7272
static var freeTokens: String {
7373
String.localized("ChatScene.FreeTokensAlert.FreeTokens", comment: "Chat: 'Free Tokens' button")
7474
}
75-
static var freeTokensMessage: String {
76-
String.localized("ChatScene.FreeTokensAlert.Message", comment: "Chat: 'Free Tokens' message")
75+
static var freeTokensTitleChat: String {
76+
String.localized("ChatScene.FreeTokensAlert.Title.Chat", comment: "Chat: 'Free Tokens' title")
77+
}
78+
static var freeTokensTitleBook: String {
79+
String.localized("ChatScene.FreeTokensAlert.Title.Book", comment: "Chat: 'Free Tokens' title")
7780
}
78-
static var freeTokensNotification: String {
79-
String.localized("ChatScene.FreeTokensAlert.Message", comment: "'Free Tokens' message")
81+
static var freeTokensTitleNotification: String {
82+
String.localized("ChatScene.FreeTokensAlert.Title.Notification", comment: "Chat: 'Free Tokens' title")
8083
}
81-
static var freeTokensContacts: String {
82-
String.localized("ChatScene.FreeTokensAlert.Message", comment: "'Free Tokens' message")
84+
static var freeTokensBuyADM: String {
85+
String.localized("ChatScene.FreeTokensAlert.BuyADM", comment: "Chat: 'Free Tokens' action")
86+
}
87+
static var freeTokensMessage: String {
88+
String.localized("ChatScene.FreeTokensAlert.Message", comment: "Chat: 'Free Tokens' message")
8389
}
8490
static var transactionSent: String {
8591
String.localized("ChatScene.Sent", comment: "Chat: 'Sent funds' bubble title")

Adamant/Modules/Chat/View/ChatViewController.swift

+15-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ final class ChatViewController: MessagesViewController {
3232
private let admWalletService: WalletService?
3333
private let screensFactory: ScreensFactory
3434
private let chatSwipeManager: ChatSwipeManager
35-
35+
private let dialogManager: ChatDialogManager
3636
let viewModel: ChatViewModel
3737

3838
// MARK: Properties
@@ -92,7 +92,8 @@ final class ChatViewController: MessagesViewController {
9292
admWalletService: WalletService?,
9393
screensFactory: ScreensFactory,
9494
chatSwipeManager: ChatSwipeManager,
95-
sendTransaction: @escaping SendTransaction
95+
sendTransaction: @escaping SendTransaction,
96+
dialogManager: ChatDialogManager
9697
) {
9798
self.viewModel = viewModel
9899
self.storedObjects = storedObjects
@@ -101,6 +102,7 @@ final class ChatViewController: MessagesViewController {
101102
self.screensFactory = screensFactory
102103
self.sendTransaction = sendTransaction
103104
self.chatSwipeManager = chatSwipeManager
105+
self.dialogManager = dialogManager
104106
super.init(nibName: nil, bundle: nil)
105107

106108
inputBar.onAttachmentButtonTap = { [weak self] in
@@ -476,6 +478,11 @@ private extension ChatViewController {
476478
self?.didTapSelectText(text: text)
477479
}
478480
.store(in: &subscriptions)
481+
dialogManager.showBuyAndSellSubject
482+
.sink { [weak self] in
483+
self?.presentBuyAndSell()
484+
}
485+
.store(in: &subscriptions)
479486
}
480487
}
481488

@@ -1097,7 +1104,12 @@ extension ChatViewController {
10971104
viewModel.needToAnimateCellIndex = nil
10981105
}
10991106
}
1100-
1107+
extension ChatViewController {
1108+
func presentBuyAndSell() {
1109+
let buyAndSellVC = screensFactory.makeBuyAndSell()
1110+
navigationController?.pushViewController(buyAndSellVC, animated: true)
1111+
}
1112+
}
11011113
private let scrollDownButtonInset: CGFloat = 20
11021114
private let messagePadding: CGFloat = 12
11031115
private let filesToolbarViewHeight: CGFloat = 140

0 commit comments

Comments
 (0)