Skip to content

Commit

Permalink
use new selfAddr api
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Nov 23, 2024
1 parent 816b505 commit dee7b66
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions deltachat-ios/Controller/WebxdcViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class WebxdcViewController: WebViewViewController {
var messageId: Int
var webxdcName: String = ""
var sourceCodeUrl: String?
var selfAddr: String = ""
private var allowInternet: Bool = false

private var shortcutManager: ShortcutManager?
Expand Down Expand Up @@ -57,7 +58,7 @@ class WebxdcViewController: WebViewViewController {
"""

lazy var webxdcbridge: String = {
let addr = dcContext.addr?
let addr = selfAddr
.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)
let displayname = (dcContext.displayname ?? dcContext.addr)?
.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)
Expand Down Expand Up @@ -284,6 +285,7 @@ class WebxdcViewController: WebViewViewController {
object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(WebxdcViewController.handleWebxdcStatusUpdate(_:)), name: Event.webxdcStatusUpdate, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(WebxdcViewController.handleWebxdcRealtimeDataReceived(_:)), name: Event.webxdcRealtimeDataReceived, object: nil)
refreshWebxdcInfo()
}

required init?(coder: NSCoder) {
Expand All @@ -298,7 +300,6 @@ class WebxdcViewController: WebViewViewController {
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItem = moreButton
refreshWebxdcInfo()
}

override func willMove(toParent parent: UIViewController?) {
Expand All @@ -321,6 +322,10 @@ class WebxdcViewController: WebViewViewController {
!sourceCode.isEmpty {
sourceCodeUrl = sourceCode
}

if let addr = dict["self_addr"] as? String {
selfAddr = addr
}
}

// MARK: - Notifications
Expand Down

0 comments on commit dee7b66

Please sign in to comment.