kotlin alerts

This commit is contained in:
Evgeny @ SimpleX Chat
2026-06-30 16:43:17 +00:00
parent 86bbe62a28
commit ae168143ca
2 changed files with 42 additions and 15 deletions
@@ -1559,25 +1559,44 @@ object ChatController {
}
r is API.Error && r.err is ChatError.ChatErrorChat
&& r.err.errorType is ChatErrorType.SimplexName -> {
val name = r.err.errorType.simplexName.shortName
if (r.err.errorType.simplexNameError is SimplexNameError.NoValidLink) {
AlertManager.shared.showAlertMsg(
generalGetString(MR.strings.cannot_reconnect_via_simplex_name),
generalGetString(MR.strings.simplex_name_unprepared_desc)
generalGetString(MR.strings.simplex_name_no_valid_link),
generalGetString(MR.strings.simplex_name_no_valid_link_desc).format(name)
)
} else {
AlertManager.shared.showAlertMsg(
generalGetString(MR.strings.simplex_name_not_found),
generalGetString(MR.strings.simplex_name_not_found_desc)
generalGetString(MR.strings.simplex_name_unconfirmed),
generalGetString(MR.strings.simplex_name_unconfirmed_desc).format(name)
)
}
}
r is API.Error && r.err is ChatError.ChatErrorAgent
&& r.err.agentError is AgentErrorType.NO_NAME_SERVERS -> {
AlertManager.shared.showAlertMsg(
generalGetString(MR.strings.simplex_name_resolution_unavailable),
generalGetString(MR.strings.simplex_name_resolver_unavailable_desc)
generalGetString(MR.strings.simplex_name_error),
generalGetString(MR.strings.simplex_name_no_servers_desc)
)
}
r is API.Error && r.err is ChatError.ChatErrorAgent
&& r.err.agentError is AgentErrorType.SMP
&& r.err.agentError.smpErr is SMPErrorType.NAME -> {
when (val nameErr = r.err.agentError.smpErr.nameErr) {
is NameErrorType.NOT_FOUND -> AlertManager.shared.showAlertMsg(
generalGetString(MR.strings.simplex_name_not_found),
generalGetString(MR.strings.simplex_name_not_found_desc)
)
is NameErrorType.NO_RESOLVER -> AlertManager.shared.showAlertMsg(
generalGetString(MR.strings.simplex_name_error),
generalGetString(MR.strings.simplex_name_server_no_resolver_desc).format(r.err.agentError.serverAddress)
)
is NameErrorType.RESOLVER -> AlertManager.shared.showAlertMsg(
generalGetString(MR.strings.simplex_name_error),
generalGetString(MR.strings.simplex_name_resolver_error_desc).format(nameErr.resolverErr)
)
}
}
r is API.Error && r.err is ChatError.ChatErrorAgent
&& r.err.agentError is AgentErrorType.SMP
&& r.err.agentError.smpErr is SMPErrorType.AUTH -> {
@@ -1617,10 +1636,14 @@ object ChatController {
generalGetString(MR.strings.unsupported_connection_link)
e is ChatError.ChatErrorChat && e.errorType is ChatErrorType.SimplexName ->
if (e.errorType.simplexNameError is SimplexNameError.NoValidLink)
generalGetString(MR.strings.cannot_reconnect_via_simplex_name)
else generalGetString(MR.strings.simplex_name_not_found)
generalGetString(MR.strings.simplex_name_no_valid_link)
else generalGetString(MR.strings.simplex_name_unconfirmed)
e is ChatError.ChatErrorAgent && e.agentError is AgentErrorType.NO_NAME_SERVERS ->
generalGetString(MR.strings.simplex_name_resolution_unavailable)
generalGetString(MR.strings.simplex_name_error)
e is ChatError.ChatErrorAgent && e.agentError is AgentErrorType.SMP && e.agentError.smpErr is SMPErrorType.NAME ->
if (e.agentError.smpErr.nameErr is NameErrorType.NOT_FOUND)
generalGetString(MR.strings.simplex_name_not_found)
else generalGetString(MR.strings.simplex_name_error)
e is ChatError.ChatErrorAgent && e.agentError is AgentErrorType.SMP && e.agentError.smpErr is SMPErrorType.AUTH ->
generalGetString(MR.strings.connection_error_auth)
e is ChatError.ChatErrorAgent && e.agentError is AgentErrorType.SMP && e.agentError.smpErr is SMPErrorType.BLOCKED ->
@@ -200,12 +200,16 @@
<string name="channel_name_requires_newer_app_version">Connecting via channel name requires a newer app version.</string>
<string name="contact_name_requires_newer_app_version">Connecting via contact name requires a newer app version.</string>
<string name="please_upgrade_the_app">Please upgrade the app.</string>
<string name="simplex_name_not_found">SimpleX name not found</string>
<string name="simplex_name_not_found_desc">There is no contact or group registered with this SimpleX name.</string>
<string name="cannot_reconnect_via_simplex_name">Cannot reconnect via name</string>
<string name="simplex_name_unprepared_desc">This SimpleX name is known but has no saved link to reconnect via.</string>
<string name="simplex_name_resolution_unavailable">Name resolution unavailable</string>
<string name="simplex_name_resolver_unavailable_desc">None of your SMP servers support resolving SimpleX names. Add a server that does, or use a connection link.</string>
<string name="simplex_name_error">SimpleX name error</string>
<string name="simplex_name_no_servers_desc">None of your servers are set to resolve SimpleX names. Configure servers, or use a connection link.</string>
<string name="simplex_name_server_no_resolver_desc">Server %1$s does not support name resolution. Configure servers, or use a connection link.</string>
<string name="simplex_name_not_found">Name not found</string>
<string name="simplex_name_not_found_desc">This SimpleX name is not registered. Please check the name.</string>
<string name="simplex_name_resolver_error_desc">Resolver error: %1$s</string>
<string name="simplex_name_no_valid_link">No valid link</string>
<string name="simplex_name_no_valid_link_desc">The SimpleX name %1$s is registered, but it has no valid link.</string>
<string name="simplex_name_unconfirmed">Unconfirmed name</string>
<string name="simplex_name_unconfirmed_desc">The SimpleX name %1$s is registered, but not added to profile. Please add it to your address or channel profile, if you are the owner.</string>
<string name="channel_temporarily_unavailable">Channel temporarily unavailable</string>
<string name="channel_no_active_relays_try_later">Channel has no active relays. Please try to join later.</string>
<string name="app_update_required">App update required</string>