Skip to content

Commit d3aef7f

Browse files
committed
Merge branch 'develop'
2 parents b774f47 + b27dd3e commit d3aef7f

34 files changed

+1118
-123
lines changed

Adamant.xcodeproj/project.pbxproj

Lines changed: 75 additions & 3 deletions
Large diffs are not rendered by default.

Adamant/App/AppDelegate.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
157157
window.rootViewController?.present(login, animated: false, completion: nil)
158158

159159
if !welcomeIsShown {
160-
if isMacOS {
161-
var size: CGSize = .init(width: 900, height: 900)
162-
window.frame = .init(origin: window.frame.origin, size: size)
163-
window.windowScene?.sizeRestrictions?.minimumSize = size
164-
window.windowScene?.sizeRestrictions?.maximumSize = size
165-
window.windowScene?.sizeRestrictions?.allowsFullScreen = false
166-
}
167-
168160
let welcome = screensFactory.makeOnboard()
169161
welcome.modalPresentationStyle = .overFullScreen
170162
login.present(welcome, animated: true, completion: nil)

Adamant/App/DI/AppAssembly.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ struct AppAssembly: MainThreadAssembly {
234234
))
235235
}.inObjectScope(.container)
236236

237+
238+
// MARK: DashLastTransactionStorage
239+
container.register(DashLastTransactionStorageProtocol.self) { r in
240+
DashLastTransactionStorage(securedStore: r.resolve(SecuredStore.self)!)
241+
}.inObjectScope(.container)
242+
237243
// MARK: LskNodeApiService
238244
container.register(KlyNodeApiService.self) { r in
239245
KlyNodeApiService(api: .init(
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// PasteInterceptingPasswordCell.swift
3+
// Adamant
4+
//
5+
// Created by Christian Benua on 23.02.2025.
6+
// Copyright © 2025 Adamant. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import Eureka
11+
12+
final class PasteInterceptingPasswordCell: CustomFieldCell<String, PasteInterceptingTextField>, CellType {
13+
14+
required init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
15+
super.init(style: style, reuseIdentifier: reuseIdentifier)
16+
}
17+
18+
required init?(coder aDecoder: NSCoder) {
19+
super.init(coder: aDecoder)
20+
}
21+
22+
override func setup() {
23+
super.setup()
24+
textField.autocorrectionType = .no
25+
textField.autocapitalizationType = .none
26+
textField.keyboardType = .asciiCapable
27+
textField.isSecureTextEntry = true
28+
textField.textContentType = .password
29+
if let textLabel = textLabel {
30+
textField.setContentHuggingPriority(textLabel.contentHuggingPriority(for: .horizontal) - 1, for: .horizontal)
31+
}
32+
}
33+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// PasteInterceptingPasswordRow.swift
3+
// Adamant
4+
//
5+
// Created by Christian Benua on 23.02.2025.
6+
// Copyright © 2025 Adamant. All rights reserved.
7+
//
8+
9+
import Eureka
10+
11+
final class PasteInterceptingPasswordRow: FieldRow<PasteInterceptingPasswordCell>, RowType {
12+
required init(tag: String?) {
13+
super.init(tag: tag)
14+
}
15+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//
2+
// PasteInterceptingTextField.swift
3+
// Adamant
4+
//
5+
// Created by Christian Benua on 23.02.2025.
6+
// Copyright © 2025 Adamant. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
final class PasteInterceptingTextField: UITextField, UITextFieldDelegate {
12+
13+
private var isAfterPaste: Bool = false
14+
var pasteInterceptor: ((String?) -> Void)?
15+
16+
override init(frame: CGRect) {
17+
super.init(frame: frame)
18+
setup()
19+
}
20+
21+
private func setup() {
22+
NotificationCenter.default.addObserver(
23+
self,
24+
selector: #selector(handlePasteNotification),
25+
name: UITextField.textDidChangeNotification,
26+
object: self
27+
)
28+
}
29+
30+
deinit {
31+
NotificationCenter.default.removeObserver(self)
32+
}
33+
34+
required init?(coder: NSCoder) {
35+
fatalError("init(coder:) has not been implemented")
36+
}
37+
38+
override func paste(_ sender: Any?) {
39+
isAfterPaste = true
40+
super.paste(sender)
41+
}
42+
43+
@objc func handlePasteNotification() {
44+
if isAfterPaste {
45+
pasteInterceptor?(text)
46+
}
47+
isAfterPaste = false
48+
}
49+
50+
func textField(
51+
_ textField: UITextField,
52+
shouldChangeCharactersIn range: NSRange,
53+
replacementString string: String
54+
) -> Bool {
55+
if isAfterPaste {
56+
pasteInterceptor?(textField.text)
57+
}
58+
59+
isAfterPaste = false
60+
return true
61+
}
62+
}

Adamant/Modules/Chat/View/Managers/ChatAction.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ enum ChatAction {
2121
case react(id: String, emoji: String)
2222
case presentMenu(arg: ChatContextMenuArguments)
2323
case openFile(messageId: String, file: ChatFile)
24+
case cancelUploading(messageId: String, file: ChatFile)
2425
case autoDownloadContentIfNeeded(messageId: String, files: [ChatFile])
2526
case forceDownloadAllFiles(messageId: String, files: [ChatFile])
2627
}

Adamant/Modules/Chat/View/Managers/ChatDataSourceManager.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ private extension ChatDataSourceManager {
201201
viewModel.copyTextInPartAction(text)
202202
case let .openFile(messageId, file):
203203
viewModel.openFile(messageId: messageId, file: file)
204+
case let .cancelUploading(messageId, file):
205+
viewModel.cancelFileUploading(messageId: messageId, file: file)
204206
case let .autoDownloadContentIfNeeded(messageId, files):
205207
viewModel.autoDownloadContentIfNeeded(
206208
messageId: messageId,

Adamant/Modules/Chat/View/Subviews/ChatMedia/Content/Views/ChatFileContainerView/FileListContainerView.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,18 @@ private extension FileListContainerView {
8383
txStatus: model.txStatus
8484
)
8585
view?.buttonActionHandler = { [weak self, file, model] in
86-
self?.actionHandler(
87-
.openFile(
88-
messageId: model.messageId,
89-
file: file
86+
if file.isBusy, file.isUploading {
87+
self?.actionHandler(
88+
.cancelUploading(messageId: model.messageId, file: file)
9089
)
91-
)
90+
} else {
91+
self?.actionHandler(
92+
.openFile(
93+
messageId: model.messageId,
94+
file: file
95+
)
96+
)
97+
}
9298
}
9399
}
94100
}

Adamant/Modules/Chat/View/Subviews/ChatMedia/Content/Views/MediaContainerView/MediaContainerView.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,18 @@ private extension MediaContainerView {
131131
txStatus: model.txStatus
132132
)
133133
mediaView.buttonActionHandler = { [weak self, file, model] in
134-
self?.actionHandler(
134+
let action: ChatAction = if file.isBusy, file.isUploading {
135+
.cancelUploading(
136+
messageId: model.messageId,
137+
file: file
138+
)
139+
} else {
135140
.openFile(
136141
messageId: model.messageId,
137142
file: file
138143
)
139-
)
144+
}
145+
self?.actionHandler(action)
140146
}
141147

142148
if let resolution = file.file.resolution,

0 commit comments

Comments
 (0)