From 919ad9596ca6c13627297e95b6fcbd3152c9e09b Mon Sep 17 00:00:00 2001
From: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
Date: Wed, 8 Nov 2023 12:44:52 -0500
Subject: [PATCH] UI/UX: avoid initial loading on main thread

Change-Id: I9179fbbb999cbe464e1738b637f427b6caf46e35
---
 Ring/Ring/AppDelegate.swift | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Ring/Ring/AppDelegate.swift b/Ring/Ring/AppDelegate.swift
index dd0b86273..eec89266a 100644
--- a/Ring/Ring/AppDelegate.swift
+++ b/Ring/Ring/AppDelegate.swift
@@ -162,6 +162,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
         // Observe connectivity changes and reconnect DHT
         self.networkService.connectionStateObservable
+            .skip(1)
             .subscribe(onNext: { _ in
                 self.daemonService.connectivityChanged()
             })
@@ -308,7 +309,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
                     UserDefaults.standard.set(true, forKey: hardareAccelerationKey)
                     return
                 }
-                self.reloadDataFor(account: currentAccount)
+                DispatchQueue.global(qos: .background).async {[weak self] in
+                    guard let self = self else { return }
+                    self.reloadDataFor(account: currentAccount)
+                }
             }, onError: { _ in
                 self.appCoordinator.showInitialLoading()
                 let time = DispatchTime.now() + 1
-- 
GitLab