Skip to content
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/F7EV0pKq] nodes are not enabled alert #643

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

leonid174
Copy link
Collaborator

@leonid174 leonid174 commented Jan 12, 2025

Purpose of the task is to notify user with alert which appears when entering the chat screen if all nodes are switched off.

Copy link
Collaborator

@ChrisBenua ChrisBenua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

alert.addAction(showListAction)
alert.addAction(cancelAction)

self.present(alert, animated: true, completion: nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ChatDialogManager. Let's not overcomplicate this huge ChatViewController

@@ -783,6 +784,37 @@ private extension ChatViewController {
}
}

func checkNodesEnabled() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too little logics, let's remove this method

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Uncle Bob said
If the functions are small it will be easier to comprehend the code. IDK I think that's ideal

@@ -985,6 +991,9 @@
/* Shared alert 'Delete' button. Used anywhere. */
"Shared.Delete" = "Удалить";

/* Shared alert 'Review Node List' button. Used on Chat screen. */
"Shared.ReviewNodeList" = "К списку узлов ADM";

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add strings for all the other languages as well (use english)

Copy link
Member

@just-software-dev just-software-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check the comments

@just-software-dev just-software-dev changed the title trello.com/c/F7EV0pKq nodes are not enabled alert [trello.com/c/F7EV0pKq] nodes are not enabled alert Jan 16, 2025
@@ -199,6 +201,26 @@ private extension ChatDialogManager {
dialogService.present(alert, animated: true, completion: nil)
}

func showNoEnabledNodesAlert(showAction: @escaping ()->Void) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@escaping () -> Void

@@ -17,6 +17,7 @@ enum ChatDialog {
case warning(String)
case richError(Error)
case freeTokenAlert
case noEnabledNodesAlert(()->Void)
Copy link
Member

@just-software-dev just-software-dev Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showNodesListAction: () -> Void

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move it to ChatLocalization, because this alert is used on the chat screen only

@@ -161,6 +161,7 @@ final class ChatViewController: MessagesViewController {
defer { viewAppeared = true }
inputBar.isUserInteractionEnabled = true
chatMessagesCollectionView.fixedBottomOffset = nil
checkNodesEnabled()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not show the alert again on the same chat screen. If we close this chat screen and open the same chat screen — it’s counted as another chat screen.

@@ -199,6 +201,26 @@ private extension ChatDialogManager {
dialogService.present(alert, animated: true, completion: nil)
}

func showNodeListAlert(showAction: @escaping () -> Void) {
let alert = UIAlertController(
title: String.adamant.chat.admNoActiveNodesTitle,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.adamant.chat.admNoActiveNodesTitle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants