ios: advanced server configuration (#1388)

* ios: advanced server configuration

* UI is mostly working, QR code scan

* refactor

* error alerts

* fixes

* remove old view

* rename view

* translations

* only show valid QR code, spinner during server test

* update tested status on edit

* space wtf

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>

* moar space

* translation

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>

* translations

* translations

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
This commit is contained in:
Evgeny Poberezkin
2022-11-21 08:37:13 +00:00
committed by GitHub
parent 7544d2f9e7
commit 7e3d53b621
20 changed files with 1043 additions and 403 deletions
+20
View File
@@ -89,6 +89,26 @@ struct ParsedMarkdown: Decodable {
var formattedText: [FormattedText]?
}
public func parseServerAddress(_ s: String) -> ServerAddress? {
var c = s.cString(using: .utf8)!
if let cjson = chat_parse_server(&c) {
if let d = fromCString(cjson).data(using: .utf8) {
do {
let r = try jsonDecoder.decode(ParsedServerAddress.self, from: d)
return r.serverAddress
} catch {
logger.error("parseServerAddress jsonDecoder.decode error: \(error.localizedDescription)")
}
}
}
return nil
}
struct ParsedServerAddress: Decodable {
var serverAddress: ServerAddress?
var parseError: String
}
private func fromCString(_ c: UnsafeMutablePointer<CChar>) -> String {
let s = String.init(cString: c)
free(c)