Skip to content

Commit

Permalink
Fixed some quirks
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-headspace committed Nov 25, 2018
1 parent 0cb7f73 commit 2d84545
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 74 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Musgravite/Controller/DetailViewController.swift"
timestampString = "564722549.324002"
timestampString = "564818490.101434"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "140"
endingLineNumber = "140"
startingLineNumber = "133"
endingLineNumber = "133"
landmarkName = "getData(_:_:_:)"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -35,5 +35,21 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Musgravite/Controller/DetailViewController.swift"
timestampString = "564818490.102037"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "134"
endingLineNumber = "134"
landmarkName = "getData(_:_:_:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
7 changes: 5 additions & 2 deletions Musgravite/Controller/CharacterCreatorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ class CharacterCreatorViewController: UIViewController, UIImagePickerControllerD
}

override func viewDidAppear(_ animated: Bool) {
inBulletin.backgroundViewStyle = .dimmed
inBulletin.showBulletin(above: self)
if UserDefaults.standard.bool(forKey: "characterLaunchedBefore") {
inBulletin.backgroundViewStyle = .dimmed
inBulletin.showBulletin(above: self)
}
}

func universalUpdater(){
Expand Down Expand Up @@ -273,6 +275,7 @@ class CharacterCreatorViewController: UIViewController, UIImagePickerControllerD
page.requiresCloseButton = false
page.isDismissable = true
page.actionHandler = { item in
UserDefaults.standard.set(true,forKey: "characterLaunchedBefore")
item.manager?.dismissBulletin(animated: true)
self.selection.selectionChanged()
_ = self.navigationController?.popViewController(animated: true)
Expand Down
13 changes: 3 additions & 10 deletions Musgravite/Controller/DetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ import SwiftMessages
import WatchConnectivity

class DetailViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, WCSessionDelegate{
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {

}
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {}

func sessionDidBecomeInactive(_ session: WCSession) {

}
func sessionDidBecomeInactive(_ session: WCSession) {}

func sessionDidDeactivate(_ session: WCSession) {

}
func sessionDidDeactivate(_ session: WCSession) {}


//Laboratory information
Expand Down Expand Up @@ -129,7 +123,6 @@ class DetailViewController: UIViewController, UICollectionViewDelegate, UICollec
bigTitleOutlet.text = labInformation!["nombre"].stringValue
/* To be changed once this information is available */
bigImageOutlet.sd_setImage(with: URL(string: labInformation!["PosterImage"].stringValue),placeholderImage: UIImage(named: "grad0"))
gradientCategory.image = UIImage(named: "grad13")
}

/* Downloads the required data from an URL */
Expand Down
2 changes: 0 additions & 2 deletions Musgravite/Controller/LaboratorySearchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ class LaboratorySearchViewController: UIViewController, UICollectionViewDelegate
Retrieves the information for the interface as a JSON
*/
func retrieveData(){
floorData = LabCards().retrieveFloorData()
labData = LabCards().retrieveLabData()
labByFloorData = filterLabArray()
}

Expand Down
67 changes: 46 additions & 21 deletions Musgravite/Controller/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import CoreLocation
import SVProgressHUD
import Hero
import WatchConnectivity
import SwiftyJSON
import Alamofire

/**
This is an extension to create round images for avatar and what not
Expand All @@ -25,17 +27,10 @@ extension UIImageView {
}

class ViewController: UIViewController, CLLocationManagerDelegate, UICollectionViewDelegate, UICollectionViewDataSource, WCSessionDelegate{
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {

}

func sessionDidBecomeInactive(_ session: WCSession) {

}

func sessionDidDeactivate(_ session: WCSession) {

}
/* Apple Watch Required Sources */
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {}
func sessionDidBecomeInactive(_ session: WCSession) {}
func sessionDidDeactivate(_ session: WCSession) {}

/* Main Menu Cards */
let mainMenu = MainMenuCards()
Expand All @@ -57,6 +52,9 @@ class ViewController: UIViewController, CLLocationManagerDelegate, UICollectionV
@IBOutlet weak var nameLabel: UILabel!
/* Watch Connectivity */
var wcSession:WCSession!
/* JSON File */
var dFloorJSON:JSON?
var dLabJSON:JSON?

override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -73,7 +71,7 @@ class ViewController: UIViewController, CLLocationManagerDelegate, UICollectionV
}

func sendMessageToWatch(_ text:String){
var message = ["message":text]
let message = ["message":text]
wcSession.sendMessage(message, replyHandler: nil, errorHandler: {error in print(error.localizedDescription)})
}

Expand Down Expand Up @@ -102,12 +100,7 @@ class ViewController: UIViewController, CLLocationManagerDelegate, UICollectionV
- Requires: The application to be launched and this method to be run from viewDidLoad
*/
func appHasBeenLaunchedBefore() -> Bool{
let launchedBefore = UserDefaults.standard.bool(forKey: "launchedBefore")
if launchedBefore {
return false
} else {
return true
}
return UserDefaults.standard.bool(forKey: "launchedBefore")
}

override func viewDidAppear(_ animated: Bool) {
Expand Down Expand Up @@ -144,12 +137,44 @@ class ViewController: UIViewController, CLLocationManagerDelegate, UICollectionV
}

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let storyboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let destinationVC = storyboard.instantiateViewController(withIdentifier: mainMenu.targets[indexPath.item])
self.navigationController?.pushViewController(destinationVC, animated: true)
if indexPath.item == 1 {
getData(mainMenu.targets[indexPath.item])
} else {
let storyboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let destinationVC = storyboard.instantiateViewController(withIdentifier: mainMenu.targets[indexPath.item])
self.navigationController?.pushViewController(destinationVC, animated: true)
}
self.selection.selectionChanged()
}

