OSAGO check advancements
This commit is contained in:
parent
9d2d0375ce
commit
4fd73e603e
@ -748,7 +748,7 @@
|
||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 13.1;
|
||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@ -757,7 +757,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -771,7 +771,7 @@
|
||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 13.1;
|
||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@ -780,7 +780,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@ -14,35 +14,35 @@
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
<integer>8</integer>
|
||||
</dict>
|
||||
<key>DifferenceKit (Playground) 2.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>3</integer>
|
||||
<integer>9</integer>
|
||||
</dict>
|
||||
<key>DifferenceKit (Playground).xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>7</integer>
|
||||
</dict>
|
||||
<key>Eureka (Playground) 1.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>8</integer>
|
||||
<integer>5</integer>
|
||||
</dict>
|
||||
<key>Eureka (Playground) 2.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>9</integer>
|
||||
<integer>6</integer>
|
||||
</dict>
|
||||
<key>Eureka (Playground) 3.xcscheme</key>
|
||||
<dict>
|
||||
@ -70,7 +70,7 @@
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>7</integer>
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
<key>GettingStarted (Playground) 1.xcscheme</key>
|
||||
<dict>
|
||||
@ -119,35 +119,35 @@
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>5</integer>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
<key>Rx (Playground) 2.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>6</integer>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
<key>Rx (Playground).xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>4</integer>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>SwiftDate (Playground) 1.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>12</integer>
|
||||
<integer>11</integer>
|
||||
</dict>
|
||||
<key>SwiftDate (Playground) 2.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>10</integer>
|
||||
<integer>12</integer>
|
||||
</dict>
|
||||
<key>SwiftDate (Playground) 3.xcscheme</key>
|
||||
<dict>
|
||||
@ -175,7 +175,7 @@
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>11</integer>
|
||||
<integer>10</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
|
||||
@ -25,7 +25,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
|
||||
let config = Realm.Configuration(
|
||||
schemaVersion: 25,
|
||||
schemaVersion: 26,
|
||||
migrationBlock: { migration, oldSchemaVersion in
|
||||
if oldSchemaVersion <= 3 {
|
||||
var numbers: [String] = []
|
||||
|
||||
@ -101,7 +101,9 @@ class CheckController: UIViewController, UITableViewDelegate, UITextFieldDelegat
|
||||
}
|
||||
|
||||
@objc private func calendarDayDidChange(_ notification : NSNotification) {
|
||||
self.historyDataSource.reload()
|
||||
DispatchQueue.main.async {
|
||||
self.historyDataSource.reload()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Checking new number
|
||||
@ -281,6 +283,7 @@ class CheckController: UIViewController, UITableViewDelegate, UITextFieldDelegat
|
||||
|
||||
self.getEvent(for: action)
|
||||
.flatMap { event in event.findAddress().map{ [event] }.catchErrorJustReturn([event]) }
|
||||
.observeOn(MainScheduler.instance)
|
||||
.catchErrorJustReturn([])
|
||||
.map { events in
|
||||
try realm.write { vehicle.events.append(objectsIn: events) }
|
||||
|
||||
@ -14,6 +14,8 @@ class OsagoController: FormViewController {
|
||||
super.viewDidLoad()
|
||||
self.title = "OSAGO contracts"
|
||||
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(checkNewDate(_:)))
|
||||
|
||||
self.tableView.rowHeight = UITableView.automaticDimension
|
||||
}
|
||||
|
||||
@objc func checkNewDate(_ sender: UIBarButtonItem) {
|
||||
@ -36,7 +38,47 @@ class OsagoController: FormViewController {
|
||||
}
|
||||
|
||||
func updateInterface() {
|
||||
self.form.allSections.forEach { $0.reload() }
|
||||
guard let vehicle = self.vehicle else { return }
|
||||
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateStyle = .medium
|
||||
formatter.timeStyle = .none
|
||||
|
||||
self.form.removeAll()
|
||||
for osago in vehicle.osagoContracts.sorted(by: { $0.date < $1.date }) {
|
||||
self.form +++ Section(formatter.string(from: Date(timeIntervalSince1970: osago.date)))
|
||||
<<< self.row("Contract #", value: osago.number)
|
||||
<<< self.row("Name", value: osago.name)
|
||||
<<< self.row("Status", value: osago.status)
|
||||
<<< self.row("Insurant", value: osago.insurant)
|
||||
<<< self.row("Owner", value: osago.owner)
|
||||
<<< self.row("Region", value: osago.usageRegion)
|
||||
<<< self.row("Restrictions", value: osago.restrictions, height: 100)
|
||||
<<< self.row("Plate number", value: osago.plateNumber)
|
||||
<<< self.row("VIN", value: osago.vin)
|
||||
}
|
||||
}
|
||||
|
||||
func row(_ title: String, value: String?, height: CGFloat = 44) -> LabelRow {
|
||||
LabelRow() { row in
|
||||
if let cell = row.cell, let label = cell.detailTextLabel, let titleLabel = cell.textLabel {
|
||||
titleLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||
titleLabel.topAnchor.constraint(equalTo: cell.contentView.topAnchor, constant: 8).isActive = true
|
||||
titleLabel.leadingAnchor.constraint(equalTo: cell.contentView.layoutMarginsGuide.leadingAnchor).isActive = true
|
||||
|
||||
label.translatesAutoresizingMaskIntoConstraints = false
|
||||
label.topAnchor.constraint(equalTo: cell.contentView.topAnchor, constant: 8).isActive = true
|
||||
label.bottomAnchor.constraint(equalTo: cell.contentView.bottomAnchor, constant: -8).isActive = true
|
||||
label.leadingAnchor.constraint(equalTo: titleLabel.trailingAnchor, constant: 8).isActive = true
|
||||
label.trailingAnchor.constraint(equalTo: cell.contentView.layoutMarginsGuide.trailingAnchor).isActive = true
|
||||
label.numberOfLines = 0
|
||||
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
|
||||
}
|
||||
|
||||
//row.cell.height = { height }
|
||||
row.title = title
|
||||
row.value = value
|
||||
}
|
||||
}
|
||||
|
||||
func update(vehicle: Vehicle) {
|
||||
|
||||
@ -2,7 +2,10 @@ import Foundation
|
||||
import RealmSwift
|
||||
|
||||
class Osago: Object, Decodable {
|
||||
@objc dynamic var date: TimeInterval
|
||||
@objc dynamic var number: String
|
||||
@objc dynamic var vin: String?
|
||||
@objc dynamic var plateNumber: String?
|
||||
@objc dynamic var name: String
|
||||
@objc dynamic var status: String
|
||||
@objc dynamic var restrictions: String
|
||||
|
||||
@ -148,6 +148,7 @@ class Vehicle: Object, Decodable, Identifiable, Differentiable {
|
||||
case photos
|
||||
case ownershipPeriods
|
||||
case events
|
||||
case osagoContracts
|
||||
}
|
||||
|
||||
required init(from decoder: Decoder) throws {
|
||||
@ -187,6 +188,10 @@ class Vehicle: Object, Decodable, Identifiable, Differentiable {
|
||||
self.updatedDate = self.addedDate
|
||||
}
|
||||
|
||||
if let osago = try container.decodeIfPresent([Osago].self, forKey: .osagoContracts) {
|
||||
self.osagoContracts.append(objectsIn: osago)
|
||||
}
|
||||
|
||||
self.identifier = self.number
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user