new screen added

This commit is contained in:
Okechi 2016-03-15 11:17:32 -04:00
parent 58742f2304
commit 994e033bfd
5 changed files with 146 additions and 4 deletions

View File

@ -49,6 +49,7 @@
3E4169491C385F1000B193AF /* 1x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E4169481C385F1000B193AF /* 1x.png */; };
3E4169551C398A5B00B193AF /* SignUpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E4169541C398A5B00B193AF /* SignUpViewController.swift */; };
3E4169571C399C4D00B193AF /* Images-3.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E4169561C399C4D00B193AF /* Images-3.xcassets */; };
3E416EEE1C97BE31001EA319 /* NextUpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E416EED1C97BE31001EA319 /* NextUpViewController.swift */; };
3E41D74C1C8D17E100FFD846 /* icon-120.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E41D74B1C8D17E100FFD846 /* icon-120.png */; };
3E41D74E1C8D17F300FFD846 /* Icon-60.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E41D74D1C8D17F300FFD846 /* Icon-60.png */; };
3E438ADE1C572DFD0055C97A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3E438ADD1C572DFD0055C97A /* Main.storyboard */; };
@ -197,6 +198,7 @@
3E4169481C385F1000B193AF /* 1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = 1x.png; path = "../../../Dropbox/Gethip/Screens/Logo Screen/6 Logo Screen/1x.png"; sourceTree = "<group>"; };
3E4169541C398A5B00B193AF /* SignUpViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignUpViewController.swift; sourceTree = "<group>"; };
3E4169561C399C4D00B193AF /* Images-3.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Images-3.xcassets"; sourceTree = "<group>"; };
3E416EED1C97BE31001EA319 /* NextUpViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NextUpViewController.swift; sourceTree = "<group>"; };
3E41D74B1C8D17E100FFD846 /* icon-120.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-120.png"; sourceTree = "<group>"; };
3E41D74D1C8D17F300FFD846 /* Icon-60.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-60.png"; sourceTree = "<group>"; };
3E438ADD1C572DFD0055C97A /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
@ -368,6 +370,7 @@
3E101F041C52E50400C895CA /* PartySessionSource */ = {
isa = PBXGroup;
children = (
3E416EEC1C97BDEA001EA319 /* NextUpInParty */,
3E6D43871C78318F00CA805F /* InvitedToParty */,
3E1EE6371C6D029800F5C5D7 /* InParty */,
3E34125A1C54C73A006226E0 /* PartySession.swift */,
@ -492,6 +495,14 @@
name = SelectSong;
sourceTree = "<group>";
};
3E416EEC1C97BDEA001EA319 /* NextUpInParty */ = {
isa = PBXGroup;
children = (
3E416EED1C97BE31001EA319 /* NextUpViewController.swift */,
);
name = NextUpInParty;
sourceTree = "<group>";
};
3E438AE01C57387B0055C97A /* iPhone5 */ = {
isa = PBXGroup;
children = (
@ -943,6 +954,7 @@
3E627FE71C55AE35005C0372 /* NSMutableArray+QueueMethods.m in Sources */,
3E3B14DE1C5BCC9B001C437F /* FriendRequestViewController.swift in Sources */,
3E18D4931C51F6230012F7DF /* UserParseData.swift in Sources */,
3E416EEE1C97BE31001EA319 /* NextUpViewController.swift in Sources */,
3E5952851C39E54A00C88C71 /* HomeScreenViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -107,6 +107,7 @@ class CurrentlyPlayingViewController: UIViewController, PartyServiceManagerDeleg
self.party.chooseNextHost()
print(self.party.currentHost)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "songDidEnd:", name: "gotDisplayID", object: nil)
}
@ -114,6 +115,10 @@ class CurrentlyPlayingViewController: UIViewController, PartyServiceManagerDeleg
}
func songDidEnd(notification: NSNotification){
self.performSegueWithIdentifier("NextUpSegue", sender: nil)
}
func timeFormat(value: Float) -> String{
var minutes: Float = floor(roundf((value)/60))
println(minutes)
@ -186,6 +191,11 @@ class CurrentlyPlayingViewController: UIViewController, PartyServiceManagerDeleg
let vc: BackToHomeScreenViewController = (segue.destinationViewController as? BackToHomeScreenViewController)!
vc.setData(self.party, user: self.usr, friends: self.frnds, request: self.requestData)
}
if segue.identifier == "NextUpSegue" {
let vc: NextUpViewController = (segue.destinationViewController as? NextUpViewController)!
vc.setData(self.party, user: self.usr, friends: self.frnds, request: self.requestData)
}
}
@ -219,9 +229,32 @@ extension CurrentlyPlayingViewController: PartyServiceManagerDelegate {
self.party.sendInstruction(dictionary, toPeer: fromPeer)
}else{
if(instruction == "pause_stream"){
self.party.inputStreamer.pause()
}else if(instruction == "resume_stream"){
self.party.inputStreamer.resume()
}else if(instruction == "want_to_be_host"){
let alert = UIAlertController(title: "Host Request", message: "Would you like to be the next host for the party and pick a song?", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "Accept", style: .Default, handler:{
(action: UIAlertAction!) -> Void in
self.party.currentHost = self.party.myPeerID.displayName
alert.dismissViewControllerAnimated(true, completion: nil)
}))
alert.addAction(UIAlertAction(title: "Decline", style: .Default, handler:{
(action: UIAlertAction!) -> Void in
var dictionary: [String: AnyObject] = ["sender": self.party.myPeerID, "instruction": "does_not_accept"]
self.party.sendInstruction(dictionary, toPeer: fromPeer)
alert.dismissViewControllerAnimated(true, completion: nil)
}))
self.presentViewController(alert, animated: true, completion: nil)
}
}

View File

@ -192,6 +192,45 @@
</objects>
<point key="canvasLocation" x="1123" y="2058"/>
</scene>
<!--Next Up View Controller-->
<scene sceneID="VyX-Pv-uWi">
<objects>
<viewController id="zgA-8b-Ylm" customClass="NextUpViewController" customModule="GetHip" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="vMS-hg-ThR"/>
<viewControllerLayoutGuide type="bottom" id="QbP-jL-nFY"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="N4y-zz-1bC">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Next Up:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oG8-pz-CA3">
<rect key="frame" x="102" y="95" width="117" height="21"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="30" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FFv-lp-b7d">
<rect key="frame" x="139" y="338" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="u1Z-Ju-AJf">
<rect key="frame" x="70" y="131" width="180" height="180"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<connections>
<outlet property="userImages" destination="u1Z-Ju-AJf" id="0wt-l7-aqy"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="1TM-nl-LNT" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2981" y="73"/>
</scene>
<!--Joining Party View Controller-->
<scene sceneID="PXH-Ng-lFX">
<objects>
@ -1327,6 +1366,7 @@
<outlet property="songImg" destination="HKj-kH-yf5" id="UAh-IG-J3y"/>
<outlet property="titleLabel" destination="tHQ-qY-ZrL" id="RE7-2e-ghS"/>
<outlet property="volCtrl" destination="AA9-Xx-q9o" id="3yD-gc-O6r"/>
<segue destination="zgA-8b-Ylm" kind="presentation" identifier="NextUpSegue" id="Pjh-gk-RHG"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="qk5-ei-kCM" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -1590,9 +1630,6 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="i76-3p-Q4h">
<rect key="frame" x="70" y="107" width="180" height="180"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="VRa-oD-Myj">
<rect key="frame" x="70" y="295" width="180" height="30"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@ -1604,6 +1641,9 @@
<action selector="changePhoto:" destination="JcU-T3-nLI" eventType="touchUpInside" id="60Q-bw-pkg"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="i76-3p-Q4h">
<rect key="frame" x="70" y="107" width="180" height="180"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>

View File

@ -0,0 +1,48 @@
//
// NextUpViewController.swift
// GetHip
//
// Created by Okechi on 3/14/16.
// Copyright (c) 2016 Kroleo. All rights reserved.
//
import UIKit
class NextUpViewController: UIViewController {
var party: PartyServiceManager!
var usr: [UserParseData] = []
var frnds: [FriendData] = []
var requestData: [FriendData] = []
@IBOutlet weak var userImages: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
self.userImages.layer.cornerRadius = self.userImages.frame.size.width/2
self.userImages.clipsToBounds = true
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func setData(prty:PartyServiceManager, user: [UserParseData], friends: [FriendData], request: [FriendData]){
self.party = prty
self.usr = user
self.frnds = friends
self.requestData = request
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}

View File

@ -93,6 +93,8 @@ class PartyServiceManager: NSObject, AnyObject {
chooseNextHost()
}else{
self.currentHost = self.connectedPeers()[nextHostIndex].displayName
var dictionary: [String: AnyObject] = ["sender": self.myPeerID, "instruction": "want_to_be_host"]
self.sendInstruction(dictionary, toPeer: self.connectedPeersDictionary[self.currentHost] as! MCPeerID)
}
}
@ -174,8 +176,15 @@ class PartyServiceManager: NSObject, AnyObject {
}
}
if(instruction == "does_not_accept"){
self.chooseNextHost()
}
return (instruction!, fromPeer)
}else{
}
else{
return ("not_an_instruction", fromPeer)
}