Filtering by location dates. Add author name to location model. Adding button for updating search results

This commit is contained in:
Selim Mustafaev 2022-09-30 22:30:55 +03:00
parent 9c44a26201
commit 3ea006c208
11 changed files with 137 additions and 68 deletions

View File

@ -1080,7 +1080,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 95; CURRENT_PROJECT_VERSION = 96;
DEVELOPMENT_TEAM = 46DTTB8X4S; DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_FILE = AutoCat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0; IPHONEOS_DEPLOYMENT_TARGET = 13.0;
@ -1105,7 +1105,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 95; CURRENT_PROJECT_VERSION = 96;
DEVELOPMENT_TEAM = 46DTTB8X4S; DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_FILE = AutoCat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0; IPHONEOS_DEPLOYMENT_TARGET = 13.0;

View File

@ -26,7 +26,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let config = Realm.Configuration( let config = Realm.Configuration(
schemaVersion: 37, schemaVersion: 38,
migrationBlock: { migration, oldSchemaVersion in migrationBlock: { migration, oldSchemaVersion in
if oldSchemaVersion <= 3 { if oldSchemaVersion <= 3 {
var numbers: [String] = [] var numbers: [String] = []

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" 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="21225" 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"/> <device id="retina4_7" orientation="portrait" appearance="dark"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@ -85,23 +85,23 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="VehicleNoteCell" id="J6y-ZM-MCf" customClass="VehicleNoteCell" customModule="AutoCat" customModuleProvider="target"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="VehicleNoteCell" id="J6y-ZM-MCf" customClass="VehicleNoteCell" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="44.5" width="375" height="62"/> <rect key="frame" x="0.0" y="50" width="375" height="67"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="J6y-ZM-MCf" id="wBh-vB-ORX"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="J6y-ZM-MCf" id="wBh-vB-ORX">
<rect key="frame" x="0.0" y="0.0" width="375" height="62"/> <rect key="frame" x="0.0" y="0.0" width="375" height="67"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="wnx-I3-WKd"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="wnx-I3-WKd">
<rect key="frame" x="16" y="11" width="343" height="40"/> <rect key="frame" x="16" y="11" width="343" height="45"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Some note about vehicle" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P90-i3-hFg"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Some note about vehicle" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P90-i3-hFg">
<rect key="frame" x="0.0" y="0.0" width="343" height="17"/> <rect key="frame" x="0.0" y="0.0" width="343" height="20.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="date" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6jy-cJ-rbF"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="date" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6jy-cJ-rbF">
<rect key="frame" x="0.0" y="25" width="343" height="15"/> <rect key="frame" x="0.0" y="28.5" width="343" height="16.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" systemColor="secondaryLabelColor"/> <color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -173,40 +173,49 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="EventCell" id="QIb-Hv-tvk" customClass="EventCell" customModule="AutoCat" customModuleProvider="target"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="EventCell" id="QIb-Hv-tvk" customClass="EventCell" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="44.5" width="375" height="132.5"/> <rect key="frame" x="0.0" y="50" width="375" height="429.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="QIb-Hv-tvk" id="Ypt-ch-fGT"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="QIb-Hv-tvk" id="Ypt-ch-fGT">
<rect key="frame" x="0.0" y="0.0" width="375" height="132.5"/> <rect key="frame" x="0.0" y="0.0" width="375" height="429.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="HP8-oO-yhP"> <stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="HP8-oO-yhP">
<rect key="frame" x="8" y="8" width="359" height="116.5"/> <rect key="frame" x="16" y="8" width="343" height="413.5"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xcQ-Wz-gJ0"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="k4Z-KM-byE">
<rect key="frame" x="0.0" y="0.0" width="359" height="50"/> <rect key="frame" x="0.0" y="0.0" width="335" height="413.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> <subviews>
<nil key="textColor"/> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xcQ-Wz-gJ0">
<nil key="highlightedColor"/> <rect key="frame" x="0.0" y="0.0" width="335" height="201"/>
</label> <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1tQ-zM-6T9"> <nil key="textColor"/>
<rect key="frame" x="0.0" y="58" width="359" height="58.5"/> <nil key="highlightedColor"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/> </label>
<color key="textColor" systemColor="secondaryLabelColor"/> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1tQ-zM-6T9">
<nil key="highlightedColor"/> <rect key="frame" x="0.0" y="209" width="335" height="204.5"/>
</label> <fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
<color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="750" verticalHuggingPriority="251" image="person" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="CFI-xa-eLs">
<rect key="frame" x="343" y="1.5" width="0.0" height="411"/>
</imageView>
</subviews> </subviews>
</stackView> </stackView>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="HP8-oO-yhP" firstAttribute="leading" secondItem="Ypt-ch-fGT" secondAttribute="leading" constant="8" id="BX3-sO-2mI"/> <constraint firstItem="HP8-oO-yhP" firstAttribute="leading" secondItem="Ypt-ch-fGT" secondAttribute="leading" constant="16" id="BX3-sO-2mI"/>
<constraint firstItem="HP8-oO-yhP" firstAttribute="top" secondItem="Ypt-ch-fGT" secondAttribute="top" constant="8" id="kUQ-n4-izs"/> <constraint firstItem="HP8-oO-yhP" firstAttribute="top" secondItem="Ypt-ch-fGT" secondAttribute="top" constant="8" id="kUQ-n4-izs"/>
<constraint firstAttribute="trailing" secondItem="HP8-oO-yhP" secondAttribute="trailing" constant="8" id="nGB-VN-Sdx"/> <constraint firstAttribute="trailing" secondItem="HP8-oO-yhP" secondAttribute="trailing" constant="16" id="nGB-VN-Sdx"/>
<constraint firstAttribute="bottom" secondItem="HP8-oO-yhP" secondAttribute="bottom" constant="8" id="pFY-Uy-LSv"/> <constraint firstAttribute="bottom" secondItem="HP8-oO-yhP" secondAttribute="bottom" constant="8" id="pFY-Uy-LSv"/>
</constraints> </constraints>
</tableViewCellContentView> </tableViewCellContentView>
<connections> <connections>
<outlet property="address" destination="xcQ-Wz-gJ0" id="k6e-Yz-MEB"/> <outlet property="address" destination="xcQ-Wz-gJ0" id="k6e-Yz-MEB"/>
<outlet property="date" destination="1tQ-zM-6T9" id="DBs-dL-CmY"/> <outlet property="date" destination="1tQ-zM-6T9" id="DBs-dL-CmY"/>
<outlet property="userImageView" destination="CFI-xa-eLs" id="2QW-xC-mfU"/>
</connections> </connections>
</tableViewCell> </tableViewCell>
</prototypes> </prototypes>
@ -269,7 +278,7 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes> <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"> <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="44.5" width="375" height="84.5"/> <rect key="frame" x="0.0" y="50" width="375" height="84.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="VEP-QD-i6y" id="8hH-8I-XLB"> <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="84.5"/> <rect key="frame" x="0.0" y="0.0" width="375" height="84.5"/>
@ -282,13 +291,13 @@
<rect key="frame" x="0.0" y="0.0" width="359" height="20"/> <rect key="frame" x="0.0" y="0.0" width="359" height="20"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="Kia Optima" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wCR-6h-HgF"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="Kia Optima" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wCR-6h-HgF">
<rect key="frame" x="0.0" y="0.0" width="293" height="20"/> <rect key="frame" x="0.0" y="0.0" width="290.5" height="20"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/> <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="exclamationmark.arrow.triangle.2.circlepath" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="Qo7-51-ou9"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="exclamationmark.arrow.triangle.2.circlepath" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="Qo7-51-ou9">
<rect key="frame" x="297" y="0.5" width="20" height="19"/> <rect key="frame" x="294.5" y="0.5" width="20" height="19"/>
<color key="tintColor" systemColor="systemOrangeColor"/> <color key="tintColor" systemColor="systemOrangeColor"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="20" id="Pct-H5-e3e"/> <constraint firstAttribute="width" constant="20" id="Pct-H5-e3e"/>
@ -296,14 +305,14 @@
</constraints> </constraints>
</imageView> </imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" image="text.bubble" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="k5v-Ic-Stn"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" image="text.bubble" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="k5v-Ic-Stn">
<rect key="frame" x="321" y="0.5" width="20" height="19.5"/> <rect key="frame" x="318.5" y="0.5" width="20" height="19.5"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="20" id="M1i-uQ-eYH"/> <constraint firstAttribute="height" constant="20" id="M1i-uQ-eYH"/>
<constraint firstAttribute="width" constant="20" id="wyl-SJ-L78"/> <constraint firstAttribute="width" constant="20" id="wyl-SJ-L78"/>
</constraints> </constraints>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="12" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QnE-Cx-aUe"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="12" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QnE-Cx-aUe">
<rect key="frame" x="345" y="0.0" width="14" height="20"/> <rect key="frame" x="342.5" y="0.0" width="16.5" height="20"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleCallout"/> <fontDescription key="fontDescription" style="UICTFontTextStyleCallout"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -321,16 +330,16 @@
</constraints> </constraints>
</view> </view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="bottom" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="quG-e3-h5v"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="bottom" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="quG-e3-h5v">
<rect key="frame" x="303" y="3.5" width="56" height="37"/> <rect key="frame" x="303" y="0.5" width="56" height="40"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="1.01.2021" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RPA-NR-0C6"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="1.01.2021" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RPA-NR-0C6">
<rect key="frame" x="3.5" y="0.0" width="52.5" height="14.5"/> <rect key="frame" x="0.0" y="0.0" width="56" height="16"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" systemColor="secondaryLabelColor"/> <color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aOM-gr-Yem"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aOM-gr-Yem">
<rect key="frame" x="25" y="22.5" width="31" height="14.5"/> <rect key="frame" x="23" y="24" width="33" height="16"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" systemColor="tertiaryLabelColor"/> <color key="textColor" systemColor="tertiaryLabelColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -495,7 +504,7 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="AudioRecordCell" id="mzE-bt-IiX" customClass="AudioRecordCell" customModule="AutoCat" customModuleProvider="target"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="AudioRecordCell" id="mzE-bt-IiX" customClass="AudioRecordCell" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="44.5" width="375" height="50.5"/> <rect key="frame" x="0.0" y="50" width="375" height="50.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="mzE-bt-IiX" id="bqu-eN-DJP"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="mzE-bt-IiX" id="bqu-eN-DJP">
<rect key="frame" x="0.0" y="0.0" width="375" height="50.5"/> <rect key="frame" x="0.0" y="0.0" width="375" height="50.5"/>
@ -589,10 +598,10 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="Peq-Zq-kNT"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="Peq-Zq-kNT">
<rect key="frame" x="62.5" y="68" width="250" height="110.5"/> <rect key="frame" x="62.5" y="68" width="250" height="114.5"/>
<subviews> <subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="A001AA 777" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="8FU-Gy-4MU" customClass="SwiftMaskTextfield" customModule="AutoCat" customModuleProvider="target"> <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="A001AA 777" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="8FU-Gy-4MU" customClass="SwiftMaskTextfield" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="250" height="46.5"/> <rect key="frame" x="0.0" y="0.0" width="250" height="50.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle0"/> <fontDescription key="fontDescription" style="UICTFontTextStyleTitle0"/>
<textInputTraits key="textInputTraits" returnKeyType="done"/> <textInputTraits key="textInputTraits" returnKeyType="done"/>
<connections> <connections>
@ -601,7 +610,7 @@
</connections> </connections>
</textField> </textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ync-fd-xQI" customClass="CustomButton" customModule="AutoCat" customModuleProvider="target"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ync-fd-xQI" customClass="CustomButton" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="62.5" width="250" height="48"/> <rect key="frame" x="0.0" y="66.5" width="250" height="48"/>
<color key="backgroundColor" systemColor="systemBlueColor"/> <color key="backgroundColor" systemColor="systemBlueColor"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="48" id="YE0-lL-OwL"/> <constraint firstAttribute="height" constant="48" id="YE0-lL-OwL"/>
@ -620,11 +629,11 @@
</constraints> </constraints>
</stackView> </stackView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="onDrag" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="JKr-UE-x8f"> <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="onDrag" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="JKr-UE-x8f">
<rect key="frame" x="0.0" y="202.5" width="375" height="415.5"/> <rect key="frame" x="0.0" y="206.5" width="375" height="411.5"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="VehicleCell" id="3ON-lr-UlV" customClass="VehicleCell" customModule="AutoCat" customModuleProvider="target"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="VehicleCell" id="3ON-lr-UlV" customClass="VehicleCell" customModule="AutoCat" customModuleProvider="target">
<rect key="frame" x="0.0" y="44.5" width="375" height="84.5"/> <rect key="frame" x="0.0" y="50" width="375" height="84.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="3ON-lr-UlV" id="IGw-UK-ebp"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="3ON-lr-UlV" id="IGw-UK-ebp">
<rect key="frame" x="0.0" y="0.0" width="375" height="84.5"/> <rect key="frame" x="0.0" y="0.0" width="375" height="84.5"/>
@ -637,13 +646,13 @@
<rect key="frame" x="0.0" y="0.0" width="359" height="20"/> <rect key="frame" x="0.0" y="0.0" width="359" height="20"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="Kia Optima" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h3N-1o-J20"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="Kia Optima" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h3N-1o-J20">
<rect key="frame" x="0.0" y="0.0" width="293" height="20"/> <rect key="frame" x="0.0" y="0.0" width="290.5" height="20"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/> <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="exclamationmark.arrow.triangle.2.circlepath" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="pdg-uR-pUn"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="exclamationmark.arrow.triangle.2.circlepath" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="pdg-uR-pUn">
<rect key="frame" x="297" y="0.5" width="20" height="19"/> <rect key="frame" x="294.5" y="0.5" width="20" height="19"/>
<color key="tintColor" systemColor="systemOrangeColor"/> <color key="tintColor" systemColor="systemOrangeColor"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="20" id="9HI-9d-T5A"/> <constraint firstAttribute="height" constant="20" id="9HI-9d-T5A"/>
@ -651,14 +660,14 @@
</constraints> </constraints>
</imageView> </imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" image="text.bubble" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="It0-Zx-REl"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" image="text.bubble" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="It0-Zx-REl">
<rect key="frame" x="321" y="0.5" width="20" height="19.5"/> <rect key="frame" x="318.5" y="0.5" width="20" height="19.5"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="20" id="2hp-7v-GVx"/> <constraint firstAttribute="height" constant="20" id="2hp-7v-GVx"/>
<constraint firstAttribute="width" constant="20" id="sDL-E7-jY4"/> <constraint firstAttribute="width" constant="20" id="sDL-E7-jY4"/>
</constraints> </constraints>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="12" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XA5-vL-FV1"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="12" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XA5-vL-FV1">
<rect key="frame" x="345" y="0.0" width="14" height="20"/> <rect key="frame" x="342.5" y="0.0" width="16.5" height="20"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleCallout"/> <fontDescription key="fontDescription" style="UICTFontTextStyleCallout"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -677,16 +686,16 @@
</constraints> </constraints>
</view> </view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="bottom" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="ApN-fV-Qw4"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="bottom" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="ApN-fV-Qw4">
<rect key="frame" x="303" y="3.5" width="56" height="37"/> <rect key="frame" x="303" y="0.5" width="56" height="40"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="1.01.2021" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rKr-3e-WYb"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="1.01.2021" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rKr-3e-WYb">
<rect key="frame" x="3.5" y="0.0" width="52.5" height="14.5"/> <rect key="frame" x="0.0" y="0.0" width="56" height="16"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" systemColor="secondaryLabelColor"/> <color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UOb-db-Sty"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UOb-db-Sty">
<rect key="frame" x="25" y="22.5" width="31" height="14.5"/> <rect key="frame" x="23" y="24" width="33" height="16"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<color key="textColor" systemColor="tertiaryLabelColor"/> <color key="textColor" systemColor="tertiaryLabelColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -1078,10 +1087,11 @@
<image name="check" width="25" height="25"/> <image name="check" width="25" height="25"/>
<image name="check-compact" width="18" height="18"/> <image name="check-compact" width="18" height="18"/>
<image name="doc.on.doc" catalog="system" width="116" height="128"/> <image name="doc.on.doc" catalog="system" width="116" height="128"/>
<image name="exclamationmark.arrow.triangle.2.circlepath" catalog="system" width="128" height="101"/> <image name="exclamationmark.arrow.triangle.2.circlepath" catalog="system" width="128" height="104"/>
<image name="line.horizontal.3.decrease" catalog="system" width="128" height="73"/> <image name="line.horizontal.3.decrease" catalog="system" width="128" height="73"/>
<image name="map" catalog="system" width="128" height="110"/> <image name="map" catalog="system" width="128" height="112"/>
<image name="play.fill" catalog="system" width="116" height="128"/> <image name="person" catalog="system" width="128" height="121"/>
<image name="play.fill" catalog="system" width="117" height="128"/>
<image name="record" width="31" height="31"/> <image name="record" width="31" height="31"/>
<image name="record-compact" width="23" height="23"/> <image name="record-compact" width="23" height="23"/>
<image name="search" width="23" height="23"/> <image name="search" width="23" height="23"/>
@ -1106,7 +1116,7 @@
<color red="0.18823529411764706" green="0.69019607843137254" blue="0.7803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.18823529411764706" green="0.69019607843137254" blue="0.7803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
<systemColor name="tertiaryLabelColor"> <systemColor name="tertiaryLabelColor">
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.29999999999999999" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.29803921568627451" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
</resources> </resources>
</document> </document>

View File

@ -4,6 +4,7 @@ import AutoCatCore
class EventCell: UITableViewCell { class EventCell: UITableViewCell {
@IBOutlet weak var address: UILabel! @IBOutlet weak var address: UILabel!
@IBOutlet weak var date: UILabel! @IBOutlet weak var date: UILabel!
@IBOutlet weak var userImageView: UIImageView!
let dateFormatter = DateFormatter() let dateFormatter = DateFormatter()
@ -23,5 +24,14 @@ class EventCell: UITableViewCell {
let date = Date(timeIntervalSince1970: event.date) let date = Date(timeIntervalSince1970: event.date)
self.date.text = self.dateFormatter.string(from: date) self.date.text = self.dateFormatter.string(from: date)
if let addedBy = event.addedBy {
let isMe = addedBy == Settings.shared.user.email
userImageView.image = UIImage(systemName: isMe ? "person.fill" : "person")
userImageView.tintColor = isMe ? self.tintColor : .secondaryLabel
userImageView.isHidden = false
} else {
userImageView.isHidden = true
}
} }
} }

View File

@ -148,6 +148,22 @@ class FiltersController: FormViewController {
.onChange { self.filter.toDate = self.nullifyTime(of: $0.value) } .onChange { self.filter.toDate = self.nullifyTime(of: $0.value) }
.cellUpdate(self.update(cell:row:)) .cellUpdate(self.update(cell:row:))
form +++ Section(NSLocalizedString("Location adding time", comment: ""))
<<< DateInlineRow("FromLocationDate") { row in
row.title = NSLocalizedString("From", comment: "")
row.noValueDisplayText = NSLocalizedString("Beginning", comment: "")
row.value = self.filter.fromLocationDate
}
.onChange { self.filter.fromLocationDate = self.nullifyTime(of: $0.value) }
.cellUpdate(self.update(cell:row:))
<<< DateInlineRow("ToLocationDate") { row in
row.title = NSLocalizedString("To", comment: "")
row.noValueDisplayText = NSLocalizedString("Now", comment: "")
row.value = self.filter.toLocationDate
}
.onChange { self.filter.toLocationDate = self.nullifyTime(of: $0.value) }
.cellUpdate(self.update(cell:row:))
form +++ Section(NSLocalizedString("Sort", comment: "Header section. Noun.")) form +++ Section(NSLocalizedString("Sort", comment: "Header section. Noun."))
<<< PickerInlineRow<SortParameter>("SortBy") { row in <<< PickerInlineRow<SortParameter>("SortBy") { row in
row.title = NSLocalizedString("Sort by", comment: "") row.title = NSLocalizedString("Sort by", comment: "")
@ -218,6 +234,8 @@ class FiltersController: FormViewController {
case "ToDate": return self.filter.toDate case "ToDate": return self.filter.toDate
case "FromDateUpdated": return self.filter.fromDateUpdated case "FromDateUpdated": return self.filter.fromDateUpdated
case "ToDateUpdated": return self.filter.toDateUpdated case "ToDateUpdated": return self.filter.toDateUpdated
case "FromLocationDate": return self.filter.fromLocationDate
case "ToLocationDate": return self.filter.toLocationDate
default: return nil default: return nil
} }
} }
@ -226,10 +244,14 @@ class FiltersController: FormViewController {
guard let tag = sender.accessibilityLabel else { return } guard let tag = sender.accessibilityLabel else { return }
guard let row = self.form.rowBy(tag: tag) as? DateInlineRow else { return } guard let row = self.form.rowBy(tag: tag) as? DateInlineRow else { return }
if tag == "FromDate" { switch tag {
self.filter.fromDate = nil case "FromDate": self.filter.fromDate = nil
} else { case "ToDate": self.filter.toDate = nil
self.filter.toDate = nil case "FromDateUpdated": self.filter.fromDateUpdated = nil
case "ToDateUpdated": self.filter.toDateUpdated = nil
case "FromLocationDate": self.filter.fromLocationDate = nil
case "ToLocationDate": self.filter.toLocationDate = nil
default: break
} }
row.value = nil row.value = nil

View File

@ -49,7 +49,7 @@ class LocationEditController: FormViewController {
@objc func doneTapped(_ sender: UIBarButtonItem) { @objc func doneTapped(_ sender: UIBarButtonItem) {
guard let placemark = self.placemark else { return } guard let placemark = self.placemark else { return }
let event = VehicleEvent(lat: placemark.latitude, lon: placemark.longitude, speed: -1, dir: -1) let event = VehicleEvent(lat: placemark.latitude, lon: placemark.longitude)
event.date = self.date.timeIntervalSince1970 event.date = self.date.timeIntervalSince1970
if let address = placemark.address { if let address = placemark.address {
event.address = address event.address = address

View File

@ -11,6 +11,9 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
@IBOutlet weak var tableView: UITableView! @IBOutlet weak var tableView: UITableView!
@IBOutlet weak var showMapButton: UIBarButtonItem! @IBOutlet weak var showMapButton: UIBarButtonItem!
private var refreshButton: UIBarButtonItem!
private var refreshIndicator: UIBarButtonItem!
private let bag = DisposeBag() private let bag = DisposeBag()
private let searchController = UISearchController(searchResultsController: nil) private let searchController = UISearchController(searchResultsController: nil)
private var refreshControl = UIRefreshControl() private var refreshControl = UIRefreshControl()
@ -32,7 +35,13 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
navigationItem.searchController = searchController navigationItem.searchController = searchController
definesPresentationContext = true definesPresentationContext = true
self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: self.pageLoadingIndicator) self.refreshButton = UIBarButtonItem(image: UIImage(systemName: "arrow.triangle.2.circlepath"),
style: .plain,
target: self,
action: #selector(refresh))
self.refreshIndicator = UIBarButtonItem(customView: self.pageLoadingIndicator)
self.navigationItem.leftBarButtonItem = self.refreshButton
//self.refreshControl.attributedTitle = NSAttributedString(string: "") //self.refreshControl.attributedTitle = NSAttributedString(string: "")
self.refreshControl.addTarget(self, action: #selector(self.refresh(_:)), for: .valueChanged) self.refreshControl.addTarget(self, action: #selector(self.refresh(_:)), for: .valueChanged)
@ -45,7 +54,10 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
self.filterRelay self.filterRelay
//.throttle(.seconds(2), scheduler: MainScheduler.instance) //.throttle(.seconds(2), scheduler: MainScheduler.instance)
.debounce(.milliseconds(500), scheduler: MainScheduler.instance) .debounce(.milliseconds(500), scheduler: MainScheduler.instance)
.do(onNext: { _ in self.pageLoadingIndicator.startAnimating() }) .do(onNext: { _ in
self.navigationItem.leftBarButtonItem = self.refreshIndicator
self.pageLoadingIndicator.startAnimating()
})
.flatMap { Api.getVehicles(with: $0, pageToken: self.datasource.pageToken).do(onError: { print($0) }).catchErrorJustReturn(PagedResponse<Vehicle>()) } .flatMap { Api.getVehicles(with: $0, pageToken: self.datasource.pageToken).do(onError: { print($0) }).catchErrorJustReturn(PagedResponse<Vehicle>()) }
.observeOn(MainScheduler.instance) .observeOn(MainScheduler.instance)
.do(onNext: { .do(onNext: {
@ -56,6 +68,7 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
self.refreshControl.endRefreshing() self.refreshControl.endRefreshing()
self.isLoadingPage = false self.isLoadingPage = false
self.pageLoadingIndicator.stopAnimating() self.pageLoadingIndicator.stopAnimating()
self.navigationItem.leftBarButtonItem = self.refreshButton
}) })
.bind(to: self.datasource.data) .bind(to: self.datasource.data)
.disposed(by: self.bag) .disposed(by: self.bag)
@ -97,6 +110,10 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
// MARK: - // MARK: -
// @IBAction func onUpdate(_ sender: UIBarButtonItem) {
// self.refresh(sender)
// }
@IBAction func onFilter(_ sender: UIBarButtonItem) { @IBAction func onFilter(_ sender: UIBarButtonItem) {
let sb = UIStoryboard(name: "Main", bundle: nil) let sb = UIStoryboard(name: "Main", bundle: nil)
let controller = sb.instantiateViewController(identifier: "FiltersController") as FiltersController let controller = sb.instantiateViewController(identifier: "FiltersController") as FiltersController

View File

@ -184,6 +184,9 @@
/* No comment provided by engineer. */ /* No comment provided by engineer. */
"Location" = "Координаты"; "Location" = "Координаты";
/* No comment provided by engineer. */
"Location adding time" = "Время добавления локаций";
/* No comment provided by engineer. */ /* No comment provided by engineer. */
"Log In" = "Войти"; "Log In" = "Войти";

View File

@ -52,6 +52,8 @@ public struct Filter {
public var toDate: Date? public var toDate: Date?
public var fromDateUpdated: Date? public var fromDateUpdated: Date?
public var toDateUpdated: Date? public var toDateUpdated: Date?
public var fromLocationDate: Date?
public var toLocationDate: Date?
public init() { public init() {
} }
@ -69,6 +71,8 @@ public struct Filter {
self.toDate = nil self.toDate = nil
self.fromDateUpdated = nil self.fromDateUpdated = nil
self.toDateUpdated = nil self.toDateUpdated = nil
self.fromLocationDate = nil
self.toLocationDate = nil
} }
public func queryDictionary() -> [String: String] { public func queryDictionary() -> [String: String] {
@ -110,6 +114,12 @@ public struct Filter {
if let toDateUpdated = self.toDateUpdated { if let toDateUpdated = self.toDateUpdated {
dict["toDateUpdated"] = String(toDateUpdated.timeIntervalSince1970) dict["toDateUpdated"] = String(toDateUpdated.timeIntervalSince1970)
} }
if let fromLocationDate = self.fromLocationDate {
dict["fromLocationDate"] = String(fromLocationDate.timeIntervalSince1970)
}
if let toLocationDate = self.toLocationDate {
dict["toLocationDate"] = String(toLocationDate.timeIntervalSince1970)
}
return dict return dict
} }

View File

@ -8,20 +8,18 @@ public class VehicleEvent: Object, Codable, Cloneable {
@objc public dynamic var date: TimeInterval = Date().timeIntervalSince1970 @objc public dynamic var date: TimeInterval = Date().timeIntervalSince1970
@objc public dynamic var latitude: Double = 0 @objc public dynamic var latitude: Double = 0
@objc public dynamic var longitude: 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 @objc public dynamic var address: String? = nil
@objc public dynamic var addedBy: String? = nil
public var number: String? public var number: String?
public var coordinate: CLLocationCoordinate2D { public var coordinate: CLLocationCoordinate2D {
return CLLocationCoordinate2D(latitude: self.latitude, longitude: self.longitude) return CLLocationCoordinate2D(latitude: self.latitude, longitude: self.longitude)
} }
public init(lat: Double, lon: Double, speed: Double, dir: Double) { public init(lat: Double, lon: Double) {
self.latitude = lat self.latitude = lat
self.longitude = lon self.longitude = lon
self.speed = speed self.addedBy = Settings.shared.user.email
self.direction = dir
} }
required init() { required init() {
@ -76,9 +74,8 @@ public class VehicleEvent: Object, Codable, Cloneable {
self.date = copy.date self.date = copy.date
self.latitude = copy.latitude self.latitude = copy.latitude
self.longitude = copy.longitude self.longitude = copy.longitude
self.speed = copy.speed
self.direction = copy.direction
self.address = copy.address self.address = copy.address
self.number = copy.number self.number = copy.number
self.addedBy = copy.addedBy
} }
} }

View File

@ -107,7 +107,7 @@ public class RxLocationManager {
private static func requestLocation() -> Single<VehicleEvent> { private static func requestLocation() -> Single<VehicleEvent> {
let proxy = RxLocationManagerDelegateProxy.proxy(for: self.manager) let proxy = RxLocationManagerDelegateProxy.proxy(for: self.manager)
let single = proxy.getNewLocationSubject().take(1).asSingle().map { location -> VehicleEvent in let single = proxy.getNewLocationSubject().take(1).asSingle().map { location -> VehicleEvent in
let event = VehicleEvent(lat: location.coordinate.latitude, lon: location.coordinate.longitude, speed: location.speed, dir: location.course) let event = VehicleEvent(lat: location.coordinate.latitude, lon: location.coordinate.longitude)
self.lastEvent = event self.lastEvent = event
return event return event
} }