-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trello.com/c/b82n6AMp adding cost to media/files #638
base: develop
Are you sure you want to change the base?
Changes from 2 commits
45d4b28
45f3a34
15ff53a
ae6065d
9a3fa77
3069464
a1ebf5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -943,6 +943,7 @@ private extension ChatViewController { | |
func closeFileToolbarView() { | ||
filesToolbarView.removeFromSuperview() | ||
messageInputBar.invalidateIntrinsicContentSize() | ||
viewModel.inputTextFileUpdated() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not do it here.
We can easily observe new files from the ChatViewModel |
||
} | ||
|
||
func didTapTransfer(id: String) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -938,6 +938,9 @@ final class ChatViewModel: NSObject { | |
} | ||
|
||
filesPicked = oldFiles | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's not add extra spaces between simple lined of code |
||
inputTextFileUpdated() | ||
|
||
case .failure(let error): | ||
dialog.send(.alert(error.localizedDescription)) | ||
} | ||
|
@@ -1060,6 +1063,29 @@ extension ChatViewModel { | |
self?.dateHeaderHidden = true | ||
} | ||
} | ||
|
||
func inputTextFileUpdated() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's rename to |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's remove this extra space |
||
guard !inputText.isEmpty || filesPicked != nil else { | ||
fee = "" | ||
return | ||
} | ||
|
||
var filesText: String = "" | ||
|
||
if let filesPicked { | ||
filesText = filesPicked.map{ | ||
($0.name ?? "") + ($0.extenstion ?? "") | ||
}.joined(separator: "") | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
let feeString = AdamantBalanceFormat.full.format( | ||
AdamantMessage.text(inputText + filesText).fee, | ||
withCurrencySymbol: AdmWalletService.currencySymbol | ||
) | ||
|
||
fee = "~\(feeString)" | ||
} | ||
} | ||
|
||
extension ChatViewModel: NSFetchedResultsControllerDelegate { | ||
|
@@ -1095,7 +1121,7 @@ private extension ChatViewModel { | |
func setupObservers() { | ||
$inputText | ||
.removeDuplicates() | ||
.sink { [weak self] _ in self?.inputTextUpdated() } | ||
.sink { [weak self] _ in self?.inputTextFileUpdated() } | ||
.store(in: &subscriptions) | ||
|
||
chatFileService.updateFileFields | ||
|
@@ -1429,20 +1455,6 @@ private extension ChatViewModel { | |
} | ||
} | ||
|
||
func inputTextUpdated() { | ||
guard !inputText.isEmpty else { | ||
fee = "" | ||
return | ||
} | ||
|
||
let feeString = AdamantBalanceFormat.full.format( | ||
AdamantMessage.text(inputText).fee, | ||
withCurrencySymbol: AdmWalletService.currencySymbol | ||
) | ||
|
||
fee = "~\(feeString)" | ||
} | ||
|
||
func updatePartnerInformation() { | ||
guard let publicKey = chatroom?.partner?.publicKey else { | ||
return | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove packages updating