@@ -20,10 +20,10 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) uses photos</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
@@ -33,8 +33,6 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>

Large diffs are not rendered by default.

@@ -11,7 +11,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" restorationIdentifier="placeholderCell" reuseIdentifier="placeholderCell" id="Mge-9F-SxD" customClass="PlaceholderCell" customModule="TAModularCameraView" customModuleProvider="target">
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" restorationIdentifier="placeholderCell" reuseIdentifier="placeholderCell" id="Mge-9F-SxD" customClass="PlaceholderCell" customModule="empa2" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="250" height="380"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
@@ -30,7 +30,7 @@
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Placeholder" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GQG-ye-m0s">
<rect key="frame" x="80" y="30" width="91" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@@ -20,3 +20,7 @@ protocol UpdateCameraFeedDelegate {
func willUpdateEmojiLabel(input: String)
func willUpdateFaceLabel(input: String)
}

protocol UISliderDelegate {
func sliderDidChange(value: Float)
}
@@ -30,13 +30,19 @@ class SessionViewController: UIViewController {
@IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var exportDataButton: UIButton!



override func viewDidLoad() {
super.viewDidLoad()
print("Hi! We're working!")
for i in 0...24 {
images.append(UIImage(named: "\((i%6)+1)")!)
}

exportDataButton.layer.cornerRadius = 20
exportDataButton.layer.borderWidth = 1
exportDataButton.layer.borderColor = UIColor.darkGray.cgColor

detector?.delegate = self
collectionView.delegate = self
collectionView.dataSource = self
@@ -59,34 +65,56 @@ class SessionViewController: UIViewController {
}

func updateCounter() {
counter+=1
print("Session time: \(counter)")
timerLabel.text = "Session time: \(counter)"
SessionViewController.dataManagerDelegate?.didUpdateTimer(counter: self.counter)
counter+=0.1
roundedCounter = counter.firstDecimal()
print("Session time: \(roundedCounter)")
timerLabel.text = "Session time: \(roundedCounter)"
SessionViewController.dataManagerDelegate?.didUpdateTimer(counter: roundedCounter)
}

@IBAction func exportData(_ sender: Any) {
SessionViewController.dataManagerDelegate?.didExportData()

guard DataManager.sharedInstance.timeData.count != 0 else {

let alert = UIAlertController(title: "No data yet.", message: "Please give us something.", preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "Ok", style: .cancel, handler: nil)
alert.addAction(cancelAction)
self.present(alert, animated: true, completion: nil)
return
}

SessionViewController.dataManagerDelegate?.didExportData()
timer.invalidate()
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

if segue.identifier == "exportData" {
print("Export data segue")
DataViewController.chartDictionary = DataManager.sharedInstance.chartDictionary
DataViewController.chartArray = DataManager.sharedInstance.chartArray

print("Export data segue")
GraphDataSource.sharedInstance.chartDictionary = DataManager.sharedInstance.chartDictionary
GraphDataSource.sharedInstance.chartArray = DataManager.sharedInstance.chartArray
} else {
print("No segue")

let alert = UIAlertController(title: "No available segue.", message: "Please give us something.", preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "Ok", style: .cancel, handler: nil)
alert.addAction(cancelAction)
self.present(alert, animated: true, completion: nil)

}

}
}

extension SessionViewController: AFDXDetectorDelegate {

//Affdex delegate methods!
func detector(_ detector: AFDXDetector!, didStartDetecting face: AFDXFace!) {
self.timer = Timer.scheduledTimer(timeInterval: 1.0, target:self, selector: #selector(SessionViewController.updateCounter), userInfo: nil, repeats: true)
self.timer = Timer.scheduledTimer(timeInterval: 0.1, target:self, selector: #selector(SessionViewController.updateCounter), userInfo: nil, repeats: true)
print("Face shown!")

//keeps the timer running even during scrolling.
RunLoop.main.add(timer, forMode: RunLoopMode.commonModes)
SessionViewController.cameraDelegate?.willUpdateFaceLabel(input: "Face shown!")
}