- Map view info header
  - Sign and publish internally on HockeyApp
  - Common config settings
This commit is contained in:
scotts@microsoft.com 2016-09-04 23:26:42 -07:00
Родитель b27b75636c
Коммит 5a1730f70a
8 изменённых файлов: 250 добавлений и 65 удалений

Просмотреть файл

@ -18,20 +18,3 @@ GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited)
SWIFT_OPTIMIZATION_LEVEL = -Onone
MTL_ENABLE_DEBUG_INFO = YES
CODE_SIGN_IDENTITY = iPhone Developer
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer
IPHONEOS_DEPLOYMENT_TARGET = 9.0
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks
INFOPLIST_FILE = LoopTripIOS/Info.plist
PRODUCT_BUNDLE_IDENTIFIER = Microsoft.LoopTripIOS
PRODUCT_NAME = Loop Trips
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR) $(PROJECT_DIR)/Carthage/Build/iOS
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon

Просмотреть файл

@ -9,9 +9,26 @@ GCC_PREPROCESSOR_DEFINITIONS = $(inherited) LOOP_APP_ID_PROP=@\"$(LOOP_APP_ID_PR
SDKROOT = iphoneos
PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.loop.ios.sdksample.df
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks
CODE_SIGN_IDENTITY = iPhone Developer
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer
INFOPLIST_FILE = LoopTripIOS/Info.plist
PRODUCT_NAME = Loop Trips
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR) $(PROJECT_DIR)/Carthage/Build/iOS
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage
COPY_PHASE_STRIP = NO
IPHONEOS_DEPLOYMENT_TARGET = 9.2
IPHONEOS_DEPLOYMENT_TARGET = 9.0
ALWAYS_SEARCH_USER_PATHS = NO
@ -60,3 +77,4 @@ GCC_WARN_UNDECLARED_SELECTOR = YES
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR
CLANG_ANALYZER_NONNULL = YES

Просмотреть файл

@ -10,20 +10,3 @@ VALIDATE_PRODUCT = YES
ENABLE_NS_ASSERTIONS = NO
MTL_ENABLE_DEBUG_INFO = NO
CODE_SIGN_IDENTITY = iPhone Developer
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer
IPHONEOS_DEPLOYMENT_TARGET = 9.0
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks
INFOPLIST_FILE = LoopTripIOS/Info.plist
PRODUCT_BUNDLE_IDENTIFIER = Microsoft.LoopTripIOS
PRODUCT_NAME = Loop Trips
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR) $(PROJECT_DIR)/Carthage/Build/iOS
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon

Просмотреть файл

