Merge branch 'main' of github.com:hykilpikonna/ProjectClock into main

This commit is contained in:
Aaron
2021-01-24 19:27:26 -05:00
3 changed files with 54 additions and 20 deletions
+21 -3
View File
@@ -199,18 +199,26 @@ class FamilyVC: UIViewController
performSegue(withIdentifier: "family-create-join", sender: nil)
}
@IBSegueAction func sendAlarm(_ c: NSCoder) -> FamilyCreateJoinVC?
@IBSegueAction func segueCreateJoin(_ coder: NSCoder) -> FamilyCreateJoinVC?
{
return FamilyCreateJoinVC(coder: c, create: createMode)
return FamilyCreateJoinVC(coder: coder, create: createMode)
}
}
/**
Create or join a family
*/
class FamilyCreateJoinVC: UIViewController
{
let createMode: Bool
@IBOutlet weak var lFamilyNameOrId: UILabel!
@IBOutlet weak var bCreateJoin: UIButton!
@IBOutlet weak var tNameOrId: UITextField!
@IBOutlet weak var tPin: UITextField!
/**
Pass in create mode from FamilyVC
*/
init?(coder: NSCoder, create: Bool)
{
createMode = create
@@ -225,6 +233,16 @@ class FamilyCreateJoinVC: UIViewController
override func viewDidLoad()
{
lFamilyNameOrId.text = createMode ? "Family Name" : "Family ID"
bCreateJoin.setTitle(createMode ? "Create" : "Join", for: .normal)
}
/**
Called when the user clicks create or join button
*/
@IBAction func btnCreateOrJoin(_ sender: Any)
{
// Check pin
guard let pin = tPin.text, pin.count >= 4 else { msg("Pin Too Weak", "Your family pin must be 4 numbers or more."); return }
}
}
+32 -8
View File
@@ -1016,7 +1016,7 @@
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="UGD-ka-LPo">
<rect key="frame" x="120" y="0.0" width="254" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" secureTextEntry="YES"/>
<textInputTraits key="textInputTraits" secureTextEntry="YES" textContentType="one-time-code"/>
</textField>
</subviews>
</stackView>
@@ -1024,6 +1024,7 @@
<rect key="frame" x="0.0" y="108" width="374" height="34"/>
<state key="normal" title="Create/Join"/>
<connections>
<action selector="btnCreateOrJoin:" destination="MJK-PM-TUJ" eventType="touchUpInside" id="wqB-ir-1be"/>
<action selector="register:" destination="ZAC-hn-zGl" eventType="touchUpInside" id="fbN-Jr-RKv"/>
</connections>
</button>
@@ -1040,7 +1041,10 @@
</view>
<navigationItem key="navigationItem" id="ZUB-xj-wf6"/>
<connections>
<outlet property="bCreateJoin" destination="KSB-S7-kAX" id="aeU-Yk-wmh"/>
<outlet property="lFamilyNameOrId" destination="YfO-H5-olP" id="OXM-3N-ZVV"/>
<outlet property="tNameOrId" destination="aPT-13-Az4" id="6Cw-ur-FBF"/>
<outlet property="tPin" destination="UGD-ka-LPo" id="aNg-6j-ipe"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="kMK-Pp-v1l" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
@@ -1055,15 +1059,15 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="650"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dki-8q-7sB">
<rect key="frame" x="20" y="20" width="374" height="61"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="justified" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dki-8q-7sB">
<rect key="frame" x="20" y="65" width="374" height="57.5"/>
<string key="text">You're not in a family yet. Do you want to create or join one? If you are a parent, family features allow you to add alarms to your children's list.</string>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" systemColor="secondaryLabelColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="Afe-5l-IkF">
<rect key="frame" x="20" y="101" width="374" height="30"/>
<rect key="frame" x="20" y="142.5" width="374" height="30"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Dd1-LB-2Mm">
<rect key="frame" x="0.0" y="0.0" width="177" height="30"/>
@@ -1071,7 +1075,6 @@
<connections>
<action selector="btnCreate:" destination="4ss-Ye-Da4" eventType="touchUpInside" id="hQN-oC-Qzf"/>
<action selector="register:" destination="ZAC-hn-zGl" eventType="touchUpInside" id="4uN-vJ-WXg"/>
<segue destination="MJK-PM-TUJ" kind="show" identifier="family-create-join" id="yZc-SF-F4F"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tz1-gQ-74Y">
@@ -1084,19 +1087,40 @@
</button>
</subviews>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Family" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4kN-8K-gM9">
<rect key="frame" x="20" y="10" width="374" height="20.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Manage Family Members" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4JV-r6-luC">
<rect key="frame" x="20" y="30.5" width="374" height="14.5"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="ZHP-aO-cBk"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="Afe-5l-IkF" firstAttribute="leading" secondItem="ZHP-aO-cBk" secondAttribute="leading" constant="20" id="7Wq-4d-rTw"/>
<constraint firstItem="4kN-8K-gM9" firstAttribute="top" secondItem="ZHP-aO-cBk" secondAttribute="top" constant="10" id="99M-Lo-GoC"/>
<constraint firstItem="4kN-8K-gM9" firstAttribute="trailing" secondItem="4JV-r6-luC" secondAttribute="trailing" id="Idr-0Z-Irc"/>
<constraint firstItem="Dki-8q-7sB" firstAttribute="leading" secondItem="ZHP-aO-cBk" secondAttribute="leading" constant="20" id="XkE-W5-sWz"/>
<constraint firstItem="Dki-8q-7sB" firstAttribute="top" secondItem="ZHP-aO-cBk" secondAttribute="top" constant="20" id="Zfm-Dv-FID"/>
<constraint firstAttribute="trailing" secondItem="Dki-8q-7sB" secondAttribute="trailing" constant="20" id="Zvs-aO-MjT"/>
<constraint firstItem="Dki-8q-7sB" firstAttribute="top" secondItem="4JV-r6-luC" secondAttribute="bottom" constant="20" id="eMB-cQ-PAa"/>
<constraint firstItem="4JV-r6-luC" firstAttribute="leading" secondItem="Dki-8q-7sB" secondAttribute="leading" id="fKc-7I-xvr"/>
<constraint firstItem="ZHP-aO-cBk" firstAttribute="trailing" secondItem="Afe-5l-IkF" secondAttribute="trailing" constant="20" id="hgw-f3-cc9"/>
<constraint firstItem="4kN-8K-gM9" firstAttribute="leading" secondItem="4JV-r6-luC" secondAttribute="leading" id="hyU-dP-Zcc"/>
<constraint firstItem="4JV-r6-luC" firstAttribute="trailing" secondItem="Dki-8q-7sB" secondAttribute="trailing" id="oH4-ST-DRW"/>
<constraint firstItem="Afe-5l-IkF" firstAttribute="top" secondItem="Dki-8q-7sB" secondAttribute="bottom" constant="20" id="pI4-jL-6vb"/>
<constraint firstItem="4JV-r6-luC" firstAttribute="top" secondItem="4kN-8K-gM9" secondAttribute="bottom" id="xRb-1q-Gad"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="6by-4V-XuW"/>
<connections>
<segue destination="MJK-PM-TUJ" kind="show" identifier="family-create-join" destinationCreationSelector="segueCreateJoin:" id="Abf-zv-CJ0"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="eGH-yq-k1z" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
+1 -9
View File
@@ -8,18 +8,10 @@
import Foundation
import AVFoundation
struct User: Codable
{
var id: String
var name: String
var email: String
var pass: String
}
struct Family: Codable
{
var fid: Int
var fname: String
var name: String
var members: [String]
// And a hidden field: admin pin
}