Pārlūkot izejas kodu

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 gadi atpakaļ
vecāks
revīzija
d91bfe31de
2 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  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)
         dc_accounts_maybe_network(accountsPointer)
     }
     }
 
 
+    public func maybeNetworkLost() {
+        dc_accounts_maybe_network_lost(accountsPointer)
+    }
+
     public func maybeStartIo() {
     public func maybeStartIo() {
         if getSelected().isConfigured() {
         if getSelected().isConfigured() {
             dc_accounts_start_io(accountsPointer)
             dc_accounts_start_io(accountsPointer)

+ 3 - 0
deltachat-ios/AppDelegate.swift

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