From 5015301bad9db61e84572cc8f09368220a38817a Mon Sep 17 00:00:00 2001 From: Ryan ZHAO <> Date: Thu, 28 Mar 2024 11:07:10 +1100 Subject: [PATCH] WIP: add toasts --- .../ConversationVC+Interaction.swift | 21 ++----------------- .../Conversations/Input View/InputView.swift | 2 +- .../Translations/en.lproj/Localizable.strings | 4 ++++ 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index 7a673251e..087e7a7c4 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -342,16 +342,7 @@ extension ConversationVC: } catch { DispatchQueue.main.async { [weak self] in - let modal: ConfirmationModal = ConfirmationModal( - targetView: self?.view, - info: ConfirmationModal.Info( - title: "sessionMessenger".localized(), - body: .text("An error occurred."), - cancelTitle: "BUTTON_OK".localized(), - cancelStyle: .alert_text - ) - ) - self?.present(modal, animated: true) + self?.viewModel.showToast(text: "attachmentsErrorLoad".localized()) } return } @@ -376,15 +367,7 @@ extension ConversationVC: let fileName = urlResourceValues.name ?? "attachment".localized() guard let dataSource = DataSourcePath.dataSource(with: url, shouldDeleteOnDeallocation: false) else { DispatchQueue.main.async { [weak self] in - let modal: ConfirmationModal = ConfirmationModal( - targetView: self?.view, - info: ConfirmationModal.Info( - title: "ATTACHMENT_PICKER_DOCUMENTS_FAILED_ALERT_TITLE".localized(), - cancelTitle: "BUTTON_OK".localized(), - cancelStyle: .alert_text - ) - ) - self?.present(modal, animated: true) + self?.viewModel.showToast(text: "attachmentsErrorLoad".localized()) } return } diff --git a/Session/Conversations/Input View/InputView.swift b/Session/Conversations/Input View/InputView.swift index f4eb8e9e1..da06deab6 100644 --- a/Session/Conversations/Input View/InputView.swift +++ b/Session/Conversations/Input View/InputView.swift @@ -122,7 +122,7 @@ final class InputView: UIView, InputViewButtonDelegate, InputTextViewDelegate, M let adjustment = (InputViewButton.expandedSize - InputViewButton.size) / 2 let maxWidth = UIScreen.main.bounds.width - 2 * InputViewButton.expandedSize - 2 * Values.smallSpacing - 2 * (Values.mediumSpacing - adjustment) let result = InputTextView(delegate: self, maxWidth: maxWidth) - result.accessibilityLabel = "Message input box" + result.accessibilityLabel = "contentDescriptionMessageComposition".localized() result.accessibilityIdentifier = "Message input box" result.isAccessibilityElement = true diff --git a/Session/Meta/Translations/en.lproj/Localizable.strings b/Session/Meta/Translations/en.lproj/Localizable.strings index 6336f10c6..56853d04b 100644 --- a/Session/Meta/Translations/en.lproj/Localizable.strings +++ b/Session/Meta/Translations/en.lproj/Localizable.strings @@ -630,6 +630,10 @@ "blockBlockedUser" = "Blocked {name}"; "blockUnblockedUser" = "Unblocked {name}"; "contentDescriptionCamera" = "Camera"; +"contentDescriptionMessageComposition" = "Message composition"; +"communityLeaveError" = "Failed to leave {communityname}"; +"contentDescriptionMediaMessage" = "Media message"; +"attachmentsErrorLoad" = "Error attaching file"; // NOT IN THE LIST YET "APP_STARTUP_EXIT" = "Exit";