core, ui: errors for blocked files and contact addresses (#5510)

* core, ui: errors for blocked files and contact addresses

* android

* iOS: How it works, stub for blog post

* android: blocked errors WIP

* android: alert with button

* update

* fix encoding

* nix

* simplexmq
This commit is contained in:
Evgeny
2025-01-12 21:25:25 +00:00
committed by GitHub
parent 0d6b26c269
commit eacae74fed
20 changed files with 216 additions and 140 deletions
+7 -1
View File
@@ -66,7 +66,7 @@ import qualified Simplex.Messaging.Crypto.Ratchet as CR
import Simplex.Messaging.Encoding
import Simplex.Messaging.Encoding.String
import Simplex.Messaging.Parsers (dropPrefix, taggedObjectJSON)
import Simplex.Messaging.Protocol (AProtoServerWithAuth (..), AProtocolType, ProtocolServer (..), ProtocolTypeI, SProtocolType (..), UserProtocol)
import Simplex.Messaging.Protocol (AProtoServerWithAuth (..), AProtocolType, BlockingInfo (..), BlockingReason (..), ProtocolServer (..), ProtocolTypeI, SProtocolType (..), UserProtocol)
import qualified Simplex.Messaging.Protocol as SMP
import Simplex.Messaging.Transport.Client (TransportHost (..))
import Simplex.Messaging.Util (safeDecodeUtf8, tshow)
@@ -2223,6 +2223,12 @@ viewChatError isCmd logLevel testView = \case
[ withConnEntity
<> "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"
]
SMP _ (SMP.BLOCKED BlockingInfo {reason}) ->
[withConnEntity <> "error: connection blocked by server operator: " <> reasonStr]
where
reasonStr = case reason of
BRSpam -> "spam"
BRContent -> "content violates conditions of use"
BROKER _ NETWORK | not isCmd -> []
BROKER _ TIMEOUT | not isCmd -> []
AGENT A_DUPLICATE -> [withConnEntity <> "error: AGENT A_DUPLICATE" | logLevel == CLLDebug || isCmd]