@@ -114,11 +114,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
114114 NCPreferences ( ) . removeAll ( )
115115
116116 if let bundleID = Bundle . main. bundleIdentifier {
117- let lastUpdateCheckDate = UserDefaults . standard. object ( forKey: AppUpdaterKey . lastUpdateCheckDate)
118117 UserDefaults . standard. removePersistentDomain ( forName: bundleID)
119- if lastUpdateCheckDate != nil {
120- UserDefaults . standard. setValue ( lastUpdateCheckDate, forKey: AppUpdaterKey . lastUpdateCheckDate)
121- }
122118 }
123119
124120 if NCBrandOptions . shared. disable_intro {
@@ -128,7 +124,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
128124 window? . makeKeyAndVisible ( )
129125 }
130126 } else {
131- if let navigationController = UIStoryboard ( name: " NCIntro " , bundle: nil ) . instantiateInitialViewController ( ) as? UINavigationController {
127+ if let viewController = UIStoryboard ( name: " NCIntro " , bundle: nil ) . instantiateInitialViewController ( ) as? NCIntroViewController {
128+ let navigationController = UINavigationController ( rootViewController: viewController)
132129 window? . rootViewController = navigationController
133130 window? . makeKeyAndVisible ( )
134131 }
@@ -211,15 +208,15 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
211208
212209 func sceneWillEnterForeground( _ scene: UIScene ) {
213210 hidePrivacyProtectionWindow ( )
214-
211+
215212 if let rootHostingController = scene. rootHostingController ( ) {
216213 if rootHostingController. anyRootView is Maintenance {
217214 return
218215 }
219216 }
220217 let session = SceneManager . shared. getSession ( scene: scene)
221218 let controller = SceneManager . shared. getController ( scene: scene)
222-
219+
223220 DispatchQueue . main. asyncAfter ( deadline: . now( ) + 1 ) {
224221 Task {
225222 if let tableAccount = await self . database. getTableAccountAsync ( account: session. account) {
@@ -229,29 +226,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
229226 }
230227 }
231228 AppUpdater ( ) . checkForUpdate ( )
232-
229+
233230 NotificationCenter . default. postOnMainThread ( name: NCGlobal . shared. notificationCenterRichdocumentGrabFocus)
231+ activateSceneForAccount ( scene, account: session. account, controller: controller)
234232 }
235233
236234 func sceneDidBecomeActive( _ scene: UIScene ) {
237- let session = SceneManager . shared. getSession ( scene: scene)
238- let controller = SceneManager . shared. getController ( scene: scene)
239- NextcloudKit . shared. nkCommonInstance. writeLog ( " [INFO] Scene did become active " )
240-
241- let oldVersion = UserDefaults . standard. value ( forKey: NCSettingsBundleHelper . SettingsBundleKeys. BuildVersionKey) as? String
242- AppUpdater ( ) . checkForUpdate ( )
243- AnalyticsHelper . shared. trackAppVersion ( oldVersion: oldVersion)
244- if let userAccount = NCManageDatabase . shared. getActiveTableAccount ( ) {
245- AnalyticsHelper . shared. trackUsedStorageData ( quotaUsed: userAccount. quotaUsed)
246- }
247-
248- NCSettingsBundleHelper . setVersionAndBuildNumber ( )
249- NCSettingsBundleHelper . checkAndExecuteSettings ( delay: 0.5 )
250-
251- // if !NCAskAuthorization().isRequesting {
252- // NCPasscode.shared.hidePrivacyProtectionWindow()
253- // }
254-
255235 hidePrivacyProtectionWindow ( )
256236
257237 if !NextcloudKit. shared. isNetworkReachable ( ) ,
@@ -266,13 +246,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
266246 }
267247 }
268248
269- // func sceneDidBecomeActive(_ scene: UIScene) {
270- // let session = SceneManager.shared.getSession(scene: scene)
271- // guard !session.account.isEmpty else { return }
272- //
273- // hidePrivacyProtectionWindow()
274- // }
275-
276249 func sceneWillResignActive( _ scene: UIScene ) {
277250 nkLog ( debug: " Scene will resign active " )
278251
@@ -281,6 +254,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
281254 return
282255 }
283256
257+ WidgetCenter . shared. reloadAllTimelines ( )
258+
284259 if NCPreferences ( ) . privacyScreenEnabled {
285260 showPrivacyProtectionWindow ( )
286261 }
@@ -290,6 +265,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
290265 let app = UIApplication . shared
291266 var bgID : UIBackgroundTaskIdentifier = . invalid
292267 let isBackgroundRefreshStatus = ( UIApplication . shared. backgroundRefreshStatus == . available)
268+ // Must be outside the Task otherwise isSuspendingDatabaseOperation suspends it
293269 let session = SceneManager . shared. getSession ( scene: scene)
294270 guard let tblAccount = NCManageDatabase . shared. getTableAccount ( predicate: NSPredicate ( format: " account == %@ " , session. account) ) else {
295271 return
@@ -542,10 +518,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
542518 }
543519
544520 private func showPrivacyProtectionWindow( ) {
545- guard privacyProtectionWindow == nil else {
546- privacyProtectionWindow? . isHidden = false
547- return
548- }
549521 guard let windowScene = self . window? . windowScene else {
550522 return
551523 }
0 commit comments