diff --git a/Ring/Ring/Features/Me/Me/DeviceCell.swift b/Ring/Ring/Features/Me/Me/DeviceCell.swift index 568df0a07a5ffb4f642adbfadfd3dec62de3f2b3..6ea0b6e995e2283e49fba57ad98c2e908e40049e 100644 --- a/Ring/Ring/Features/Me/Me/DeviceCell.swift +++ b/Ring/Ring/Features/Me/Me/DeviceCell.swift @@ -24,4 +24,5 @@ import RxSwift class DeviceCell: UITableViewCell, NibReusable { @IBOutlet weak var deviceIdLabel: UILabel! + @IBOutlet weak var deviceNameLabel: UILabel! } diff --git a/Ring/Ring/Features/Me/Me/DeviceCell.xib b/Ring/Ring/Features/Me/Me/DeviceCell.xib index 73c29127b5f9c9f18f269bee5a87a437ec1498ad..dd95e44c145d32e9c7b7b2be4ca2630d1487a86d 100644 --- a/Ring/Ring/Features/Me/Me/DeviceCell.xib +++ b/Ring/Ring/Features/Me/Me/DeviceCell.xib @@ -6,49 +6,60 @@ <dependencies> <deployment identifier="iOS"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/> + <capability name="Constraints to layout margins" minToolsVersion="6.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"/> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="15" id="Fgg-CE-GkC" customClass="DeviceCell" customModule="Ring" customModuleProvider="target"> - <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="default" indentationWidth="15" rowHeight="59" id="Fgg-CE-GkC" customClass="DeviceCell" customModule="Ring" customModuleProvider="target"> + <rect key="frame" x="0.0" y="0.0" width="375" height="80"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Fgg-CE-GkC" id="fvy-0B-phe"> - <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/> + <rect key="frame" x="0.0" y="0.0" width="375" height="79.5"/> <autoresizingMask key="autoresizingMask"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Device ID" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OQs-TS-z4j"> - <rect key="frame" x="40" y="15" width="325" height="13.5"/> - <fontDescription key="fontDescription" type="system" pointSize="15"/> + <rect key="frame" x="8" y="31.5" width="61.5" height="30"/> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Emx-P1-xQc"> + <rect key="frame" x="8" y="10" width="39.5" height="19.5"/> + <fontDescription key="fontDescription" type="system" pointSize="16"/> <nil key="textColor"/> <nil key="highlightedColor"/> </label> - <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="device" translatesAutoresizingMaskIntoConstraints="NO" id="rQq-Mc-A6A"> - <rect key="frame" x="10" y="12" width="20" height="20"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nhJ-Qc-UCB"> + <rect key="frame" x="15" y="77.5" width="345" height="1"/> + <color key="backgroundColor" name="gridColor" catalog="System" colorSpace="catalog"/> <constraints> - <constraint firstAttribute="width" constant="20" id="GWa-IT-XzN"/> - <constraint firstAttribute="height" constant="20" id="yTt-mK-xNR"/> + <constraint firstAttribute="height" constant="1" id="PFf-5r-QZ9"/> </constraints> - </imageView> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> </subviews> <constraints> - <constraint firstItem="OQs-TS-z4j" firstAttribute="centerY" secondItem="fvy-0B-phe" secondAttribute="centerY" id="1ub-Tt-uhc"/> - <constraint firstItem="OQs-TS-z4j" firstAttribute="top" secondItem="fvy-0B-phe" secondAttribute="top" constant="15" id="Bm7-bn-pZ8"/> - <constraint firstItem="rQq-Mc-A6A" firstAttribute="leading" secondItem="fvy-0B-phe" secondAttribute="leading" constant="10" id="CCb-8S-cPs"/> - <constraint firstItem="OQs-TS-z4j" firstAttribute="leading" secondItem="rQq-Mc-A6A" secondAttribute="trailing" constant="10" id="SBZ-1f-gmH"/> - <constraint firstAttribute="trailing" secondItem="OQs-TS-z4j" secondAttribute="trailing" constant="10" id="c1v-0c-oUl"/> - <constraint firstAttribute="bottom" secondItem="OQs-TS-z4j" secondAttribute="bottom" constant="15" id="uZX-qs-oIK"/> - <constraint firstItem="rQq-Mc-A6A" firstAttribute="centerY" secondItem="fvy-0B-phe" secondAttribute="centerY" id="vxW-wo-3mL"/> + <constraint firstItem="OQs-TS-z4j" firstAttribute="top" secondItem="Emx-P1-xQc" secondAttribute="bottom" constant="2" id="1u2-sP-E0H"/> + <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="Emx-P1-xQc" secondAttribute="trailing" constant="20" symbolic="YES" id="3NP-Bl-2xN"/> + <constraint firstAttribute="bottom" secondItem="nhJ-Qc-UCB" secondAttribute="bottom" constant="1" id="J3B-DR-i7C"/> + <constraint firstItem="nhJ-Qc-UCB" firstAttribute="leading" secondItem="fvy-0B-phe" secondAttribute="leading" constant="15" id="QFw-mo-mRM"/> + <constraint firstItem="Emx-P1-xQc" firstAttribute="leading" secondItem="OQs-TS-z4j" secondAttribute="leading" id="VnE-T5-ZB0"/> + <constraint firstAttribute="trailing" secondItem="nhJ-Qc-UCB" secondAttribute="trailing" constant="15" id="XZz-Yv-j22"/> + <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="OQs-TS-z4j" secondAttribute="trailing" constant="10" id="c1v-0c-oUl"/> + <constraint firstItem="Emx-P1-xQc" firstAttribute="top" secondItem="fvy-0B-phe" secondAttribute="top" constant="10" id="jpW-b6-d6g"/> + <constraint firstItem="OQs-TS-z4j" firstAttribute="leading" secondItem="fvy-0B-phe" secondAttribute="leadingMargin" id="m5d-gg-Ugj"/> + <constraint firstAttribute="bottomMargin" secondItem="OQs-TS-z4j" secondAttribute="bottom" constant="10" id="mzU-aw-WHP"/> </constraints> </tableViewCellContentView> <connections> <outlet property="deviceIdLabel" destination="OQs-TS-z4j" id="UZg-Z8-A28"/> + <outlet property="deviceNameLabel" destination="Emx-P1-xQc" id="Z5C-rX-Jmc"/> </connections> - <point key="canvasLocation" x="85.5" y="124"/> + <point key="canvasLocation" x="85.5" y="131"/> </tableViewCell> </objects> - <resources> - <image name="device" width="24" height="24"/> - </resources> </document> diff --git a/Ring/Ring/Features/Me/Me/MeViewController.storyboard b/Ring/Ring/Features/Me/Me/MeViewController.storyboard index 2325c9b3389b987fb578ee39964f02217000f4c0..37bbfb4d1b17c6d63a289f1c7e34863c0f6056b6 100644 --- a/Ring/Ring/Features/Me/Me/MeViewController.storyboard +++ b/Ring/Ring/Features/Me/Me/MeViewController.storyboard @@ -74,7 +74,7 @@ </userDefinedRuntimeAttributes> </label> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_contact_picture" translatesAutoresizingMaskIntoConstraints="NO" id="8HY-Zl-94u"> - <rect key="frame" x="137" y="70" width="100" height="100"/> + <rect key="frame" x="137.5" y="70" width="100" height="100"/> <constraints> <constraint firstAttribute="height" constant="100" id="3Ik-A7-Cyx"/> <constraint firstAttribute="width" constant="100" id="xE6-h0-miE"/> @@ -86,7 +86,7 @@ <color key="textColor" red="0.20000000300000001" green="0.20000000300000001" blue="0.20000000300000001" alpha="1" colorSpace="calibratedRGB"/> <nil key="highlightedColor"/> </label> - <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="eg8-N7-lDA"> + <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="40" estimatedSectionHeaderHeight="40" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="eg8-N7-lDA"> <rect key="frame" x="0.0" y="310" width="375" height="357"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> </tableView> @@ -96,7 +96,6 @@ <constraint firstItem="tam-QD-Xpf" firstAttribute="top" secondItem="eg8-N7-lDA" secondAttribute="bottom" id="2zg-J2-7oF"/> <constraint firstAttribute="trailingMargin" secondItem="rC6-Ga-QjY" secondAttribute="trailing" constant="5" id="4mU-no-jxy"/> <constraint firstItem="tS0-P7-fYT" firstAttribute="leading" secondItem="nkh-py-Uar" secondAttribute="leading" constant="20" id="6OH-dg-fT7"/> - <constraint firstAttribute="trailingMargin" secondItem="w8x-Sv-T50" secondAttribute="trailing" constant="5" id="Bm3-S8-KXr"/> <constraint firstItem="GCe-jT-OCG" firstAttribute="top" secondItem="8HY-Zl-94u" secondAttribute="bottom" constant="30" id="E9u-9R-kVg"/> <constraint firstItem="8HY-Zl-94u" firstAttribute="top" secondItem="nkh-py-Uar" secondAttribute="topMargin" constant="50" id="FBb-kO-4nV"/> <constraint firstItem="tS0-P7-fYT" firstAttribute="top" secondItem="GCe-jT-OCG" secondAttribute="bottom" constant="1" id="FGU-ae-3wK"/> @@ -107,9 +106,12 @@ <constraint firstItem="GCe-jT-OCG" firstAttribute="leading" secondItem="nkh-py-Uar" secondAttribute="leadingMargin" constant="20" id="Sp4-fa-qoR"/> <constraint firstAttribute="trailing" secondItem="tS0-P7-fYT" secondAttribute="trailing" constant="20" id="Uvb-ZR-7rf"/> <constraint firstItem="GCe-jT-OCG" firstAttribute="centerX" secondItem="nkh-py-Uar" secondAttribute="centerX" id="WO3-X1-ObR"/> + <constraint firstItem="w8x-Sv-T50" firstAttribute="trailing" secondItem="rC6-Ga-QjY" secondAttribute="trailing" id="cl3-7W-wQd"/> <constraint firstItem="rC6-Ga-QjY" firstAttribute="leading" secondItem="nkh-py-Uar" secondAttribute="leadingMargin" constant="5" id="g4K-vz-fbY"/> <constraint firstItem="w8x-Sv-T50" firstAttribute="top" secondItem="rC6-Ga-QjY" secondAttribute="bottom" constant="5" id="kSt-bN-hIG"/> <constraint firstItem="eg8-N7-lDA" firstAttribute="leading" secondItem="nkh-py-Uar" secondAttribute="leading" id="lt1-n4-Wb9"/> + <constraint firstItem="w8x-Sv-T50" firstAttribute="centerX" secondItem="nkh-py-Uar" secondAttribute="centerX" id="mWZ-vm-Oj4"/> + <constraint firstItem="rC6-Ga-QjY" firstAttribute="centerX" secondItem="nkh-py-Uar" secondAttribute="centerX" id="s2O-7d-18r"/> <constraint firstItem="w8x-Sv-T50" firstAttribute="leading" secondItem="rC6-Ga-QjY" secondAttribute="leading" id="t75-yu-OEC"/> <constraint firstAttribute="trailing" secondItem="eg8-N7-lDA" secondAttribute="trailing" id="tv6-ma-ze2"/> <constraint firstItem="rC6-Ga-QjY" firstAttribute="top" secondItem="tS0-P7-fYT" secondAttribute="bottom" constant="21" id="yve-5B-6tl"/> diff --git a/Ring/Ring/Features/Me/Me/MeViewController.swift b/Ring/Ring/Features/Me/Me/MeViewController.swift index f52b5697f3f399d55d5dc3dc25adac30fd976357..6d7d34a42d1056d525f9cb99c05bd3d0c7576c6b 100644 --- a/Ring/Ring/Features/Me/Me/MeViewController.swift +++ b/Ring/Ring/Features/Me/Me/MeViewController.swift @@ -81,6 +81,9 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas let cell = tableView.dequeueReusableCell(for: indexPath, cellType: DeviceCell.self) cell.deviceIdLabel.text = device.deviceId + if let deviceName = device.deviceName { + cell.deviceNameLabel.text = deviceName + } cell.selectionStyle = .none return cell diff --git a/Ring/Ring/Models/DeviceModel.swift b/Ring/Ring/Models/DeviceModel.swift index 3998bdcbbfbb5695f40990b9e48dc3165e756f33..5a1840732f19be82b0c4d5248cc2b63ce53b5e5b 100644 --- a/Ring/Ring/Models/DeviceModel.swift +++ b/Ring/Ring/Models/DeviceModel.swift @@ -24,9 +24,11 @@ import RxRealm class DeviceModel: Object { dynamic var deviceId = "" + dynamic var deviceName: String? - convenience init(withDeviceId deviceId: String) { + convenience init(withDeviceId deviceId: String, deviceName: String?) { self.init() self.deviceId = deviceId + self.deviceName = deviceName } } diff --git a/Ring/Ring/Services/AccountsService.swift b/Ring/Ring/Services/AccountsService.swift index 528bdb79ee167d4d951aa9ef07634eecf6658005..11b38ea9578c29f6812ec2ab6ea247b604089b88 100644 --- a/Ring/Ring/Services/AccountsService.swift +++ b/Ring/Ring/Services/AccountsService.swift @@ -354,7 +354,7 @@ class AccountsService: AccountAdapterDelegate { for key in knownRingDevices.allKeys { if let key = key as? String { - devices.append(DeviceModel(withDeviceId: key)) + devices.append(DeviceModel(withDeviceId: key, deviceName: knownRingDevices.value(forKey: key) as? String)) } }