瀏覽代碼

improve syntax

Co-authored-by: bjoern <r10s@b44t.com>
cyBerta 2 年之前
父節點
當前提交
2250626226
共有 1 個文件被更改,包括 1 次插入4 次删除
  1. 1 4
      deltachat-ios/Controller/WebViewViewController.swift

+ 1 - 4
deltachat-ios/Controller/WebViewViewController.swift

@@ -215,10 +215,7 @@ class WebViewViewController: UIViewController, WKNavigationDelegate {
         // workaround:
         let contacts: [Int] = dcContext.getContacts(flags: DC_GCL_ADD_SELF, queryString: emailAddress)
         let index = contacts.firstIndex(where: { dcContext.getContact(id: $0).email == emailAddress }) ?? -1
-        var contactId = 0
-        if index >= 0 {
-            contactId = contacts[index]
-        }
+        let contactId = index >= 0 ? contacts[index] : 0
 
         if contactId == 0 {
             let alert = UIAlertController(title: String.localizedStringWithFormat(String.localized("ask_start_chat_with"), emailAddress),