/* Downloads the required data from an URL */
func getData(_ segueIdentifier:String) {
SVProgressHUD.show(withStatus: "Descargando Campus...")
Alamofire.request(NetworkSupport().getFloorUrl()).responseData { (response) in
if response.error == nil {
if let data = response.data {
self.dFloorJSON = try! JSON(data: data)
self.selection.selectionChanged()
Alamofire.request(NetworkSupport().getLabURL()).responseData { (response) in
if response.error == nil {
if let data = response.data {
self.dLabJSON = try! JSON(data: data)
self.selection.selectionChanged()
self.performSegue(withIdentifier: segueIdentifier, sender: self)
SVProgressHUD.dismiss()
}}}
}}}
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "LaboratorySearchViewController" {
if let destination = segue.destination as? LaboratorySearchViewController {
destination.floorData = dFloorJSON
destination.labData = dLabJSON
}
}
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// Show the navigation bar on other view controllers
Expand Down
12 changes: 4 additions & 8 deletions Musgravite/Model/MainMenuCards.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class MainMenuCards {
public let notification = UINotificationFeedbackGenerator()
public let selection = UISelectionFeedbackGenerator()
/* Data to be used in cards */
let images = ["img1","img2","img3","img4"]
let titles = ["Crea tu propio avatar","Busca laboratorios","Acerca de la aplicacion","Laboratorios guardados"]
let subtitles = ["Personaliza tu experiencia virtual","¡Crea tu siguiente inovacion ahora!","Autores detras de este proyecto","Ve la lista de laboratorios guardados"]
let targets = ["CharacterCreatorViewController","LaboratorySearchViewController","AboutPageViewController","UserSavedLaboratoriesViewController"]
let images = ["img1","img2","img3"]
let titles = ["Crea tu propio avatar","Busca laboratorios","Acerca de la aplicacion"]
let subtitles = ["Personaliza tu experiencia virtual","¡Crea tu siguiente inovacion ahora!","Autores detras de este proyecto"]
let targets = ["CharacterCreatorViewController","LaboratorySearchViewController","AboutPageViewController"]


/**
Expand Down Expand Up @@ -168,11 +168,7 @@ class MainMenuCards {
}

page.actionHandler = { item in
#if DEBUG
UserDefaults.standard.set(false, forKey: "launchedBefore")
#else
UserDefaults.standard.set(true, forKey: "launchedBefore")
#endif
item.manager?.dismissBulletin(animated: true)
self.selection.selectionChanged()
}
Expand Down
31 changes: 3 additions & 28 deletions Musgravite/View/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
<outlet property="dateLabel" destination="R5u-Op-nbp" id="xXq-a8-sKx"/>
<outlet property="nameLabel" destination="vlv-HC-85Q" id="sI8-PC-9Ri"/>
<outlet property="userAvatarImage" destination="bbf-O5-pVD" id="2M7-eg-lUs"/>
<segue destination="Azx-5G-eG2" kind="show" identifier="LaboratorySearchViewController" id="LoZ-Pq-Cz1"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
Expand Down Expand Up @@ -495,7 +496,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tI8-h9-M4r">
<rect key="frame" x="0.0" y="44" width="375" height="1322"/>
<rect key="frame" x="0.0" y="88" width="375" height="1278"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="F9f-eU-zWf">
<rect key="frame" x="0.0" y="0.0" width="375" height="1300"/>
Expand All @@ -511,7 +512,7 @@
<userDefinedRuntimeAttribute type="boolean" keyPath="isSkeletonable" value="YES"/>
</userDefinedRuntimeAttributes>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="grad5" translatesAutoresizingMaskIntoConstraints="NO" id="OcG-Qb-MRv">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="OcG-Qb-MRv">
<rect key="frame" x="0.0" y="296" width="375" height="5"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3F9-Ql-c7I">
Expand Down Expand Up @@ -889,7 +890,6 @@
<outlet property="button360" destination="taJ-1z-wPi" id="Cj0-Pn-2CB"/>
<outlet property="button3D" destination="8aP-xc-oZn" id="bVg-jn-Y6L"/>
<outlet property="descriptionOutlet" destination="HF7-KG-ouB" id="Wp2-Oe-Vsl"/>
<outlet property="gradientCategory" destination="OcG-Qb-MRv" id="3wl-w9-XSY"/>
<outlet property="imagesCollectionView" destination="8TW-Zf-lF7" id="oFn-b6-etJ"/>
<outlet property="locationOutlet" destination="3F9-Ql-c7I" id="Ddc-UW-Sep"/>
<outlet property="modelCollectionView" destination="q00-yE-fR5" id="rSd-Sx-udA"/>
Expand Down Expand Up @@ -1081,30 +1081,6 @@
</objects>
<point key="canvasLocation" x="5560.8000000000002" y="551.97044334975374"/>
</scene>
<!--User Saved Laboratories View Controller-->
<scene sceneID="qER-Nb-BYh">
<objects>
<viewController storyboardIdentifier="UserSavedLaboratoriesViewController" id="SKa-CV-k0M" customClass="UserSavedLaboratoriesViewController" customModule="Musgravite" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="7zf-ec-iOH">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="laboratory list" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nm5-Yh-pka">
<rect key="frame" x="132" y="231" width="195" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="GUk-Jo-xxQ"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ag0-9m-Odg" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1382" y="1009"/>
</scene>
<!--Custom Nav View Controller-->
<scene sceneID="R9O-qN-wfI">
<objects>
Expand Down Expand Up @@ -1621,7 +1597,6 @@
<image name="eyecol-6" width="117" height="40"/>
<image name="grad17" width="600" height="500"/>
<image name="grad19" width="600" height="500"/>
<image name="grad5" width="600" height="500"/>
<image name="head-1" width="400" height="400"/>
<image name="lab-default" width="1024" height="768"/>
<image name="skin-1" width="80" height="80"/>
Expand Down

0 comments on commit 2d84545

Please sign in to comment.