From 130f029ff4cb4164b3a7e971f5055f2af865c23c Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Sat, 12 Mar 2022 23:56:55 +0300 Subject: [PATCH] Fixed bug when vehicle was not updated in case of error --- AutoCat.xcodeproj/project.pbxproj | 4 +- AutoCat/AppDelegate.swift | 8 ++- AutoCat/Base.lproj/Main.storyboard | 79 +++++++++++++++-------- AutoCat/Cells/VehicleCell.swift | 3 + AutoCat/Controllers/CheckController.swift | 5 +- AutoCatCore/Models/Vehicle.swift | 7 ++ AutoCatCore/Utils/Api.swift | 10 +-- 7 files changed, 75 insertions(+), 41 deletions(-) diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index 2a10ff3..7565742 100644 --- a/AutoCat.xcodeproj/project.pbxproj +++ b/AutoCat.xcodeproj/project.pbxproj @@ -1080,7 +1080,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 87; + CURRENT_PROJECT_VERSION = 88; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -1105,7 +1105,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 87; + CURRENT_PROJECT_VERSION = 88; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; diff --git a/AutoCat/AppDelegate.swift b/AutoCat/AppDelegate.swift index 46e6990..476f72d 100644 --- a/AutoCat/AppDelegate.swift +++ b/AutoCat/AppDelegate.swift @@ -26,7 +26,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { let config = Realm.Configuration( - schemaVersion: 35, + schemaVersion: 37, migrationBlock: { migration, oldSchemaVersion in if oldSchemaVersion <= 3 { var numbers: [String] = [] @@ -148,6 +148,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate { new?["id"] = newId } } + + if oldSchemaVersion <= 36 { + migration.enumerateObjects(ofType: "Vehicle") { old, new in + new?["synchronized"] = true + } + } }) Realm.Configuration.defaultConfiguration = config diff --git a/AutoCat/Base.lproj/Main.storyboard b/AutoCat/Base.lproj/Main.storyboard index d00a27e..b013ab5 100644 --- a/AutoCat/Base.lproj/Main.storyboard +++ b/AutoCat/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -173,14 +173,14 @@ - + - + - +