From cb8305f014c1940af3863d945e9a72a95c535ebe Mon Sep 17 00:00:00 2001 From: Allan Feldman <6374032+a-feld@users.noreply.github.com> Date: Wed, 26 Feb 2025 23:40:07 -0500 Subject: [PATCH] (Fix) autofill / extensions and restore persistent storage location (#686) --- pass/AppDelegate.swift | 1 - passKit/Controllers/CoreDataStack.swift | 5 ++++- passKitTests/CoreData/CoreDataTestCase.swift | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pass/AppDelegate.swift b/pass/AppDelegate.swift index 6c18228..08e1a7a 100644 --- a/pass/AppDelegate.swift +++ b/pass/AppDelegate.swift @@ -23,7 +23,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { lazy var passcodeLockPresenter = PasscodeLockPresenter(mainWindow: self.window) func application(_: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - PersistenceController.shared.setup() // Override point for customization after application launch. SVProgressHUD.setMinimumSize(CGSize(width: 150, height: 100)) passcodeLockPresenter.present(windowLevel: UIApplication.shared.windows.last?.windowLevel.rawValue) diff --git a/passKit/Controllers/CoreDataStack.swift b/passKit/Controllers/CoreDataStack.swift index 29dbd1f..0452259 100644 --- a/passKit/Controllers/CoreDataStack.swift +++ b/passKit/Controllers/CoreDataStack.swift @@ -25,10 +25,13 @@ public class PersistenceController { description?.shouldInferMappingModelAutomatically = false if isUnitTest { description?.url = URL(fileURLWithPath: "/dev/null") + } else { + description?.url = URL(fileURLWithPath: Globals.dbPath) } + setup() } - public func setup() { + func setup() { container.loadPersistentStores { _, error in if error != nil { self.reinitializePersistentStore() diff --git a/passKitTests/CoreData/CoreDataTestCase.swift b/passKitTests/CoreData/CoreDataTestCase.swift index 8b3958c..fa356bf 100644 --- a/passKitTests/CoreData/CoreDataTestCase.swift +++ b/passKitTests/CoreData/CoreDataTestCase.swift @@ -21,7 +21,6 @@ class CoreDataTestCase: XCTestCase { try super.setUpWithError() controller = PersistenceController(isUnitTest: true) - controller.setup() } override func tearDown() {