diff --git a/Sources/App/DependencyRegistrator.swift b/Sources/App/DependencyRegistrator.swift index c5d0b830d4c0c028fd8e6642ffad1503df18eee3..182ac2f5dbe6af2ee532e45b08e9b73d49a1e0a8 100644 --- a/Sources/App/DependencyRegistrator.swift +++ b/Sources/App/DependencyRegistrator.swift @@ -57,6 +57,8 @@ struct DependencyRegistrator { container.register(XXLogger.noop) container.register(CrashReporter.noop) container.register(VersionChecker.mock) + container.register(ReportingStatus.mock()) + container.register(SendReport.mock()) container.register(XXNetwork<BindingsMock>() as XXNetworking) container.register(MockNetworkMonitor() as NetworkMonitoring) container.register(KeyObjectStore.userDefaults) @@ -82,6 +84,7 @@ struct DependencyRegistrator { container.register(CrashReporter.live) container.register(VersionChecker.live()) container.register(ReportingStatus.live()) + container.register(SendReport.live) container.register(XXNetwork<BindingsClient>() as XXNetworking) container.register(NetworkMonitor() as NetworkMonitoring) @@ -105,7 +108,6 @@ struct DependencyRegistrator { container.register(Voxophone()) container.register(BackupService()) container.register(MakeAppScreenshot.live) - container.register(SendReport.live) container.register(FetchBannedList.live) container.register(ProcessBannedList.live) container.register(MakeReportDrawer.live) diff --git a/Sources/ChatFeature/Controllers/SingleChatController.swift b/Sources/ChatFeature/Controllers/SingleChatController.swift index 91aa66ec122b86593e3c0e9eab9c3eaf72793a31..b8d8b7703b180178f4c39ab6f04a73c0e7e7b4d6 100644 --- a/Sources/ChatFeature/Controllers/SingleChatController.swift +++ b/Sources/ChatFeature/Controllers/SingleChatController.swift @@ -530,12 +530,10 @@ extension SingleChatController: KeyboardListenerDelegate { } func keyboardWillChangeFrame(info: KeyboardInfo) { - let keyWindow: UIWindow? = UIApplication.shared.connectedScenes - .filter { $0.activationState == .foregroundActive } - .compactMap { $0 as? UIWindowScene } - .first? - .windows - .first(where: \.isKeyWindow) + let keyWindow = UIApplication.shared + .connectedScenes + .flatMap { ($0 as? UIWindowScene)?.windows ?? [] } + .first { $0.isKeyWindow } guard let keyWindow = keyWindow else { fatalError("[keyboardWillChangeFrame]: Couldn't get key window") diff --git a/Sources/ChatInputFeature/ChatInputView.swift b/Sources/ChatInputFeature/ChatInputView.swift index 689d0842691684eb2d874bb424380506fee03dcc..31e5a8ae93cb5f49b64765280130dd89efe87bd1 100644 --- a/Sources/ChatInputFeature/ChatInputView.swift +++ b/Sources/ChatInputFeature/ChatInputView.swift @@ -122,7 +122,12 @@ public final class ChatInputView: UIToolbar { .map(\.text) .sink { [unowned self] in if text.textView.markedTextRange == nil { + let range = text.textView.selectedTextRange text.textView.text = $0 + + if let range = range { + text.textView.selectedTextRange = range + } } else if $0 == "" { text.textView.text = $0 } diff --git a/Sources/Integration/Mocks/BindingsMock.swift b/Sources/Integration/Mocks/BindingsMock.swift index 61ccceb42f58ccae7adc40a76c4e13d230f53a47..b4eb5c0bdb65e64130ef0f1c6e85e01993fb8bf4 100644 --- a/Sources/Integration/Mocks/BindingsMock.swift +++ b/Sources/Integration/Mocks/BindingsMock.swift @@ -120,7 +120,6 @@ public final class BindingsMock: BindingsInterface { self?.requestsSubject.send(.carlRequested) self?.requestsSubject.send(.angelinaRequested) self?.requestsSubject.send(.elonRequested) - self?.groupRequestsSubject.send(.mockGroup) DispatchQueue.global().asyncAfter(deadline: .now() + 1) { [weak self] in self?.confirmationsSubject.send(.georgeDiscovered) diff --git a/Sources/ReportingFeature/ReportingStatus.swift b/Sources/ReportingFeature/ReportingStatus.swift index 2ed407a84c13f84cc39060f4dd3457688437e324..1bb72983430de28a6d46c47cd7ec2a3a21612659 100644 --- a/Sources/ReportingFeature/ReportingStatus.swift +++ b/Sources/ReportingFeature/ReportingStatus.swift @@ -35,4 +35,17 @@ extension ReportingStatus { } ) } + + public static func mock( + isEnabled: Bool = false, + isOptional: Bool = true + ) -> ReportingStatus { + let isEnabledSubject = CurrentValueSubject<Bool, Never>(isEnabled) + return ReportingStatus( + isOptional: { isOptional }, + isEnabled: { isEnabledSubject.value }, + isEnabledPublisher: { isEnabledSubject.eraseToAnyPublisher() }, + enable: { isEnabledSubject.send($0) } + ) + } } diff --git a/Sources/ReportingFeature/SendReport.swift b/Sources/ReportingFeature/SendReport.swift index acc24a0ce640a40bb0ed1df5eede6053603c3c2f..4793d998d49c43426012ac9760cd28e39e8eb8e6 100644 --- a/Sources/ReportingFeature/SendReport.swift +++ b/Sources/ReportingFeature/SendReport.swift @@ -37,6 +37,18 @@ extension SendReport { } task.resume() } + + public static func mock( + result: Result<Void, Error> = .success(()) + ) -> SendReport { + SendReport { report, completion in + print("[SendReport.mock] Sending report: \(report)") + DispatchQueue.main.asyncAfter(deadline: .now() + 3) { + print("[SendReport.mock] Sending report finished") + completion(result) + } + } + } } extension SendReport { diff --git a/Sources/Shared/Views/SearchComponent.swift b/Sources/Shared/Views/SearchComponent.swift index b3d530991d687604af21ea311eca69c458566f32..2edd280f23bb8ee82fb79b0003eb9eebcbee7359 100644 --- a/Sources/Shared/Views/SearchComponent.swift +++ b/Sources/Shared/Views/SearchComponent.swift @@ -51,6 +51,7 @@ public final class SearchComponent: UIView { rightButton.setContentCompressionResistancePriority(.required, for: .horizontal) inputField.delegate = self + inputField.autocapitalizationType = .none inputField.textColor = Asset.neutralActive.color inputField.font = Fonts.Mulish.regular.font(size: 16.0)