mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 13:11:55 +00:00
review round on UX coverage
This commit is contained in:
1 parent
42a4cc8adf
commit
baf485b8d6
17 files changed
+336
-167
No files matched your search
@@ -41,7 +41,7 @@ import Data.List.NonEmpty (NonEmpty)
|
||||
import Data.Map.Strict (Map)
|
||||
import Data.Set (Set)
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Maybe (fromMaybe, isNothing)
|
||||
import Data.String
|
||||
import Data.Text (Text)
|
||||
import Data.Text.Encoding (decodeLatin1)
|
||||
@@ -718,6 +718,7 @@ planResolveModeP :: A.Parser PlanResolveMode
|
||||
planResolveModeP =
|
||||
A.takeTill (== ' ') >>= \case
|
||||
"all" -> pure PRMAll
|
||||
"allGroups" -> pure PRMAll
|
||||
"on" -> pure PRMAll
|
||||
"unknown" -> pure PRMUnknown
|
||||
"off" -> pure PRMUnknown
|
||||
@@ -1229,15 +1230,15 @@ connectionPlanProceed = \case
|
||||
ILPOk {} -> True
|
||||
ILPOwnLink -> True
|
||||
_ -> False
|
||||
CPContactAddress cap _ -> case cap of
|
||||
CAPOk {} -> True
|
||||
CAPOwnLink -> True
|
||||
CPContactAddress cap w_ -> case cap of
|
||||
CAPOk {addressChanged} -> not addressChanged
|
||||
CAPOwnLink -> isNothing w_
|
||||
CAPConnectingConfirmReconnect -> True
|
||||
CAPContactViaAddress _ -> True
|
||||
_ -> False
|
||||
CPGroupLink glp _ -> case glp of
|
||||
GLPOk {} -> True
|
||||
GLPOwnLink _ -> True
|
||||
CPGroupLink glp w_ -> case glp of
|
||||
GLPOk {addressChanged} -> not addressChanged
|
||||
GLPOwnLink _ -> isNothing w_
|
||||
GLPConnectingConfirmReconnect -> True
|
||||
GLPNoRelays _ -> False
|
||||
GLPUpdateRequired _ -> False
|
||||
|
||||
@@ -4429,7 +4429,8 @@ processChatCommand cxt nm = \case
|
||||
Right reg -> do
|
||||
now <- liftIO getSystemSeconds
|
||||
let linkOrWarning ni = serverShortLink <$> nameLinkOrWarning now ni reg
|
||||
namePlan ni = (\(l, planName, _, p) -> (l, planName, otherName ni, p)) <$> connectPlan user (nameTarget ni) resolveMode sig_ (Just reg)
|
||||
namePlanWith other ni = (\(l, planName, _, p) -> (l, planName, other, p)) <$> connectPlan user (nameTarget ni) resolveMode sig_ (Just reg)
|
||||
namePlan ni = namePlanWith (otherName ni) ni
|
||||
otherName SimplexNameInfo {nameType} = case nameType of
|
||||
NTPublicGroup -> newName contactName contact_
|
||||
NTContact -> newName channelName channel_
|
||||
@@ -4439,7 +4440,7 @@ processChatCommand cxt nm = \case
|
||||
case match_ of
|
||||
Just (ni, _) -> namePlan ni
|
||||
Nothing -> case (linkOrWarning channelName, linkOrWarning contactName) of
|
||||
(Right _, Right _) -> namePlan channelName `catchAllErrors` \e -> (namePlan contactName `catchAllErrors` \_ -> throwError e)
|
||||
(Right _, Right _) -> namePlan channelName `catchAllErrors` \e -> (namePlanWith Nothing contactName `catchAllErrors` \_ -> throwError e)
|
||||
(Right _, Left _) -> namePlan channelName
|
||||
(Left _, Right _) -> namePlan contactName
|
||||
(Left w, Left _) -> pure (Nothing, Nothing, Nothing, CPNameNotConnectable d w)
|
||||
@@ -4514,16 +4515,22 @@ processChatCommand cxt nm = \case
|
||||
Nothing | resolveMode == PRMNever -> throwChatError CENotResolvedLocally
|
||||
_ ->
|
||||
tryAllErrors (maybe (resolveNameRegistration user nm (nameDomain ni)) pure nameReg_) >>= \case
|
||||
Left e -> case known_ of
|
||||
Just r@(_, p) | knownChat p -> pure $ first Just r
|
||||
_ -> throwError e
|
||||
Left e -> first Just <$> knownChatOrThrow e
|
||||
Right reg -> do
|
||||
now <- liftIO getSystemSeconds
|
||||
case nameLinkOrWarning now ni reg of
|
||||
Right l' -> first Just <$> linkPlan (nameExpiresAt reg) (serverShortLink l')
|
||||
Left w -> pure $ maybe (Nothing, CPNameNotConnectable (nameDomain ni) w) (bimap Just (setNameWarning w)) known_
|
||||
Right l' -> first Just <$> (linkPlan (nameExpiresAt reg) (serverShortLink l') `catchAllErrors` knownChatOrThrow)
|
||||
Left w -> case known_ of
|
||||
Just (l, p) -> do
|
||||
let p' = setNameWarning w p
|
||||
when (isNothing $ nameWarning_ p') $ setKnownVerified (nameExpiresAt reg) p'
|
||||
pure (Just l, p')
|
||||
Nothing -> pure (Nothing, CPNameNotConnectable (nameDomain ni) w)
|
||||
where
|
||||
known_ = fst <$> knownFresh_
|
||||
knownChatOrThrow e = case known_ of
|
||||
Just r@(_, p) | knownChat p -> pure r
|
||||
_ -> throwError e
|
||||
linkPlan expiresAt l' = case known_ of
|
||||
Just r@(l, _)
|
||||
| knownLinkOf l == Just l' -> confirmKnown expiresAt l' r
|
||||
|
||||
@@ -1366,10 +1366,6 @@ Query: UPDATE connections SET smp_agent_version = ?, pq_support = ?, enable_ntfs
|
||||
Plan:
|
||||
SEARCH connections USING PRIMARY KEY (conn_id=?)
|
||||
|
||||
Query: UPDATE deleted_snd_chunk_replicas SET delay = ?, retries = retries + 1, updated_at = ? WHERE deleted_snd_chunk_replica_id = ?
|
||||
Plan:
|
||||
SEARCH deleted_snd_chunk_replicas USING INTEGER PRIMARY KEY (rowid=?)
|
||||
|
||||
Query: UPDATE messages SET msg_body = x'' WHERE conn_id = ? AND internal_id = ?
|
||||
Plan:
|
||||
SEARCH messages USING PRIMARY KEY (conn_id=? AND internal_id=?)
|
||||
@@ -1378,6 +1374,10 @@ Query: UPDATE ratchets SET ratchet_state = ? WHERE conn_id = ?
|
||||
Plan:
|
||||
SEARCH ratchets USING PRIMARY KEY (conn_id=?)
|
||||
|
||||
Query: UPDATE rcv_file_chunk_replicas SET delay = ?, retries = retries + 1, updated_at = ? WHERE rcv_file_chunk_replica_id = ?
|
||||
Plan:
|
||||
SEARCH rcv_file_chunk_replicas USING INTEGER PRIMARY KEY (rowid=?)
|
||||
|
||||
Query: UPDATE rcv_file_chunk_replicas SET received = 1, updated_at = ? WHERE rcv_file_chunk_replica_id = ?
|
||||
Plan:
|
||||
SEARCH rcv_file_chunk_replicas USING INTEGER PRIMARY KEY (rowid=?)
|
||||
|
||||
Reference in new issue
Block a user