Fix for history update bug. Report controller rewritten from MagazineLayout ti Eureke

This commit is contained in:
Selim Mustafaev 2020-11-15 19:10:44 +03:00
parent cefb0143e5
commit 6f62258f9e
12 changed files with 116 additions and 663 deletions

View File

@ -60,8 +60,6 @@
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 */; };
7A7547DD2403180A004E8406 /* SectionHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A7547DB2403180A004E8406 /* SectionHeader.swift */; };
7A7547DE2403180A004E8406 /* SectionHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7A7547DC2403180A004E8406 /* SectionHeader.xib */; };
7A7547E024032CB6004E8406 /* VehiclePhotoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A7547DF24032CB6004E8406 /* VehiclePhotoCell.swift */; };
7A813DBE2506A57100CC93B9 /* AuthenticationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A813DBD2506A57100CC93B9 /* AuthenticationServices.framework */; };
7A813DC12508C4D900CC93B9 /* ExceptionCatcher in Frameworks */ = {isa = PBXBuildFile; productRef = 7A813DC02508C4D900CC93B9 /* ExceptionCatcher */; };
@ -96,10 +94,7 @@
7AEF47A4253DC4D2001D6238 /* Eureka in Frameworks */ = {isa = PBXBuildFile; productRef = 7AEF47A3253DC4D2001D6238 /* Eureka */; };
7AEFC3BE2529D3CC00BADFB2 /* ConfigurableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AEFC3BD2529D3CC00BADFB2 /* ConfigurableCell.swift */; };
7AEFE728240455E200910EB7 /* SettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AEFE727240455E200910EB7 /* SettingsController.swift */; };
7AF58D2F24029C5200CE01A0 /* MagazineLayout in Frameworks */ = {isa = PBXBuildFile; productRef = 7AF58D2E24029C5200CE01A0 /* MagazineLayout */; };
7AF58D3124029E1000CE01A0 /* VehicleHeaderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF58D3024029E1000CE01A0 /* VehicleHeaderCell.swift */; };
7AF58D342402A91C00CE01A0 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 7AF58D332402A91C00CE01A0 /* Kingfisher */; };
7AF58D58240309CA00CE01A0 /* VehicleTextParamCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF58D57240309CA00CE01A0 /* VehicleTextParamCell.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -152,8 +147,6 @@
7A6DD90B24335A6D009DE740 /* FlagLayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlagLayer.swift; sourceTree = "<group>"; };
7A6DD90D24337930009DE740 /* PlateNumber.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlateNumber.swift; sourceTree = "<group>"; };
7A6E03272485951700DB22ED /* OwnersController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OwnersController.swift; sourceTree = "<group>"; };
7A7547DB2403180A004E8406 /* SectionHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionHeader.swift; sourceTree = "<group>"; };
7A7547DC2403180A004E8406 /* SectionHeader.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SectionHeader.xib; sourceTree = "<group>"; };
7A7547DF24032CB6004E8406 /* VehiclePhotoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VehiclePhotoCell.swift; sourceTree = "<group>"; };
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 = "<group>"; };
@ -185,8 +178,6 @@
7AE26A3424F31B0700625033 /* EventsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventsController.swift; sourceTree = "<group>"; };
7AEFC3BD2529D3CC00BADFB2 /* ConfigurableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurableCell.swift; sourceTree = "<group>"; };
7AEFE727240455E200910EB7 /* SettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsController.swift; sourceTree = "<group>"; };
7AF58D3024029E1000CE01A0 /* VehicleHeaderCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VehicleHeaderCell.swift; sourceTree = "<group>"; };
7AF58D57240309CA00CE01A0 /* VehicleTextParamCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VehicleTextParamCell.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -207,7 +198,6 @@
7AABDE23253327F10041AFC6 /* DifferenceKit in Frameworks */,
7A530B8B240181F500CBFE6E /* RxRealm in Frameworks */,
7A11471F23FEA18700B424AF /* RxRelay in Frameworks */,
7AF58D2F24029C5200CE01A0 /* MagazineLayout in Frameworks */,
7A11471D23FEA18700B424AF /* RxSwift in Frameworks */,
7A11472623FEA1F400B424AF /* Realm in Frameworks */,
);
@ -351,10 +341,6 @@
isa = PBXGroup;
children = (
7A530B7D24017FEE00CBFE6E /* VehicleCell.swift */,
7AF58D3024029E1000CE01A0 /* VehicleHeaderCell.swift */,
7AF58D57240309CA00CE01A0 /* VehicleTextParamCell.swift */,
7A7547DB2403180A004E8406 /* SectionHeader.swift */,
7A7547DC2403180A004E8406 /* SectionHeader.xib */,
7A7547DF24032CB6004E8406 /* VehiclePhotoCell.swift */,
7A1090E724A394F100B4F0B2 /* AudioRecordCell.swift */,
7A813DC22508EE4F00CC93B9 /* EventCell.swift */,
@ -434,7 +420,6 @@
7A11472523FEA1F400B424AF /* Realm */,
7A11472723FEA1F400B424AF /* RealmSwift */,
7A530B8A240181F500CBFE6E /* RxRealm */,
7AF58D2E24029C5200CE01A0 /* MagazineLayout */,
7AF58D332402A91C00CE01A0 /* Kingfisher */,
7A051610241412CA00FC55AC /* SwiftDate */,
7A813DC02508C4D900CC93B9 /* ExceptionCatcher */,
@ -474,7 +459,6 @@
7A11471B23FEA18700B424AF /* XCRemoteSwiftPackageReference "RxSwift" */,
7A11472423FEA1F400B424AF /* XCRemoteSwiftPackageReference "realm-cocoa" */,
7A530B89240181F500CBFE6E /* XCRemoteSwiftPackageReference "RxRealm" */,
7AF58D2D24029C5200CE01A0 /* XCRemoteSwiftPackageReference "MagazineLayout" */,
7AF58D322402A91C00CE01A0 /* XCRemoteSwiftPackageReference "Kingfisher" */,
7A05160F241412CA00FC55AC /* XCRemoteSwiftPackageReference "SwiftDate" */,
7A813DBF2508C4D900CC93B9 /* XCRemoteSwiftPackageReference "ExceptionCatcher" */,
@ -497,7 +481,6 @@
buildActionMask = 2147483647;
files = (
7ADF6C99250F872C00F237B2 /* RoadNumbers.otf in Resources */,
7A7547DE2403180A004E8406 /* SectionHeader.xib in Resources */,
7A11470D23FDE7E600B424AF /* LaunchScreen.storyboard in Resources */,
7A6DD90A24329541009DE740 /* RoadNumbers2.0.otf in Resources */,
7A11470A23FDE7E600B424AF /* Assets.xcassets in Resources */,
@ -551,14 +534,11 @@
7A6E03282485951700DB22ED /* OwnersController.swift in Sources */,
7A64AE742469DFB600ABE48E /* MediaContentView.swift in Sources */,
7A1090EC24A4E3E100B4F0B2 /* CellProgressView.swift in Sources */,
7A7547DD2403180A004E8406 /* SectionHeader.swift in Sources */,
7AF58D58240309CA00CE01A0 /* VehicleTextParamCell.swift in Sources */,
7A96AE2D246B2B7400297C33 /* GoogleSignInController.swift in Sources */,
7A15051224DB3E3000F39631 /* AnyEncodable.swift in Sources */,
7A1090EA24A3A26300B4F0B2 /* AudioPlayer.swift in Sources */,
7A11474723FF2AA500B424AF /* User.swift in Sources */,
7A11471623FDEB2A00B424AF /* MainSplitController.swift in Sources */,
7AF58D3124029E1000CE01A0 /* VehicleHeaderCell.swift in Sources */,
7A813DC5250AAF3C00CC93B9 /* LocationEditController.swift in Sources */,
7A43F9F8246C8A6200BA5B49 /* JWT.swift in Sources */,
7A6DD903242BF4A5009DE740 /* PlateView.swift in Sources */,
@ -732,6 +712,7 @@
DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 13.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -754,6 +735,7 @@
DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 13.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -854,14 +836,6 @@
kind = branch;
};
};
7AF58D2D24029C5200CE01A0 /* XCRemoteSwiftPackageReference "MagazineLayout" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/airbnb/MagazineLayout";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.5.5;
};
};
7AF58D322402A91C00CE01A0 /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/onevcat/Kingfisher";
@ -933,11 +907,6 @@
package = 7AEF47A2253DC4D2001D6238 /* XCRemoteSwiftPackageReference "Eureka" */;
productName = Eureka;
};
7AF58D2E24029C5200CE01A0 /* MagazineLayout */ = {
isa = XCSwiftPackageProductDependency;
package = 7AF58D2D24029C5200CE01A0 /* XCRemoteSwiftPackageReference "MagazineLayout" */;
productName = MagazineLayout;
};
7AF58D332402A91C00CE01A0 /* Kingfisher */ = {
isa = XCSwiftPackageProductDependency;
package = 7AF58D322402A91C00CE01A0 /* XCRemoteSwiftPackageReference "Kingfisher" */;

View File

@ -37,15 +37,6 @@
"version": "5.15.5"
}
},
{
"package": "MagazineLayout",
"repositoryURL": "https://github.com/airbnb/MagazineLayout",
"state": {
"branch": null,
"revision": "6f88742c282de208e48cb738a7a14b7dc2651701",
"version": "1.6.3"
}
},
{
"package": "PKHUD",
"repositoryURL": "https://github.com/pkluz/PKHUD.git",

View File

@ -8,7 +8,7 @@
BreakpointExtensionID = "Xcode.Breakpoint.SwiftErrorBreakpoint">
<BreakpointContent
uuid = "C14D0996-5708-44D2-A6BA-4A4B50B522EE"
shouldBeEnabled = "Yes"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No">
</BreakpointContent>
@ -17,7 +17,7 @@
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
uuid = "CF01B44D-372B-4C78-A197-7FDEC607CE0E"
shouldBeEnabled = "Yes"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
scope = "1"
@ -63,21 +63,5 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "91C7B4B0-D2EE-413D-8DFC-FC9421FDC23A"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AutoCat/ThirdParty/IHProgressHUD/IHProgressHUD.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "989"
endingLineNumber = "989"
landmarkName = "set(containerView:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -14,35 +14,35 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>5</integer>
<integer>8</integer>
</dict>
<key>DifferenceKit (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>6</integer>
<integer>9</integer>
</dict>
<key>DifferenceKit (Playground).xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>4</integer>
<integer>7</integer>
</dict>
<key>Eureka (Playground) 1.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>2</integer>
<integer>5</integer>
</dict>
<key>Eureka (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>3</integer>
<integer>6</integer>
</dict>
<key>Eureka (Playground) 3.xcscheme</key>
<dict>
@ -70,7 +70,7 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>1</integer>
<integer>4</integer>
</dict>
<key>GettingStarted (Playground) 1.xcscheme</key>
<dict>
@ -112,42 +112,42 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>13</integer>
<integer>12</integer>
</dict>
<key>Rx (Playground) 1.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>8</integer>
<integer>2</integer>
</dict>
<key>Rx (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>9</integer>
<integer>3</integer>
</dict>
<key>Rx (Playground).xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>7</integer>
<integer>1</integer>
</dict>
<key>SwiftDate (Playground) 1.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>10</integer>
<integer>11</integer>
</dict>
<key>SwiftDate (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>12</integer>
<integer>13</integer>
</dict>
<key>SwiftDate (Playground) 3.xcscheme</key>
<dict>
@ -175,7 +175,7 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>11</integer>
<integer>10</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>

View File

@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="pme-aR-UNJ">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="pme-aR-UNJ">
<device id="retina4_7" orientation="portrait" appearance="dark"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="collection view cell content view" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@ -17,175 +16,8 @@
<view key="view" contentMode="scaleToFill" id="u3u-z2-y6J">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="rG3-ze-Zre">
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
<color key="backgroundColor" systemColor="systemGroupedBackgroundColor"/>
<collectionViewFlowLayout key="collectionViewLayout" automaticEstimatedItemSize="YES" minimumLineSpacing="10" minimumInteritemSpacing="10" id="w9q-DU-Wac">
<size key="itemSize" width="303" height="85"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="VehicleHeaderCell" id="PxV-55-Ajy" customClass="VehicleHeaderCell" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="36" y="0.0" width="303" height="85"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="xpE-cC-0kB">
<rect key="frame" x="0.0" y="0.0" width="303" height="85"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="PNF-XJ-Eng">
<rect key="frame" x="8" y="8" width="287" height="69"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Y6d-8t-aA6">
<rect key="frame" x="0.0" y="0.0" width="64" height="69"/>
<constraints>
<constraint firstAttribute="width" constant="64" id="u1h-wz-yPt"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ysk-FW-p2W">
<rect key="frame" x="72" y="0.0" width="215" height="69"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="48" id="LY4-Uu-HcM"/>
</constraints>
</stackView>
</subviews>
<constraints>
<constraint firstItem="PNF-XJ-Eng" firstAttribute="top" secondItem="xpE-cC-0kB" secondAttribute="top" constant="8" id="7vz-6R-L0q"/>
<constraint firstItem="PNF-XJ-Eng" firstAttribute="leading" secondItem="xpE-cC-0kB" secondAttribute="leading" constant="8" id="N8F-gj-vIH"/>
<constraint firstAttribute="bottom" secondItem="PNF-XJ-Eng" secondAttribute="bottom" constant="8" id="XPz-Uh-X3F"/>
<constraint firstAttribute="trailing" secondItem="PNF-XJ-Eng" secondAttribute="trailing" constant="8" id="i3S-To-SCP"/>
</constraints>
</collectionViewCellContentView>
<color key="backgroundColor" systemColor="systemGroupedBackgroundColor"/>
<size key="customSize" width="303" height="85"/>
<connections>
<outlet property="logo" destination="Y6d-8t-aA6" id="Bai-Bn-lEh"/>
<outlet property="name" destination="Ysk-FW-p2W" id="xx2-sw-1tL"/>
</connections>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" reuseIdentifier="VehicleTextParamCell" id="3Qa-Fn-qe7" customClass="VehicleTextParamCell" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="118" width="145" height="42.5"/>
<autoresizingMask key="autoresizingMask"/>
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="fmb-JM-Fcr">
<rect key="frame" x="0.0" y="0.0" width="145" height="42.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="023-Q6-kPk">
<rect key="frame" x="16" y="8" width="52" height="26.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="Value" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="xoM-AA-KQ5" customClass="CustomTextField" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="76" y="8" width="53" height="27"/>
<color key="textColor" systemColor="secondaryLabelColor"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
<textInputTraits key="textInputTraits"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="editable" value="NO"/>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WAm-et-t5P">
<rect key="frame" x="0.0" y="41.5" width="145" height="1"/>
<color key="backgroundColor" systemColor="separatorColor"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Mpt-xA-af2"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="WAm-et-t5P" secondAttribute="bottom" id="91A-1k-B4C"/>
<constraint firstItem="WAm-et-t5P" firstAttribute="leading" secondItem="fmb-JM-Fcr" secondAttribute="leading" id="Qr4-Eb-9YL"/>
<constraint firstItem="xoM-AA-KQ5" firstAttribute="centerY" secondItem="fmb-JM-Fcr" secondAttribute="centerY" id="TRj-nX-R3d"/>
<constraint firstItem="xoM-AA-KQ5" firstAttribute="leading" secondItem="023-Q6-kPk" secondAttribute="trailing" constant="8" id="Vip-dt-0kM"/>
<constraint firstAttribute="bottom" secondItem="023-Q6-kPk" secondAttribute="bottom" constant="8" id="asT-vZ-W1W"/>
<constraint firstItem="023-Q6-kPk" firstAttribute="top" secondItem="fmb-JM-Fcr" secondAttribute="top" constant="8" id="i2x-Tv-BGw"/>
<constraint firstItem="023-Q6-kPk" firstAttribute="leading" secondItem="fmb-JM-Fcr" secondAttribute="leading" constant="16" id="j9m-4c-c7c"/>
<constraint firstAttribute="trailing" secondItem="xoM-AA-KQ5" secondAttribute="trailing" constant="16" id="oAu-y7-Ano"/>
<constraint firstAttribute="trailing" secondItem="WAm-et-t5P" secondAttribute="trailing" id="zil-58-Wao"/>
</constraints>
</collectionViewCellContentView>
<color key="backgroundColor" systemColor="tableCellGroupedBackgroundColor"/>
<connections>
<outlet property="dividerHeightConstraint" destination="Mpt-xA-af2" id="bYb-0D-Lz0"/>
<outlet property="paramName" destination="023-Q6-kPk" id="pGj-6y-fbP"/>
<outlet property="paramValue" destination="xoM-AA-KQ5" id="2Q2-ig-dIW"/>
</connections>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" reuseIdentifier="VehiclePhotoCell" id="X77-i3-DVY" customClass="VehiclePhotoCell" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="155" y="95" width="57.5" height="88"/>
<autoresizingMask key="autoresizingMask"/>
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="AMu-PZ-gGR">
<rect key="frame" x="0.0" y="0.0" width="57.5" height="88"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="wgf-C8-UOE">
<rect key="frame" x="0.0" y="0.0" width="57.5" height="37.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="wgf-C8-UOE" secondAttribute="height" multiplier="101:66" id="Eou-Ta-7sN"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1HU-6D-JSt">
<rect key="frame" x="8" y="217.5" width="41.5" height="20.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="l3q-fD-P3R">
<rect key="frame" x="8" y="242" width="41.5" height="18"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
<color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="1HU-6D-JSt" firstAttribute="top" secondItem="wgf-C8-UOE" secondAttribute="bottom" constant="4" id="2nP-F6-Jr9"/>
<constraint firstAttribute="trailing" secondItem="1HU-6D-JSt" secondAttribute="trailing" constant="8" id="AI8-D3-c49"/>
<constraint firstItem="l3q-fD-P3R" firstAttribute="top" secondItem="1HU-6D-JSt" secondAttribute="bottom" constant="4" id="Gxd-mq-F5c"/>
<constraint firstAttribute="trailing" secondItem="wgf-C8-UOE" secondAttribute="trailing" id="Moc-ou-hry"/>
<constraint firstAttribute="trailing" secondItem="l3q-fD-P3R" secondAttribute="trailing" constant="8" id="QwX-uc-3NV"/>
<constraint firstItem="1HU-6D-JSt" firstAttribute="leading" secondItem="AMu-PZ-gGR" secondAttribute="leading" constant="8" id="SAN-qq-lXm"/>
<constraint firstAttribute="bottom" secondItem="l3q-fD-P3R" secondAttribute="bottom" constant="4" id="TcR-1f-apo"/>
<constraint firstItem="wgf-C8-UOE" firstAttribute="leading" secondItem="AMu-PZ-gGR" secondAttribute="leading" id="jVo-O5-SX5"/>
<constraint firstItem="wgf-C8-UOE" firstAttribute="top" secondItem="AMu-PZ-gGR" secondAttribute="top" id="k1d-ot-dij"/>
<constraint firstItem="l3q-fD-P3R" firstAttribute="leading" secondItem="AMu-PZ-gGR" secondAttribute="leading" constant="8" id="u0P-VY-lFV"/>
</constraints>
</collectionViewCellContentView>
<color key="backgroundColor" systemColor="tableCellGroupedBackgroundColor"/>
<connections>
<outlet property="date" destination="l3q-fD-P3R" id="rEm-YK-xrw"/>
<outlet property="model" destination="1HU-6D-JSt" id="SfI-p5-s2o"/>
<outlet property="photo" destination="wgf-C8-UOE" id="ztK-ib-ImI"/>
</connections>
</collectionViewCell>
</cells>
<connections>
<outlet property="dataSource" destination="i1k-Y4-pyh" id="vJN-oM-YaN"/>
<outlet property="delegate" destination="i1k-Y4-pyh" id="ou7-HH-r6H"/>
</connections>
</collectionView>
</subviews>
<viewLayoutGuide key="safeArea" id="fbN-WR-iQY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="rG3-ze-Zre" firstAttribute="trailing" secondItem="fbN-WR-iQY" secondAttribute="trailing" id="8JI-c0-3hf"/>
<constraint firstItem="rG3-ze-Zre" firstAttribute="bottom" secondItem="u3u-z2-y6J" secondAttribute="bottom" id="ZCY-XN-Awz"/>
<constraint firstItem="rG3-ze-Zre" firstAttribute="top" secondItem="fbN-WR-iQY" secondAttribute="top" id="nqG-ez-Kjm"/>
<constraint firstItem="rG3-ze-Zre" firstAttribute="leading" secondItem="fbN-WR-iQY" secondAttribute="leading" id="qo7-O7-zc7"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="goK-kc-WCv">
<rightBarButtonItems>
@ -203,7 +35,6 @@
</navigationItem>
<connections>
<outlet property="actionBarItem" destination="2MI-Nh-b8L" id="hPg-h1-dgv"/>
<outlet property="collection" destination="rG3-ze-Zre" id="f8S-jh-WSw"/>
<outlet property="copyBarItem" destination="WZn-dn-wEG" id="NCX-Xv-vOx"/>
</connections>
</viewController>
@ -335,14 +166,14 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="VehicleCell" id="VEP-QD-i6y" customClass="VehicleCell" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="85.5"/>
<rect key="frame" x="0.0" y="28" width="375" height="85"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="VEP-QD-i6y" id="8hH-8I-XLB">
<rect key="frame" x="0.0" y="0.0" width="375" height="85.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="85"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Kia (JF) Optima" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AQY-7N-q8D">
<rect key="frame" x="8" y="8" width="124" height="21.5"/>
<rect key="frame" x="8" y="8" width="124" height="21"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
@ -354,7 +185,7 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cvf-vM-QnT" customClass="PlateView" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="8" y="37.5" width="317" height="40"/>
<rect key="frame" x="8" y="37" width="317" height="40"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="Xoz-Iw-PCU"/>
@ -1050,26 +881,14 @@
<systemColor name="secondaryLabelColor">
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="separatorColor">
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.28999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemBlueColor">
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemGroupedBackgroundColor">
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemTealColor">
<color red="0.35294117647058826" green="0.78431372549019607" blue="0.98039215686274506" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="tableCellGroupedBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="tableCellGroupedBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@ -1,18 +0,0 @@
import UIKit
import MagazineLayout
class SectionHeader: MagazineLayoutCollectionReusableView {
@IBOutlet weak var title: UILabel!
@IBOutlet weak var divider: UIView!
@IBOutlet weak var dividerHeightConstraint: NSLayoutConstraint!
override func awakeFromNib() {
super.awakeFromNib()
self.dividerHeightConstraint.constant = 1/UIScreen.main.scale
}
func configure(with section: ReportSection) {
self.title.text = section.description
self.divider.isHidden = section == .photos
}
}

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionReusableView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="U6b-Vx-4bR" customClass="SectionHeader" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FPf-35-HkN">
<rect key="frame" x="16" y="24" width="288" height="18"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<color key="textColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="co2-Tz-MXm">
<rect key="frame" x="0.0" y="49" width="320" height="1"/>
<color key="backgroundColor" systemColor="separatorColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.28999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="6Y8-H1-th4"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemGroupedBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="co2-Tz-MXm" secondAttribute="bottom" id="1cv-aB-G49"/>
<constraint firstAttribute="trailing" secondItem="FPf-35-HkN" secondAttribute="trailing" constant="16" id="7fE-KT-Qbf"/>
<constraint firstItem="VXr-Tz-HHm" firstAttribute="trailing" secondItem="co2-Tz-MXm" secondAttribute="trailing" id="GTl-lK-7Be"/>
<constraint firstItem="co2-Tz-MXm" firstAttribute="leading" secondItem="VXr-Tz-HHm" secondAttribute="leading" id="Hzk-ur-lNg"/>
<constraint firstItem="FPf-35-HkN" firstAttribute="leading" secondItem="U6b-Vx-4bR" secondAttribute="leading" constant="16" id="MeA-dL-PeZ"/>
<constraint firstItem="FPf-35-HkN" firstAttribute="top" secondItem="U6b-Vx-4bR" secondAttribute="top" constant="24" id="P1f-gG-3TZ"/>
<constraint firstItem="VXr-Tz-HHm" firstAttribute="bottom" secondItem="FPf-35-HkN" secondAttribute="bottom" constant="8" id="han-2D-OPQ"/>
</constraints>
<viewLayoutGuide key="safeArea" id="VXr-Tz-HHm"/>
<connections>
<outlet property="divider" destination="co2-Tz-MXm" id="0C5-OK-vyS"/>
<outlet property="dividerHeightConstraint" destination="6Y8-H1-th4" id="fQS-Xf-i5n"/>
<outlet property="title" destination="FPf-35-HkN" id="yr1-mY-pnu"/>
</connections>
<point key="canvasLocation" x="132" y="154"/>
</collectionReusableView>
</objects>
</document>

View File

@ -1,23 +0,0 @@
import UIKit
import MagazineLayout
import Kingfisher
class VehicleHeaderCell: MagazineLayoutCollectionViewCell {
@IBOutlet weak var logo: UIImageView!
@IBOutlet weak var name: UILabel!
private let placeholder = UIImage(named: "SteeringWheel")
override func prepareForReuse() {
self.logo.kf.cancelDownloadTask()
}
func configure(with vehicle: Vehicle) {
self.name.text = vehicle.brand?.name?.original
self.logo.image = self.placeholder
if let url = vehicle.brand?.logo {
self.logo.kf.setImage(with: URL(string: url), placeholder: self.placeholder)
}
}
}

View File

@ -1,8 +1,7 @@
import UIKit
import MagazineLayout
import Kingfisher
class VehiclePhotoCell: MagazineLayoutCollectionViewCell {
class VehiclePhotoCell: UICollectionViewCell {
@IBOutlet weak var photo: UIImageView!
@IBOutlet weak var model: UILabel!
@IBOutlet weak var date: UILabel!

View File

@ -1,18 +0,0 @@
import UIKit
import MagazineLayout
class VehicleTextParamCell: MagazineLayoutCollectionViewCell {
@IBOutlet weak var paramName: UILabel!
@IBOutlet weak var paramValue: UITextField!
@IBOutlet weak var dividerHeightConstraint: NSLayoutConstraint!
override func awakeFromNib() {
super.awakeFromNib()
self.dividerHeightConstraint.constant = 1/UIScreen.main.scale
}
func configure(param: String, value: String) {
self.paramName.text = param
self.paramValue.text = value
}
}

View File

@ -1,96 +1,21 @@
import UIKit
import MagazineLayout
import Kingfisher
import LinkPresentation
import RealmSwift
import Eureka
enum ReportSection: Int, CaseIterable, CustomStringConvertible {
case header = 0
case general = 1
case identifiers = 2
case engine = 3
case photos = 4
var description: String {
switch self {
case .header: return "Header"
case .general: return "General"
case .identifiers: return "Identifiers"
case .engine: return "Engine"
case .photos: return "Photos"
}
}
}
class ReportController: FormViewController, MediaBrowserViewControllerDataSource, MediaBrowserViewControllerDelegate, UIActivityItemSource {
enum ReportGeneralSection: Int, CaseIterable, CustomStringConvertible {
case year = 0
case color = 1
case category = 2
case wheelPosition = 3
case japanese = 4
case owners = 5
case events = 6
var description: String {
switch self {
case .year: return "Year"
case .color: return "Color"
case .category: return "Category"
case .wheelPosition: return "Steering wheel position"
case .japanese: return "Japanese"
case .owners: return "Owners (from PTS)"
case .events: return "Events"
}
}
}
enum ReportIdSection: Int, CaseIterable, CustomStringConvertible {
case number = 0
case vin = 1
case sts = 2
case pts = 3
var description: String {
switch self {
case .number: return "Number"
case .vin: return "VIN"
case .pts: return "PTS"
case .sts: return "STS"
}
}
}
enum ReportEngineSection: Int, CaseIterable, CustomStringConvertible {
case number = 0
case fuelType = 1
case volume = 2
case powerHp = 3
case powerKw = 4
var description: String {
switch self {
case .number: return "Number"
case .fuelType: return "Fuel type"
case .volume: return "Volume (cm³)"
case .powerHp: return "Power (HP)"
case .powerKw: return "Power (kw)"
}
}
}
class ReportController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateMagazineLayout, MediaBrowserViewControllerDataSource, MediaBrowserViewControllerDelegate, UIActivityItemSource {
@IBOutlet weak var collection: UICollectionView!
@IBOutlet weak var actionBarItem: UIBarButtonItem!
@IBOutlet weak var copyBarItem: UIBarButtonItem!
private let fullWidth = MagazineLayoutItemSizeMode(widthMode: .fullWidth(respectsHorizontalInsets: true), heightMode: .dynamic)
private var reportImageUrl: URL?
private let logoPlaceholder = UIImage(named: "SteeringWheel")
var vehicle: Vehicle? {
didSet {
loadViewIfNeeded()
self.collection.reloadData()
self.form.allSections.forEach { $0.reload() }
self.navigationController?.setNavigationBarHidden(self.vehicle == nil, animated: false)
}
}
@ -112,15 +37,91 @@ class ReportController: UIViewController, UICollectionViewDataSource, UICollecti
override func viewDidLoad() {
super.viewDidLoad()
self.collection.collectionViewLayout = MagazineLayout()
let nib = UINib(nibName: "SectionHeader", bundle: nil)
self.collection.register(nib, forSupplementaryViewOfKind: MagazineLayout.SupplementaryViewKind.sectionHeader, withReuseIdentifier: "SectionHeader")
if let vehicle = self.vehicle {
let urls = Array(vehicle.photos.compactMap { URL(string: $0.url) })
let prefetcher = ImagePrefetcher(urls: urls)
prefetcher.start()
}
form +++ Section()
<<< LabelRow().cellUpdate { cell, _ in
cell.detailTextLabel?.text = self.vehicle?.brand?.name?.original ?? "<unknown>"
cell.imageView?.kf.setImage(with: URL(string: self.vehicle?.brand?.logo ?? ""), placeholder: self.logoPlaceholder)
}
let generalSection = Section("General")
form +++ generalSection
<<< LabelRow() { $0.title = "Year" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = String(self.vehicle?.year ?? 0) }
<<< LabelRow() { $0.title = "Color" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = self.vehicle?.color ?? "<unknown>" }
<<< LabelRow() { $0.title = "Category" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = self.vehicle?.category ?? "<unknown>" }
<<< LabelRow() { $0.title = "Steering wheel position" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = self.stringFromBool(self.vehicle?.isRightWheel.value, yes: "Right", no: "Left") }
<<< LabelRow() { $0.title = "Japanese" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = self.stringFromBool(self.vehicle?.isJapanese.value, yes: "Yes", no: "No") }
<<< LabelRow() { $0.title = "Events" }.cellUpdate { cell, _ in
cell.detailTextLabel?.text = String(self.vehicle?.events.count ?? 0)
cell.accessoryType = .disclosureIndicator
}
.onCellSelection { _, _ in
let sb = UIStoryboard(name: "Main", bundle: nil)
let controller = sb.instantiateViewController(identifier: "EventsController") as EventsController
controller.vehicle = self.vehicle
self.navigationController?.pushViewController(controller, animated: true)
}
if self.vehicle?.ownershipPeriods.count ?? 0 > 0 {
generalSection <<< LabelRow() { $0.title = "Owners" }.cellUpdate { cell, _ in
cell.detailTextLabel?.text = String(self.vehicle?.ownershipPeriods.count ?? 0)
cell.accessoryType = .disclosureIndicator
}
.onCellSelection { _, _ in
let sb = UIStoryboard(name: "Main", bundle: nil)
let controller = sb.instantiateViewController(identifier: "OwnersController") as OwnersController
controller.owners = self.vehicle?.ownershipPeriods.toArray() ?? []
self.navigationController?.pushViewController(controller, animated: true)
}
}
if self.vehicle?.photos.count ?? 0 > 0 {
generalSection <<< LabelRow() { $0.title = "Photos" }.cellUpdate { cell, _ in
cell.detailTextLabel?.text = String(self.vehicle?.photos.count ?? 0)
cell.accessoryType = .disclosureIndicator
}
.onCellSelection { _, _ in
let mediaBrowser = MediaBrowserViewController(index: 0, dataSource: self, delegate: self)
mediaBrowser.shouldShowTitle = true
mediaBrowser.title = self.vehicle?.photos.first?.description
self.present(mediaBrowser, animated: true, completion: nil)
}
}
form +++ Section("Identifiers")
<<< LabelRow() { $0.title = "Number" }.cellUpdate { cell, _ in
guard let vehicle = self.vehicle else {
cell.detailTextLabel?.text = "<unknown>"
return
}
var num = vehicle.getNumber()
if vehicle.outdated, let current = vehicle.currentNumber {
num = "\(vehicle.getNumber()) (\(current))"
}
cell.detailTextLabel?.text = num
}
<<< LabelRow() { $0.title = "VIN" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = self.vehicle?.vin1 ?? "<unknown>" }
<<< LabelRow() { $0.title = "STS" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = self.vehicle?.sts ?? "<unknown>" }
<<< LabelRow() { $0.title = "PTS" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = self.vehicle?.pts ?? "<unknown>" }
form +++ Section("Engine")
<<< LabelRow() { $0.title = "Number" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = self.vehicle?.engine?.number ?? "<unknown>" }
<<< LabelRow() { $0.title = "Fuel type" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = self.vehicle?.engine?.fuelType ?? "<unknown>" }
<<< LabelRow() { $0.title = "Volume (cm³)" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = String(self.vehicle?.engine?.volume.value ?? 0) }
<<< LabelRow() { $0.title = "Power (HP)" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = String(self.vehicle?.engine?.powerHp ?? 0) }
<<< LabelRow() { $0.title = "Power (kw)" }.cellUpdate { cell, _ in cell.detailTextLabel?.text = String(self.vehicle?.engine?.powerKw.value ?? 0) }
}
func stringFromBool(_ value: Bool?, yes: String, no: String) -> String {
guard let value = value else { return "<unknown>" }
return value ? yes : no
}
override func viewWillAppear(_ animated: Bool) {
@ -136,216 +137,7 @@ class ReportController: UIViewController, UICollectionViewDataSource, UICollecti
break
}
self.collection.reloadData()
}
// MARK: - UICollectionViewDataSource
func numberOfSections(in collectionView: UICollectionView) -> Int {
guard self.vehicle != nil else { return 0 }
return ReportSection.allCases.count
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
guard let vehicle = self.vehicle else { return 0 }
guard let section = ReportSection(rawValue: section) else { return 0 }
switch section {
case .header: return 1
case .general: return ReportGeneralSection.allCases.count
case .identifiers: return ReportIdSection.allCases.count
case .engine: return ReportEngineSection.allCases.count
case .photos: return vehicle.photos.count
}
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let section = ReportSection(rawValue: indexPath.section) else { return UICollectionViewCell() }
guard let vehicle = self.vehicle else { return UICollectionViewCell() }
switch section {
case .header:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VehicleHeaderCell", for: indexPath) as? VehicleHeaderCell
cell?.configure(with: vehicle)
return cell ?? UICollectionViewCell()
case .general:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VehicleTextParamCell", for: indexPath) as? VehicleTextParamCell
if let generalSection = ReportGeneralSection(rawValue: indexPath.item) {
switch generalSection {
case .year:
cell?.configure(param: generalSection.description, value: String(vehicle.year))
break
case .color:
cell?.configure(param: generalSection.description, value: vehicle.color ?? "<unknown>")
break
case .category:
cell?.configure(param: generalSection.description, value: vehicle.category ?? "<unknown>")
break
case .wheelPosition:
var position = "<Unknown>"
if let rightWheel = vehicle.isRightWheel.value {
position = rightWheel ? "Right" : "Left"
}
cell?.configure(param: generalSection.description, value: position)
break
case .japanese:
var japanese = "<Unknown>"
if let isJapanese = vehicle.isJapanese.value {
japanese = isJapanese ? "Yes" : "No"
}
cell?.configure(param: generalSection.description, value: japanese)
break
case .owners:
cell?.configure(param: generalSection.description, value: String(vehicle.ownershipPeriods.count))
break
case .events:
cell?.configure(param: generalSection.description, value: String(vehicle.events.count))
}
}
return cell ?? UICollectionViewCell()
case .identifiers:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VehicleTextParamCell", for: indexPath) as? VehicleTextParamCell
if let idSection = ReportIdSection(rawValue: indexPath.item) {
switch idSection {
case .number:
var num = vehicle.getNumber()
if vehicle.outdated, let current = vehicle.currentNumber {
num = "\(vehicle.getNumber()) (\(current))"
}
cell?.configure(param: idSection.description, value: num)
break
case .vin:
cell?.configure(param: idSection.description, value: vehicle.vin1 ?? "<unknown>")
break
case .sts:
cell?.configure(param: idSection.description, value: vehicle.sts ?? "<unknown>")
break
case .pts:
cell?.configure(param: idSection.description, value: vehicle.pts ?? "<unknown>")
break
}
}
return cell ?? UICollectionViewCell()
case .engine:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VehicleTextParamCell", for: indexPath) as? VehicleTextParamCell
if let engineSection = ReportEngineSection(rawValue: indexPath.item), let engine = vehicle.engine {
switch engineSection {
case .number:
cell?.configure(param: engineSection.description, value: engine.number ?? "<unknown>")
break
case .fuelType:
cell?.configure(param: engineSection.description, value: engine.fuelType ?? "<unknown>")
break
case .volume:
cell?.configure(param: engineSection.description, value: String(engine.volume.value ?? 0))
break
case .powerHp:
cell?.configure(param: engineSection.description, value: String(engine.powerHp))
break
case .powerKw:
cell?.configure(param: engineSection.description, value: String(engine.powerKw.value ?? 0))
break
}
}
return cell ?? UICollectionViewCell()
case .photos:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "VehiclePhotoCell", for: indexPath) as? VehiclePhotoCell
let photo = vehicle.photos[indexPath.item]
cell?.configure(with: photo)
return cell ?? UICollectionViewCell()
}
}
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView
{
guard let section = ReportSection(rawValue: indexPath.section) else { return UICollectionReusableView() }
if let sectionHeader = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "SectionHeader", for: indexPath) as? SectionHeader {
sectionHeader.configure(with: section)
return sectionHeader
}
return UICollectionReusableView()
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if indexPath.section == ReportSection.photos.rawValue {
let mediaBrowser = MediaBrowserViewController(index: indexPath.item, dataSource: self, delegate: self)
mediaBrowser.shouldShowTitle = true
mediaBrowser.title = self.vehicle?.photos[indexPath.item].description
present(mediaBrowser, animated: true, completion: nil)
}
if indexPath.section == ReportSection.general.rawValue {
let sb = UIStoryboard(name: "Main", bundle: nil)
if indexPath.row == ReportGeneralSection.owners.rawValue {
let controller = sb.instantiateViewController(identifier: "OwnersController") as OwnersController
controller.owners = self.vehicle?.ownershipPeriods.toArray() ?? []
self.navigationController?.pushViewController(controller, animated: true)
}
else if indexPath.row == ReportGeneralSection.events.rawValue {
let controller = sb.instantiateViewController(identifier: "EventsController") as EventsController
controller.vehicle = self.vehicle
self.navigationController?.pushViewController(controller, animated: true)
}
}
}
// MARK: - UICollectionViewDelegateMagazineLayout
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeModeForItemAt indexPath: IndexPath) -> MagazineLayoutItemSizeMode
{
guard let section = ReportSection(rawValue: indexPath.section) else { return self.fullWidth }
switch section {
case .header: return self.fullWidth
case .general: return self.fullWidth
case .identifiers: return self.fullWidth
case .engine: return self.fullWidth
case .photos:
let wMode: MagazineLayoutItemWidthMode = self.traitCollection.horizontalSizeClass != .compact ? .thirdWidth : .halfWidth
return .init(widthMode: wMode, heightMode: .dynamic)
}
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, visibilityModeForHeaderInSectionAtIndex index: Int) -> MagazineLayoutHeaderVisibilityMode
{
guard let section = ReportSection(rawValue: index) else { return .hidden }
switch section {
case .header: return .hidden
case .general: return .visible(heightMode: .dynamic)
case .identifiers: return .visible(heightMode: .dynamic)
case .engine: return .visible(heightMode: .dynamic)
case .photos: return .visible(heightMode: .dynamic)
}
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, visibilityModeForFooterInSectionAtIndex index: Int) -> MagazineLayoutFooterVisibilityMode
{
return .hidden
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, visibilityModeForBackgroundInSectionAtIndex index: Int) -> MagazineLayoutBackgroundVisibilityMode
{
return .hidden
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, horizontalSpacingForItemsInSectionAtIndex index: Int) -> CGFloat
{
return 16
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, verticalSpacingForElementsInSectionAtIndex index: Int) -> CGFloat
{
return index == ReportSection.photos.rawValue ? 16 : 0
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetsForSectionAtIndex index: Int) -> UIEdgeInsets
{
return index == ReportSection.photos.rawValue ? UIEdgeInsets(top: 0, left: 0, bottom: 16, right: 0) : .zero
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetsForItemsInSectionAtIndex index: Int) -> UIEdgeInsets
{
return index == ReportSection.photos.rawValue ? UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16) : .zero
self.form.allSections.forEach { $0.reload() }
}
// MARK: - MediaBrowserViewControllerDataSource & MediaBrowserViewControllerDelegate
@ -388,7 +180,7 @@ class ReportController: UIViewController, UICollectionViewDataSource, UICollecti
let cancel = UIAlertAction(title: "Cancel", style: .cancel) { _ in sheet.dismiss(animated: true, completion: nil) }
let shareImage = UIAlertAction(title: "As one image", style: .default) { _ in
let image = vehicle.reportImage(width: self.collection.contentSize.width)
let image = vehicle.reportImage(width: self.tableView.contentSize.width)
do {
let fm = FileManager.default

View File

@ -10,6 +10,7 @@ class RealmSectionedDataSource<Item,Cell>: NSObject, UITableViewDataSource where
private var notificationToken: NotificationToken?
private var sections: [DateSection<Item>] = []
private var cellIdentifier: String
private var lastUpdateTime = Date()
init(table: UITableView, data: Results<Item>, cellIdentifier: String = String(describing: Cell.self)) {
self.tv = table
@ -24,6 +25,12 @@ class RealmSectionedDataSource<Item,Cell>: NSObject, UITableViewDataSource where
self.sections = self.data.groupedByDate()
self.tv.reloadData()
case .update(_, let deletions, let insertions, let modifications):
if !Calendar.current.isDateInToday(self.lastUpdateTime) {
self.sections = self.data.groupedByDate()
self.tv.reloadData()
return
}
var actions = "Deletions: \(deletions), Insertions: \(insertions), Modifications: \(modifications)"
let newSections = self.data.groupedByDate()
let changeset = StagedChangeset(source: self.sections, target: newSections, section: 0)