Fix for puller

This commit is contained in:
Selim Mustafaev 2023-01-10 23:23:40 +03:00
parent 5be64456c3
commit f4b5b7d328
5 changed files with 44 additions and 7 deletions

View File

@ -1136,7 +1136,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 102;
CURRENT_PROJECT_VERSION = 103;
DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
@ -1161,7 +1161,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 102;
CURRENT_PROJECT_VERSION = 103;
DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;

View File

@ -34,7 +34,8 @@ class MainTabController: UITabBarController, UITabBarControllerDelegate {
attributes.screenBackground = .color(color: EKColor(UIColor(white: 0, alpha: 0.7)))
attributes.roundCorners = .top(radius: 24)
attributes.screenInteraction = .dismiss
attributes.entryInteraction = .forward
attributes.scroll = .disabled
attributes.entryInteraction = .absorbTouches
attributes.entranceAnimation = .init(translate: .init(duration: 0.2))
attributes.exitAnimation = .init(translate: .init(duration: 0.2))

View File

@ -233,6 +233,14 @@ class NotesController: UIViewController, UITableViewDataSource, UITableViewDeleg
// MARK: - Utils
func showAddNoteAlert(text: String?, completion: @escaping (String) -> Void) {
#if targetEnvironment(macCatalyst)
showAddNoteAlertCatalyst(text: text, completion: completion)
#else
showAddNoteAlertIos(text: text, completion: completion)
#endif
}
func showAddNoteAlertIos(text: String?, completion: @escaping (String) -> Void) {
let alertController = UIAlertController(title: NSLocalizedString("New note", comment: ""), message: nil, preferredStyle: .alert)
let cancelAction = UIAlertAction.init(title: NSLocalizedString("Cancel", comment: ""), style: .default)
@ -265,4 +273,23 @@ class NotesController: UIViewController, UITableViewDataSource, UITableViewDeleg
@objc func tapDone(sender: Any) {
self.textView.endEditing(true)
}
func showAddNoteAlertCatalyst(text: String?, completion: @escaping (String) -> Void) {
let alertController = UIAlertController(title: NSLocalizedString("New note", comment: ""), message: nil, preferredStyle: .alert)
let cancelAction = UIAlertAction.init(title: NSLocalizedString("Cancel", comment: ""), style: .default)
alertController.addAction(cancelAction)
let saveAction = UIAlertAction(title: NSLocalizedString("Done", comment: ""), style: .default) { (action) in
let enteredText = alertController.textFields?.first?.text ?? ""
completion(enteredText)
}
alertController.addAction(saveAction)
alertController.addTextField { textField in
textField.text = text
}
self.present(alertController, animated: true)
}
}

View File

@ -163,12 +163,17 @@ class RealmSectionedDataSource<Item,Cell>: NSObject, UITableViewDataSource
throw CocoaError.error("Type \(Item.self) is not exportable")
}
var items = self.data.toArray().map { $0.clone() }
if let predicate = self.filterPredicate {
items = items.filter(predicate)
}
var result = ""
let newLine: Character = "\r\n" //"\u{000B}"
result.append(type.csvHeader)
result.append(newLine)
for item in self.data {
for item in items {
if let exportableItem = item as? Exportable {
result.append(exportableItem.csvLine)
result.append(newLine)

View File

@ -364,7 +364,7 @@ public class Vehicle: Object, Decodable, Identifiable, Differentiable, Cloneable
// MARK: - Exportable
public static var csvHeader: String {
return "Plate Number, Model, Color, Year, Owners, VIN, STS, PTS, Added Date, Updated date, Locations, Notes"
return "Plate Number, Model, Color, Year, Power (HP), Events, Owners, VIN, STS, PTS, Added Date, Updated date, Locations, Notes"
}
public var csvLine: String {
@ -383,11 +383,15 @@ public class Vehicle: Object, Decodable, Identifiable, Differentiable, Cloneable
partialResult + note.text + "\r\n"
}
return String(format: "%@, \"%@\", %@, %d, %d, %@, %@, %@, \"%@\", \"%@\", \"%@\", \"%@\"",
self.number,
let number = self.currentNumber == nil ? self.number : "\(self.number) (\(self.currentNumber ?? ""))"
return String(format: "%@, \"%@\", %@, %d, %f, %d, %d, %@, %@, %@, \"%@\", \"%@\", \"%@\", \"%@\"",
number,
model,
self.color ?? "",
self.year,
self.engine?.powerHp ?? 0.0,
self.events.count,
self.ownershipPeriods.count,
self.vin1 ?? "",
self.sts ?? "",