From c5d2e9af68aa1d0f089fb15b759ad362f21ed319 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 15 Mar 2020 11:26:30 -0400 Subject: [PATCH] Fix preferences/drafts not saving on iPad in some circumstances --- Tusker/SceneDelegate.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Tusker/SceneDelegate.swift b/Tusker/SceneDelegate.swift index b2a172a2..5755676f 100644 --- a/Tusker/SceneDelegate.swift +++ b/Tusker/SceneDelegate.swift @@ -82,6 +82,9 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { // This occurs shortly after the scene enters the background, or when its session is discarded. // Release any resources associated with this scene that can be re-created the next time the scene connects. // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). + + Preferences.save() + DraftsManager.save() } func sceneDidBecomeActive(_ scene: UIScene) { @@ -92,6 +95,9 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func sceneWillResignActive(_ scene: UIScene) { // Called when the scene will move from an active state to an inactive state. // This may occur due to temporary interruptions (ex. an incoming phone call). + + Preferences.save() + DraftsManager.save() } func sceneWillEnterForeground(_ scene: UIScene) { @@ -103,9 +109,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { // Called as the scene transitions from the foreground to the background. // Use this method to save data, release shared resources, and store enough scene-specific state information // to restore the scene back to its current state. - - Preferences.save() - DraftsManager.save() } func activateAccount(_ account: LocalData.UserAccountInfo) {