Skip to content

Commit

Permalink
Get proxies from core (hopefully, #2382)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitschlag committed Nov 5, 2024
1 parent 9bdad82 commit ebe55e9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions deltachat-ios/DC/DcContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -741,4 +741,23 @@ public class DcContext {
public var isChatmail: Bool {
return getConfigInt("is_chatmail") == 1
}

public var isProxyEnabled: Bool {
get { return getConfigBool("proxy_enabled") }
set { setConfigBool("proxy_enabled", newValue) }
}

public func getProxies() -> [String] {
guard let proxyURLStrings = getConfig("proxy_url"),
let proxies = proxyURLStrings.split(separator: "\n") as? [String]
else { return [] }

return proxies
}

public func setProxies(proxyURLs: [String]) {
let allProxies = proxyURLs.joined(separator: "\n")

setConfig("proxy_url", allProxies)
}
}

0 comments on commit ebe55e9

Please sign in to comment.