浏览代码

call new dc_accounts_maybe_network_lost()

when calling dc_accounts_maybe_network_lost() on lost network,
we get the corresponding connectivity-changed events from the core,
delayed by 10~20 seconds, for whatever reason,
maybe cores tries some things ...
but that seems to be okay.

when networks becomes available,
the update is instant.

the "crash" on network lost, btw seems not to be a crash,
it is more that the connection to the debugger ist lost,
maybe because of missing network.

without debugger,
nothing crahes.
B. Petersen 4 年之前
父节点
当前提交
d91bfe31de
共有 2 个文件被更改,包括 7 次插入0 次删除
  1. 4 0
      DcCore/DcCore/DC/Wrapper.swift
  2. 3 0
      deltachat-ios/AppDelegate.swift

+ 4 - 0
DcCore/DcCore/DC/Wrapper.swift

@@ -47,6 +47,10 @@ public class DcAccounts {
         dc_accounts_maybe_network(accountsPointer)
     }
 
+    public func maybeNetworkLost() {
+        dc_accounts_maybe_network_lost(accountsPointer)
+    }
+
     public func maybeStartIo() {
         if getSelected().isConfigured() {
             dc_accounts_start_io(accountsPointer)

+ 3 - 0
deltachat-ios/AppDelegate.swift

@@ -95,6 +95,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
         reachability.whenUnreachable = { _ in
             logger.info("network: not reachable")
+            DispatchQueue.global(qos: .background).async { [weak self] in
+                self?.dcAccounts.maybeNetworkLost()
+            }
         }
 
         do {