ios: update servers API/UI (#2149)

* ios: update servers API/UI

* fix UI

* fix
This commit is contained in:
Evgeny Poberezkin
2023-04-06 22:48:32 +01:00
committed by GitHub
parent d250e503b0
commit 5ae0afe1fe
8 changed files with 150 additions and 103 deletions

View File

@@ -697,7 +697,7 @@ data ParsedServerAddress = ParsedServerAddress
instance ToJSON ParsedServerAddress where toEncoding = J.genericToEncoding J.defaultOptions
data ServerAddress = ServerAddress
{ protocol :: AProtocolType,
{ serverProtocol :: AProtocolType,
hostnames :: NonEmpty String,
port :: String,
keyHash :: String,

View File

@@ -198,7 +198,7 @@ chatParseServer = LB.unpack . J.encode . toServerAddress . strDecode . B.pack
toServerAddress = \case
Right (AProtoServerWithAuth protocol (ProtoServerWithAuth ProtocolServer {host, port, keyHash = C.KeyHash kh} auth)) ->
let basicAuth = maybe "" (\(BasicAuth a) -> enc a) auth
in ParsedServerAddress (Just ServerAddress {protocol = AProtocolType protocol, hostnames = L.map enc host, port, keyHash = enc kh, basicAuth}) ""
in ParsedServerAddress (Just ServerAddress {serverProtocol = AProtocolType protocol, hostnames = L.map enc host, port, keyHash = enc kh, basicAuth}) ""
Left e -> ParsedServerAddress Nothing e
enc :: StrEncoding a => a -> String
enc = B.unpack . strEncode