Skip to content

Commit

Permalink
Working on new event view
Browse files Browse the repository at this point in the history
  • Loading branch information
redsn0w422 committed Feb 18, 2017
1 parent 92c120b commit c7c1ebd
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 26 deletions.
4 changes: 4 additions & 0 deletions HackIllinois: QR.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
2C2EFF3751D864194E8AAF57 /* Pods_HackIllinois__QRTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66B938DD4A3F3CC85BE83D48 /* Pods_HackIllinois__QRTests.framework */; };
3DA2A117F80259320E343F6A /* Pods_HackIllinois__QR.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 305529D902BF1604EEA51AF9 /* Pods_HackIllinois__QR.framework */; };
84C7D6CF1E5394110018AA46 /* ScanViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84C7D6CE1E5394110018AA46 /* ScanViewController.swift */; };
84EF44C21E581BD200581079 /* AddViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84EF44C11E581BD200581079 /* AddViewController.swift */; };
84EFA7471E51407B00424F8F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84EFA7461E51407B00424F8F /* AppDelegate.swift */; };
84EFA7491E51407B00424F8F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84EFA7481E51407B00424F8F /* ViewController.swift */; };
84EFA74C1E51407B00424F8F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84EFA74A1E51407B00424F8F /* Main.storyboard */; };
Expand Down Expand Up @@ -46,6 +47,7 @@
66B938DD4A3F3CC85BE83D48 /* Pods_HackIllinois__QRTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_HackIllinois__QRTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6B154F548C1D70B49E437A8B /* Pods-HackIllinois: QR.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HackIllinois: QR.release.xcconfig"; path = "Pods/Target Support Files/Pods-HackIllinois: QR/Pods-HackIllinois: QR.release.xcconfig"; sourceTree = "<group>"; };
84C7D6CE1E5394110018AA46 /* ScanViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScanViewController.swift; sourceTree = "<group>"; };
84EF44C11E581BD200581079 /* AddViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddViewController.swift; sourceTree = "<group>"; };
84EFA7431E51407B00424F8F /* HackIllinois: QR.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "HackIllinois: QR.app"; sourceTree = BUILT_PRODUCTS_DIR; };
84EFA7461E51407B00424F8F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
84EFA7481E51407B00424F8F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -132,6 +134,7 @@
84EFA7461E51407B00424F8F /* AppDelegate.swift */,
84EFA7481E51407B00424F8F /* ViewController.swift */,
84EFA74A1E51407B00424F8F /* Main.storyboard */,
84EF44C11E581BD200581079 /* AddViewController.swift */,
84C7D6CE1E5394110018AA46 /* ScanViewController.swift */,
84EFA74D1E51407B00424F8F /* Assets.xcassets */,
84EFA74F1E51407B00424F8F /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -454,6 +457,7 @@
files = (
84EFA7491E51407B00424F8F /* ViewController.swift in Sources */,
84EFA7471E51407B00424F8F /* AppDelegate.swift in Sources */,
84EF44C21E581BD200581079 /* AddViewController.swift in Sources */,
84C7D6CF1E5394110018AA46 /* ScanViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Binary file not shown.
43 changes: 43 additions & 0 deletions HackIllinois: QR/AddViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// AddViewController.swift
// HackIllinois: QR
//
// Created by Yasha Mostofi on 2/18/17.
// Copyright © 2017 Yasha Mostofi. All rights reserved.
//

import UIKit

class AddViewController: BaseViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

@IBAction func cancelButton(_ sender: Any) {
print("cancel")
self.dismiss(animated: true, completion: nil)
}
@IBAction func saveButton(_ sender: Any) {
print("save")
self.dismiss(animated: true, completion: nil)
}
}
98 changes: 78 additions & 20 deletions HackIllinois: QR/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<scene sceneID="oCW-CJ-bju">
<objects>
<navigationController id="noT-k3-Ta6" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" misplaced="YES" id="zqM-SB-frT">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="zqM-SB-frT">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
Expand Down Expand Up @@ -78,7 +78,7 @@
<outlet property="email_input" destination="OhU-0G-emJ" id="dTM-Ny-Aq4"/>
<outlet property="login_button" destination="FWv-Br-zeN" id="Dlg-8g-llq"/>
<outlet property="password_input" destination="Yol-Ws-fKc" id="Opa-cR-l3K"/>
<segue destination="QsI-mm-d63" kind="show" identifier="ShowScanner" id="l2e-BM-Zud"/>
<segue destination="gqP-1R-7Tq" kind="show" identifier="ShowScanner" id="l2e-BM-Zud"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
Expand All @@ -96,33 +96,91 @@
<view key="view" contentMode="scaleToFill" id="dqU-7c-ajY">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cAY-5J-vOQ">
<rect key="frame" x="131" y="531" width="114" height="42"/>
<fontDescription key="fontDescription" type="system" pointSize="25"/>
<state key="normal" title="Add Event">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
</state>
<connections>
<action selector="addEventButton:" destination="QsI-mm-d63" eventType="touchUpInside" id="Cqf-uj-vG1"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="cAY-5J-vOQ" firstAttribute="centerX" secondItem="dqU-7c-ajY" secondAttribute="centerX" id="4de-ef-Rln"/>
<constraint firstItem="R6N-vG-jFR" firstAttribute="top" secondItem="cAY-5J-vOQ" secondAttribute="bottom" constant="50" id="WHR-vR-zRS"/>
</constraints>
</view>
<toolbarItems/>
<navigationItem key="navigationItem" id="xYJ-WG-hPI">
<barButtonItem key="rightBarButtonItem" systemItem="add" id="I8X-Jc-Lz3">
<connections>
<action selector="addEventButton:" destination="QsI-mm-d63" id="ZSE-U6-xBH"/>
<segue destination="Lyj-Dz-FZM" kind="show" id="20l-oK-NOU"/>
</connections>
</barButtonItem>
</navigationItem>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<outlet property="add_event" destination="cAY-5J-vOQ" id="8h8-3N-4pE"/>
<outlet property="add_event" destination="I8X-Jc-Lz3" id="bNz-8o-N2t"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="CJd-Uf-4dR" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="812" y="39"/>
<point key="canvasLocation" x="1751.2" y="38.23088455772114"/>
</scene>
<!--Add View Controller-->
<scene sceneID="dkz-WM-Zfq">
<objects>
<viewController id="3F4-SQ-gnG" customClass="AddViewController" customModule="HackIllinois__QR" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="lc2-9j-zBJ"/>
<viewControllerLayoutGuide type="bottom" id="zsB-gF-2KZ"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="DYl-Fe-Cqg">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="BZI-bG-e1f">
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="8Kp-ho-ibR">
<connections>
<action selector="cancelButton:" destination="3F4-SQ-gnG" id="PkO-SJ-oB8"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" systemItem="save" id="Z0H-vt-13o">
<connections>
<action selector="saveButton:" destination="3F4-SQ-gnG" id="GI5-pB-pHH"/>
</connections>
</barButtonItem>
</navigationItem>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="b7y-gr-5hB" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3656.8000000000002" y="37.331334332833585"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="kX3-py-Zd8">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="gqP-1R-7Tq" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="Bge-cD-Igb">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="QsI-mm-d63" kind="relationship" relationship="rootViewController" id="BJw-mn-T23"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="WZG-zW-Zyj" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="812" y="38.23088455772114"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="aAx-IT-xv1">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="Lyj-Dz-FZM" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="nAu-Cd-Saa">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="3F4-SQ-gnG" kind="relationship" relationship="rootViewController" id="uoN-Np-vxs"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="3sH-Ph-OFb" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2717.5999999999999" y="37.331334332833585"/>
</scene>
</scenes>
</document>
17 changes: 14 additions & 3 deletions HackIllinois: QR/ScanViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,20 @@ import Foundation
class ScanViewController: BaseViewController {
let scanner = QRCode()

@IBOutlet var add_event: UIButton!
@IBOutlet var add_event: UIBarButtonItem!
// @IBOutlet var add_event: UIButton!
// @IBAction func addEventButton(_ sender: Any) {
// print("button clicked")
// if self.check_permissions(key: self.login_session) != "ADMIN" {
// return
// }
//
// }
@IBAction func addEventButton(_ sender: Any) {
print("button clicked")
if self.check_permissions(key: self.login_session) != "ADMIN" {
return
}
}
override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -28,11 +39,11 @@ class ScanViewController: BaseViewController {
}
print(self.check_permissions(key: self.login_session))
if self.check_permissions(key: self.login_session) == "ADMIN" {
self.add_event.isHidden = false
// self.add_event.isHidden = false
self.add_event.isEnabled = true
}
else {
self.add_event.isHidden = true
// self.add_event.isHidden = true
self.add_event.isEnabled = false
}
scanner.prepareScan(view) { (stringValue) -> () in
Expand Down
7 changes: 4 additions & 3 deletions HackIllinois: QR/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ class ViewController: BaseViewController {
let image = UIImage(named: "hackillinois")
imageView.image = image
navigationItem.titleView = imageView
email_input.text = "[email protected]"
password_input.text = "qqqqqqqq"
// email_input.text = "[email protected]"
// password_input.text = "qqqqqqqq"
email_input.text = "[email protected]"

// TODO: make it so you don't have to click the log in each time
}

func logIn(email: String, password: String) {
if email == "" && password == "" {
if email == "" || password == "" {
let preferences = UserDefaults.standard
if preferences.object(forKey: "session") != nil
{
Expand Down

0 comments on commit c7c1ebd

Please sign in to comment.