SMP AUTH error processing and descriptions (#544)

* SMP AUTH error descriptions

* change text

* android error description

* Update apps/android/app/src/main/res/values/strings.xml

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>

* Update apps/android/app/src/main/res/values-ru/strings.xml

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>

* fix translations

* Apply suggestions from code review

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
JRoberts
2022-04-21 11:50:24 +04:00
committed by GitHub
parent ec5aea0773
commit effd37402a
9 changed files with 54 additions and 2 deletions
@@ -223,6 +223,15 @@ open class ChatController(private val ctrl: ChatCtrl, private val ntfManager: Nt
)
return false
}
r is CR.ChatCmdError && r.chatError is ChatError.ChatErrorAgent
&& r.chatError.agentError is AgentErrorType.SMP
&& r.chatError.agentError.smpErr is SMPErrorType.AUTH -> {
AlertManager.shared.showAlertMsg(
generalGetString(R.string.connection_error_auth),
generalGetString(R.string.connection_error_auth_desc)
)
return false
}
else -> {
apiErrorAlert("apiConnect", "Connection error", r)
return false
@@ -33,6 +33,8 @@
<string name="you_are_already_connected_to_vName_via_this_link">Вы уже соединены с <xliff:g id="contactName" example="Alice">%1$s!</xliff:g> через эту ссылку.</string>
<string name="invalid_connection_link">Ошибка в ссылке контакта</string>
<string name="please_check_correct_link_and_maybe_ask_for_a_new_one">Пожалуйста, проверьте, что вы использовали правильную ссылку, или попросите ваш контакт отправить вам новую.</string>
<string name="connection_error_auth">Ошибка соединения (AUTH)</string>
<string name="connection_error_auth_desc">Возможно, ваш контакт удалил ссылку, или она уже была использована. Если это не так, то это может быть ошибкой - пожалуйста, сообщите нам об этом.\nЧтобы установить соединение, попросите ваш контакт создать еще одну ссылку и проверьте ваше соединение с сетью.</string>
<string name="cannot_delete_contact">Невозможно удалить контакт!</string>
<string name="contact_cannot_be_deleted_as_they_are_in_groups">Контакт <xliff:g id="contactName" example="Jane Doe">%1$s!</xliff:g> не может быть удален, так как является членом групп(ы) <xliff:g id="groups" example="[team, chess club]">%2$s</xliff:g>.</string>
<string name="icon_descr_instant_notifications">Мгновенные уведомления</string>
@@ -33,6 +33,8 @@
<string name="you_are_already_connected_to_vName_via_this_link">You are already connected to <xliff:g id="contactName" example="Alice">%1$s!</xliff:g> via this link.</string>
<string name="invalid_connection_link">Invalid connection link</string>
<string name="please_check_correct_link_and_maybe_ask_for_a_new_one">Please check that you used the correct link or ask your contact to send you another one.</string>
<string name="connection_error_auth">Connection error (AUTH)</string>
<string name="connection_error_auth_desc">Unless your contact deleted the connection or this link was already used, it might be a bug - please report it.\nTo connect, please ask your contact to create another connection link and check that you have a stable network connection.</string>
<string name="cannot_delete_contact">Can\'t delete contact!</string>
<string name="contact_cannot_be_deleted_as_they_are_in_groups">Contact <xliff:g id="contactName" example="Jane Doe">%1$s!</xliff:g> cannot be deleted, they are a member of the group(s) <xliff:g id="groups" example="[team, chess club]">%2$s</xliff:g>.</string>
<string name="icon_descr_instant_notifications">Instant notifications</string>
+6
View File
@@ -492,6 +492,12 @@ func apiConnect(connReq: String) async throws -> Bool {
message: "Please check your network connection and try again."
)
return false
case .chatCmdError(.errorAgent(.SMP(.AUTH))):
am.showAlertMsg(
title: "Connection error (AUTH)",
message: "Unless your contact deleted the connection or this link was already used, it might be a bug - please report it.\nTo connect, please ask your contact to create another connection link and check that you have a stable network connection."
)
return false
default: throw r
}
}
@@ -195,6 +195,11 @@
<target>Connection error</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Connection error (AUTH)" xml:space="preserve">
<source>Connection error (AUTH)</source>
<target>Connection error (AUTH)</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Connection request" xml:space="preserve">
<source>Connection request</source>
<target>Connection request</target>
@@ -587,6 +592,13 @@ to scan from the app</target>
<target>Unexpected error: %@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Unless your contact deleted the connection or this link was already used, it might be a bug - please report it.&#10;To connect, please ask your contact to create another connection link and check that you have a stable network connection." xml:space="preserve">
<source>Unless your contact deleted the connection or this link was already used, it might be a bug - please report it.
To connect, please ask your contact to create another connection link and check that you have a stable network connection.</source>
<target>Unless your contact deleted the connection or this link was already used, it might be a bug - please report it.
To connect, please ask your contact to create another connection link and check that you have a stable network connection.</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Use SimpleX Chat servers?" xml:space="preserve">
<source>Use SimpleX Chat servers?</source>
<target>Use SimpleX Chat servers?</target>
@@ -195,6 +195,11 @@
<target>Ошибка соединения</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Connection error (AUTH)" xml:space="preserve">
<source>Connection error (AUTH)</source>
<target>Ошибка соединения (AUTH)</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Connection request" xml:space="preserve">
<source>Connection request</source>
<target>Запрос на соединение</target>
@@ -586,6 +591,13 @@ to scan from the app</source>
<target>Неожиданная ошибка: %@</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Unless your contact deleted the connection or this link was already used, it might be a bug - please report it.&#10;To connect, please ask your contact to create another connection link and check that you have a stable network connection." xml:space="preserve">
<source>Unless your contact deleted the connection or this link was already used, it might be a bug - please report it.
To connect, please ask your contact to create another connection link and check that you have a stable network connection.</source>
<target>Возможно, ваш контакт удалил ссылку, или она уже была использована. Если это не так, то это может быть ошибкой - пожалуйста, сообщите нам об этом.
Чтобы установить соединение, попросите ваш контакт создать еще одну ссылку и проверьте ваше соединение с сетью.</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Use SimpleX Chat servers?" xml:space="preserve">
<source>Use SimpleX Chat servers?</source>
<target>Использовать серверы предосталенные SimpleX Chat?</target>
+6
View File
@@ -142,6 +142,9 @@
/* No comment provided by engineer. */
"Connection error" = "Ошибка соединения";
/* No comment provided by engineer. */
"Connection error (AUTH)" = "Ошибка соединения (AUTH)";
/* No comment provided by engineer. */
"Connection request" = "Запрос на соединение";
@@ -388,6 +391,9 @@
/* No comment provided by engineer. */
"Unexpected error: %@" = "Неожиданная ошибка: %@";
/* No comment provided by engineer. */
"Unless your contact deleted the connection or this link was already used, it might be a bug - please report it.\nTo connect, please ask your contact to create another connection link and check that you have a stable network connection." = "Возможно, ваш контакт удалил ссылку, или она уже была использована. Если это не так, то это может быть ошибкой - пожалуйста, сообщите нам об этом.\nЧтобы установить соединение, попросите ваш контакт создать еще одну ссылку и проверьте ваше соединение с сетью.";
/* No comment provided by engineer. */
"Use SimpleX Chat servers?" = "Использовать серверы предосталенные SimpleX Chat?";
+4 -1
View File
@@ -654,7 +654,10 @@ viewChatError = \case
SEQuotedChatItemNotFound -> ["message not found - reply is not sent"]
e -> ["chat db error: " <> sShow e]
ChatErrorAgent err -> case err of
SMP SMP.AUTH -> ["error: this connection is deleted"]
SMP SMP.AUTH ->
[ "error: connection authorization failed - this could happen if connection was deleted,\
\ secured with different credentials, or due to a bug - please re-create the connection"
]
e -> ["smp agent error: " <> sShow e]
where
fileNotFound fileId = ["file " <> sShow fileId <> " not found"]
+1 -1
View File
@@ -1694,7 +1694,7 @@ testRejectContactAndDeleteUserContact = testChat3 aliceProfile bobProfile cathPr
alice <## "To create a new chat address use /ad"
cath ##> ("/c " <> cLink)
cath <## "error: this connection is deleted"
cath <## "error: connection authorization failed - this could happen if connection was deleted, secured with different credentials, or due to a bug - please re-create the connection"
testDeleteConnectionRequests :: IO ()
testDeleteConnectionRequests = testChat3 aliceProfile bobProfile cathProfile $