Skip to content
Snippets Groups Projects
Commit dc09b926 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk
Browse files

Account Page: add device name


Change-Id: Ia6a9cda402cef15266d44139314ebd5ec3b271e5
Reviewed-by: default avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 2c78f0c5
Branches
No related tags found
No related merge requests found
...@@ -24,4 +24,5 @@ import RxSwift ...@@ -24,4 +24,5 @@ import RxSwift
class DeviceCell: UITableViewCell, NibReusable { class DeviceCell: UITableViewCell, NibReusable {
@IBOutlet weak var deviceIdLabel: UILabel! @IBOutlet weak var deviceIdLabel: UILabel!
@IBOutlet weak var deviceNameLabel: UILabel!
} }
...@@ -6,49 +6,60 @@ ...@@ -6,49 +6,60 @@
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/> <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"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <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"> <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="44"/> <rect key="frame" x="0.0" y="0.0" width="375" height="80"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Fgg-CE-GkC" id="fvy-0B-phe"> <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"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <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"> <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"/> <rect key="frame" x="8" y="31.5" width="61.5" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/> <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="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="device" translatesAutoresizingMaskIntoConstraints="NO" id="rQq-Mc-A6A"> <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="10" y="12" width="20" height="20"/> <rect key="frame" x="15" y="77.5" width="345" height="1"/>
<color key="backgroundColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="20" id="GWa-IT-XzN"/> <constraint firstAttribute="height" constant="1" id="PFf-5r-QZ9"/>
<constraint firstAttribute="height" constant="20" id="yTt-mK-xNR"/>
</constraints> </constraints>
</imageView> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews> </subviews>
<constraints> <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="Emx-P1-xQc" secondAttribute="bottom" constant="2" id="1u2-sP-E0H"/>
<constraint firstItem="OQs-TS-z4j" firstAttribute="top" secondItem="fvy-0B-phe" secondAttribute="top" constant="15" id="Bm7-bn-pZ8"/> <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="Emx-P1-xQc" secondAttribute="trailing" constant="20" symbolic="YES" id="3NP-Bl-2xN"/>
<constraint firstItem="rQq-Mc-A6A" firstAttribute="leading" secondItem="fvy-0B-phe" secondAttribute="leading" constant="10" id="CCb-8S-cPs"/> <constraint firstAttribute="bottom" secondItem="nhJ-Qc-UCB" secondAttribute="bottom" constant="1" id="J3B-DR-i7C"/>
<constraint firstItem="OQs-TS-z4j" firstAttribute="leading" secondItem="rQq-Mc-A6A" secondAttribute="trailing" constant="10" id="SBZ-1f-gmH"/> <constraint firstItem="nhJ-Qc-UCB" firstAttribute="leading" secondItem="fvy-0B-phe" secondAttribute="leading" constant="15" id="QFw-mo-mRM"/>
<constraint firstAttribute="trailing" secondItem="OQs-TS-z4j" secondAttribute="trailing" constant="10" id="c1v-0c-oUl"/> <constraint firstItem="Emx-P1-xQc" firstAttribute="leading" secondItem="OQs-TS-z4j" secondAttribute="leading" id="VnE-T5-ZB0"/>
<constraint firstAttribute="bottom" secondItem="OQs-TS-z4j" secondAttribute="bottom" constant="15" id="uZX-qs-oIK"/> <constraint firstAttribute="trailing" secondItem="nhJ-Qc-UCB" secondAttribute="trailing" constant="15" id="XZz-Yv-j22"/>
<constraint firstItem="rQq-Mc-A6A" firstAttribute="centerY" secondItem="fvy-0B-phe" secondAttribute="centerY" id="vxW-wo-3mL"/> <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> </constraints>
</tableViewCellContentView> </tableViewCellContentView>
<connections> <connections>
<outlet property="deviceIdLabel" destination="OQs-TS-z4j" id="UZg-Z8-A28"/> <outlet property="deviceIdLabel" destination="OQs-TS-z4j" id="UZg-Z8-A28"/>
<outlet property="deviceNameLabel" destination="Emx-P1-xQc" id="Z5C-rX-Jmc"/>
</connections> </connections>
<point key="canvasLocation" x="85.5" y="124"/> <point key="canvasLocation" x="85.5" y="131"/>
</tableViewCell> </tableViewCell>
</objects> </objects>
<resources>
<image name="device" width="24" height="24"/>
</resources>
</document> </document>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
</label> </label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_contact_picture" translatesAutoresizingMaskIntoConstraints="NO" id="8HY-Zl-94u"> <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> <constraints>
<constraint firstAttribute="height" constant="100" id="3Ik-A7-Cyx"/> <constraint firstAttribute="height" constant="100" id="3Ik-A7-Cyx"/>
<constraint firstAttribute="width" constant="100" id="xE6-h0-miE"/> <constraint firstAttribute="width" constant="100" id="xE6-h0-miE"/>
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
<color key="textColor" red="0.20000000300000001" green="0.20000000300000001" blue="0.20000000300000001" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="0.20000000300000001" green="0.20000000300000001" blue="0.20000000300000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </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"/> <rect key="frame" x="0.0" y="310" width="375" height="357"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableView> </tableView>
...@@ -96,7 +96,6 @@ ...@@ -96,7 +96,6 @@
<constraint firstItem="tam-QD-Xpf" firstAttribute="top" secondItem="eg8-N7-lDA" secondAttribute="bottom" id="2zg-J2-7oF"/> <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 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 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="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="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"/> <constraint firstItem="tS0-P7-fYT" firstAttribute="top" secondItem="GCe-jT-OCG" secondAttribute="bottom" constant="1" id="FGU-ae-3wK"/>
...@@ -107,9 +106,12 @@ ...@@ -107,9 +106,12 @@
<constraint firstItem="GCe-jT-OCG" firstAttribute="leading" secondItem="nkh-py-Uar" secondAttribute="leadingMargin" constant="20" id="Sp4-fa-qoR"/> <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 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="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="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="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="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 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 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"/> <constraint firstItem="rC6-Ga-QjY" firstAttribute="top" secondItem="tS0-P7-fYT" secondAttribute="bottom" constant="21" id="yve-5B-6tl"/>
......
...@@ -81,6 +81,9 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas ...@@ -81,6 +81,9 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
let cell = tableView.dequeueReusableCell(for: indexPath, cellType: DeviceCell.self) let cell = tableView.dequeueReusableCell(for: indexPath, cellType: DeviceCell.self)
cell.deviceIdLabel.text = device.deviceId cell.deviceIdLabel.text = device.deviceId
if let deviceName = device.deviceName {
cell.deviceNameLabel.text = deviceName
}
cell.selectionStyle = .none cell.selectionStyle = .none
return cell return cell
......
...@@ -24,9 +24,11 @@ import RxRealm ...@@ -24,9 +24,11 @@ import RxRealm
class DeviceModel: Object { class DeviceModel: Object {
dynamic var deviceId = "" dynamic var deviceId = ""
dynamic var deviceName: String?
convenience init(withDeviceId deviceId: String) { convenience init(withDeviceId deviceId: String, deviceName: String?) {
self.init() self.init()
self.deviceId = deviceId self.deviceId = deviceId
self.deviceName = deviceName
} }
} }
...@@ -354,7 +354,7 @@ class AccountsService: AccountAdapterDelegate { ...@@ -354,7 +354,7 @@ class AccountsService: AccountAdapterDelegate {
for key in knownRingDevices.allKeys { for key in knownRingDevices.allKeys {
if let key = key as? String { if let key = key as? String {
devices.append(DeviceModel(withDeviceId: key)) devices.append(DeviceModel(withDeviceId: key, deviceName: knownRingDevices.value(forKey: key) as? String))
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment