diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index 17d8af4..b48e508 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 = 90; + CURRENT_PROJECT_VERSION = 91; 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 = 90; + CURRENT_PROJECT_VERSION = 91; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; diff --git a/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 6aca2f1..705989c 100644 --- a/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/AutoCat.xcodeproj/xcuserdata/selim.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -100,5 +100,21 @@ landmarkType = "7"> + + + + diff --git a/AutoCat/Utils/RxRealmDataSource.swift b/AutoCat/Utils/RxRealmDataSource.swift index 4dca7bb..ee4ea6b 100644 --- a/AutoCat/Utils/RxRealmDataSource.swift +++ b/AutoCat/Utils/RxRealmDataSource.swift @@ -38,6 +38,10 @@ class RealmSectionedDataSource: NSObject, UITableViewDataSource self.insertFirst() } else if deletions.isEmpty && insertions.isEmpty && modifications.count == 1 && modifications.first == 0 { self.reloadFirst() + } else if modifications.isEmpty && deletions.count == 1 && insertions.count == 1 && insertions.first == 0 { + // Probably moving an item to the first position + // For example - updating number info + self.moveToFirst(deleteIndex: deletions.first!) } else { self.reload(animated: false) } @@ -95,16 +99,23 @@ class RealmSectionedDataSource: NSObject, UITableViewDataSource } func insertFirst() { - guard !sections.isEmpty, let item = data.first?.clone() else { + guard let item = data.first?.clone() else { + reload(animated: false) return } - sections[0].insert(item, at: 0) - tv.insertRows(at: [IndexPath(row: 0, section: 0)], with: .fade) + if sections.isEmpty { + sections = [item].groupedByDate() + tv.insertSections(IndexSet(integer: 0), with: .fade) + } else { + sections[0].insert(item, at: 0) + tv.insertRows(at: [IndexPath(row: 0, section: 0)], with: .fade) + } } func reloadFirst() { guard !sections.isEmpty, let item = data.first?.clone() else { + reload(animated: false) return } @@ -112,6 +123,29 @@ class RealmSectionedDataSource: NSObject, UITableViewDataSource tv.reloadRows(at: [IndexPath(row: 0, section: 0)], with: .none) } + func moveToFirst(deleteIndex: Int) { + var itemIndex = deleteIndex + for index in 0.. Int? { + return nil + } + func setFilterPredicate(_ predicate: FilterPredicate?) { self.filterPredicate = predicate self.reload()