From a42fd3eddbc19a468b87b0949cb9969224c7a3fa Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Sun, 27 Jun 2021 15:51:21 +0300 Subject: [PATCH] Moving non-interface related code into framework (for later using it in unit test) --- .idea/autocat.iml | 2 + .idea/modules.xml | 8 + .idea/runConfigurations/AutoCat.xml | 2 +- AutoCat.xcodeproj/project.pbxproj | 506 ++++++++++++++++-- .../xcshareddata/swiftpm/Package.resolved | 2 +- .../xcshareddata/xcschemes/AutoCat.xcscheme | 20 + .../xcschemes/xcschememanagement.plist | 113 ++-- AutoCat/AppDelegate.swift | 1 + AutoCat/Cells/AudioRecordCell.swift | 1 + AutoCat/Cells/EventCell.swift | 1 + AutoCat/Cells/VehicleCell.swift | 1 + AutoCat/Cells/VehiclePhotoCell.swift | 1 + AutoCat/Controllers/AdsController.swift | 1 + AutoCat/Controllers/AuthController.swift | 1 + AutoCat/Controllers/CheckController.swift | 9 +- AutoCat/Controllers/FiltersController.swift | 39 +- .../Controllers/GoogleSignInController.swift | 1 + .../Location/EventsController.swift | 1 + .../Location/GlobalEventsController.swift | 1 + .../Location/LocationEditController.swift | 1 + .../Location/LocationPickerController.swift | 3 +- .../Location/ShowEventController.swift | 1 + .../Osago/OsagoAddController.swift | 1 + .../Controllers/Osago/OsagoController.swift | 1 + AutoCat/Controllers/OwnersController.swift | 1 + AutoCat/Controllers/RecordsController.swift | 3 +- AutoCat/Controllers/RegionsController.swift | 1 + AutoCat/Controllers/ReportController.swift | 1 + AutoCat/Controllers/SearchController.swift | 1 + AutoCat/Controllers/SettingsController.swift | 1 + AutoCat/Extensions/Dated.swift | 1 + AutoCat/Extensions/Error.swift | 27 + AutoCat/Extensions/VehicleReportImage.swift | 1 + AutoCat/Models/DebugInfo.swift | 27 - AutoCat/Models/Filter.swift | 75 --- AutoCat/Models/Osago.swift | 32 -- AutoCat/Models/PagedResponse.swift | 13 - AutoCat/Models/User.swift | 13 - AutoCat/Models/VehicleAd.swift | 33 -- AutoCat/Models/VehicleRegion.swift | 10 - AutoCat/SceneDelegate.swift | 1 + AutoCat/Utils/Constants.swift | 34 -- AutoCat/Utils/RxRealmDataSource.swift | 1 + AutoCat/Utils/RxSectionedDataSource.swift | 1 + AutoCat/Views/PNKeyboard.swift | 1 + AutoCat/Views/PlateView.swift | 1 + AutoCat/Views/eureka/SourceStatusRow.swift | 1 + AutoCatCore/AutoCatCore.h | 19 + .../Extensions/CocoaError.swift | 32 +- .../Extensions/Exportable.swift | 2 +- AutoCatCore/Info.plist | 22 + .../Models/AudioRecord.swift | 30 +- .../Models/Cloneable.swift | 4 +- .../Models/DateSection.swift | 22 +- AutoCatCore/Models/DebugInfo.swift | 27 + AutoCatCore/Models/Filter.swift | 116 ++++ AutoCatCore/Models/Osago.swift | 32 ++ AutoCatCore/Models/PagedResponse.swift | 13 + .../Models/PlateNumber.swift | 10 +- .../Models/Response.swift | 0 .../Models/Settings.swift | 14 +- AutoCatCore/Models/User.swift | 13 + {AutoCat => AutoCatCore}/Models/Vehicle.swift | 154 +++--- AutoCatCore/Models/VehicleAd.swift | 33 ++ .../Models/VehicleEvent.swift | 34 +- AutoCatCore/Models/VehicleRegion.swift | 10 + .../ThirdParty/AnyEncodable.swift | 0 .../ThirdParty/Base64FS.swift | 0 {AutoCat => AutoCatCore}/Utils/Api.swift | 2 +- AutoCatCore/Utils/Constants.swift | 34 ++ {AutoCat => AutoCatCore}/Utils/JWT.swift | 22 +- {AutoCat => AutoCatCore}/Utils/Location.swift | 13 +- AutoCatTests/AutoCatTests.swift | 19 + AutoCatTests/Info.plist | 22 + AutoCatTests/Mocks/FakeLocationManager.swift | 16 + 75 files changed, 1138 insertions(+), 575 deletions(-) create mode 100644 .idea/autocat.iml create mode 100644 .idea/modules.xml create mode 100644 AutoCat/Extensions/Error.swift delete mode 100644 AutoCat/Models/DebugInfo.swift delete mode 100644 AutoCat/Models/Filter.swift delete mode 100644 AutoCat/Models/Osago.swift delete mode 100644 AutoCat/Models/PagedResponse.swift delete mode 100644 AutoCat/Models/User.swift delete mode 100644 AutoCat/Models/VehicleAd.swift delete mode 100644 AutoCat/Models/VehicleRegion.swift delete mode 100644 AutoCat/Utils/Constants.swift create mode 100644 AutoCatCore/AutoCatCore.h rename {AutoCat => AutoCatCore}/Extensions/CocoaError.swift (70%) rename {AutoCat => AutoCatCore}/Extensions/Exportable.swift (76%) create mode 100644 AutoCatCore/Info.plist rename {AutoCat => AutoCatCore}/Models/AudioRecord.swift (56%) rename {AutoCat => AutoCatCore}/Models/Cloneable.swift (63%) rename {AutoCat => AutoCatCore}/Models/DateSection.swift (72%) create mode 100644 AutoCatCore/Models/DebugInfo.swift create mode 100644 AutoCatCore/Models/Filter.swift create mode 100644 AutoCatCore/Models/Osago.swift create mode 100644 AutoCatCore/Models/PagedResponse.swift rename {AutoCat => AutoCatCore}/Models/PlateNumber.swift (74%) rename {AutoCat => AutoCatCore}/Models/Response.swift (100%) rename {AutoCat => AutoCatCore}/Models/Settings.swift (87%) create mode 100644 AutoCatCore/Models/User.swift rename {AutoCat => AutoCatCore}/Models/Vehicle.swift (69%) create mode 100644 AutoCatCore/Models/VehicleAd.swift rename {AutoCat => AutoCatCore}/Models/VehicleEvent.swift (66%) create mode 100644 AutoCatCore/Models/VehicleRegion.swift rename {AutoCat => AutoCatCore}/ThirdParty/AnyEncodable.swift (100%) rename {AutoCat => AutoCatCore}/ThirdParty/Base64FS.swift (100%) rename {AutoCat => AutoCatCore}/Utils/Api.swift (99%) create mode 100644 AutoCatCore/Utils/Constants.swift rename {AutoCat => AutoCatCore}/Utils/JWT.swift (90%) rename {AutoCat => AutoCatCore}/Utils/Location.swift (94%) create mode 100644 AutoCatTests/AutoCatTests.swift create mode 100644 AutoCatTests/Info.plist create mode 100644 AutoCatTests/Mocks/FakeLocationManager.swift diff --git a/.idea/autocat.iml b/.idea/autocat.iml new file mode 100644 index 0000000..8b84e1f --- /dev/null +++ b/.idea/autocat.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b49df74 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/AutoCat.xml b/.idea/runConfigurations/AutoCat.xml index 9789011..89ded25 100644 --- a/.idea/runConfigurations/AutoCat.xml +++ b/.idea/runConfigurations/AutoCat.xml @@ -1,5 +1,5 @@ - + diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index 6ef9303..060a177 100644 --- a/AutoCat.xcodeproj/project.pbxproj +++ b/AutoCat.xcodeproj/project.pbxproj @@ -7,15 +7,11 @@ objects = { /* Begin PBXBuildFile section */ - 6841A4F018B0E07966C1CEFC /* PagedResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6841A913FABBB0AB20DEF4FC /* PagedResponse.swift */; }; 6841A85D4B60DB71D1E68DA0 /* ImageGrid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6841AC687EA6293A0757678C /* ImageGrid.swift */; }; - 7A000AA224C2EEDE001F5B00 /* Location.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A000AA124C2EEDE001F5B00 /* Location.swift */; }; - 7A0420AA25619AEC00034941 /* Osago.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0420A925619AEC00034941 /* Osago.swift */; }; 7A0420AD2561A0B100034941 /* OsagoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0420AC2561A0B100034941 /* OsagoController.swift */; }; 7A0420B12561A0E100034941 /* OsagoAddController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0420B02561A0E100034941 /* OsagoAddController.swift */; }; 7A0420B62568650C00034941 /* DkbmController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0420B52568650C00034941 /* DkbmController.swift */; }; 7A0420BA25693D2C00034941 /* dkbm.js in Resources */ = {isa = PBXBuildFile; fileRef = 7A0420B925693D2C00034941 /* dkbm.js */; }; - 7A05161A2414FF0900FC55AC /* DateSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0516192414FF0900FC55AC /* DateSection.swift */; }; 7A0B96A0257D6D4B000B39AD /* MultilineLabelRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0B969F257D6D4B000B39AD /* MultilineLabelRow.swift */; }; 7A1090E824A394F100B4F0B2 /* AudioRecordCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A1090E724A394F100B4F0B2 /* AudioRecordCell.swift */; }; 7A1090EA24A3A26300B4F0B2 /* AudioPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A1090E924A3A26300B4F0B2 /* AudioPlayer.swift */; }; @@ -28,29 +24,19 @@ 7A11471623FDEB2A00B424AF /* MainSplitController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11471523FDEB2A00B424AF /* MainSplitController.swift */; }; 7A11471823FDEBFA00B424AF /* ReportController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11471723FDEBFA00B424AF /* ReportController.swift */; }; 7A11471A23FE839000B424AF /* AuthController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11471923FE839000B424AF /* AuthController.swift */; }; - 7A11474423FF06CA00B424AF /* Api.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11474323FF06CA00B424AF /* Api.swift */; }; - 7A11474723FF2AA500B424AF /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11474623FF2AA500B424AF /* User.swift */; }; - 7A11474923FF2B2D00B424AF /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11474823FF2B2D00B424AF /* Response.swift */; }; - 7A11474B23FF368B00B424AF /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11474A23FF368B00B424AF /* Settings.swift */; }; - 7A15051224DB3E3000F39631 /* AnyEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A15051124DB3E3000F39631 /* AnyEncodable.swift */; }; 7A1DC38E2517ED98002E9C99 /* BlockBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A1DC38D2517ED98002E9C99 /* BlockBarButtonItem.swift */; }; 7A21112A24FC3D7E003BBF6F /* AudioEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A21112924FC3D7E003BBF6F /* AudioEngine.swift */; }; 7A27ADC7249D43210035F39E /* RegionsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A27ADC6249D43210035F39E /* RegionsController.swift */; }; 7A27ADF3249F8B650035F39E /* RecordsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A27ADF2249F8B650035F39E /* RecordsController.swift */; }; 7A27ADF5249FD2F90035F39E /* FileManagerExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A27ADF4249FD2F90035F39E /* FileManagerExt.swift */; }; 7A27ADF7249FEF690035F39E /* Recorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A27ADF6249FEF690035F39E /* Recorder.swift */; }; - 7A27ADF924A09CAD0035F39E /* CocoaError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A27ADF824A09CAD0035F39E /* CocoaError.swift */; }; - 7A2DE69825868AC800A113FC /* VehicleAd.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2DE69725868AC800A113FC /* VehicleAd.swift */; }; 7A2DE69B25869ABD00A113FC /* AdsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2DE69A25869ABD00A113FC /* AdsController.swift */; }; 7A2DE69E2589606A00A113FC /* ImageGridRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2DE69D2589606A00A113FC /* ImageGridRow.swift */; }; 7A33381124990DAE00D878F1 /* FiltersController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A33381024990DAE00D878F1 /* FiltersController.swift */; }; - 7A333814249A532400D878F1 /* Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A333813249A532400D878F1 /* Filter.swift */; }; 7A3F07AB24360DC800E59687 /* Dated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A3F07AA24360DC800E59687 /* Dated.swift */; }; 7A3F07AD2436350B00E59687 /* SearchController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A3F07AC2436350B00E59687 /* SearchController.swift */; }; - 7A43F9F8246C8A6200BA5B49 /* JWT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A43F9F7246C8A6200BA5B49 /* JWT.swift */; }; 7A530B7A24001D3300CBFE6E /* CheckController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A530B7924001D3300CBFE6E /* CheckController.swift */; }; 7A530B7E24017FEE00CBFE6E /* VehicleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A530B7D24017FEE00CBFE6E /* VehicleCell.swift */; }; - 7A530B802401803A00CBFE6E /* Vehicle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A530B7F2401803A00CBFE6E /* Vehicle.swift */; }; 7A61FF8B2575A2CD00D905D5 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7A61FF892575A2CD00D905D5 /* Localizable.strings */; }; 7A61FF912575A5B300D905D5 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7A61FF8F2575A5B300D905D5 /* InfoPlist.strings */; }; 7A61FFA0257D3CFC00D905D5 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 7A61FFA2257D3CFC00D905D5 /* Localizable.stringsdict */; }; @@ -58,15 +44,19 @@ 7A64AE742469DFB600ABE48E /* MediaContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A64AE702469DFB600ABE48E /* MediaContentView.swift */; }; 7A64AE752469DFB600ABE48E /* MediaBrowserViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A64AE712469DFB600ABE48E /* MediaBrowserViewController.swift */; }; 7A64AE762469DFB600ABE48E /* ContentTransformers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A64AE722469DFB600ABE48E /* ContentTransformers.swift */; }; - 7A659B5924A2B1BA0043A0F2 /* AudioRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A659B5824A2B1BA0043A0F2 /* AudioRecord.swift */; }; 7A659B5B24A3768A0043A0F2 /* Substrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A659B5A24A3768A0043A0F2 /* Substrings.swift */; }; 7A6DD903242BF4A5009DE740 /* PlateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A6DD902242BF4A5009DE740 /* PlateView.swift */; }; 7A6DD90824329144009DE740 /* CenterTextLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A6DD90724329144009DE740 /* CenterTextLayer.swift */; }; 7A6DD90A24329541009DE740 /* RoadNumbers2.0.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7A6DD90924329541009DE740 /* RoadNumbers2.0.otf */; }; 7A6DD90C24335A6D009DE740 /* FlagLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A6DD90B24335A6D009DE740 /* FlagLayer.swift */; }; - 7A6DD90E24337930009DE740 /* PlateNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A6DD90D24337930009DE740 /* PlateNumber.swift */; }; 7A6E03282485951700DB22ED /* OwnersController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A6E03272485951700DB22ED /* OwnersController.swift */; }; 7A7547E024032CB6004E8406 /* VehiclePhotoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A7547DF24032CB6004E8406 /* VehiclePhotoCell.swift */; }; + 7A761C042677F18E0005F28F /* Api.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11474323FF06CA00B424AF /* Api.swift */; }; + 7A761C052677F1BC0005F28F /* CocoaError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A27ADF824A09CAD0035F39E /* CocoaError.swift */; }; + 7A761C07267E8E7F0005F28F /* AnyEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A15051124DB3E3000F39631 /* AnyEncodable.swift */; }; + 7A761C08267E8EA20005F28F /* JWT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A43F9F7246C8A6200BA5B49 /* JWT.swift */; }; + 7A761C09267E8EE40005F28F /* Base64FS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A96AE32246C095700297C33 /* Base64FS.swift */; }; + 7A761C0B267E8FF90005F28F /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A761C0A267E8FF90005F28F /* Error.swift */; }; 7A813DBE2506A57100CC93B9 /* AuthenticationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A813DBD2506A57100CC93B9 /* AuthenticationServices.framework */; }; 7A813DC32508EE4F00CC93B9 /* EventCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A813DC22508EE4F00CC93B9 /* EventCell.swift */; }; 7A813DC5250AAF3C00CC93B9 /* LocationEditController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A813DC4250AAF3C00CC93B9 /* LocationEditController.swift */; }; @@ -75,12 +65,9 @@ 7A8A2209248D10EC0073DFD9 /* ResizeImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A8A2208248D10EC0073DFD9 /* ResizeImage.swift */; }; 7A8A220B248D67B60073DFD9 /* VehicleReportImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A8A220A248D67B60073DFD9 /* VehicleReportImage.swift */; }; 7A8AB76525A0DB8F00ECF2C1 /* BundleVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A8AB76425A0DB8F00ECF2C1 /* BundleVersion.swift */; }; - 7A8AB76825A0DC8200ECF2C1 /* DebugInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A8AB76725A0DC8200ECF2C1 /* DebugInfo.swift */; }; 7A8AB76B25A1D95500ECF2C1 /* SourceStatusRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A8AB76A25A1D95500ECF2C1 /* SourceStatusRow.swift */; }; 7A96AE2D246B2B7400297C33 /* GoogleSignInController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A96AE2C246B2B7400297C33 /* GoogleSignInController.swift */; }; 7A96AE2F246B2BCD00297C33 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A96AE2E246B2BCD00297C33 /* WebKit.framework */; }; - 7A96AE31246B2FE400297C33 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A96AE30246B2FE400297C33 /* Constants.swift */; }; - 7A96AE33246C095700297C33 /* Base64FS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A96AE32246C095700297C33 /* Base64FS.swift */; }; 7A9FEEC82529AB23001CA50E /* RxRealmDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A9FEEC72529AB23001CA50E /* RxRealmDataSource.swift */; }; 7AA7BC2C25A5DFB80053A5D5 /* RxSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 7A11471C23FEA18700B424AF /* RxSwift */; }; 7AA7BC2D25A5DFB80053A5D5 /* RxRelay in Frameworks */ = {isa = PBXBuildFile; productRef = 7A11471E23FEA18700B424AF /* RxRelay */; }; @@ -95,9 +82,9 @@ 7AA7BC3625A5DFB80053A5D5 /* PKHUD in Frameworks */ = {isa = PBXBuildFile; productRef = 7AABDE1C2532F3EB0041AFC6 /* PKHUD */; }; 7AA7BC3725A5DFB80053A5D5 /* DifferenceKit in Frameworks */ = {isa = PBXBuildFile; productRef = 7AABDE22253327F10041AFC6 /* DifferenceKit */; }; 7AA7BC3825A5DFB80053A5D5 /* Eureka in Frameworks */ = {isa = PBXBuildFile; productRef = 7AEF47A3253DC4D2001D6238 /* Eureka */; }; + 7AABB1F0267E9CAA00D7AB32 /* DifferenceKit in Frameworks */ = {isa = PBXBuildFile; productRef = 7AABB1EF267E9CAA00D7AB32 /* DifferenceKit */; }; + 7AABB1F2267E9CC800D7AB32 /* SwiftDate in Frameworks */ = {isa = PBXBuildFile; productRef = 7AABB1F1267E9CC800D7AB32 /* SwiftDate */; }; 7AABDE26253350C30041AFC6 /* RxSectionedDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AABDE25253350C30041AFC6 /* RxSectionedDataSource.swift */; }; - 7AAE6AD324CDDF950023860B /* VehicleEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AAE6AD224CDDF950023860B /* VehicleEvent.swift */; }; - 7AB562BA249C9E9B00473D53 /* VehicleRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AB562B9249C9E9B00473D53 /* VehicleRegion.swift */; }; 7AB67E8C2435C38700258F61 /* CustomTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AB67E8B2435C38700258F61 /* CustomTextField.swift */; }; 7AB67E8E2435D1A000258F61 /* CustomButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AB67E8D2435D1A000258F61 /* CustomButton.swift */; }; 7ADF6C93250B954900F237B2 /* Navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ADF6C92250B954900F237B2 /* Navigation.swift */; }; @@ -111,12 +98,68 @@ 7AE26A3324EEF9EC00625033 /* UIViewControllerExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE26A3224EEF9EC00625033 /* UIViewControllerExt.swift */; }; 7AE26A3524F31B0700625033 /* EventsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE26A3424F31B0700625033 /* EventsController.swift */; }; 7AE492A1259232F000322D2E /* MultilineLinkRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE492A0259232F000322D2E /* MultilineLinkRow.swift */; }; - 7AE8424E26109F78002F6B31 /* Exportable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE8424D26109F78002F6B31 /* Exportable.swift */; }; 7AEFC3BE2529D3CC00BADFB2 /* ConfigurableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AEFC3BD2529D3CC00BADFB2 /* ConfigurableCell.swift */; }; 7AEFE728240455E200910EB7 /* SettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AEFE727240455E200910EB7 /* SettingsController.swift */; }; - 7AF12B1D258C9CFF0090F8B8 /* Cloneable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF12B1C258C9CFF0090F8B8 /* Cloneable.swift */; }; + 7AF6D1E02677A7E00086EA64 /* AutoCatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF6D1DF2677A7E00086EA64 /* AutoCatTests.swift */; }; + 7AF6D1E92677A8410086EA64 /* FakeLocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF6D1E82677A8410086EA64 /* FakeLocationManager.swift */; }; + 7AF6D2042677C03B0086EA64 /* AutoCatCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF6D1EF2677C03B0086EA64 /* AutoCatCore.framework */; }; + 7AF6D2052677C03B0086EA64 /* AutoCatCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF6D1EF2677C03B0086EA64 /* AutoCatCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 7AF6D20F2677C0EA0086EA64 /* RxCocoa in Frameworks */ = {isa = PBXBuildFile; productRef = 7AF6D20E2677C0EA0086EA64 /* RxCocoa */; }; + 7AF6D2112677C0EA0086EA64 /* RxSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 7AF6D2102677C0EA0086EA64 /* RxSwift */; }; + 7AF6D2122677C12E0086EA64 /* Location.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A000AA124C2EEDE001F5B00 /* Location.swift */; }; + 7AF6D2132677C15A0086EA64 /* AudioRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A659B5824A2B1BA0043A0F2 /* AudioRecord.swift */; }; + 7AF6D2142677C1680086EA64 /* VehicleEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AAE6AD224CDDF950023860B /* VehicleEvent.swift */; }; + 7AF6D2152677C1680086EA64 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11474A23FF368B00B424AF /* Settings.swift */; }; + 7AF6D2162677C1680086EA64 /* Cloneable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF12B1C258C9CFF0090F8B8 /* Cloneable.swift */; }; + 7AF6D2172677C1680086EA64 /* VehicleRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AB562B9249C9E9B00473D53 /* VehicleRegion.swift */; }; + 7AF6D2182677C1680086EA64 /* VehicleAd.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2DE69725868AC800A113FC /* VehicleAd.swift */; }; + 7AF6D2192677C1680086EA64 /* DateSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0516192414FF0900FC55AC /* DateSection.swift */; }; + 7AF6D21A2677C1680086EA64 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11474623FF2AA500B424AF /* User.swift */; }; + 7AF6D21B2677C1680086EA64 /* Vehicle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A530B7F2401803A00CBFE6E /* Vehicle.swift */; }; + 7AF6D21C2677C1680086EA64 /* DebugInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A8AB76725A0DC8200ECF2C1 /* DebugInfo.swift */; }; + 7AF6D21D2677C1680086EA64 /* Osago.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0420A925619AEC00034941 /* Osago.swift */; }; + 7AF6D21E2677C1680086EA64 /* PlateNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A6DD90D24337930009DE740 /* PlateNumber.swift */; }; + 7AF6D21F2677C1680086EA64 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11474823FF2B2D00B424AF /* Response.swift */; }; + 7AF6D2202677C1680086EA64 /* Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A333813249A532400D878F1 /* Filter.swift */; }; + 7AF6D2212677C1680086EA64 /* PagedResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6841A913FABBB0AB20DEF4FC /* PagedResponse.swift */; }; + 7AF6D2232677C2B40086EA64 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 7AF6D2222677C2B40086EA64 /* Realm */; }; + 7AF6D2252677C2B40086EA64 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 7AF6D2242677C2B40086EA64 /* RealmSwift */; }; + 7AF6D2272677C2B40086EA64 /* RxRealm in Frameworks */ = {isa = PBXBuildFile; productRef = 7AF6D2262677C2B40086EA64 /* RxRealm */; }; + 7AF6D2282677C2DC0086EA64 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A96AE30246B2FE400297C33 /* Constants.swift */; }; + 7AF6D22A2677C3AD0086EA64 /* Exportable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE8424D26109F78002F6B31 /* Exportable.swift */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 7AF6D1E22677A7E00086EA64 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7A1146F523FDE7E500B424AF /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7A1146FC23FDE7E500B424AF; + remoteInfo = AutoCat; + }; + 7AF6D2022677C03B0086EA64 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7A1146F523FDE7E500B424AF /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7AF6D1EE2677C03B0086EA64; + remoteInfo = AutoCatCore; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 7AF6D2092677C03B0086EA64 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 7AF6D2052677C03B0086EA64 /* AutoCatCore.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 6841A913FABBB0AB20DEF4FC /* PagedResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PagedResponse.swift; sourceTree = ""; }; 6841AC687EA6293A0757678C /* ImageGrid.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageGrid.swift; sourceTree = ""; }; @@ -188,6 +231,7 @@ 7A6DD90D24337930009DE740 /* PlateNumber.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlateNumber.swift; sourceTree = ""; }; 7A6E03272485951700DB22ED /* OwnersController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OwnersController.swift; sourceTree = ""; }; 7A7547DF24032CB6004E8406 /* VehiclePhotoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VehiclePhotoCell.swift; sourceTree = ""; }; + 7A761C0A267E8FF90005F28F /* Error.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Error.swift; sourceTree = ""; }; 7A813DBD2506A57100CC93B9 /* AuthenticationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AuthenticationServices.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AuthenticationServices.framework; sourceTree = DEVELOPER_DIR; }; 7A813DC22508EE4F00CC93B9 /* EventCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventCell.swift; sourceTree = ""; }; 7A813DC4250AAF3C00CC93B9 /* LocationEditController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationEditController.swift; sourceTree = ""; }; @@ -224,6 +268,13 @@ 7AEFC3BD2529D3CC00BADFB2 /* ConfigurableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurableCell.swift; sourceTree = ""; }; 7AEFE727240455E200910EB7 /* SettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsController.swift; sourceTree = ""; }; 7AF12B1C258C9CFF0090F8B8 /* Cloneable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cloneable.swift; sourceTree = ""; }; + 7AF6D1DD2677A7E00086EA64 /* AutoCatTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AutoCatTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 7AF6D1DF2677A7E00086EA64 /* AutoCatTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCatTests.swift; sourceTree = ""; }; + 7AF6D1E12677A7E00086EA64 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 7AF6D1E82677A8410086EA64 /* FakeLocationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakeLocationManager.swift; sourceTree = ""; }; + 7AF6D1EF2677C03B0086EA64 /* AutoCatCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AutoCatCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7AF6D1F12677C03B0086EA64 /* AutoCatCore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AutoCatCore.h; sourceTree = ""; }; + 7AF6D1F22677C03B0086EA64 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -242,6 +293,7 @@ 7AA7BC3625A5DFB80053A5D5 /* PKHUD in Frameworks */, 7AA7BC2E25A5DFB80053A5D5 /* RxCocoa in Frameworks */, 7AA7BC3425A5DFB80053A5D5 /* SwiftDate in Frameworks */, + 7AF6D2042677C03B0086EA64 /* AutoCatCore.framework in Frameworks */, 7AA7BC3725A5DFB80053A5D5 /* DifferenceKit in Frameworks */, 7AA7BC3225A5DFB80053A5D5 /* RxRealm in Frameworks */, 7AA7BC2D25A5DFB80053A5D5 /* RxRelay in Frameworks */, @@ -249,6 +301,27 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 7AF6D1DA2677A7E00086EA64 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7AF6D1EC2677C03B0086EA64 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 7AABB1F0267E9CAA00D7AB32 /* DifferenceKit in Frameworks */, + 7AF6D2252677C2B40086EA64 /* RealmSwift in Frameworks */, + 7AF6D2232677C2B40086EA64 /* Realm in Frameworks */, + 7AF6D2112677C0EA0086EA64 /* RxSwift in Frameworks */, + 7AABB1F2267E9CC800D7AB32 /* SwiftDate in Frameworks */, + 7AF6D20F2677C0EA0086EA64 /* RxCocoa in Frameworks */, + 7AF6D2272677C2B40086EA64 /* RxRealm in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -285,6 +358,8 @@ isa = PBXGroup; children = ( 7A1146FF23FDE7E500B424AF /* AutoCat */, + 7AF6D1DE2677A7E00086EA64 /* AutoCatTests */, + 7AF6D1F02677C03B0086EA64 /* AutoCatCore */, 7A1146FE23FDE7E500B424AF /* Products */, 7A11474C23FFEE8700B424AF /* Frameworks */, ); @@ -294,6 +369,8 @@ isa = PBXGroup; children = ( 7A1146FD23FDE7E500B424AF /* AutoCat.app */, + 7AF6D1DD2677A7E00086EA64 /* AutoCatTests.xctest */, + 7AF6D1EF2677C03B0086EA64 /* AutoCatCore.framework */, ); name = Products; sourceTree = ""; @@ -306,7 +383,6 @@ 7A3F07A924360D9100E59687 /* Extensions */, 7A6DD90424326788009DE740 /* Fonts */, 7A0420B825693CEE00034941 /* JS */, - 7A11474523FF2A9000B424AF /* Models */, 7A11472C23FECA3E00B424AF /* ThirdParty */, 7A11474223FF06B600B424AF /* Utils */, 7A6DD901242BF48D009DE740 /* Views */, @@ -350,8 +426,6 @@ children = ( 7A64AE6E2469DFB600ABE48E /* ATGMediaBrowser */, 7A6DD90724329144009DE740 /* CenterTextLayer.swift */, - 7A96AE32246C095700297C33 /* Base64FS.swift */, - 7A15051124DB3E3000F39631 /* AnyEncodable.swift */, 7ADF6C9C250FA96000F237B2 /* SwiftMaskTextfield.swift */, ); path = ThirdParty; @@ -360,12 +434,8 @@ 7A11474223FF06B600B424AF /* Utils */ = { isa = PBXGroup; children = ( - 7A96AE30246B2FE400297C33 /* Constants.swift */, - 7A43F9F7246C8A6200BA5B49 /* JWT.swift */, - 7A11474323FF06CA00B424AF /* Api.swift */, 7A27ADF6249FEF690035F39E /* Recorder.swift */, 7A1090E924A3A26300B4F0B2 /* AudioPlayer.swift */, - 7A000AA124C2EEDE001F5B00 /* Location.swift */, 7A9FEEC72529AB23001CA50E /* RxRealmDataSource.swift */, 7AABDE25253350C30041AFC6 /* RxSectionedDataSource.swift */, ); @@ -411,9 +481,7 @@ 7A21112924FC3D7E003BBF6F /* AudioEngine.swift */, 7A8AB76425A0DB8F00ECF2C1 /* BundleVersion.swift */, 7AE24C5E251F1B4E00758E39 /* Buttons.swift */, - 7A27ADF824A09CAD0035F39E /* CocoaError.swift */, 7A3F07AA24360DC800E59687 /* Dated.swift */, - 7AE8424D26109F78002F6B31 /* Exportable.swift */, 7A27ADF4249FD2F90035F39E /* FileManagerExt.swift */, 7ADF6CA02512244400F237B2 /* MapExt.swift */, 7ADF6C92250B954900F237B2 /* Navigation.swift */, @@ -421,6 +489,7 @@ 7A659B5A24A3768A0043A0F2 /* Substrings.swift */, 7AE26A3224EEF9EC00625033 /* UIViewControllerExt.swift */, 7A8A220A248D67B60073DFD9 /* VehicleReportImage.swift */, + 7A761C0A267E8FF90005F28F /* Error.swift */, ); path = Extensions; sourceTree = ""; @@ -473,6 +542,15 @@ path = Fonts; sourceTree = ""; }; + 7A761C06267E8E720005F28F /* ThirdParty */ = { + isa = PBXGroup; + children = ( + 7A96AE32246C095700297C33 /* Base64FS.swift */, + 7A15051124DB3E3000F39631 /* AnyEncodable.swift */, + ); + path = ThirdParty; + sourceTree = ""; + }; 7A813DC7250B5C6E00CC93B9 /* Location */ = { isa = PBXGroup; children = ( @@ -486,8 +564,69 @@ path = Location; sourceTree = ""; }; + 7AF6D1DE2677A7E00086EA64 /* AutoCatTests */ = { + isa = PBXGroup; + children = ( + 7AF6D1E72677A81F0086EA64 /* Mocks */, + 7AF6D1DF2677A7E00086EA64 /* AutoCatTests.swift */, + 7AF6D1E12677A7E00086EA64 /* Info.plist */, + ); + path = AutoCatTests; + sourceTree = ""; + }; + 7AF6D1E72677A81F0086EA64 /* Mocks */ = { + isa = PBXGroup; + children = ( + 7AF6D1E82677A8410086EA64 /* FakeLocationManager.swift */, + ); + path = Mocks; + sourceTree = ""; + }; + 7AF6D1F02677C03B0086EA64 /* AutoCatCore */ = { + isa = PBXGroup; + children = ( + 7A761C06267E8E720005F28F /* ThirdParty */, + 7AF6D2292677C3950086EA64 /* Extensions */, + 7A11474523FF2A9000B424AF /* Models */, + 7AF6D20D2677C0C30086EA64 /* Utils */, + 7AF6D1F12677C03B0086EA64 /* AutoCatCore.h */, + 7AF6D1F22677C03B0086EA64 /* Info.plist */, + ); + path = AutoCatCore; + sourceTree = ""; + }; + 7AF6D20D2677C0C30086EA64 /* Utils */ = { + isa = PBXGroup; + children = ( + 7A43F9F7246C8A6200BA5B49 /* JWT.swift */, + 7A11474323FF06CA00B424AF /* Api.swift */, + 7A96AE30246B2FE400297C33 /* Constants.swift */, + 7A000AA124C2EEDE001F5B00 /* Location.swift */, + ); + path = Utils; + sourceTree = ""; + }; + 7AF6D2292677C3950086EA64 /* Extensions */ = { + isa = PBXGroup; + children = ( + 7A27ADF824A09CAD0035F39E /* CocoaError.swift */, + 7AE8424D26109F78002F6B31 /* Exportable.swift */, + ); + path = Extensions; + sourceTree = ""; + }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + 7AF6D1EA2677C03B0086EA64 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ 7A1146FC23FDE7E500B424AF /* AutoCat */ = { isa = PBXNativeTarget; @@ -496,10 +635,12 @@ 7A1146F923FDE7E500B424AF /* Sources */, 7A1146FA23FDE7E500B424AF /* Frameworks */, 7A1146FB23FDE7E500B424AF /* Resources */, + 7AF6D2092677C03B0086EA64 /* Embed Frameworks */, ); buildRules = ( ); dependencies = ( + 7AF6D2032677C03B0086EA64 /* PBXTargetDependency */, ); name = AutoCat; packageProductDependencies = ( @@ -521,19 +662,71 @@ productReference = 7A1146FD23FDE7E500B424AF /* AutoCat.app */; productType = "com.apple.product-type.application"; }; + 7AF6D1DC2677A7E00086EA64 /* AutoCatTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7AF6D1E62677A7E00086EA64 /* Build configuration list for PBXNativeTarget "AutoCatTests" */; + buildPhases = ( + 7AF6D1D92677A7E00086EA64 /* Sources */, + 7AF6D1DA2677A7E00086EA64 /* Frameworks */, + 7AF6D1DB2677A7E00086EA64 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 7AF6D1E32677A7E00086EA64 /* PBXTargetDependency */, + ); + name = AutoCatTests; + productName = AutoCatTests; + productReference = 7AF6D1DD2677A7E00086EA64 /* AutoCatTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 7AF6D1EE2677C03B0086EA64 /* AutoCatCore */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7AF6D2062677C03B0086EA64 /* Build configuration list for PBXNativeTarget "AutoCatCore" */; + buildPhases = ( + 7AF6D1EA2677C03B0086EA64 /* Headers */, + 7AF6D1EB2677C03B0086EA64 /* Sources */, + 7AF6D1EC2677C03B0086EA64 /* Frameworks */, + 7AF6D1ED2677C03B0086EA64 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AutoCatCore; + packageProductDependencies = ( + 7AF6D20E2677C0EA0086EA64 /* RxCocoa */, + 7AF6D2102677C0EA0086EA64 /* RxSwift */, + 7AF6D2222677C2B40086EA64 /* Realm */, + 7AF6D2242677C2B40086EA64 /* RealmSwift */, + 7AF6D2262677C2B40086EA64 /* RxRealm */, + 7AABB1EF267E9CAA00D7AB32 /* DifferenceKit */, + 7AABB1F1267E9CC800D7AB32 /* SwiftDate */, + ); + productName = AutoCatCore; + productReference = 7AF6D1EF2677C03B0086EA64 /* AutoCatCore.framework */; + productType = "com.apple.product-type.framework"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 7A1146F523FDE7E500B424AF /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 1130; + LastSwiftUpdateCheck = 1250; LastUpgradeCheck = 1130; ORGANIZATIONNAME = "Selim Mustafaev"; TargetAttributes = { 7A1146FC23FDE7E500B424AF = { CreatedOnToolsVersion = 11.3.1; }; + 7AF6D1DC2677A7E00086EA64 = { + CreatedOnToolsVersion = 12.5; + TestTargetID = 7A1146FC23FDE7E500B424AF; + }; + 7AF6D1EE2677C03B0086EA64 = { + CreatedOnToolsVersion = 12.5; + }; }; }; buildConfigurationList = 7A1146F823FDE7E500B424AF /* Build configuration list for PBXProject "AutoCat" */; @@ -562,6 +755,8 @@ projectRoot = ""; targets = ( 7A1146FC23FDE7E500B424AF /* AutoCat */, + 7AF6D1EE2677C03B0086EA64 /* AutoCatCore */, + 7AF6D1DC2677A7E00086EA64 /* AutoCatTests */, ); }; /* End PBXProject section */ @@ -583,6 +778,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 7AF6D1DB2677A7E00086EA64 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7AF6D1ED2677C03B0086EA64 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -591,12 +800,8 @@ buildActionMask = 2147483647; files = ( 7AEFC3BE2529D3CC00BADFB2 /* ConfigurableCell.swift in Sources */, - 7A96AE33246C095700297C33 /* Base64FS.swift in Sources */, - 7A530B802401803A00CBFE6E /* Vehicle.swift in Sources */, - 7A96AE31246B2FE400297C33 /* Constants.swift in Sources */, 7A11470123FDE7E500B424AF /* AppDelegate.swift in Sources */, 7ADF6C9D250FA96000F237B2 /* SwiftMaskTextfield.swift in Sources */, - 7A27ADF924A09CAD0035F39E /* CocoaError.swift in Sources */, 7A813DC9250B5C9700CC93B9 /* LocationRow.swift in Sources */, 7A2DE69B25869ABD00A113FC /* AdsController.swift in Sources */, 7A6DD90824329144009DE740 /* CenterTextLayer.swift in Sources */, @@ -604,10 +809,9 @@ 7A813DC32508EE4F00CC93B9 /* EventCell.swift in Sources */, 7A3F07AD2436350B00E59687 /* SearchController.swift in Sources */, 7AABDE26253350C30041AFC6 /* RxSectionedDataSource.swift in Sources */, - 7AB562BA249C9E9B00473D53 /* VehicleRegion.swift in Sources */, 7A0B96A0257D6D4B000B39AD /* MultilineLabelRow.swift in Sources */, - 7A659B5924A2B1BA0043A0F2 /* AudioRecord.swift in Sources */, 7A6DD90C24335A6D009DE740 /* FlagLayer.swift in Sources */, + 7A761C0B267E8FF90005F28F /* Error.swift in Sources */, 7AE26A3524F31B0700625033 /* EventsController.swift in Sources */, 7A2DE69E2589606A00A113FC /* ImageGridRow.swift in Sources */, 7AB67E8C2435C38700258F61 /* CustomTextField.swift in Sources */, @@ -617,7 +821,6 @@ 7AE26A3324EEF9EC00625033 /* UIViewControllerExt.swift in Sources */, 7A27ADF3249F8B650035F39E /* RecordsController.swift in Sources */, 7A8A2209248D10EC0073DFD9 /* ResizeImage.swift in Sources */, - 7A6DD90E24337930009DE740 /* PlateNumber.swift in Sources */, 7ADF6CA12512244400F237B2 /* MapExt.swift in Sources */, 7A659B5B24A3768A0043A0F2 /* Substrings.swift in Sources */, 7AEFE728240455E200910EB7 /* SettingsController.swift in Sources */, @@ -625,35 +828,24 @@ 7A3F07AB24360DC800E59687 /* Dated.swift in Sources */, 7A33381124990DAE00D878F1 /* FiltersController.swift in Sources */, 7A1090E824A394F100B4F0B2 /* AudioRecordCell.swift in Sources */, - 7A11474923FF2B2D00B424AF /* Response.swift in Sources */, 7A64AE762469DFB600ABE48E /* ContentTransformers.swift in Sources */, 7A11471823FDEBFA00B424AF /* ReportController.swift in Sources */, 7AE24C5F251F1B4E00758E39 /* Buttons.swift in Sources */, - 7AF12B1D258C9CFF0090F8B8 /* Cloneable.swift in Sources */, 7A11471A23FE839000B424AF /* AuthController.swift in Sources */, 7A530B7A24001D3300CBFE6E /* CheckController.swift in Sources */, 7A6E03282485951700DB22ED /* OwnersController.swift in Sources */, 7A64AE742469DFB600ABE48E /* MediaContentView.swift in Sources */, 7A1090EC24A4E3E100B4F0B2 /* CellProgressView.swift in Sources */, - 7AE8424E26109F78002F6B31 /* Exportable.swift in Sources */, 7A96AE2D246B2B7400297C33 /* GoogleSignInController.swift in Sources */, - 7A15051224DB3E3000F39631 /* AnyEncodable.swift in Sources */, 7A1090EA24A3A26300B4F0B2 /* AudioPlayer.swift in Sources */, 7A0420B12561A0E100034941 /* OsagoAddController.swift in Sources */, - 7A11474723FF2AA500B424AF /* User.swift in Sources */, 7A11471623FDEB2A00B424AF /* MainSplitController.swift in Sources */, - 7A2DE69825868AC800A113FC /* VehicleAd.swift in Sources */, 7A813DC5250AAF3C00CC93B9 /* LocationEditController.swift in Sources */, - 7A43F9F8246C8A6200BA5B49 /* JWT.swift in Sources */, 7A6DD903242BF4A5009DE740 /* PlateView.swift in Sources */, - 7A8AB76825A0DC8200ECF2C1 /* DebugInfo.swift in Sources */, 7ADF6C9F251201D200F237B2 /* GlobalEventsController.swift in Sources */, - 7AAE6AD324CDDF950023860B /* VehicleEvent.swift in Sources */, 7A11470323FDE7E500B424AF /* SceneDelegate.swift in Sources */, 7A530B7E24017FEE00CBFE6E /* VehicleCell.swift in Sources */, 7A813DCB250B5DC900CC93B9 /* LocationPickerController.swift in Sources */, - 7A0420AA25619AEC00034941 /* Osago.swift in Sources */, - 7A11474423FF06CA00B424AF /* Api.swift in Sources */, 7A9FEEC82529AB23001CA50E /* RxRealmDataSource.swift in Sources */, 7A8AB76525A0DB8F00ECF2C1 /* BundleVersion.swift in Sources */, 7A0420AD2561A0B100034941 /* OsagoController.swift in Sources */, @@ -662,23 +854,70 @@ 7A8A220B248D67B60073DFD9 /* VehicleReportImage.swift in Sources */, 7ADF6C95250D037700F237B2 /* ShowEventController.swift in Sources */, 7A27ADC7249D43210035F39E /* RegionsController.swift in Sources */, - 7A05161A2414FF0900FC55AC /* DateSection.swift in Sources */, 7AE492A1259232F000322D2E /* MultilineLinkRow.swift in Sources */, - 7A333814249A532400D878F1 /* Filter.swift in Sources */, - 7A11474B23FF368B00B424AF /* Settings.swift in Sources */, 7ADF6C93250B954900F237B2 /* Navigation.swift in Sources */, 7A64AE752469DFB600ABE48E /* MediaBrowserViewController.swift in Sources */, 7A64AE732469DFB600ABE48E /* DismissAnimationController.swift in Sources */, 7ADF6C97250F41B000F237B2 /* PNKeyboard.swift in Sources */, - 7A000AA224C2EEDE001F5B00 /* Location.swift in Sources */, 7A7547E024032CB6004E8406 /* VehiclePhotoCell.swift in Sources */, 6841A85D4B60DB71D1E68DA0 /* ImageGrid.swift in Sources */, - 6841A4F018B0E07966C1CEFC /* PagedResponse.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7AF6D1D92677A7E00086EA64 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7AF6D1E02677A7E00086EA64 /* AutoCatTests.swift in Sources */, + 7AF6D1E92677A8410086EA64 /* FakeLocationManager.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7AF6D1EB2677C03B0086EA64 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7AF6D2182677C1680086EA64 /* VehicleAd.swift in Sources */, + 7A761C08267E8EA20005F28F /* JWT.swift in Sources */, + 7AF6D2282677C2DC0086EA64 /* Constants.swift in Sources */, + 7A761C09267E8EE40005F28F /* Base64FS.swift in Sources */, + 7AF6D2202677C1680086EA64 /* Filter.swift in Sources */, + 7A761C042677F18E0005F28F /* Api.swift in Sources */, + 7AF6D21C2677C1680086EA64 /* DebugInfo.swift in Sources */, + 7AF6D2122677C12E0086EA64 /* Location.swift in Sources */, + 7AF6D2142677C1680086EA64 /* VehicleEvent.swift in Sources */, + 7AF6D2172677C1680086EA64 /* VehicleRegion.swift in Sources */, + 7AF6D21E2677C1680086EA64 /* PlateNumber.swift in Sources */, + 7AF6D21F2677C1680086EA64 /* Response.swift in Sources */, + 7A761C07267E8E7F0005F28F /* AnyEncodable.swift in Sources */, + 7AF6D2162677C1680086EA64 /* Cloneable.swift in Sources */, + 7AF6D21A2677C1680086EA64 /* User.swift in Sources */, + 7AF6D21D2677C1680086EA64 /* Osago.swift in Sources */, + 7AF6D2152677C1680086EA64 /* Settings.swift in Sources */, + 7A761C052677F1BC0005F28F /* CocoaError.swift in Sources */, + 7AF6D2132677C15A0086EA64 /* AudioRecord.swift in Sources */, + 7AF6D21B2677C1680086EA64 /* Vehicle.swift in Sources */, + 7AF6D22A2677C3AD0086EA64 /* Exportable.swift in Sources */, + 7AF6D2212677C1680086EA64 /* PagedResponse.swift in Sources */, + 7AF6D2192677C1680086EA64 /* DateSection.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 7AF6D1E32677A7E00086EA64 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7A1146FC23FDE7E500B424AF /* AutoCat */; + targetProxy = 7AF6D1E22677A7E00086EA64 /* PBXContainerItemProxy */; + }; + 7AF6D2032677C03B0086EA64 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7AF6D1EE2677C03B0086EA64 /* AutoCatCore */; + targetProxy = 7AF6D2022677C03B0086EA64 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 7A11470623FDE7E500B424AF /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -848,6 +1087,7 @@ 7A11471223FDE7E600B424AF /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; @@ -872,6 +1112,7 @@ 7A11471323FDE7E600B424AF /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; @@ -893,6 +1134,106 @@ }; name = Release; }; + 7AF6D1E42677A7E00086EA64 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = AutoCatTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = pro.aliencat.AutoCatTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AutoCat.app/AutoCat"; + }; + name = Debug; + }; + 7AF6D1E52677A7E00086EA64 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = AutoCatTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = pro.aliencat.AutoCatTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AutoCat.app/AutoCat"; + }; + name = Release; + }; + 7AF6D2072677C03B0086EA64 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 46DTTB8X4S; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = AutoCatCore/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = pro.aliencat.AutoCatCore; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 7AF6D2082677C03B0086EA64 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 46DTTB8X4S; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = AutoCatCore/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = pro.aliencat.AutoCatCore; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -914,6 +1255,24 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 7AF6D1E62677A7E00086EA64 /* Build configuration list for PBXNativeTarget "AutoCatTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7AF6D1E42677A7E00086EA64 /* Debug */, + 7AF6D1E52677A7E00086EA64 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7AF6D2062677C03B0086EA64 /* Build configuration list for PBXNativeTarget "AutoCatCore" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7AF6D2072677C03B0086EA64 /* Debug */, + 7AF6D2082677C03B0086EA64 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ @@ -1037,6 +1396,16 @@ package = 7A813DBF2508C4D900CC93B9 /* XCRemoteSwiftPackageReference "ExceptionCatcher" */; productName = ExceptionCatcher; }; + 7AABB1EF267E9CAA00D7AB32 /* DifferenceKit */ = { + isa = XCSwiftPackageProductDependency; + package = 7AABDE21253327F10041AFC6 /* XCRemoteSwiftPackageReference "DifferenceKit" */; + productName = DifferenceKit; + }; + 7AABB1F1267E9CC800D7AB32 /* SwiftDate */ = { + isa = XCSwiftPackageProductDependency; + package = 7A05160F241412CA00FC55AC /* XCRemoteSwiftPackageReference "SwiftDate" */; + productName = SwiftDate; + }; 7AABDE1C2532F3EB0041AFC6 /* PKHUD */ = { isa = XCSwiftPackageProductDependency; package = 7AABDE1B2532F3EB0041AFC6 /* XCRemoteSwiftPackageReference "PKHUD" */; @@ -1057,6 +1426,31 @@ package = 7AF58D322402A91C00CE01A0 /* XCRemoteSwiftPackageReference "Kingfisher" */; productName = Kingfisher; }; + 7AF6D20E2677C0EA0086EA64 /* RxCocoa */ = { + isa = XCSwiftPackageProductDependency; + package = 7A11471B23FEA18700B424AF /* XCRemoteSwiftPackageReference "RxSwift" */; + productName = RxCocoa; + }; + 7AF6D2102677C0EA0086EA64 /* RxSwift */ = { + isa = XCSwiftPackageProductDependency; + package = 7A11471B23FEA18700B424AF /* XCRemoteSwiftPackageReference "RxSwift" */; + productName = RxSwift; + }; + 7AF6D2222677C2B40086EA64 /* Realm */ = { + isa = XCSwiftPackageProductDependency; + package = 7A11472423FEA1F400B424AF /* XCRemoteSwiftPackageReference "realm-cocoa" */; + productName = Realm; + }; + 7AF6D2242677C2B40086EA64 /* RealmSwift */ = { + isa = XCSwiftPackageProductDependency; + package = 7A11472423FEA1F400B424AF /* XCRemoteSwiftPackageReference "realm-cocoa" */; + productName = RealmSwift; + }; + 7AF6D2262677C2B40086EA64 /* RxRealm */ = { + isa = XCSwiftPackageProductDependency; + package = 7A530B89240181F500CBFE6E /* XCRemoteSwiftPackageReference "RxRealm" */; + productName = RxRealm; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 7A1146F523FDE7E500B424AF /* Project object */; diff --git a/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 099e37a..58b4350 100644 --- a/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -33,7 +33,7 @@ "repositoryURL": "https://github.com/onevcat/Kingfisher", "state": { "branch": null, - "revision": "2a10bf41da75599a9f8e872dbd44fe0155a2e00c", + "revision": "1a0c2df04b31ed7aa318354f3583faea24f006fc", "version": "5.15.8" } }, diff --git a/AutoCat.xcodeproj/xcshareddata/xcschemes/AutoCat.xcscheme b/AutoCat.xcodeproj/xcshareddata/xcschemes/AutoCat.xcscheme index e1ebd13..7a98d5f 100644 --- a/AutoCat.xcodeproj/xcshareddata/xcschemes/AutoCat.xcscheme +++ b/AutoCat.xcodeproj/xcshareddata/xcschemes/AutoCat.xcscheme @@ -28,6 +28,26 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + + + + + orderHint 0 + AutoCatCore.xcscheme_^#shared#^_ + + orderHint + 1 + DifferenceKit (Playground) 1.xcscheme isShown - + orderHint - 5 + 7 DifferenceKit (Playground) 2.xcscheme isShown - + orderHint - 6 + 8 DifferenceKit (Playground).xcscheme isShown - + orderHint - 4 + 2 Eureka (Playground) 1.xcscheme isShown - + orderHint - 8 + 10 Eureka (Playground) 2.xcscheme isShown - + orderHint - 9 + 11 Eureka (Playground) 3.xcscheme isShown - + orderHint - 19 + 23 Eureka (Playground) 4.xcscheme isShown - + orderHint - 21 + 25 Eureka (Playground) 5.xcscheme isShown - + orderHint - 23 + 27 Eureka (Playground).xcscheme isShown - + orderHint - 7 + 9 GettingStarted (Playground) 1.xcscheme isShown - + orderHint - 14 + 16 GettingStarted (Playground) 2.xcscheme isShown - + orderHint - 15 + 17 GettingStarted (Playground) 3.xcscheme isShown - + orderHint - 13 + 14 GettingStarted (Playground) 4.xcscheme isShown - + orderHint - 16 + 18 GettingStarted (Playground) 5.xcscheme isShown - + orderHint - 18 + 21 GettingStarted (Playground).xcscheme isShown - + orderHint - 13 + 15 Rx (Playground) 1.xcscheme isShown - + orderHint - 2 + 4 Rx (Playground) 2.xcscheme isShown - + orderHint - 3 + 5 Rx (Playground) 3.xcscheme isShown - + orderHint - 16 + 19 Rx (Playground) 4.xcscheme isShown - + orderHint - 17 + 20 Rx (Playground) 5.xcscheme isShown - + orderHint - 18 + 22 Rx (Playground).xcscheme isShown - + orderHint - 1 + 3 SwiftDate (Playground) 1.xcscheme isShown - + orderHint 12 SwiftDate (Playground) 2.xcscheme isShown - + orderHint - 10 + 13 SwiftDate (Playground) 3.xcscheme isShown - + orderHint - 20 + 24 SwiftDate (Playground) 4.xcscheme isShown - + orderHint - 22 + 26 SwiftDate (Playground) 5.xcscheme isShown - + orderHint - 24 + 28 SwiftDate (Playground).xcscheme isShown - + orderHint - 11 + 6 SuppressBuildableAutocreation @@ -204,7 +209,7 @@ 7A1146FC23FDE7E500B424AF primary - + diff --git a/AutoCat/AppDelegate.swift b/AutoCat/AppDelegate.swift index 634206d..bf47b13 100644 --- a/AutoCat/AppDelegate.swift +++ b/AutoCat/AppDelegate.swift @@ -4,6 +4,7 @@ import RxSwift import RxCocoa import os.log import PKHUD +import AutoCatCore extension OSLog { static let startup = OSLog(subsystem: "pro.aliencat.autocat.startup", category: "startup") diff --git a/AutoCat/Cells/AudioRecordCell.swift b/AutoCat/Cells/AudioRecordCell.swift index 34de807..c9575de 100644 --- a/AutoCat/Cells/AudioRecordCell.swift +++ b/AutoCat/Cells/AudioRecordCell.swift @@ -1,6 +1,7 @@ import UIKit import RxSwift import PKHUD +import AutoCatCore class AudioRecordCell: UITableViewCell, ConfigurableCell { diff --git a/AutoCat/Cells/EventCell.swift b/AutoCat/Cells/EventCell.swift index 2d2e63a..c4281f1 100644 --- a/AutoCat/Cells/EventCell.swift +++ b/AutoCat/Cells/EventCell.swift @@ -1,4 +1,5 @@ import UIKit +import AutoCatCore class EventCell: UITableViewCell { @IBOutlet weak var address: UILabel! diff --git a/AutoCat/Cells/VehicleCell.swift b/AutoCat/Cells/VehicleCell.swift index a038efe..81e5979 100644 --- a/AutoCat/Cells/VehicleCell.swift +++ b/AutoCat/Cells/VehicleCell.swift @@ -1,4 +1,5 @@ import UIKit +import AutoCatCore class VehicleCell: UITableViewCell, ConfigurableCell { diff --git a/AutoCat/Cells/VehiclePhotoCell.swift b/AutoCat/Cells/VehiclePhotoCell.swift index d1e4f07..71170a2 100644 --- a/AutoCat/Cells/VehiclePhotoCell.swift +++ b/AutoCat/Cells/VehiclePhotoCell.swift @@ -1,5 +1,6 @@ import UIKit import Kingfisher +import AutoCatCore class VehiclePhotoCell: UICollectionViewCell { @IBOutlet weak var photo: UIImageView! diff --git a/AutoCat/Controllers/AdsController.swift b/AutoCat/Controllers/AdsController.swift index 09061f1..9282cd7 100644 --- a/AutoCat/Controllers/AdsController.swift +++ b/AutoCat/Controllers/AdsController.swift @@ -2,6 +2,7 @@ import UIKit import Eureka import Kingfisher import SafariServices +import AutoCatCore class AdsController: FormViewController, MediaBrowserViewControllerDataSource { diff --git a/AutoCat/Controllers/AuthController.swift b/AutoCat/Controllers/AuthController.swift index 5b5d222..93281e2 100644 --- a/AutoCat/Controllers/AuthController.swift +++ b/AutoCat/Controllers/AuthController.swift @@ -4,6 +4,7 @@ import RxCocoa import RealmSwift import AuthenticationServices import PKHUD +import AutoCatCore class AuthController: UIViewController, ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding { diff --git a/AutoCat/Controllers/CheckController.swift b/AutoCat/Controllers/CheckController.swift index 9c6c1b9..d2af1f9 100644 --- a/AutoCat/Controllers/CheckController.swift +++ b/AutoCat/Controllers/CheckController.swift @@ -5,6 +5,7 @@ import SwiftDate import RxRealm import PKHUD import CoreLocation +import AutoCatCore enum EventAction: Equatable { case doNotSend @@ -251,7 +252,7 @@ class CheckController: UIViewController, UITableViewDelegate, UITextFieldDelegat // MARK: - UITextFieldDelegate @IBAction func textFieldDidBeginEditing(_ textField: UITextField) { - LocationManager.requestCurrentLocation().subscribe().disposed(by: self.bag) + RxLocationManager.requestCurrentLocation().subscribe().disposed(by: self.bag) } @IBAction func textFieldDidChange(_ textField: UITextField) { @@ -362,10 +363,10 @@ class CheckController: UIViewController, UITableViewDelegate, UITextFieldDelegat return Single.just(event) } - if let event = LocationManager.lastEvent, (Date().timeIntervalSince1970 - event.date) < 100 { + if let event = RxLocationManager.lastEvent, (Date().timeIntervalSince1970 - event.date) < 100 { return Single.just(event) } else { - return LocationManager.requestCurrentLocation() + return RxLocationManager.requestCurrentLocation() } } @@ -410,7 +411,7 @@ class CheckController: UIViewController, UITableViewDelegate, UITextFieldDelegat } .compactMap { $0 } - LocationManager.resetLastEvent() + RxLocationManager.resetLastEvent() if vehicleResult.vehicle.unrecognized { let realm = try Realm() diff --git a/AutoCat/Controllers/FiltersController.swift b/AutoCat/Controllers/FiltersController.swift index 5ed0600..7fe74a4 100644 --- a/AutoCat/Controllers/FiltersController.swift +++ b/AutoCat/Controllers/FiltersController.swift @@ -1,44 +1,7 @@ import UIKit import Eureka import RxSwift - -enum AddedBy: String, CustomStringConvertible, CaseIterable { - case anyone - case me - case anyoneButMe - - var description: String { - switch self { - case .anyone: return NSLocalizedString("Anyone", comment: "Added by") - case .me: return NSLocalizedString("Me", comment: "Added by") - case .anyoneButMe: return NSLocalizedString("Anyone but me", comment: "Added by") - } - } -} - -enum SortParameter: String, CustomStringConvertible, CaseIterable { - case addedDate - case updatedDate - - var description: String { - switch self { - case .addedDate: return NSLocalizedString("added time", comment: "sort by added time") - case .updatedDate: return NSLocalizedString("updated time", comment: "sort by updated time") - } - } -} - -enum SortOrder: String, CustomStringConvertible, CaseIterable { - case ascending - case descending - - var description: String { - switch self { - case .ascending: return NSLocalizedString("ascending", comment: "sort order") - case .descending: return NSLocalizedString("descending", comment: "sort order") - } - } -} +import AutoCatCore class FiltersController: FormViewController { diff --git a/AutoCat/Controllers/GoogleSignInController.swift b/AutoCat/Controllers/GoogleSignInController.swift index bd61bad..c8b0403 100644 --- a/AutoCat/Controllers/GoogleSignInController.swift +++ b/AutoCat/Controllers/GoogleSignInController.swift @@ -3,6 +3,7 @@ import WebKit import CommonCrypto import RxSwift import PKHUD +import AutoCatCore struct TokenResponse: Codable { var id_token: String diff --git a/AutoCat/Controllers/Location/EventsController.swift b/AutoCat/Controllers/Location/EventsController.swift index 250e1c9..7613ff3 100644 --- a/AutoCat/Controllers/Location/EventsController.swift +++ b/AutoCat/Controllers/Location/EventsController.swift @@ -6,6 +6,7 @@ import RealmSwift import PKHUD import MobileCoreServices import ExceptionCatcher +import AutoCatCore class EventPin: NSObject, MKAnnotation { var coordinate: CLLocationCoordinate2D diff --git a/AutoCat/Controllers/Location/GlobalEventsController.swift b/AutoCat/Controllers/Location/GlobalEventsController.swift index 99ff73b..b076473 100644 --- a/AutoCat/Controllers/Location/GlobalEventsController.swift +++ b/AutoCat/Controllers/Location/GlobalEventsController.swift @@ -2,6 +2,7 @@ import UIKit import MapKit import RxSwift import PKHUD +import AutoCatCore class GlobalEventsController: UIViewController { diff --git a/AutoCat/Controllers/Location/LocationEditController.swift b/AutoCat/Controllers/Location/LocationEditController.swift index d74f18a..e9c6c11 100644 --- a/AutoCat/Controllers/Location/LocationEditController.swift +++ b/AutoCat/Controllers/Location/LocationEditController.swift @@ -2,6 +2,7 @@ import UIKit import Eureka import RxSwift import CoreLocation +import AutoCatCore class LocationEditController: FormViewController { diff --git a/AutoCat/Controllers/Location/LocationPickerController.swift b/AutoCat/Controllers/Location/LocationPickerController.swift index 78dfdae..37af5c2 100644 --- a/AutoCat/Controllers/Location/LocationPickerController.swift +++ b/AutoCat/Controllers/Location/LocationPickerController.swift @@ -3,6 +3,7 @@ import MapKit import Eureka import RxSwift import Intents +import AutoCatCore public struct Placemark: Equatable { var latitude: Double @@ -124,7 +125,7 @@ public class LocationPickerController : UIViewController, TypedRowControllerType self.address = nil self.geocodingDisposable?.dispose() - self.geocodingDisposable = LocationManager + self.geocodingDisposable = RxLocationManager .getAddressForLocation(latitude: mapView.centerCoordinate.latitude, longitude: mapView.centerCoordinate.longitude) .observeOn(MainScheduler.instance) .subscribe(onSuccess: { address in diff --git a/AutoCat/Controllers/Location/ShowEventController.swift b/AutoCat/Controllers/Location/ShowEventController.swift index 8d2af02..c59676b 100644 --- a/AutoCat/Controllers/Location/ShowEventController.swift +++ b/AutoCat/Controllers/Location/ShowEventController.swift @@ -1,5 +1,6 @@ import UIKit import MapKit +import AutoCatCore class ShowEventController: UIViewController { diff --git a/AutoCat/Controllers/Osago/OsagoAddController.swift b/AutoCat/Controllers/Osago/OsagoAddController.swift index f55258b..5cdb302 100644 --- a/AutoCat/Controllers/Osago/OsagoAddController.swift +++ b/AutoCat/Controllers/Osago/OsagoAddController.swift @@ -3,6 +3,7 @@ import Eureka import PKHUD import RxSwift import RxCocoa +import AutoCatCore enum OsagoCheckSource: Equatable, CustomStringConvertible { case plateNumber(number: String) diff --git a/AutoCat/Controllers/Osago/OsagoController.swift b/AutoCat/Controllers/Osago/OsagoController.swift index 9748913..c66ea8e 100644 --- a/AutoCat/Controllers/Osago/OsagoController.swift +++ b/AutoCat/Controllers/Osago/OsagoController.swift @@ -1,6 +1,7 @@ import UIKit import Eureka import PKHUD +import AutoCatCore class OsagoController: FormViewController { diff --git a/AutoCat/Controllers/OwnersController.swift b/AutoCat/Controllers/OwnersController.swift index 7249f1b..4efb716 100644 --- a/AutoCat/Controllers/OwnersController.swift +++ b/AutoCat/Controllers/OwnersController.swift @@ -1,5 +1,6 @@ import UIKit import Eureka +import AutoCatCore class OwnersController: FormViewController { diff --git a/AutoCat/Controllers/RecordsController.swift b/AutoCat/Controllers/RecordsController.swift index 533beed..3eef2ba 100644 --- a/AutoCat/Controllers/RecordsController.swift +++ b/AutoCat/Controllers/RecordsController.swift @@ -8,6 +8,7 @@ import CoreSpotlight import MobileCoreServices import os.log import PKHUD +import AutoCatCore class RecordsController: UIViewController, UITableViewDelegate { @@ -94,7 +95,7 @@ class RecordsController: UIViewController, UITableViewDelegate { var alert: UIAlertController? var url: URL! - let locationObservable = LocationManager.requestCurrentLocation() + let locationObservable = RxLocationManager.requestCurrentLocation() .map(Optional.init) .catchErrorJustReturn(nil) diff --git a/AutoCat/Controllers/RegionsController.swift b/AutoCat/Controllers/RegionsController.swift index 28386cc..9e6ccbf 100644 --- a/AutoCat/Controllers/RegionsController.swift +++ b/AutoCat/Controllers/RegionsController.swift @@ -1,5 +1,6 @@ import UIKit import RxSwift +import AutoCatCore class RegionsDataSourse: UITableViewDiffableDataSource { override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { diff --git a/AutoCat/Controllers/ReportController.swift b/AutoCat/Controllers/ReportController.swift index dbd1741..bb04216 100644 --- a/AutoCat/Controllers/ReportController.swift +++ b/AutoCat/Controllers/ReportController.swift @@ -3,6 +3,7 @@ import Kingfisher import LinkPresentation import RealmSwift import Eureka +import AutoCatCore class ReportController: FormViewController, MediaBrowserViewControllerDataSource, MediaBrowserViewControllerDelegate, UIActivityItemSource { diff --git a/AutoCat/Controllers/SearchController.swift b/AutoCat/Controllers/SearchController.swift index a32c53d..0225450 100644 --- a/AutoCat/Controllers/SearchController.swift +++ b/AutoCat/Controllers/SearchController.swift @@ -4,6 +4,7 @@ import RxCocoa import RealmSwift import PKHUD import ExceptionCatcher +import AutoCatCore class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDelegate, UIScrollViewDelegate { diff --git a/AutoCat/Controllers/SettingsController.swift b/AutoCat/Controllers/SettingsController.swift index 05d2eb8..30e285b 100644 --- a/AutoCat/Controllers/SettingsController.swift +++ b/AutoCat/Controllers/SettingsController.swift @@ -1,6 +1,7 @@ import UIKit import Eureka import AuthenticationServices +import AutoCatCore class SettingsController: FormViewController { diff --git a/AutoCat/Extensions/Dated.swift b/AutoCat/Extensions/Dated.swift index 56f7d75..41a2f52 100644 --- a/AutoCat/Extensions/Dated.swift +++ b/AutoCat/Extensions/Dated.swift @@ -1,6 +1,7 @@ import Foundation import SwiftDate import DifferenceKit +import AutoCatCore protocol Dated { var added: Date { get } diff --git a/AutoCat/Extensions/Error.swift b/AutoCat/Extensions/Error.swift new file mode 100644 index 0000000..e8649ac --- /dev/null +++ b/AutoCat/Extensions/Error.swift @@ -0,0 +1,27 @@ +import UIKit +import PKHUD +import AutoCatCore + +extension UIViewController { + func show(error: Error, animated: Bool = true, completion: (() -> Void)? = nil) { + let msg = (error as NSError).displayMessage + let alert = UIAlertController(title: msg.title, message: msg.body, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { _ in + completion?() + })) + self.present(alert, animated: animated) + } + + func showAlert(title: String, message: String) { + let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) + self.present(alert, animated: true) + } +} + +extension HUD { + static func show(error: Error) { + let msg = (error as NSError).displayMessage + self.flash(.labeledError(title: msg.title, subtitle: msg.body), delay: 2.0) + } +} diff --git a/AutoCat/Extensions/VehicleReportImage.swift b/AutoCat/Extensions/VehicleReportImage.swift index 9b2b01c..2611978 100644 --- a/AutoCat/Extensions/VehicleReportImage.swift +++ b/AutoCat/Extensions/VehicleReportImage.swift @@ -1,5 +1,6 @@ import UIKit import Kingfisher +import AutoCatCore extension Vehicle { func drawLine(y: CGFloat, width: CGFloat, margin: CGFloat = 15,context: CGContext) { diff --git a/AutoCat/Models/DebugInfo.swift b/AutoCat/Models/DebugInfo.swift deleted file mode 100644 index ad25794..0000000 --- a/AutoCat/Models/DebugInfo.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation -import RealmSwift - -enum DebugInfoStatus: Int { - case success = 0 - case error = 1 - case warning = 2 -} - -class DebugInfo: Object, Decodable { - @objc dynamic var autocod: DebugInfoEntry! - @objc dynamic var vin01vin: DebugInfoEntry! - @objc dynamic var vin01base: DebugInfoEntry! - @objc dynamic var vin01history: DebugInfoEntry! - @objc dynamic var nomerogram: DebugInfoEntry! -} - -class DebugInfoEntry: Object, Decodable { - @objc dynamic var fields: Int64 = 0 - @objc dynamic var error: String? - @objc dynamic var status: Int = 0 - - var statusEnum: DebugInfoStatus { - get { DebugInfoStatus(rawValue: self.status)! } - set { self.status = newValue.rawValue } - } -} diff --git a/AutoCat/Models/Filter.swift b/AutoCat/Models/Filter.swift deleted file mode 100644 index 3ae961f..0000000 --- a/AutoCat/Models/Filter.swift +++ /dev/null @@ -1,75 +0,0 @@ -import Foundation - -struct Filter { - var searchString = "" - var brand: String? - var model: String? - var color: String? - var year: String? - var regions: [Int]? - var addedBy: AddedBy? - var sortBy: SortParameter? = .updatedDate - var sortOrder: SortOrder? = .descending - var fromDate: Date? - var toDate: Date? - var fromDateUpdated: Date? - var toDateUpdated: Date? - - mutating func clear() { - self.brand = nil - self.model = nil - self.color = nil - self.year = nil - self.regions = nil - self.addedBy = nil - self.sortBy = .updatedDate - self.sortOrder = .descending - self.fromDate = nil - self.toDate = nil - self.fromDateUpdated = nil - self.toDateUpdated = nil - } - - func queryDictionary() -> [String: String] { - var dict: [String: String] = ["query": self.searchString] - - if let brand = self.brand { - dict["brand"] = brand - } - if let model = self.model { - dict["model"] = model - } - if let color = self.color { - dict["color"] = color - } - if let year = self.year { - dict["year"] = year - } - if let regions = self.regions { - dict["regions"] = regions.map(String.init).joined(separator: ",") - } - if let addedBy = self.addedBy { - dict["addedBy"] = addedBy.rawValue - } - if let sortBy = self.sortBy { - dict["sortBy"] = sortBy.rawValue - } - if let sortOrder = self.sortOrder { - dict["sortOrder"] = sortOrder.rawValue - } - if let fromDate = self.fromDate { - dict["fromDate"] = String(fromDate.timeIntervalSince1970) - } - if let toDate = self.toDate { - dict["toDate"] = String(toDate.timeIntervalSince1970) - } - if let fromDateUpdated = self.fromDateUpdated { - dict["fromDateUpdated"] = String(fromDateUpdated.timeIntervalSince1970) - } - if let toDateUpdated = self.toDateUpdated { - dict["toDateUpdated"] = String(toDateUpdated.timeIntervalSince1970) - } - - return dict - } -} diff --git a/AutoCat/Models/Osago.swift b/AutoCat/Models/Osago.swift deleted file mode 100644 index e92b8c9..0000000 --- a/AutoCat/Models/Osago.swift +++ /dev/null @@ -1,32 +0,0 @@ -import Foundation -import RealmSwift - -class Osago: Object, Decodable, Cloneable { - @objc dynamic var date: TimeInterval = 0 - @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 = "" - @objc dynamic var insurant: String? - @objc dynamic var owner: String? - @objc dynamic var usageRegion: String? - - required init(copy: Osago) { - self.date = copy.date - self.number = copy.number - self.vin = copy.vin - self.plateNumber = copy.plateNumber - self.name = copy.name - self.status = copy.status - self.restrictions = copy.restrictions - self.insurant = copy.insurant - self.owner = copy.owner - self.usageRegion = copy.usageRegion - } - - required init() { - super.init() - } -} diff --git a/AutoCat/Models/PagedResponse.swift b/AutoCat/Models/PagedResponse.swift deleted file mode 100644 index a6021c3..0000000 --- a/AutoCat/Models/PagedResponse.swift +++ /dev/null @@ -1,13 +0,0 @@ -import Foundation - -class PagedResponse: Decodable where T: Decodable { - let count: Int? - let pageToken: String? - let items: [T] - - init() { - self.items = [] - self.count = nil - self.pageToken = nil - } -} diff --git a/AutoCat/Models/User.swift b/AutoCat/Models/User.swift deleted file mode 100644 index 4c0fd00..0000000 --- a/AutoCat/Models/User.swift +++ /dev/null @@ -1,13 +0,0 @@ -import Foundation - -struct User: Codable { - let email: String - var token: String - var firebaseIdToken: String? - var firebaseRefreshToken: String? - - init() { - self.email = "" - self.token = "" - } -} diff --git a/AutoCat/Models/VehicleAd.swift b/AutoCat/Models/VehicleAd.swift deleted file mode 100644 index 0a1e283..0000000 --- a/AutoCat/Models/VehicleAd.swift +++ /dev/null @@ -1,33 +0,0 @@ -import Foundation -import RealmSwift - -class VehicleAd: Object, Decodable, Cloneable { - @objc dynamic var id: Int = 0 - @objc dynamic var url: String? - @objc dynamic var price: String? - @objc dynamic var date: TimeInterval = Date().timeIntervalSince1970 - @objc dynamic var mileage: String? - @objc dynamic var region: String? - @objc dynamic var city: String? - @objc dynamic var adDescription: String? - var photos = List() - - required init(copy: VehicleAd) { - self.id = copy.id - self.url = copy.url - self.price = copy.price - self.date = copy.date - self.mileage = copy.mileage - self.region = copy.region - self.city = copy.city - self.adDescription = copy.adDescription - - let photos = List() - photos.append(objectsIn: copy.photos) - self.photos = photos - } - - required init() { - super.init() - } -} diff --git a/AutoCat/Models/VehicleRegion.swift b/AutoCat/Models/VehicleRegion.swift deleted file mode 100644 index a156cbb..0000000 --- a/AutoCat/Models/VehicleRegion.swift +++ /dev/null @@ -1,10 +0,0 @@ -import Foundation - -struct VehicleRegion: Codable, Hashable { - var name: String - var codes: [Int] - - static func == (lhs: VehicleRegion, rhs: VehicleRegion) -> Bool { - return lhs.name == rhs.name - } -} diff --git a/AutoCat/SceneDelegate.swift b/AutoCat/SceneDelegate.swift index d822548..4c33320 100644 --- a/AutoCat/SceneDelegate.swift +++ b/AutoCat/SceneDelegate.swift @@ -3,6 +3,7 @@ import os.log import AVFoundation import RxSwift import PKHUD +import AutoCatCore class SceneDelegate: UIResponder, UIWindowSceneDelegate { diff --git a/AutoCat/Utils/Constants.swift b/AutoCat/Utils/Constants.swift deleted file mode 100644 index 34e7169..0000000 --- a/AutoCat/Utils/Constants.swift +++ /dev/null @@ -1,34 +0,0 @@ -import Foundation - -enum Constants { - static var baseUrl: String { - #if DEBUG - return "http://127.0.0.1:3000/" - //return "http://192.168.1.67:3000/" - //return "https://vps.aliencat.pro:8443/" - #else - return "https://vps.aliencat.pro:8443/" - #endif - } - - static let pnLettersMap: [Character: Character] = [ - "А": "A", "В": "B", "Е": "E", "К": "K", "М": "M", "Н": "H", "О": "O", "Р": "P", "С": "C", "Т": "T", "У": "Y", "Х": "X" - ] - - static let googleAuthURL = "https://accounts.google.com/o/oauth2/v2/auth" - static let googleTokenURL = "https://oauth2.googleapis.com/token" - static let googleRedirectURL = "com.googleusercontent.apps.994679674451-k7clunkk4nicl6iuajdtc5u7hvustbdb:/oauth2callback" - - static let fbClientId = "994679674451-k7clunkk4nicl6iuajdtc5u7hvustbdb.apps.googleusercontent.com" - static let fbApiKey = "AIzaSyDVlrQj_05y6AeZNf8enpSWFIiHhgwfnGI" - - static let fbClientVersion = "iOS/FirebaseSDK/6.5.1/FirebaseCore-iOS" - static let fbVerifyAssertion = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion" - static let fbRefreshToken = "https://securetoken.googleapis.com/v1/token" - static let fbUserAgent = "FirebaseAuth.iOS/6.5.1 ru.Vin01/1.0 iPhone/13.5 hw/sim" - - static let secondProviderBundleId = "ru.Vin01" - - static let reportLinkTokenSecret = "#TheTruthIsOutThere" - static let reportLinkBaseURL = "https://auto.aliencat.pro/report.html" -} diff --git a/AutoCat/Utils/RxRealmDataSource.swift b/AutoCat/Utils/RxRealmDataSource.swift index 61abcdc..64f057d 100644 --- a/AutoCat/Utils/RxRealmDataSource.swift +++ b/AutoCat/Utils/RxRealmDataSource.swift @@ -2,6 +2,7 @@ import UIKit import RealmSwift import DifferenceKit import ExceptionCatcher +import AutoCatCore typealias FilterPredicate = (T) -> Bool diff --git a/AutoCat/Utils/RxSectionedDataSource.swift b/AutoCat/Utils/RxSectionedDataSource.swift index ad1ae65..9e7917a 100644 --- a/AutoCat/Utils/RxSectionedDataSource.swift +++ b/AutoCat/Utils/RxSectionedDataSource.swift @@ -2,6 +2,7 @@ import UIKit import DifferenceKit import RxSwift import RxCocoa +import AutoCatCore class RxSectionedDataSource: NSObject, UITableViewDataSource where Item: Dated & Hashable & Differentiable & Decodable, Cell: UITableViewCell & ConfigurableCell, Cell.Item == Item { private var tv: UITableView diff --git a/AutoCat/Views/PNKeyboard.swift b/AutoCat/Views/PNKeyboard.swift index 2f1e3ec..607de8d 100644 --- a/AutoCat/Views/PNKeyboard.swift +++ b/AutoCat/Views/PNKeyboard.swift @@ -1,4 +1,5 @@ import UIKit +import AutoCatCore protocol PNKeyboardDelegate: class { func returnClicked() diff --git a/AutoCat/Views/PlateView.swift b/AutoCat/Views/PlateView.swift index 71c2e9c..494fc72 100644 --- a/AutoCat/Views/PlateView.swift +++ b/AutoCat/Views/PlateView.swift @@ -1,4 +1,5 @@ import UIKit +import AutoCatCore class PlateView: UIView { // Some driver plate parameters from "ГОСТ Р 50577-93" diff --git a/AutoCat/Views/eureka/SourceStatusRow.swift b/AutoCat/Views/eureka/SourceStatusRow.swift index 690530b..2fb95d4 100644 --- a/AutoCat/Views/eureka/SourceStatusRow.swift +++ b/AutoCat/Views/eureka/SourceStatusRow.swift @@ -1,5 +1,6 @@ import UIKit import Eureka +import AutoCatCore extension DebugInfoStatus { var color: UIColor { diff --git a/AutoCatCore/AutoCatCore.h b/AutoCatCore/AutoCatCore.h new file mode 100644 index 0000000..a1914cb --- /dev/null +++ b/AutoCatCore/AutoCatCore.h @@ -0,0 +1,19 @@ +// +// AutoCatCore.h +// AutoCatCore +// +// Created by Selim Mustafaev on 14.06.2021. +// Copyright © 2021 Selim Mustafaev. All rights reserved. +// + +#import + +//! Project version number for AutoCatCore. +FOUNDATION_EXPORT double AutoCatCoreVersionNumber; + +//! Project version string for AutoCatCore. +FOUNDATION_EXPORT const unsigned char AutoCatCoreVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/AutoCat/Extensions/CocoaError.swift b/AutoCatCore/Extensions/CocoaError.swift similarity index 70% rename from AutoCat/Extensions/CocoaError.swift rename to AutoCatCore/Extensions/CocoaError.swift index 2edcf5e..91a5c9e 100644 --- a/AutoCat/Extensions/CocoaError.swift +++ b/AutoCatCore/Extensions/CocoaError.swift @@ -1,9 +1,7 @@ -import UIKit -import PKHUD import CoreLocation extension NSError { - var displayMessage: (title: String, body: String) { + public var displayMessage: (title: String, body: String) { if let description = self.userInfo[NSLocalizedDescriptionKey] as? String { return (title: "Error", body: description) } else if let failure = self.userInfo[NSLocalizedFailureErrorKey] as? String, let reason = self.localizedFailureReason { @@ -19,11 +17,11 @@ extension NSError { } extension CocoaError { - static func error(_ description: String) -> NSError { + public static func error(_ description: String) -> NSError { return error(Code(rawValue: 0), userInfo: [NSLocalizedDescriptionKey: description], url: nil) as NSError } - static func error(_ error: String, reason: String, suggestion: String? = nil) -> NSError { + public static func error(_ error: String, reason: String, suggestion: String? = nil) -> NSError { var info = [ NSLocalizedFailureErrorKey: error, NSLocalizedFailureReasonErrorKey: reason @@ -37,30 +35,6 @@ extension CocoaError { } } -extension UIViewController { - func show(error: Error, animated: Bool = true, completion: (() -> Void)? = nil) { - let msg = (error as NSError).displayMessage - let alert = UIAlertController(title: msg.title, message: msg.body, preferredStyle: .alert) - alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { _ in - completion?() - })) - self.present(alert, animated: animated) - } - - func showAlert(title: String, message: String) { - let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) - alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) - self.present(alert, animated: true) - } -} - -extension HUD { - static func show(error: Error) { - let msg = (error as NSError).displayMessage - self.flash(.labeledError(title: msg.title, subtitle: msg.body), delay: 2.0) - } -} - extension CLError.Code: CustomStringConvertible { public var description: String { switch self { diff --git a/AutoCat/Extensions/Exportable.swift b/AutoCatCore/Extensions/Exportable.swift similarity index 76% rename from AutoCat/Extensions/Exportable.swift rename to AutoCatCore/Extensions/Exportable.swift index 4a6a98a..cad673f 100644 --- a/AutoCat/Extensions/Exportable.swift +++ b/AutoCatCore/Extensions/Exportable.swift @@ -1,6 +1,6 @@ import Foundation -protocol Exportable { +public protocol Exportable { static var csvHeader: String { get } var csvLine: String { get } } diff --git a/AutoCatCore/Info.plist b/AutoCatCore/Info.plist new file mode 100644 index 0000000..9bcb244 --- /dev/null +++ b/AutoCatCore/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/AutoCat/Models/AudioRecord.swift b/AutoCatCore/Models/AudioRecord.swift similarity index 56% rename from AutoCat/Models/AudioRecord.swift rename to AutoCatCore/Models/AudioRecord.swift index 881d772..70551b1 100644 --- a/AutoCat/Models/AudioRecord.swift +++ b/AutoCatCore/Models/AudioRecord.swift @@ -2,30 +2,30 @@ import Foundation import RealmSwift import DifferenceKit -class AudioRecord: Object, Identifiable, Differentiable, Cloneable { +public class AudioRecord: Object, Identifiable, Differentiable, Cloneable { - @objc dynamic var path: String = "" - @objc dynamic var number: String? - @objc dynamic var rawText: String = "" + @objc public dynamic var path: String = "" + @objc public dynamic var number: String? + @objc public dynamic var rawText: String = "" @objc private dynamic var addedDate: TimeInterval = 0 - @objc dynamic var duration: TimeInterval = 0 - @objc dynamic var event: VehicleEvent? + @objc public dynamic var duration: TimeInterval = 0 + @objc public dynamic var event: VehicleEvent? - var identifier: TimeInterval = 0 - var id: TimeInterval { + public var identifier: TimeInterval = 0 + public var id: TimeInterval { if self.identifier == 0 { self.identifier = self.addedDate } return self.identifier } - var differenceIdentifier: TimeInterval { id } + public var differenceIdentifier: TimeInterval { id } - func isContentEqual(to source: AudioRecord) -> Bool { + public func isContentEqual(to source: AudioRecord) -> Bool { return self == source } - init(path: String, number: String?, raw: String, duration: TimeInterval, event: VehicleEvent?) { + public init(path: String, number: String?, raw: String, duration: TimeInterval, event: VehicleEvent?) { self.path = path self.number = number self.duration = duration @@ -38,15 +38,15 @@ class AudioRecord: Object, Identifiable, Differentiable, Cloneable { super.init() } - override static func primaryKey() -> String? { + public override static func primaryKey() -> String? { return "path" } - override class func ignoredProperties() -> [String] { + public override class func ignoredProperties() -> [String] { return ["id", "identifier", "differenceIdentifier"] } - func getAddedDate() -> TimeInterval { + public func getAddedDate() -> TimeInterval { if self.identifier == 0 { self.identifier = self.addedDate print("getAddedDate: \(self.identifier)") @@ -57,7 +57,7 @@ class AudioRecord: Object, Identifiable, Differentiable, Cloneable { // MARK: - Cloneable - required init(copy: AudioRecord) { + required public init(copy: AudioRecord) { self.path = copy.path self.number = copy.number self.rawText = copy.rawText diff --git a/AutoCat/Models/Cloneable.swift b/AutoCatCore/Models/Cloneable.swift similarity index 63% rename from AutoCat/Models/Cloneable.swift rename to AutoCatCore/Models/Cloneable.swift index 4194051..6086a33 100644 --- a/AutoCat/Models/Cloneable.swift +++ b/AutoCatCore/Models/Cloneable.swift @@ -1,11 +1,11 @@ import Foundation -protocol Cloneable { +public protocol Cloneable { init(copy: Self) } extension Cloneable { - func clone() -> Self { + public func clone() -> Self { return Self.init(copy: self) } } diff --git a/AutoCat/Models/DateSection.swift b/AutoCatCore/Models/DateSection.swift similarity index 72% rename from AutoCat/Models/DateSection.swift rename to AutoCatCore/Models/DateSection.swift index 936643c..6d5eb90 100644 --- a/AutoCat/Models/DateSection.swift +++ b/AutoCatCore/Models/DateSection.swift @@ -2,24 +2,24 @@ import Foundation import SwiftDate import DifferenceKit -struct DateSection: Differentiable, DifferentiableSection, Hashable where T: Differentiable & Hashable { +public struct DateSection: Differentiable, DifferentiableSection, Hashable where T: Differentiable & Hashable { var timestamp: Double = 0 - var header: String - var elements: [T] + public var header: String + public var elements: [T] - init(source: DateSection, elements: C) where C : Swift.Collection, C.Element == Self.Collection.Element { + public init(source: DateSection, elements: C) where C : Swift.Collection, C.Element == Self.Collection.Element { self.timestamp = source.timestamp self.header = source.header self.elements = Array(elements) } - init(original: DateSection, items: [T]) { + public init(original: DateSection, items: [T]) { self = original self.elements = items } - init(timestamp: Double, items: [T]) { + public init(timestamp: Double, items: [T]) { let formatter = DateFormatter() formatter.dateStyle = .medium formatter.timeStyle = .medium @@ -51,27 +51,27 @@ struct DateSection: Differentiable, DifferentiableSection, Hashable where T: self.elements = items } - mutating func append(_ element: T) { + public mutating func append(_ element: T) { self.elements.append(element) } // MARK: - Differentiable - var differenceIdentifier: String { + public var differenceIdentifier: String { return header } - func isContentEqual(to source: DateSection) -> Bool { + public func isContentEqual(to source: DateSection) -> Bool { return self.differenceIdentifier == source.differenceIdentifier } // MARK: - Hashable - static func == (lhs: DateSection, rhs: DateSection) -> Bool { + public static func == (lhs: DateSection, rhs: DateSection) -> Bool { return lhs.timestamp == rhs.timestamp && lhs.elements == rhs.elements } - func hash(into hasher: inout Hasher) { + public func hash(into hasher: inout Hasher) { hasher.combine(self.timestamp) hasher.combine(self.elements) } diff --git a/AutoCatCore/Models/DebugInfo.swift b/AutoCatCore/Models/DebugInfo.swift new file mode 100644 index 0000000..74f9e08 --- /dev/null +++ b/AutoCatCore/Models/DebugInfo.swift @@ -0,0 +1,27 @@ +import Foundation +import RealmSwift + +public enum DebugInfoStatus: Int { + case success = 0 + case error = 1 + case warning = 2 +} + +public class DebugInfo: Object, Decodable { + @objc public dynamic var autocod: DebugInfoEntry! + @objc public dynamic var vin01vin: DebugInfoEntry! + @objc public dynamic var vin01base: DebugInfoEntry! + @objc public dynamic var vin01history: DebugInfoEntry! + @objc public dynamic var nomerogram: DebugInfoEntry! +} + +public class DebugInfoEntry: Object, Decodable { + @objc public dynamic var fields: Int64 = 0 + @objc public dynamic var error: String? + @objc public dynamic var status: Int = 0 + + public var statusEnum: DebugInfoStatus { + get { DebugInfoStatus(rawValue: self.status)! } + set { self.status = newValue.rawValue } + } +} diff --git a/AutoCatCore/Models/Filter.swift b/AutoCatCore/Models/Filter.swift new file mode 100644 index 0000000..b7310fd --- /dev/null +++ b/AutoCatCore/Models/Filter.swift @@ -0,0 +1,116 @@ +import Foundation + +public enum AddedBy: String, CustomStringConvertible, CaseIterable { + case anyone + case me + case anyoneButMe + + public var description: String { + switch self { + case .anyone: return NSLocalizedString("Anyone", comment: "Added by") + case .me: return NSLocalizedString("Me", comment: "Added by") + case .anyoneButMe: return NSLocalizedString("Anyone but me", comment: "Added by") + } + } +} + +public enum SortParameter: String, CustomStringConvertible, CaseIterable { + case addedDate + case updatedDate + + public var description: String { + switch self { + case .addedDate: return NSLocalizedString("added time", comment: "sort by added time") + case .updatedDate: return NSLocalizedString("updated time", comment: "sort by updated time") + } + } +} + +public enum SortOrder: String, CustomStringConvertible, CaseIterable { + case ascending + case descending + + public var description: String { + switch self { + case .ascending: return NSLocalizedString("ascending", comment: "sort order") + case .descending: return NSLocalizedString("descending", comment: "sort order") + } + } +} + +public struct Filter { + public var searchString = "" + public var brand: String? + public var model: String? + public var color: String? + public var year: String? + public var regions: [Int]? + public var addedBy: AddedBy? + public var sortBy: SortParameter? = .updatedDate + public var sortOrder: SortOrder? = .descending + public var fromDate: Date? + public var toDate: Date? + public var fromDateUpdated: Date? + public var toDateUpdated: Date? + + public init() { + } + + public mutating func clear() { + self.brand = nil + self.model = nil + self.color = nil + self.year = nil + self.regions = nil + self.addedBy = nil + self.sortBy = .updatedDate + self.sortOrder = .descending + self.fromDate = nil + self.toDate = nil + self.fromDateUpdated = nil + self.toDateUpdated = nil + } + + public func queryDictionary() -> [String: String] { + var dict: [String: String] = ["query": self.searchString] + + if let brand = self.brand { + dict["brand"] = brand + } + if let model = self.model { + dict["model"] = model + } + if let color = self.color { + dict["color"] = color + } + if let year = self.year { + dict["year"] = year + } + if let regions = self.regions { + dict["regions"] = regions.map(String.init).joined(separator: ",") + } + if let addedBy = self.addedBy { + dict["addedBy"] = addedBy.rawValue + } + if let sortBy = self.sortBy { + dict["sortBy"] = sortBy.rawValue + } + if let sortOrder = self.sortOrder { + dict["sortOrder"] = sortOrder.rawValue + } + if let fromDate = self.fromDate { + dict["fromDate"] = String(fromDate.timeIntervalSince1970) + } + if let toDate = self.toDate { + dict["toDate"] = String(toDate.timeIntervalSince1970) + } + if let fromDateUpdated = self.fromDateUpdated { + dict["fromDateUpdated"] = String(fromDateUpdated.timeIntervalSince1970) + } + if let toDateUpdated = self.toDateUpdated { + dict["toDateUpdated"] = String(toDateUpdated.timeIntervalSince1970) + } + + return dict + } +} diff --git a/AutoCatCore/Models/Osago.swift b/AutoCatCore/Models/Osago.swift new file mode 100644 index 0000000..449f2e8 --- /dev/null +++ b/AutoCatCore/Models/Osago.swift @@ -0,0 +1,32 @@ +import Foundation +import RealmSwift + +public class Osago: Object, Decodable, Cloneable { + @objc public dynamic var date: TimeInterval = 0 + @objc public dynamic var number: String = "" + @objc public dynamic var vin: String? + @objc public dynamic var plateNumber: String? + @objc public dynamic var name: String = "" + @objc public dynamic var status: String = "" + @objc public dynamic var restrictions: String = "" + @objc public dynamic var insurant: String? + @objc public dynamic var owner: String? + @objc public dynamic var usageRegion: String? + + public required init(copy: Osago) { + self.date = copy.date + self.number = copy.number + self.vin = copy.vin + self.plateNumber = copy.plateNumber + self.name = copy.name + self.status = copy.status + self.restrictions = copy.restrictions + self.insurant = copy.insurant + self.owner = copy.owner + self.usageRegion = copy.usageRegion + } + + required init() { + super.init() + } +} diff --git a/AutoCatCore/Models/PagedResponse.swift b/AutoCatCore/Models/PagedResponse.swift new file mode 100644 index 0000000..b2a72d5 --- /dev/null +++ b/AutoCatCore/Models/PagedResponse.swift @@ -0,0 +1,13 @@ +import Foundation + +public class PagedResponse: Decodable where T: Decodable { + public let count: Int? + public let pageToken: String? + public let items: [T] + + public init() { + self.items = [] + self.count = nil + self.pageToken = nil + } +} diff --git a/AutoCat/Models/PlateNumber.swift b/AutoCatCore/Models/PlateNumber.swift similarity index 74% rename from AutoCat/Models/PlateNumber.swift rename to AutoCatCore/Models/PlateNumber.swift index 5fa5604..b861870 100644 --- a/AutoCat/Models/PlateNumber.swift +++ b/AutoCatCore/Models/PlateNumber.swift @@ -1,24 +1,24 @@ import Foundation -class PlateNumber { +public class PlateNumber { private var number: String private var numberEnglish: String - init(_ string: String) { + public init(_ string: String) { self.number = string self.numberEnglish = String(self.number.map { Constants.pnLettersMap[$0] ?? $0 }) } - func asString() -> String { + public func asString() -> String { return self.number } - func mainPart() -> String { + public func mainPart() -> String { let index = self.numberEnglish.index(self.numberEnglish.startIndex, offsetBy: 6) return String(self.numberEnglish[.. String { + public func region() -> String { let index = self.numberEnglish.index(self.numberEnglish.startIndex, offsetBy: 6) return String(self.numberEnglish[index...]) } diff --git a/AutoCat/Models/Response.swift b/AutoCatCore/Models/Response.swift similarity index 100% rename from AutoCat/Models/Response.swift rename to AutoCatCore/Models/Response.swift diff --git a/AutoCat/Models/Settings.swift b/AutoCatCore/Models/Settings.swift similarity index 87% rename from AutoCat/Models/Settings.swift rename to AutoCatCore/Models/Settings.swift index 3365176..5b149c8 100644 --- a/AutoCat/Models/Settings.swift +++ b/AutoCatCore/Models/Settings.swift @@ -1,10 +1,10 @@ import Foundation -class Settings { +public class Settings { private static let defaults = UserDefaults.standard public static let shared = Settings() - var user: User { + public var user: User { didSet { if let json = try? JSONEncoder().encode(self.user) { Settings.defaults.set(json, forKey: "user") @@ -13,35 +13,35 @@ class Settings { } } - var recognizeAlternativeOrder: Bool = false { + public var recognizeAlternativeOrder: Bool = false { didSet { Settings.defaults.set(self.recognizeAlternativeOrder, forKey: "recognizeAlternativeOrder") Settings.defaults.synchronize() } } - var recognizeShortenedNumbers: Bool = false { + public var recognizeShortenedNumbers: Bool = false { didSet { Settings.defaults.set(self.recognizeShortenedNumbers, forKey: "recognizeShortenedNumbers") Settings.defaults.synchronize() } } - var defaultRegion: String = "" { + public var defaultRegion: String = "" { didSet { Settings.defaults.set(self.defaultRegion, forKey: "defaultRegion") Settings.defaults.synchronize() } } - var recordBeep: Bool = false { + public var recordBeep: Bool = false { didSet { Settings.defaults.set(self.recordBeep, forKey: "recordBeep") Settings.defaults.synchronize() } } - var showDebugInfo: Bool = false { + public var showDebugInfo: Bool = false { didSet { Settings.defaults.set(self.showDebugInfo, forKey: "showDebugInfo") Settings.defaults.synchronize() diff --git a/AutoCatCore/Models/User.swift b/AutoCatCore/Models/User.swift new file mode 100644 index 0000000..68f4508 --- /dev/null +++ b/AutoCatCore/Models/User.swift @@ -0,0 +1,13 @@ +import Foundation + +public struct User: Codable { + public let email: String + public var token: String + public var firebaseIdToken: String? + public var firebaseRefreshToken: String? + + public init() { + self.email = "" + self.token = "" + } +} diff --git a/AutoCat/Models/Vehicle.swift b/AutoCatCore/Models/Vehicle.swift similarity index 69% rename from AutoCat/Models/Vehicle.swift rename to AutoCatCore/Models/Vehicle.swift index 2d15fa5..f8464a7 100644 --- a/AutoCat/Models/Vehicle.swift +++ b/AutoCatCore/Models/Vehicle.swift @@ -2,11 +2,11 @@ import Foundation import RealmSwift import DifferenceKit -class VehicleName: Object, Decodable, Cloneable { - @objc dynamic var original: String? - @objc dynamic var normalized: String? +public class VehicleName: Object, Decodable, Cloneable { + @objc public dynamic var original: String? + @objc public dynamic var normalized: String? - required init(copy: VehicleName) { + public required init(copy: VehicleName) { self.original = copy.original self.normalized = copy.normalized } @@ -15,11 +15,11 @@ class VehicleName: Object, Decodable, Cloneable { } } -class VehicleBrand: Object, Decodable, Cloneable { - @objc dynamic var name: VehicleName? - @objc dynamic var logo: String? +public class VehicleBrand: Object, Decodable, Cloneable { + @objc public dynamic var name: VehicleName? + @objc public dynamic var logo: String? - required init(copy: VehicleBrand) { + public required init(copy: VehicleBrand) { self.name = copy.name?.clone() self.logo = copy.logo } @@ -29,10 +29,10 @@ class VehicleBrand: Object, Decodable, Cloneable { } } -class VehicleModel: Object, Decodable, Cloneable { +public class VehicleModel: Object, Decodable, Cloneable { @objc dynamic var name: VehicleName? - required init(copy: VehicleModel) { + public required init(copy: VehicleModel) { self.name = copy.name?.clone() } @@ -41,18 +41,18 @@ class VehicleModel: Object, Decodable, Cloneable { } } -class VehicleEngine: Object, Decodable, Cloneable { - @objc dynamic var number: String? - var volume: RealmOptional = RealmOptional(0) - @objc dynamic var powerHp: Float = 0 - var powerKw: RealmOptional = RealmOptional(0) - @objc dynamic var fuelType: String? +public class VehicleEngine: Object, Decodable, Cloneable { + @objc public dynamic var number: String? + public var volume: RealmOptional = RealmOptional(0) + @objc public dynamic var powerHp: Float = 0 + public var powerKw: RealmOptional = RealmOptional(0) + @objc public dynamic var fuelType: String? enum CodingKeys: String, CodingKey { case number, volume, powerHp, powerKw, fuelType } - required init(from decoder: Decoder) throws { + required public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.number = try container.decodeIfPresent(String.self, forKey: .number) self.volume = RealmOptional(try container.decodeIfPresent(Int.self, forKey: .volume)) @@ -65,7 +65,7 @@ class VehicleEngine: Object, Decodable, Cloneable { super.init() } - required init(copy: VehicleEngine) { + public required init(copy: VehicleEngine) { self.number = copy.number self.volume = copy.volume self.powerHp = copy.powerHp @@ -74,13 +74,13 @@ class VehicleEngine: Object, Decodable, Cloneable { } } -class VehiclePhoto: Object, Decodable, Cloneable { - @objc dynamic var brand: String? - @objc dynamic var model: String? - @objc dynamic var date: TimeInterval = 0 - @objc dynamic var url: String = "" +public class VehiclePhoto: Object, Decodable, Cloneable { + @objc public dynamic var brand: String? + @objc public dynamic var model: String? + @objc public dynamic var date: TimeInterval = 0 + @objc public dynamic var url: String = "" - override var description: String { + public override var description: String { let formatter = DateFormatter() formatter.timeZone = TimeZone(identifier:"GMT") formatter.dateStyle = .medium @@ -90,7 +90,7 @@ class VehiclePhoto: Object, Decodable, Cloneable { return "\(self.brand ?? "") \(self.model ?? "") (\(dateStr))" } - required init(copy: VehiclePhoto) { + public required init(copy: VehiclePhoto) { self.brand = copy.brand self.model = copy.model self.date = copy.date @@ -102,11 +102,11 @@ class VehiclePhoto: Object, Decodable, Cloneable { } } -enum OwnerType: String, CustomStringConvertible { +public enum OwnerType: String, CustomStringConvertible { case legal case individual - var description: String { + public var description: String { switch self { case .legal: return NSLocalizedString("legal", comment: "Owner type") case .individual: return NSLocalizedString("individual", comment: "Owner type") @@ -114,12 +114,12 @@ enum OwnerType: String, CustomStringConvertible { } } -enum SteeringWheelPosition: CustomStringConvertible { +public enum SteeringWheelPosition: CustomStringConvertible { case left case right case unknown - var description: String { + public var description: String { switch self { case .left: return "Left" case .right: return "Right" @@ -128,20 +128,20 @@ enum SteeringWheelPosition: CustomStringConvertible { } } -class VehicleOwnershipPeriod: Object, Decodable, Cloneable { - @objc dynamic var lastOperation: String = "" - @objc dynamic var ownerType: String = "" - @objc dynamic var from: Int64 = 0 - @objc dynamic var to: Int64 = 0 - @objc dynamic var region: String? - @objc dynamic var registrationRegion: String? - @objc dynamic var locality: String? - @objc dynamic var code: String? - @objc dynamic var street: String? - @objc dynamic var building: String? - @objc dynamic var inn: String? +public class VehicleOwnershipPeriod: Object, Decodable, Cloneable { + @objc public dynamic var lastOperation: String = "" + @objc public dynamic var ownerType: String = "" + @objc public dynamic var from: Int64 = 0 + @objc public dynamic var to: Int64 = 0 + @objc public dynamic var region: String? + @objc public dynamic var registrationRegion: String? + @objc public dynamic var locality: String? + @objc public dynamic var code: String? + @objc public dynamic var street: String? + @objc public dynamic var building: String? + @objc public dynamic var inn: String? - required init(copy: VehicleOwnershipPeriod) { + required public init(copy: VehicleOwnershipPeriod) { self.lastOperation = copy.lastOperation self.ownerType = copy.ownerType self.from = copy.from @@ -160,30 +160,30 @@ class VehicleOwnershipPeriod: Object, Decodable, Cloneable { } } -class Vehicle: Object, Decodable, Identifiable, Differentiable, Cloneable, Exportable { - @objc dynamic var brand: VehicleBrand? - @objc dynamic var model: VehicleModel? - @objc dynamic var color: String? - @objc dynamic var year: Int = 0 - @objc dynamic var category: String? - @objc dynamic var engine: VehicleEngine? +public class Vehicle: Object, Decodable, Identifiable, Differentiable, Cloneable, Exportable { + @objc public dynamic var brand: VehicleBrand? + @objc public dynamic var model: VehicleModel? + @objc public dynamic var color: String? + @objc public dynamic var year: Int = 0 + @objc public dynamic var category: String? + @objc public dynamic var engine: VehicleEngine? @objc private dynamic var number: String = "" - @objc dynamic var currentNumber: String? - @objc dynamic var vin1: String? - @objc dynamic var vin2: String? - @objc dynamic var sts: String? - @objc dynamic var pts: String? - var isRightWheel = RealmOptional() - var isJapanese: RealmOptional = RealmOptional() - @objc dynamic var addedDate: TimeInterval = 0 - @objc dynamic var updatedDate: TimeInterval = 0 - @objc dynamic var addedBy: String = "" - var photos = List() - var ownershipPeriods = List() - var events = List() - var osagoContracts = List() - var ads = List() - @objc dynamic var debugInfo: DebugInfo? + @objc public dynamic var currentNumber: String? + @objc public dynamic var vin1: String? + @objc public dynamic var vin2: String? + @objc public dynamic var sts: String? + @objc public dynamic var pts: String? + public var isRightWheel = RealmOptional() + public var isJapanese: RealmOptional = RealmOptional() + @objc public dynamic var addedDate: TimeInterval = 0 + @objc public dynamic var updatedDate: TimeInterval = 0 + @objc public dynamic var addedBy: String = "" + public var photos = List() + public var ownershipPeriods = List() + public var events = List() + public var osagoContracts = List() + public var ads = List() + @objc public dynamic var debugInfo: DebugInfo? lazy var formatter: DateFormatter = { let f = DateFormatter() @@ -192,9 +192,9 @@ class Vehicle: Object, Decodable, Identifiable, Differentiable, Cloneable, Expor return f }() - var differenceIdentifier: String { self.number } + public var differenceIdentifier: String { self.number } - func isContentEqual(to source: Vehicle) -> Bool { + public func isContentEqual(to source: Vehicle) -> Bool { return self.number == source.number && self.addedDate == source.addedDate && self.updatedDate == source.updatedDate @@ -226,7 +226,7 @@ class Vehicle: Object, Decodable, Identifiable, Differentiable, Cloneable, Expor case debugInfo } - required init(from decoder: Decoder) throws { + required public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.brand = try container.decodeIfPresent(VehicleBrand.self, forKey: .brand) self.model = try container.decodeIfPresent(VehicleModel.self, forKey: .model) @@ -272,29 +272,29 @@ class Vehicle: Object, Decodable, Identifiable, Differentiable, Cloneable, Expor super.init() } - init(_ number: String) { + public init(_ number: String) { self.number = number self.addedDate = Date().timeIntervalSince1970 self.updatedDate = self.addedDate } - func getNumber() -> String { + public func getNumber() -> String { return self.number } - override static func primaryKey() -> String? { + public override static func primaryKey() -> String? { return "number" } - override class func ignoredProperties() -> [String] { + public override class func ignoredProperties() -> [String] { return ["id", "identifier", "differenceIdentifier", "formatter"] } - var unrecognized: Bool { + public var unrecognized: Bool { return self.brand == nil } - var outdated: Bool { + public var outdated: Bool { if let current = self.currentNumber { return current != self.number } else { @@ -304,7 +304,7 @@ class Vehicle: Object, Decodable, Identifiable, Differentiable, Cloneable, Expor // MARK: - Cloneable - required init(copy: Vehicle) { + required public init(copy: Vehicle) { self.brand = copy.brand self.model = copy.model self.color = copy.color @@ -346,11 +346,11 @@ class Vehicle: Object, Decodable, Identifiable, Differentiable, Cloneable, Expor // MARK: - Exportable - static var csvHeader: String { + public static var csvHeader: String { return "Model, Color, Year, Plate Number, VIN, STS, PTS, Added Date, Updated date" } - var csvLine: String { + public var csvLine: String { let model = self.brand?.name?.original ?? "" let added = self.formatter.string(from: Date(timeIntervalSince1970: self.addedDate)) let updated = self.formatter.string(from: Date(timeIntervalSince1970: self.updatedDate)) diff --git a/AutoCatCore/Models/VehicleAd.swift b/AutoCatCore/Models/VehicleAd.swift new file mode 100644 index 0000000..8cdd06c --- /dev/null +++ b/AutoCatCore/Models/VehicleAd.swift @@ -0,0 +1,33 @@ +import Foundation +import RealmSwift + +public class VehicleAd: Object, Decodable, Cloneable { + @objc public dynamic var id: Int = 0 + @objc public dynamic var url: String? + @objc public dynamic var price: String? + @objc public dynamic var date: TimeInterval = Date().timeIntervalSince1970 + @objc public dynamic var mileage: String? + @objc public dynamic var region: String? + @objc public dynamic var city: String? + @objc public dynamic var adDescription: String? + public var photos = List() + + public required init(copy: VehicleAd) { + self.id = copy.id + self.url = copy.url + self.price = copy.price + self.date = copy.date + self.mileage = copy.mileage + self.region = copy.region + self.city = copy.city + self.adDescription = copy.adDescription + + let photos = List() + photos.append(objectsIn: copy.photos) + self.photos = photos + } + + required init() { + super.init() + } +} diff --git a/AutoCat/Models/VehicleEvent.swift b/AutoCatCore/Models/VehicleEvent.swift similarity index 66% rename from AutoCat/Models/VehicleEvent.swift rename to AutoCatCore/Models/VehicleEvent.swift index ff80756..093ab0a 100644 --- a/AutoCat/Models/VehicleEvent.swift +++ b/AutoCatCore/Models/VehicleEvent.swift @@ -3,21 +3,21 @@ import RealmSwift import RxSwift import CoreLocation -class VehicleEvent: Object, Codable, Cloneable { - @objc dynamic var id: String? - @objc dynamic var date: TimeInterval = Date().timeIntervalSince1970 - @objc dynamic var latitude: Double = 0 - @objc dynamic var longitude: Double = 0 - @objc dynamic var speed: Double = 0 - @objc dynamic var direction: Double = 0 - @objc dynamic var address: String? = nil +public class VehicleEvent: Object, Codable, Cloneable { + @objc public dynamic var id: String? + @objc public dynamic var date: TimeInterval = Date().timeIntervalSince1970 + @objc public dynamic var latitude: Double = 0 + @objc public dynamic var longitude: Double = 0 + @objc public dynamic var speed: Double = 0 + @objc public dynamic var direction: Double = 0 + @objc public dynamic var address: String? = nil - var number: String? - var coordinate: CLLocationCoordinate2D { + public var number: String? + public var coordinate: CLLocationCoordinate2D { return CLLocationCoordinate2D(latitude: self.latitude, longitude: self.longitude) } - init(lat: Double, lon: Double, speed: Double, dir: Double) { + public init(lat: Double, lon: Double, speed: Double, dir: Double) { self.latitude = lat self.longitude = lon self.speed = speed @@ -28,11 +28,11 @@ class VehicleEvent: Object, Codable, Cloneable { super.init() } - func findAddress() -> Single { + public func findAddress() -> Single { if address != nil { return Single.just(()) } else { - return LocationManager + return RxLocationManager .getAddressForLocation(latitude: self.latitude, longitude: self.longitude) .map { addr in if let realm = self.realm { @@ -44,11 +44,11 @@ class VehicleEvent: Object, Codable, Cloneable { } } - override static func ignoredProperties() -> [String] { + public override static func ignoredProperties() -> [String] { return ["plateNumber"] } - func getMapLink() -> URL? { + public func getMapLink() -> URL? { var urlString = "http://maps.apple.com/?sll=\(self.latitude),\(self.longitude)" if let address = self.address?.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) { urlString = urlString + "&address=" + address @@ -56,7 +56,7 @@ class VehicleEvent: Object, Codable, Cloneable { return URL(string: urlString) } - func getLocationString() -> String { + public func getLocationString() -> String { let coordinates = "Lat: \(self.latitude), Lon: \(self.longitude)" if let addressString = self.address { return "\(addressString) (\(coordinates)" @@ -67,7 +67,7 @@ class VehicleEvent: Object, Codable, Cloneable { // MARK: - Cloneable - required init(copy: VehicleEvent) { + public required init(copy: VehicleEvent) { self.id = copy.id self.date = copy.date self.latitude = copy.latitude diff --git a/AutoCatCore/Models/VehicleRegion.swift b/AutoCatCore/Models/VehicleRegion.swift new file mode 100644 index 0000000..d7c7eb1 --- /dev/null +++ b/AutoCatCore/Models/VehicleRegion.swift @@ -0,0 +1,10 @@ +import Foundation + +public struct VehicleRegion: Codable, Hashable { + public var name: String + public var codes: [Int] + + public static func == (lhs: VehicleRegion, rhs: VehicleRegion) -> Bool { + return lhs.name == rhs.name + } +} diff --git a/AutoCat/ThirdParty/AnyEncodable.swift b/AutoCatCore/ThirdParty/AnyEncodable.swift similarity index 100% rename from AutoCat/ThirdParty/AnyEncodable.swift rename to AutoCatCore/ThirdParty/AnyEncodable.swift diff --git a/AutoCat/ThirdParty/Base64FS.swift b/AutoCatCore/ThirdParty/Base64FS.swift similarity index 100% rename from AutoCat/ThirdParty/Base64FS.swift rename to AutoCatCore/ThirdParty/Base64FS.swift diff --git a/AutoCat/Utils/Api.swift b/AutoCatCore/Utils/Api.swift similarity index 99% rename from AutoCat/Utils/Api.swift rename to AutoCatCore/Utils/Api.swift index 12f56e4..da37a4f 100644 --- a/AutoCat/Utils/Api.swift +++ b/AutoCatCore/Utils/Api.swift @@ -2,7 +2,7 @@ import Foundation import RxSwift import RxCocoa -class Api { +public class Api { private static let session: URLSession = { let sessionConfig = URLSessionConfiguration.default diff --git a/AutoCatCore/Utils/Constants.swift b/AutoCatCore/Utils/Constants.swift new file mode 100644 index 0000000..7b58439 --- /dev/null +++ b/AutoCatCore/Utils/Constants.swift @@ -0,0 +1,34 @@ +import Foundation + +public enum Constants { + public static var baseUrl: String { + #if DEBUG + return "http://127.0.0.1:3000/" + //return "http://192.168.1.67:3000/" + //return "https://vps.aliencat.pro:8443/" + #else + return "https://vps.aliencat.pro:8443/" + #endif + } + + public static let pnLettersMap: [Character: Character] = [ + "А": "A", "В": "B", "Е": "E", "К": "K", "М": "M", "Н": "H", "О": "O", "Р": "P", "С": "C", "Т": "T", "У": "Y", "Х": "X" + ] + + public static let googleAuthURL = "https://accounts.google.com/o/oauth2/v2/auth" + public static let googleTokenURL = "https://oauth2.googleapis.com/token" + public static let googleRedirectURL = "com.googleusercontent.apps.994679674451-k7clunkk4nicl6iuajdtc5u7hvustbdb:/oauth2callback" + + public static let fbClientId = "994679674451-k7clunkk4nicl6iuajdtc5u7hvustbdb.apps.googleusercontent.com" + public static let fbApiKey = "AIzaSyDVlrQj_05y6AeZNf8enpSWFIiHhgwfnGI" + + public static let fbClientVersion = "iOS/FirebaseSDK/6.5.1/FirebaseCore-iOS" + public static let fbVerifyAssertion = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion" + public static let fbRefreshToken = "https://securetoken.googleapis.com/v1/token" + public static let fbUserAgent = "FirebaseAuth.iOS/6.5.1 ru.Vin01/1.0 iPhone/13.5 hw/sim" + + public static let secondProviderBundleId = "ru.Vin01" + + public static let reportLinkTokenSecret = "#TheTruthIsOutThere" + public static let reportLinkBaseURL = "https://auto.aliencat.pro/report.html" +} diff --git a/AutoCat/Utils/JWT.swift b/AutoCatCore/Utils/JWT.swift similarity index 90% rename from AutoCat/Utils/JWT.swift rename to AutoCatCore/Utils/JWT.swift index 8b8451f..91e8a98 100644 --- a/AutoCat/Utils/JWT.swift +++ b/AutoCatCore/Utils/JWT.swift @@ -61,33 +61,33 @@ extension String { } } -protocol JwtPayload: Codable { +public protocol JwtPayload: Codable { var exp: Int { get } } extension JwtPayload { - var exp: Int { 0 } + public var exp: Int { 0 } } -struct EmptyPayload: JwtPayload { } +public struct EmptyPayload: JwtPayload { } -struct FirebasePayload: JwtPayload { - var email: String - var name: String +public struct FirebasePayload: JwtPayload { + public var email: String + public var name: String } -struct NumberPayload: JwtPayload { - var plateNumber: String +public struct NumberPayload: JwtPayload { + public var plateNumber: String } -class JWT where T: JwtPayload { +public class JWT where T: JwtPayload { private var jwt: String public let payload: T public var expired: Bool { return TimeInterval(self.payload.exp) < Date().timeIntervalSince1970 } - init?(string: String) { + public init?(string: String) { self.jwt = string let parts = string.split(separator: ".") @@ -111,7 +111,7 @@ class JWT where T: JwtPayload { } } - static func generate(for plateNumber: String) throws -> String { + public static func generate(for plateNumber: String) throws -> String { let header = #"{ "typ": "JWT", "alg": "HS256" }"# let bodyDict: [String: Any] = [ "iat": Date().timeIntervalSince1970, diff --git a/AutoCat/Utils/Location.swift b/AutoCatCore/Utils/Location.swift similarity index 94% rename from AutoCat/Utils/Location.swift rename to AutoCatCore/Utils/Location.swift index baf2aca..097ce25 100644 --- a/AutoCat/Utils/Location.swift +++ b/AutoCatCore/Utils/Location.swift @@ -65,15 +65,16 @@ class RxLocationManagerDelegateProxy: DelegateProxy? - private(set) static var lastEvent: VehicleEvent? + public private(set) static var lastEvent: VehicleEvent? private static func checkPermissions() -> Single { return Single.create { observer in @@ -114,7 +115,7 @@ class LocationManager { return single } - static func requestCurrentLocation() -> Single { + public static func requestCurrentLocation() -> Single { if let result = self.eventObservable { return result } else { @@ -128,11 +129,11 @@ class LocationManager { } } - static func locationRequestInProgress() -> Bool { + public static func locationRequestInProgress() -> Bool { return self.eventObservable != nil } - static func getAddressForLocation(latitude: Double, longitude: Double) -> Single { + public static func getAddressForLocation(latitude: Double, longitude: Double) -> Single { return Single.create { observer in let geocoder = CLGeocoder() let location = CLLocation(latitude: latitude, longitude: longitude) @@ -152,7 +153,7 @@ class LocationManager { } } - static func resetLastEvent() { + public static func resetLastEvent() { self.lastEvent = nil } } diff --git a/AutoCatTests/AutoCatTests.swift b/AutoCatTests/AutoCatTests.swift new file mode 100644 index 0000000..c0b0e42 --- /dev/null +++ b/AutoCatTests/AutoCatTests.swift @@ -0,0 +1,19 @@ +import XCTest +import AutoCatCore + +class AutoCatTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + +} diff --git a/AutoCatTests/Info.plist b/AutoCatTests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/AutoCatTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/AutoCatTests/Mocks/FakeLocationManager.swift b/AutoCatTests/Mocks/FakeLocationManager.swift new file mode 100644 index 0000000..561115b --- /dev/null +++ b/AutoCatTests/Mocks/FakeLocationManager.swift @@ -0,0 +1,16 @@ +import Foundation +import CoreLocation + +class FakeLocationManager: CLLocationManager { + override func requestAlwaysAuthorization() { + + } + + override func requestLocation() { + + } + + override func stopUpdatingLocation() { + + } +}