Commit 5919311d authored by Philip Brechler's avatar Philip Brechler

Merge branch 'master' into 'hatchery_makeover'

# Conflicts:
#   card10badge/Base.lproj/Main.storyboard
#   card10badge/Conncted/ConnectedViewController.swift
parents 5a3c156d cdb1b74b
......@@ -97,7 +97,7 @@
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="JET-70-HyJ">
<rect key="frame" x="20" y="194" width="374" height="337.5"/>
<rect key="frame" x="20" y="194" width="374" height="365.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Light Sensor: 0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lJg-Re-XS3">
<rect key="frame" x="0.0" y="0.0" width="374" height="20.5"/>
......@@ -114,24 +114,36 @@
<action selector="setTimeButtonActionWithSender:" destination="e67-Bh-g0f" eventType="touchUpInside" id="iw9-SA-WOv"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UFI-0G-kFH">
<rect key="frame" x="0.0" y="74.5" width="374" height="30"/>
<state key="normal" title="Upload File">
<color key="titleColor" name="communication_color"/>
</state>
<connections>
<action selector="uploadFileButtonActionWithSender:" destination="e67-Bh-g0f" eventType="touchUpInside" id="9b0-nX-VpP"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ppM-PE-5Ht" userLabel="Upload Button Wrapper">
<rect key="frame" x="0.0" y="74.5" width="374" height="44"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UFI-0G-kFH">
<rect key="frame" x="128.5" y="8" width="117" height="28"/>
<inset key="contentEdgeInsets" minX="20" minY="5" maxX="20" maxY="5"/>
<state key="normal" title="Upload File">
<color key="titleColor" name="tintColor"/>
</state>
<connections>
<action selector="uploadFileButtonActionWithSender:" destination="e67-Bh-g0f" eventType="touchUpInside" id="9b0-nX-VpP"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="B7s-ZB-b58"/>
<constraint firstItem="UFI-0G-kFH" firstAttribute="centerX" secondItem="ppM-PE-5Ht" secondAttribute="centerX" id="btj-Kg-8at"/>
<constraint firstItem="UFI-0G-kFH" firstAttribute="centerY" secondItem="ppM-PE-5Ht" secondAttribute="centerY" id="ndA-9W-ysr"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="z6x-tZ-fWU" userLabel="Separator View">
<rect key="frame" x="0.0" y="116.5" width="374" height="1"/>
<rect key="frame" x="0.0" y="130.5" width="374" height="1"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="4Qx-us-bLV"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="1D6-jV-aH3">
<rect key="frame" x="0.0" y="129.5" width="374" height="29"/>
<rect key="frame" x="0.0" y="143.5" width="374" height="29"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Blue Rocket" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cB5-3u-vrD">
<rect key="frame" x="0.0" y="0.0" width="272" height="29"/>
......@@ -149,7 +161,7 @@
<viewLayoutGuide key="safeArea" id="Ygw-J2-6aA"/>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="znU-kU-yoJ">
<rect key="frame" x="0.0" y="170.5" width="374" height="29"/>
<rect key="frame" x="0.0" y="184.5" width="374" height="29"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Yellow Rocket" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mn7-Gg-Hsi">
<rect key="frame" x="0.0" y="0.0" width="272" height="29"/>
......@@ -166,7 +178,7 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="sr7-gT-G1y">
<rect key="frame" x="0.0" y="211.5" width="374" height="29"/>
<rect key="frame" x="0.0" y="225.5" width="374" height="29"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Green Rocket" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fnh-o6-x1V">
<rect key="frame" x="0.0" y="0.0" width="272" height="29"/>
......@@ -184,19 +196,19 @@
<viewLayoutGuide key="safeArea" id="9RV-tW-uRj"/>
</stackView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="31w-Zr-Xcp" userLabel="Separator View">
<rect key="frame" x="0.0" y="252.5" width="374" height="1"/>
<rect key="frame" x="0.0" y="266.5" width="374" height="1"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="0xT-F1-xr0"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" spacing="22" translatesAutoresizingMaskIntoConstraints="NO" id="MLe-f0-Jxr">
<rect key="frame" x="0.0" y="265.5" width="374" height="30"/>
<rect key="frame" x="0.0" y="279.5" width="374" height="30"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="100 ms" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8q2-st-RHK" userLabel="Vibration Duration Label">
<rect key="frame" x="0.0" y="0.0" width="55.5" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<color key="textColor" name="tintColor"/>
<nil key="highlightedColor"/>
</label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="100" minValue="1" maxValue="1000" translatesAutoresizingMaskIntoConstraints="NO" id="rkJ-6S-YNK">
......@@ -208,15 +220,30 @@
</slider>
</subviews>
</stackView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fgN-8S-U4R">
<rect key="frame" x="0.0" y="307.5" width="374" height="30"/>
<state key="normal" title="((( Vibrate )))">
<color key="titleColor" name="communication_color"/>
</state>
<connections>
<action selector="vibrateButtonActionWithSender:" destination="e67-Bh-g0f" eventType="touchUpInside" id="tCP-NF-fRk"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tUq-Xb-8Xb" userLabel="Vibrate Button Wrapper">
<rect key="frame" x="0.0" y="321.5" width="374" height="44"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fgN-8S-U4R">
<rect key="frame" x="121.5" y="0.0" width="131" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="a7U-Cz-Ala"/>
</constraints>
<inset key="contentEdgeInsets" minX="20" minY="5" maxX="20" maxY="5"/>
<state key="normal" title="((( Vibrate )))">
<color key="titleColor" name="tintColor"/>
</state>
<connections>
<action selector="vibrateButtonActionWithSender:" destination="e67-Bh-g0f" eventType="touchUpInside" id="tCP-NF-fRk"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="fgN-8S-U4R" firstAttribute="centerX" secondItem="tUq-Xb-8Xb" secondAttribute="centerX" id="B9m-on-yCh"/>
<constraint firstItem="fgN-8S-U4R" firstAttribute="centerY" secondItem="tUq-Xb-8Xb" secondAttribute="centerY" id="cOs-Lu-BnR"/>
<constraint firstAttribute="height" constant="44" id="lCx-H1-ahM"/>
</constraints>
</view>
</subviews>
</stackView>
</subviews>
......@@ -244,6 +271,7 @@
<outlet property="rocket2Stepper" destination="KQi-nU-1q5" id="aia-G2-P7I"/>
<outlet property="rocket3Label" destination="fnh-o6-x1V" id="YMd-1g-A4d"/>
<outlet property="rocket3Stepper" destination="I6D-iL-6DL" id="mKE-Jy-YpQ"/>
<outlet property="uploadFileButton" destination="UFI-0G-kFH" id="Z6B-Qa-8oc"/>
<outlet property="vibrateButton" destination="fgN-8S-U4R" id="IlA-I1-Nca"/>
<outlet property="vibrateDurationLabel" destination="8q2-st-RHK" id="wPj-Gt-zde"/>
<outlet property="vibrateSlider" destination="rkJ-6S-YNK" id="FOe-8j-s0V"/>
......
......@@ -25,6 +25,7 @@ class ConnectedViewController: UIViewController,UIDocumentPickerDelegate,Bluetoo
@IBOutlet weak var rocket3Label: UILabel?
@IBOutlet weak var rocket3Stepper: UIStepper?
@IBOutlet weak var uploadFileButton: UIButton!
@IBOutlet weak var vibrateButton: UIButton!
@IBOutlet weak var vibrateSlider: UISlider!
@IBOutlet weak var vibrateDurationLabel: UILabel!
......@@ -47,9 +48,13 @@ class ConnectedViewController: UIViewController,UIDocumentPickerDelegate,Bluetoo
override func viewDidLoad() {
super.viewDidLoad()
self.tabBarItem = UITabBarItem.init(title: "Control", image: UIImage(named: "control_icon"), selectedImage: nil)
self.navigationController?.navigationBar.tintColor = UIColor.init(named: "communication_color")
self.tabBarItem = UITabBarItem.init(title: "Control", image: UIImage(named: "fd_communication"), selectedImage: nil)
[uploadFileButton, vibrateButton].compactMap { $0 }.forEach {
$0.layer.cornerRadius = 5
$0.layer.borderColor = UIColor.init(named: "tintColor")?.cgColor
$0.layer.borderWidth = 1
}
}
override func viewWillAppear(_ animated: Bool) {
......@@ -190,7 +195,7 @@ extension ConnectedViewController {
var b: UInt8 = 0
while (UInt64(r) + UInt64(g) + UInt64(b) == UInt64(0)) {
r = UInt8.random(in: 0..<3) * 127 // 128 would overflow UInt(8
r = UInt8.random(in: 0..<3) * 127 // 128 would overflow UInt 😬
g = UInt8.random(in: 0..<3) * 127
b = UInt8.random(in: 0..<3) * 127
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment