소스 검색

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 {