@ -53,7 +53,7 @@
/* Begin PBXFileReference section */
B505DC4F1D148FD1008646FE /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Carthage/Build/iOS/Alamofire.framework; sourceTree = "<group>"; };
B55568BA1D10D3D1000174F8 /* Keys.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Keys.xcconfig; sourceTree = "<group>"; };
B588870F1CF3A6AD00B25BCD /* Loop Trip.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Loop Trip.app"; sourceTree = BUILT_PRODUCTS_DIR; };
B588870F1CF3A6AD00B25BCD /* Loop Trips.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Loop Trips.app"; sourceTree = BUILT_PRODUCTS_DIR; };
B58887121CF3A6AD00B25BCD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
B58887171CF3A6AD00B25BCD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
B58887191CF3A6AD00B25BCD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@ -112,7 +112,7 @@
B58887101CF3A6AD00B25BCD /* Products */ = {
isa = PBXGroup;
children = (
B588870F1CF3A6AD00B25BCD /* Loop Trip.app */,
B588870F1CF3A6AD00B25BCD /* Loop Trips.app */,
);
name = Products;
sourceTree = "<group>";
@ -208,7 +208,7 @@
);
name = LoopTrip;
productName = SimpleTest;
productReference = B588870F1CF3A6AD00B25BCD /* Loop Trip.app */;
productReference = B588870F1CF3A6AD00B25BCD /* Loop Trips.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
@ -330,16 +330,8 @@
isa = XCBuildConfiguration;
baseConfigurationReference = F6E0F6681D1066B2005A13E5 /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ms.loop.trip;
PRODUCT_NAME = "Loop Trip";
CODE_SIGN_IDENTITY = "iPhone Developer";
PROVISIONING_PROFILE = "3de8be19-9e52-496e-90bd-aa05ed74cdcf";
};
name = Debug;
};
@ -347,16 +339,8 @@
isa = XCBuildConfiguration;
baseConfigurationReference = F6E0F6691D1066BC005A13E5 /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ms.loop.trip;
PRODUCT_NAME = "Loop Trip";
CODE_SIGN_IDENTITY = "iPhone Developer";
PROVISIONING_PROFILE = "3de8be19-9e52-496e-90bd-aa05ed74cdcf";
};
name = Release;
};

Просмотреть файл

@ -433,13 +433,130 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="5s4-Ad-GeN">
<rect key="frame" x="0.0" y="164" width="600" height="387"/>
<rect key="frame" x="0.0" y="134" width="600" height="417"/>
</mapView>
<view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pU8-Jz-rmf" userLabel="Details View">
<rect key="frame" x="0.0" y="64" width="600" height="100"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<rect key="frame" x="0.0" y="64" width="600" height="70"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="BELLEVUE" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NyX-3q-bmM">
<rect key="frame" x="20" y="15" width="78" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="90" id="WEb-yi-8Ae"/>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="90" id="pKw-DD-gSR"/>
</constraints>
<fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
<exclude reference="WEb-yi-8Ae"/>
</mask>
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="REDMOND" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Kx2-7Z-xd3">
<rect key="frame" x="143" y="15" width="68" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="90" id="00G-I5-kc0"/>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="90" id="QDT-F3-nnz"/>
</constraints>
<fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
<exclude reference="00G-I5-kc0"/>
</mask>
</variation>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ICO Cell Blank" translatesAutoresizingMaskIntoConstraints="NO" id="NpI-gL-5ve">
<rect key="frame" x="216" y="17" width="16" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="16" id="9o9-3i-6Kl"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="16" id="Jav-RR-NQS"/>
<constraint firstAttribute="height" constant="16" id="VEr-fq-ifm"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="16" id="WKi-yq-Q9V"/>
<constraint firstAttribute="width" constant="16" id="WnT-rF-GcP"/>
<constraint firstAttribute="width" constant="16" id="eEf-ia-jfy"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="Jav-RR-NQS"/>
<exclude reference="WKi-yq-Q9V"/>
<exclude reference="WnT-rF-GcP"/>
<exclude reference="eEf-ia-jfy"/>
</mask>
</variation>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Today 11:32 AM - 1:29 PM" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="i3B-ga-bDv">
<rect key="frame" x="20" y="38" width="174" height="18"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="18" id="BUQ-Lh-TsL"/>
<constraint firstAttribute="height" constant="18" id="n3o-QH-vMJ"/>
</constraints>
<fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="12"/>
<color key="textColor" red="0.45094840380000001" green="0.46968793250000002" blue="0.49691181280000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ICO Direction" translatesAutoresizingMaskIntoConstraints="NO" id="3Qi-AZ-FQe">
<rect key="frame" x="108" y="21" width="25" height="8"/>
<constraints>
<constraint firstAttribute="height" constant="8" id="efm-m0-h5m"/>
<constraint firstAttribute="width" constant="25" id="td2-7b-QWf"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="01:56:41" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f0V-6R-2mD">
<rect key="frame" x="522" y="40" width="58" height="14"/>
<fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="12"/>
<color key="textColor" red="0.45094840380000001" green="0.46968793250000002" blue="0.49691181280000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ICO Cell Time" translatesAutoresizingMaskIntoConstraints="NO" id="ga6-Ky-nKd">
<rect key="frame" x="504" y="39" width="15" height="15"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="15" id="H7G-KI-zCK"/>
<constraint firstAttribute="width" constant="15" id="MwM-i0-R8f"/>
<constraint firstAttribute="height" constant="15" id="aeO-UZ-1AT"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="15" id="h1N-a6-TKB"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" 10.94 mi. " textAlignment="center" lineBreakMode="tailTruncation" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Gl-KQ-GiV">
<rect key="frame" x="500" y="16" width="80" height="16"/>
<color key="backgroundColor" red="0.062745098040000002" green="0.062745098040000002" blue="0.062745098040000002" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="120" id="6lr-RA-agb"/>
<constraint firstAttribute="width" constant="80" id="Cqj-ZX-fae"/>
<constraint firstAttribute="height" constant="16" id="rYF-Mp-yPQ"/>
</constraints>
<fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="12"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="highlightedColor" red="0.062745098040000002" green="0.062745098040000002" blue="0.062745098040000002" alpha="1" colorSpace="calibratedRGB"/>
<variation key="default">
<mask key="constraints">
<exclude reference="Cqj-ZX-fae"/>
</mask>
</variation>
</label>
</subviews>
<color key="backgroundColor" red="0.94117647058823528" green="0.94117647058823528" blue="0.94117647058823528" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="100" id="tqe-je-vaX"/>
<constraint firstAttribute="trailing" secondItem="1Gl-KQ-GiV" secondAttribute="trailing" constant="20" id="7fG-H8-Z1f"/>
<constraint firstItem="Kx2-7Z-xd3" firstAttribute="leading" secondItem="3Qi-AZ-FQe" secondAttribute="trailing" constant="10" id="7jr-vM-iGZ"/>
<constraint firstItem="i3B-ga-bDv" firstAttribute="top" secondItem="NyX-3q-bmM" secondAttribute="bottom" constant="4" id="80R-S7-uoI"/>
<constraint firstItem="ga6-Ky-nKd" firstAttribute="top" secondItem="1Gl-KQ-GiV" secondAttribute="bottom" constant="7" id="8M0-Qc-04i"/>
<constraint firstItem="3Qi-AZ-FQe" firstAttribute="leading" secondItem="NyX-3q-bmM" secondAttribute="trailing" constant="10" id="DEK-K2-tJJ"/>
<constraint firstItem="NpI-gL-5ve" firstAttribute="top" secondItem="pU8-Jz-rmf" secondAttribute="top" constant="17" id="DQc-Wv-6Ip"/>
<constraint firstAttribute="trailing" secondItem="f0V-6R-2mD" secondAttribute="trailing" constant="20" id="EVI-3m-au0"/>
<constraint firstAttribute="height" constant="70" id="JRT-Bl-vp0"/>
<constraint firstItem="NyX-3q-bmM" firstAttribute="leading" secondItem="pU8-Jz-rmf" secondAttribute="leading" constant="20" id="LWd-Ew-vEj"/>
<constraint firstItem="1Gl-KQ-GiV" firstAttribute="top" secondItem="pU8-Jz-rmf" secondAttribute="top" constant="16" id="Pn9-3w-Baj"/>
<constraint firstItem="i3B-ga-bDv" firstAttribute="leading" secondItem="pU8-Jz-rmf" secondAttribute="leading" constant="20" id="QTT-ik-XgB"/>
<constraint firstItem="f0V-6R-2mD" firstAttribute="leading" secondItem="ga6-Ky-nKd" secondAttribute="trailing" constant="3" id="YZn-cX-w07"/>
<constraint firstItem="Kx2-7Z-xd3" firstAttribute="top" secondItem="pU8-Jz-rmf" secondAttribute="top" constant="15" id="ZWQ-Au-fLW"/>
<constraint firstItem="3Qi-AZ-FQe" firstAttribute="top" secondItem="pU8-Jz-rmf" secondAttribute="top" constant="21" id="gzJ-7K-3ec"/>
<constraint firstItem="NpI-gL-5ve" firstAttribute="leading" secondItem="Kx2-7Z-xd3" secondAttribute="trailing" constant="5" id="lFN-zf-kFS"/>
<constraint firstItem="f0V-6R-2mD" firstAttribute="top" secondItem="1Gl-KQ-GiV" secondAttribute="bottom" constant="8" id="rxG-Kx-wlA"/>
<constraint firstItem="NyX-3q-bmM" firstAttribute="top" secondItem="pU8-Jz-rmf" secondAttribute="top" constant="15" id="wcw-ah-1bD"/>
<constraint firstItem="NpI-gL-5ve" firstAttribute="leading" secondItem="NyX-3q-bmM" secondAttribute="trailing" priority="250" constant="5" id="xqT-9G-Xz1"/>
</constraints>
</view>
</subviews>
@ -453,15 +570,27 @@
<constraint firstItem="5s4-Ad-GeN" firstAttribute="top" secondItem="pU8-Jz-rmf" secondAttribute="bottom" id="f7j-uv-LD5"/>
<constraint firstAttribute="trailing" secondItem="pU8-Jz-rmf" secondAttribute="trailing" id="iIk-gt-8Zy"/>
<constraint firstItem="pU8-Jz-rmf" firstAttribute="leading" secondItem="Wb2-g8-diJ" secondAttribute="leading" id="r5b-it-ZOG"/>
<constraint firstItem="pU8-Jz-rmf" firstAttribute="top" secondItem="orG-w6-nsn" secondAttribute="bottom" id="sSv-fT-oe9"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="sSv-fT-oe9"/>
<exclude reference="f7j-uv-LD5"/>
</mask>
</variation>
</view>
<connections>
<outlet property="destinationArrow" destination="3Qi-AZ-FQe" id="ZUT-Mf-XM1"/>
<outlet property="destinationArrowLeadingConstraint" destination="DEK-K2-tJJ" id="bSy-wT-kob"/>
<outlet property="detailsView" destination="pU8-Jz-rmf" id="jis-xZ-Saj"/>
<outlet property="endLocation" destination="Kx2-7Z-xd3" id="GAw-nC-FY6"/>
<outlet property="endLocationLeadingConstraint" destination="efm-m0-h5m" id="iPL-xC-UCl"/>
<outlet property="locationDistance" destination="1Gl-KQ-GiV" id="S0c-6Z-3bQ"/>
<outlet property="locationDuration" destination="f0V-6R-2mD" id="o3Y-iS-KTu"/>
<outlet property="locationIcon" destination="NpI-gL-5ve" id="FPg-pg-qiB"/>
<outlet property="locationTime" destination="i3B-ga-bDv" id="ayZ-kf-nOc"/>
<outlet property="mapView" destination="5s4-Ad-GeN" id="aXr-sY-438"/>
<outlet property="startLocation" destination="NyX-3q-bmM" id="pT3-14-ZuF"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="VhR-yd-6OD" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -568,6 +697,9 @@
<resources>
<image name="Dashed Cell Line" width="597" height="4"/>
<image name="Dashed Nav Line" width="375" height="4"/>
<image name="ICO Cell Blank" width="16" height="16"/>
<image name="ICO Cell Time" width="24" height="24"/>
<image name="ICO Direction" width="31" height="9"/>
<image name="ICO Drives Off" width="24" height="14"/>
<image name="ICO Drives On" width="24" height="14"/>
<image name="ICO Settings Off" width="19" height="20"/>

Просмотреть файл

@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>100</string>
<key>LOOP_APP_ID_PROP</key>
<string>$(LOOP_APP_ID_PROP)</string>
<key>LOOP_APP_TOKEN_PROP</key>

Просмотреть файл

@ -21,6 +21,17 @@ class LoopPointAnnotation: MKPointAnnotation {
class MapViewController: UIViewController, MKMapViewDelegate {
@IBOutlet weak var detailsView: UIView!
@IBOutlet weak var startLocation: UILabel!
@IBOutlet weak var endLocation: UILabel!
@IBOutlet weak var locationIcon: UIImageView!
@IBOutlet weak var destinationArrow: UIImageView!
@IBOutlet weak var locationDistance: UILabel!
@IBOutlet weak var locationDuration: UILabel!
@IBOutlet weak var locationTime: UILabel!
@IBOutlet weak var endLocationLeadingConstraint: NSLayoutConstraint!
@IBOutlet weak var destinationArrowLeadingConstraint: NSLayoutConstraint!
@IBOutlet weak var mapView: MKMapView!
private var mapViewUpdateObserver: NSObjectProtocol!
@ -29,13 +40,20 @@ class MapViewController: UIViewController, MKMapViewDelegate {
var tripData: LoopTrip?
var transportMode = MKDirectionsTransportType.Walking
let mapRouteLineCache = MapRouteLineCache.sharedInstance
let knownLocationRepository = KnownLocationRepository.sharedInstance
let leadingConstraintConstant: CGFloat = 10.0
override func viewDidLoad() {
super.viewDidLoad()
self.detailsView.layer.shadowOpacity = 0.7
self.detailsView.layer.shadowOffset = CGSize(width: 0.0, height: 2.0)
self.title = self.showTrips ? "TRIP ROUTE" : "DRIVE ROUTE"
self.mapView.delegate = self
self.setDetails()
mapViewUpdateObserver = NSNotificationCenter.defaultCenter()
.addObserverForName(MapRouteLineCacheAddedContentNotification,
object: nil,
@ -73,6 +91,73 @@ class MapViewController: UIViewController, MKMapViewDelegate {
}
}
// MARK - Details
extension MapViewController {
private func setDetails() {
if let loopTrip = self.tripData {
self.setLocaleLabels(loopTrip)
self.locationDistance.text = " \(ConversionUtils.kilometersToMiles(loopTrip.distanceTraveledInKilometers)) mi. "
self.locationDuration.text = loopTrip.endedAt.offsetFrom(loopTrip.startedAt)
self.locationTime.text = loopTrip.startedAt.relativeDayAndStartEndTime(loopTrip.endedAt)
}
}
func setLocaleLabels(trip: LoopTrip) {
var locationIconName = "ICO Cell Blank"
if knownLocationRepository.locationsEntityIdMap.count > 0 {
if let locationEntityId = trip.entityId {
if let iconName = knownLocationRepository.locationsEntityIdMap[locationEntityId] {
locationIconName = iconName
}
}
}
if let startLocaleText = trip.startLocale?.getFriendlyName().uppercaseString {
setStartLocaleLabelText(startLocaleText)
if let endLocaleText = trip.endLocale?.getFriendlyName().uppercaseString {
if (endLocaleText != startLocaleText) {
adjustEndLocaleLabelText(false)
setEndLocaleLabelText(endLocaleText)
}
else {
adjustEndLocaleLabelText(true)
}
}
else {
adjustEndLocaleLabelText(true)
}
} else {
adjustEndLocaleLabelText(true)
setStartLocaleLabelText("UNKONWN")
}
locationIcon.image = UIImage(named: locationIconName)
}
private func setStartLocaleLabelText(text: String) {
self.startLocation.text = text
}
private func setEndLocaleLabelText(text: String) {
self.endLocation.text = text
}
private func adjustEndLocaleLabelText(removeLabel: Bool) {
let adjustConstraintConstant = removeLabel ? 0 : self.leadingConstraintConstant
self.endLocation.hidden = removeLabel
self.endLocationLeadingConstraint.constant = adjustConstraintConstant
self.destinationArrow.hidden = removeLabel
self.destinationArrowLeadingConstraint.constant = adjustConstraintConstant
}
}
// MARK - Privates

Просмотреть файл

@ -36,14 +36,14 @@ class TripCell: UITableViewCell {
sampleTripIndicator.hidden = true
}
setLocaleLabel(trip)
setLocaleLabels(trip)
self.locationDistance.text = " \(ConversionUtils.kilometersToMiles(trip.distanceTraveledInKilometers)) mi. "
self.locationDuration.text = trip.endedAt.offsetFrom(trip.startedAt)
self.locationTime.text = trip.startedAt.relativeDayAndStartEndTime(trip.endedAt)
}
func setLocaleLabel(trip: LoopTrip) {
func setLocaleLabels(trip: LoopTrip) {
var locationIconName = "ICO Cell Blank"
if knownLocationRepository.locationsEntityIdMap.count > 0 {