Fix problem with electric vehicles (engine volume is 0)
This commit is contained in:
parent
8fc14fdfbe
commit
a0bb646623
@ -728,7 +728,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 48;
|
CURRENT_PROJECT_VERSION = 49;
|
||||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||||
@ -750,7 +750,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 48;
|
CURRENT_PROJECT_VERSION = 49;
|
||||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||||
|
|||||||
@ -14,35 +14,35 @@
|
|||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>8</integer>
|
<integer>5</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>DifferenceKit (Playground) 2.xcscheme</key>
|
<key>DifferenceKit (Playground) 2.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>9</integer>
|
<integer>6</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>DifferenceKit (Playground).xcscheme</key>
|
<key>DifferenceKit (Playground).xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>7</integer>
|
<integer>4</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>Eureka (Playground) 1.xcscheme</key>
|
<key>Eureka (Playground) 1.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>3</integer>
|
<integer>8</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>Eureka (Playground) 2.xcscheme</key>
|
<key>Eureka (Playground) 2.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>4</integer>
|
<integer>9</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>Eureka (Playground) 3.xcscheme</key>
|
<key>Eureka (Playground) 3.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>2</integer>
|
<integer>7</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>GettingStarted (Playground) 1.xcscheme</key>
|
<key>GettingStarted (Playground) 1.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
@ -112,42 +112,42 @@
|
|||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>13</integer>
|
<integer>12</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>Rx (Playground) 1.xcscheme</key>
|
<key>Rx (Playground) 1.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>6</integer>
|
<integer>1</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>Rx (Playground) 2.xcscheme</key>
|
<key>Rx (Playground) 2.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>5</integer>
|
<integer>3</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>Rx (Playground).xcscheme</key>
|
<key>Rx (Playground).xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>1</integer>
|
<integer>2</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SwiftDate (Playground) 1.xcscheme</key>
|
<key>SwiftDate (Playground) 1.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>10</integer>
|
<integer>11</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SwiftDate (Playground) 2.xcscheme</key>
|
<key>SwiftDate (Playground) 2.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>12</integer>
|
<integer>13</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SwiftDate (Playground) 3.xcscheme</key>
|
<key>SwiftDate (Playground) 3.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
@ -175,7 +175,7 @@
|
|||||||
<key>isShown</key>
|
<key>isShown</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>11</integer>
|
<integer>10</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SuppressBuildableAutocreation</key>
|
<key>SuppressBuildableAutocreation</key>
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||||
|
|
||||||
let config = Realm.Configuration(
|
let config = Realm.Configuration(
|
||||||
schemaVersion: 21,
|
schemaVersion: 22,
|
||||||
migrationBlock: { migration, oldSchemaVersion in
|
migrationBlock: { migration, oldSchemaVersion in
|
||||||
if oldSchemaVersion <= 3 {
|
if oldSchemaVersion <= 3 {
|
||||||
var numbers: [String] = []
|
var numbers: [String] = []
|
||||||
@ -80,6 +80,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if oldSchemaVersion <= 21 {
|
||||||
|
migration.enumerateObjects(ofType: "Vehicle") { old, new in
|
||||||
|
if let oldEngineVolume = (old?["engine"] as? MigrationObject)?["volume"] as? Int {
|
||||||
|
(new?["engine"] as? MigrationObject)?["volume"] = RealmOptional(oldEngineVolume)
|
||||||
|
} else {
|
||||||
|
(new?["engine"] as? MigrationObject)?["volume"] = RealmOptional(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
Realm.Configuration.defaultConfiguration = config
|
Realm.Configuration.defaultConfiguration = config
|
||||||
|
|||||||
@ -241,7 +241,7 @@ class CheckController: UIViewController, UITableViewDelegate, UITextFieldDelegat
|
|||||||
return Single.just(event)
|
return Single.just(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let event = LocationManager.lastEvent, (Date().timeIntervalSince1970 - event.date) < 30 {
|
if let event = LocationManager.lastEvent, (Date().timeIntervalSince1970 - event.date) < 10 {
|
||||||
return Single<VehicleEvent>.just(event)
|
return Single<VehicleEvent>.just(event)
|
||||||
} else {
|
} else {
|
||||||
return LocationManager.requestCurrentLocation()
|
return LocationManager.requestCurrentLocation()
|
||||||
|
|||||||
@ -233,7 +233,7 @@ class ReportController: UIViewController, UICollectionViewDataSource, UICollecti
|
|||||||
cell?.configure(param: engineSection.description, value: engine.fuelType ?? "<unknown>")
|
cell?.configure(param: engineSection.description, value: engine.fuelType ?? "<unknown>")
|
||||||
break
|
break
|
||||||
case .volume:
|
case .volume:
|
||||||
cell?.configure(param: engineSection.description, value: String(engine.volume))
|
cell?.configure(param: engineSection.description, value: String(engine.volume.value ?? 0))
|
||||||
break
|
break
|
||||||
case .powerHp:
|
case .powerHp:
|
||||||
cell?.configure(param: engineSection.description, value: String(engine.powerHp))
|
cell?.configure(param: engineSection.description, value: String(engine.powerHp))
|
||||||
|
|||||||
@ -110,7 +110,7 @@ extension Vehicle {
|
|||||||
y += cellHeight
|
y += cellHeight
|
||||||
self.drawCell(y: y, width: w, height: cellHeight, title: "Fuel type", value: self.engine?.fuelType ?? "<unknown>", context: ctx)
|
self.drawCell(y: y, width: w, height: cellHeight, title: "Fuel type", value: self.engine?.fuelType ?? "<unknown>", context: ctx)
|
||||||
y += cellHeight
|
y += cellHeight
|
||||||
self.drawCell(y: y, width: w, height: cellHeight, title: "Volume (cm³)", value: String(self.engine?.volume ?? 0), context: ctx)
|
self.drawCell(y: y, width: w, height: cellHeight, title: "Volume (cm³)", value: String(self.engine?.volume.value ?? 0), context: ctx)
|
||||||
y += cellHeight
|
y += cellHeight
|
||||||
self.drawCell(y: y, width: w, height: cellHeight, title: "Power (HP)", value: String(self.engine?.powerHp ?? 0), context: ctx)
|
self.drawCell(y: y, width: w, height: cellHeight, title: "Power (HP)", value: String(self.engine?.powerHp ?? 0), context: ctx)
|
||||||
y += cellHeight
|
y += cellHeight
|
||||||
|
|||||||
@ -18,7 +18,7 @@ class VehicleModel: Object, Decodable {
|
|||||||
|
|
||||||
class VehicleEngine: Object, Decodable {
|
class VehicleEngine: Object, Decodable {
|
||||||
@objc dynamic var number: String?
|
@objc dynamic var number: String?
|
||||||
@objc dynamic var volume: Int = 0
|
var volume: RealmOptional<Int> = RealmOptional(0)
|
||||||
@objc dynamic var powerHp: Float = 0
|
@objc dynamic var powerHp: Float = 0
|
||||||
@objc dynamic var powerKw: Float = 0
|
@objc dynamic var powerKw: Float = 0
|
||||||
@objc dynamic var fuelType: String?
|
@objc dynamic var fuelType: String?
|
||||||
|
|||||||
@ -3,9 +3,9 @@ import Foundation
|
|||||||
enum Constants {
|
enum Constants {
|
||||||
static var baseUrl: String {
|
static var baseUrl: String {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
//return "http://127.0.0.1:3000/"
|
return "http://127.0.0.1:3000/"
|
||||||
//return "http://192.168.1.67:3000/"
|
//return "http://192.168.1.67:3000/"
|
||||||
return "https://vps.aliencat.pro:8443/"
|
//return "https://vps.aliencat.pro:8443/"
|
||||||
#else
|
#else
|
||||||
return "https://vps.aliencat.pro:8443/"
|
return "https://vps.aliencat.pro:8443/"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -23,6 +23,7 @@ class RealmSectionedDataSource<Item,Cell>: NSObject, UITableViewDataSource where
|
|||||||
self.sections = self.data.groupedByDate()
|
self.sections = self.data.groupedByDate()
|
||||||
self.tv.reloadData()
|
self.tv.reloadData()
|
||||||
case .update(_, let deletions, let insertions, let modifications):
|
case .update(_, let deletions, let insertions, let modifications):
|
||||||
|
print("Deletions: \(deletions.count), Insertions: \(insertions.count), Modifications: \(modifications.count)")
|
||||||
let newSections = self.data.groupedByDate()
|
let newSections = self.data.groupedByDate()
|
||||||
let changeset = StagedChangeset(source: self.sections, target: newSections, section: 0)
|
let changeset = StagedChangeset(source: self.sections, target: newSections, section: 0)
|
||||||
|
|
||||||
@ -32,7 +33,10 @@ class RealmSectionedDataSource<Item,Cell>: NSObject, UITableViewDataSource where
|
|||||||
self.tv.insertRows(at: insertions.map(self.indexPath), with: .automatic)
|
self.tv.insertRows(at: insertions.map(self.indexPath), with: .automatic)
|
||||||
self.tv.reloadRows(at: modifications.map(self.indexPath), with: .automatic)
|
self.tv.reloadRows(at: modifications.map(self.indexPath), with: .automatic)
|
||||||
|
|
||||||
|
print("Changesets count: \(changeset.count)")
|
||||||
if let firstChangeset = changeset.first {
|
if let firstChangeset = changeset.first {
|
||||||
|
print("Deletions: \(firstChangeset.elementDeleted.map { $0.element })")
|
||||||
|
print("Insertions: \(firstChangeset.elementInserted.map { $0.element })")
|
||||||
self.tv.deleteSections(IndexSet(firstChangeset.elementDeleted.map { $0.element }), with: .automatic)
|
self.tv.deleteSections(IndexSet(firstChangeset.elementDeleted.map { $0.element }), with: .automatic)
|
||||||
self.tv.insertSections(IndexSet(firstChangeset.elementInserted.map { $0.element }), with: .automatic)
|
self.tv.insertSections(IndexSet(firstChangeset.elementInserted.map { $0.element }), with: .automatic)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user