From 1f0284f3572b8046ebaef916a7a2a16927fbd4e6 Mon Sep 17 00:00:00 2001 From: Okechi Date: Wed, 10 Feb 2016 23:25:22 -0500 Subject: [PATCH] Finished joining party screen, working on currently playing screen and functionality --- GetHip.xcodeproj/project.pbxproj | 30 ++++++ GetHip/AppDelegate.swift | 14 ++- GetHip/CurrentlyPlayingViewController.swift | 41 ++++++++ GetHip/HomeScreenViewController.swift | 15 ++- GetHip/InvitedCollectionViewCell.swift | 16 +++ GetHip/LoadingPartyViewController.swift | 109 ++++++++++++++++++++ GetHip/Main.storyboard | 76 ++++++++++++-- GetHip/PartyServiceManager.swift | 6 +- GetHip/SettingsDetailViewWrapper.swift | 21 ++-- GetHip/SongSelectionViewController.swift | 27 +++-- GetHip/TestInviteFriendsController.swift | 4 +- 11 files changed, 322 insertions(+), 37 deletions(-) create mode 100644 GetHip/CurrentlyPlayingViewController.swift create mode 100644 GetHip/InvitedCollectionViewCell.swift create mode 100644 GetHip/LoadingPartyViewController.swift diff --git a/GetHip.xcodeproj/project.pbxproj b/GetHip.xcodeproj/project.pbxproj index 99d4e54..0c55db7 100644 --- a/GetHip.xcodeproj/project.pbxproj +++ b/GetHip.xcodeproj/project.pbxproj @@ -55,6 +55,8 @@ 3E43B8C91C37639C002F97A7 /* FBSDKCoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E1BDA751C3713F900EE3B84 /* FBSDKCoreKit.framework */; }; 3E43B8CA1C37639C002F97A7 /* FBSDKLoginKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */; }; 3E43B8CF1C376F9F002F97A7 /* Logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E43B8CE1C376F9F002F97A7 /* Logo.png */; }; + 3E5485B31C69A7DA00E7D5AB /* LoadingPartyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5485B21C69A7DA00E7D5AB /* LoadingPartyViewController.swift */; }; + 3E5485B51C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5485B41C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift */; }; 3E5952631C39DBC900C88C71 /* Friends.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E59525A1C39DBC900C88C71 /* Friends.png */; }; 3E5952641C39DBC900C88C71 /* Friends@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E59525B1C39DBC900C88C71 /* Friends@2x.png */; }; 3E5952651C39DBC900C88C71 /* Friends@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E59525C1C39DBC900C88C71 /* Friends@3x.png */; }; @@ -80,6 +82,7 @@ 3E5952891C39EB6100C88C71 /* Turntable.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E5952861C39EB6100C88C71 /* Turntable.png */; }; 3E59528A1C39EB6100C88C71 /* Turntable@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E5952871C39EB6100C88C71 /* Turntable@2x.png */; }; 3E59528B1C39EB6100C88C71 /* Turntable@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E5952881C39EB6100C88C71 /* Turntable@3x.png */; }; + 3E5BD3111C6C424300266B16 /* CurrentlyPlayingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5BD3101C6C424300266B16 /* CurrentlyPlayingViewController.swift */; }; 3E627FC31C55978E005C0372 /* PartySessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E627FC21C55978E005C0372 /* PartySessionManager.swift */; }; 3E627FE61C55AE35005C0372 /* NSInputStream+URLInitialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E627FC81C55AE35005C0372 /* NSInputStream+URLInitialization.m */; }; 3E627FE71C55AE35005C0372 /* NSMutableArray+QueueMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E627FCA1C55AE35005C0372 /* NSMutableArray+QueueMethods.m */; }; @@ -179,6 +182,8 @@ 3E43B8C41C375E73002F97A7 /* Bolts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Bolts.framework; path = ../../FacebookSDK/Bolts.framework; sourceTree = ""; }; 3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBSDKLoginKit.framework; path = ../../FacebookSDK/FBSDKLoginKit.framework; sourceTree = ""; }; 3E43B8CE1C376F9F002F97A7 /* Logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Logo.png; path = "../../../Dropbox/gethip/Screens/6 Login/Assets/Logo.png"; sourceTree = ""; }; + 3E5485B21C69A7DA00E7D5AB /* LoadingPartyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingPartyViewController.swift; sourceTree = ""; }; + 3E5485B41C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvitedCollectionViewCell.swift; sourceTree = ""; }; 3E59525A1C39DBC900C88C71 /* Friends.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Friends.png; path = "../Get Hip/Get Hip/Assets/Friends.png"; sourceTree = ""; }; 3E59525B1C39DBC900C88C71 /* Friends@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Friends@2x.png"; path = "../Get Hip/Get Hip/Assets/Friends@2x.png"; sourceTree = ""; }; 3E59525C1C39DBC900C88C71 /* Friends@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Friends@3x.png"; path = "../Get Hip/Get Hip/Assets/Friends@3x.png"; sourceTree = ""; }; @@ -204,6 +209,7 @@ 3E5952861C39EB6100C88C71 /* Turntable.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Turntable.png; path = "../Get Hip/Get Hip/Assets/Turntable.png"; sourceTree = ""; }; 3E5952871C39EB6100C88C71 /* Turntable@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Turntable@2x.png"; path = "../Get Hip/Get Hip/Assets/Turntable@2x.png"; sourceTree = ""; }; 3E5952881C39EB6100C88C71 /* Turntable@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Turntable@3x.png"; path = "../Get Hip/Get Hip/Assets/Turntable@3x.png"; sourceTree = ""; }; + 3E5BD3101C6C424300266B16 /* CurrentlyPlayingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrentlyPlayingViewController.swift; sourceTree = ""; }; 3E627FC21C55978E005C0372 /* PartySessionManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PartySessionManager.swift; sourceTree = ""; }; 3E627FC71C55AE35005C0372 /* NSInputStream+URLInitialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSInputStream+URLInitialization.h"; sourceTree = ""; }; 3E627FC81C55AE35005C0372 /* NSInputStream+URLInitialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSInputStream+URLInitialization.m"; sourceTree = ""; }; @@ -320,6 +326,8 @@ 3E34125A1C54C73A006226E0 /* PartySession.swift */, 3E627FC21C55978E005C0372 /* PartySessionManager.swift */, 3E101F071C52E65300C895CA /* PartyServiceManager.swift */, + 3E5BD30F1C6C41F300266B16 /* CurrentlyPlaying */, + 3E5485B11C69A77B00E7D5AB /* LoadingParty */, 3E3412551C54C2BC006226E0 /* SelectSong */, 3EBE976D1C53E5CF0079B54A /* InviteFriends */, ); @@ -472,6 +480,15 @@ name = IPhone6; sourceTree = ""; }; + 3E5485B11C69A77B00E7D5AB /* LoadingParty */ = { + isa = PBXGroup; + children = ( + 3E5485B21C69A7DA00E7D5AB /* LoadingPartyViewController.swift */, + 3E5485B41C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift */, + ); + name = LoadingParty; + sourceTree = ""; + }; 3E5952591C39DB2800C88C71 /* CreateJoinOrReturnToPartyScreen */ = { isa = PBXGroup; children = ( @@ -503,6 +520,14 @@ name = CreateJoinOrReturnToPartyScreen; sourceTree = ""; }; + 3E5BD30F1C6C41F300266B16 /* CurrentlyPlaying */ = { + isa = PBXGroup; + children = ( + 3E5BD3101C6C424300266B16 /* CurrentlyPlayingViewController.swift */, + ); + name = CurrentlyPlaying; + sourceTree = ""; + }; 3E627FC01C5543FB005C0372 /* User Authentication */ = { isa = PBXGroup; children = ( @@ -769,6 +794,7 @@ 3E627FEA1C55AE35005C0372 /* TDAudioFileStream.m in Sources */, 3E627FC31C55978E005C0372 /* PartySessionManager.swift in Sources */, 3E627FE61C55AE35005C0372 /* NSInputStream+URLInitialization.m in Sources */, + 3E5485B51C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift in Sources */, 3E3412571C54C31F006226E0 /* SongSelectionViewController.swift in Sources */, 3E627FE81C55AE35005C0372 /* TDAudioMetaInfo.m in Sources */, 3E34125B1C54C73A006226E0 /* PartySession.swift in Sources */, @@ -782,6 +808,7 @@ 3E1AAD141C3BD92600809367 /* FriendsListViewController.swift in Sources */, 3E326BCE1C51C77600F785CF /* SettingsCellWrapper.swift in Sources */, 3E627FF31C55AE35005C0372 /* TDAudioPlayerConstants.m in Sources */, + 3E5485B31C69A7DA00E7D5AB /* LoadingPartyViewController.swift in Sources */, 3E3B14DC1C5BBB3B001C437F /* PendingRequestViewController.swift in Sources */, 3E379EF61C3E646000F7BCCD /* ParseNetDebug.m in Sources */, 3E627FED1C55AE35005C0372 /* TDAudioQueueBufferManager.m in Sources */, @@ -800,6 +827,7 @@ 3E1BDA521C37111D00EE3B84 /* AppDelegate.swift in Sources */, 3E627FF11C55AE35005C0372 /* TDAudioInputStreamer.m in Sources */, 3E4169551C398A5B00B193AF /* SignUpViewController.swift in Sources */, + 3E5BD3111C6C424300266B16 /* CurrentlyPlayingViewController.swift in Sources */, 3E627FEE1C55AE35005C0372 /* TDAudioQueueController.m in Sources */, 3E627FE71C55AE35005C0372 /* NSMutableArray+QueueMethods.m in Sources */, 3E3B14DE1C5BCC9B001C437F /* FriendRequestViewController.swift in Sources */, @@ -940,6 +968,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "$PROJECT_NAME/Bridging-Header.h"; + TARGETED_DEVICE_FAMILY = 1; }; name = Debug; }; @@ -964,6 +993,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "$PROJECT_NAME/Bridging-Header.h"; + TARGETED_DEVICE_FAMILY = 1; }; name = Release; }; diff --git a/GetHip/AppDelegate.swift b/GetHip/AppDelegate.swift index 908b736..f607f98 100644 --- a/GetHip/AppDelegate.swift +++ b/GetHip/AppDelegate.swift @@ -19,7 +19,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat // var app = UIApplication.sharedApplication() func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + let userNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound + let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil) + application.registerUserNotificationSettings(settings) application.registerForRemoteNotifications() + //create new CLLocaationManager /*var locationStarted = false locationManager.delegate = self*/ @@ -108,9 +112,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat }) } - /* + func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) { NSLog("Did register for remote notifications with device token (%@)", deviceToken) + let installation = PFInstallation.currentInstallation() + installation.setDeviceTokenFromData(deviceToken) + installation.channels = ["global"] + installation.saveInBackground() } func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) { @@ -119,8 +127,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat } func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) { - - }*/ + PFPush.handlePush(userInfo) + } diff --git a/GetHip/CurrentlyPlayingViewController.swift b/GetHip/CurrentlyPlayingViewController.swift new file mode 100644 index 0000000..7c1695c --- /dev/null +++ b/GetHip/CurrentlyPlayingViewController.swift @@ -0,0 +1,41 @@ +// +// CurrentlyPlayingViewController.swift +// GetHip +// +// Created by Okechi on 2/10/16. +// Copyright (c) 2016 Kroleo. All rights reserved. +// + +import UIKit + +class CurrentlyPlayingViewController: UIViewController { + + var party: PartyServiceManager! + + 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. + } + + func setData(prty: PartyServiceManager){ + self.party = prty + } + + + /* + // 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. + } + */ + +} diff --git a/GetHip/HomeScreenViewController.swift b/GetHip/HomeScreenViewController.swift index 9a8be8c..f6bc6cb 100644 --- a/GetHip/HomeScreenViewController.swift +++ b/GetHip/HomeScreenViewController.swift @@ -38,6 +38,16 @@ class HomeScreenViewController: UIViewController { self.partyData.setPeerID((self.userData[0].displayName)) self.partyData.setAdvertiser() + + //initialize browser to find nearby friends + self.partyData.setBrowser() + + //initialize session + self.partyData.initializeSession() + + //start peer-to-peer transcieveing + self.partyData.startListening() + self.partyData.startBrowser() } func loadID(notification: NSNotification){ @@ -75,11 +85,6 @@ class HomeScreenViewController: UIViewController { //initialize host role self.partyData.setRole(PeerType(rawValue: 0)!) - //initialize browser to find nearby friends - self.partyData.setBrowser() - - //initialize session - self.partyData.initializeSession() vc.setData(self.userData, frndData: self.friendData, party: self.partyData) } diff --git a/GetHip/InvitedCollectionViewCell.swift b/GetHip/InvitedCollectionViewCell.swift new file mode 100644 index 0000000..1edbe12 --- /dev/null +++ b/GetHip/InvitedCollectionViewCell.swift @@ -0,0 +1,16 @@ +// +// LoadingFriendCollectionViewCell.swift +// GetHip +// +// Created by Okechi on 2/9/16. +// Copyright (c) 2016 Kroleo. All rights reserved. +// + +import UIKit + +class InvitedCollectionViewCell: UICollectionViewCell { + @IBOutlet var friendImage: UIImageView! + + + +} diff --git a/GetHip/LoadingPartyViewController.swift b/GetHip/LoadingPartyViewController.swift new file mode 100644 index 0000000..d8a562b --- /dev/null +++ b/GetHip/LoadingPartyViewController.swift @@ -0,0 +1,109 @@ +// +// LoadingPartyViewController.swift +// GetHip +// +// Created by Okechi on 2/8/16. +// Copyright (c) 2016 Kroleo. All rights reserved. +// + +import UIKit +import MediaPlayer + +class LoadingPartyViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate{ + var party: PartyServiceManager! + + @IBOutlet var songImg: UIImageView! + @IBOutlet var invitedFriends: UICollectionView! + @IBOutlet var songLabel: UILabel! + @IBOutlet var timerLabel: UILabel! + var timer = NSTimer() + var counter = 30 + + @IBAction func cancelInvites(sender: UIButton){ + self.dismissViewControllerAnimated(true, completion: nil) + } + + @IBAction func chngSong(sender: UIButton){ + + //cancel all current operations + + //go back to song selection + self.dismissViewControllerAnimated(true, completion: nil) + } + + override func viewDidLoad() { + super.viewDidLoad() + + self.invitedFriends.dataSource = self + self.invitedFriends.delegate = self + + // Do any additional setup after loading the view. + self.songImg.image = self.party.currentSong.valueForProperty(MPMediaItemPropertyArtwork).imageWithSize(songImg.frame.size) + self.songLabel.text = (self.party.currentSong.valueForProperty(MPMediaItemPropertyTitle) as? String!)! + " by " + (self.party.currentSong.valueForProperty(MPMediaItemPropertyArtist) as? String!)! + + //sets up timer label and starts countdown to next screen + self.timerLabel.text = String(counter) + self.timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("updateCounter"), userInfo: nil, repeats: true) + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + func updateCounter(){ + self.timerLabel.text = String(counter--) + if(self.counter == -2){ + self.timer.invalidate() + self.performSegueWithIdentifier("CurrentlyPlayingSegue", sender: nil) + } + } + + func setData(prty: PartyServiceManager){ + self.party = prty + } + + func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { + + let friend = self.party.invitedFriends[indexPath.row] + let cell: InvitedCollectionViewCell = self.invitedFriends.dequeueReusableCellWithReuseIdentifier("InvitedCollectionCell", forIndexPath: indexPath) as! InvitedCollectionViewCell + + if friend.profileImg == nil { + cell.friendImage.backgroundColor = UIColor.grayColor() + } + else{ + + } + + //rounds uiimage and configures UIImageView + //cell!.proImage.layer.borderWidth = 3.0 + //cell!.proImage.clipsToBounds = true + cell.friendImage.layer.cornerRadius = cell.friendImage.frame.size.width/2 + cell.alpha = 0.5 + //cell!.proImage.layer.borderColor = UIColor.whiteColor().CGColor + //cell!.proImage.layer.masksToBounds = true + + return cell + + } + + func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return self.party.invitedFriends.count + } + + + // 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. + if(segue.identifier == "CurrentlyPlayingSegue"){ + let vc: CurrentlyPlayingViewController = (segue.destinationViewController as? CurrentlyPlayingViewController)! + vc.setData(self.party) + } + } + + +} diff --git a/GetHip/Main.storyboard b/GetHip/Main.storyboard index b728af1..d3c403a 100644 --- a/GetHip/Main.storyboard +++ b/GetHip/Main.storyboard @@ -644,7 +644,7 @@ - + @@ -666,7 +666,7 @@ - + @@ -679,8 +679,15 @@ + + + + + + + + - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + diff --git a/GetHip/PartyServiceManager.swift b/GetHip/PartyServiceManager.swift index 50b3352..b774ff4 100644 --- a/GetHip/PartyServiceManager.swift +++ b/GetHip/PartyServiceManager.swift @@ -42,7 +42,7 @@ class PartyServiceManager: NSObject { //peer variables var foundPeers: [String] = [] - var invitedFriends: [String] = [] + var invitedFriends: [FriendData] = [] var role: PeerType! = nil var connectingPeersDictionary = NSMutableDictionary() @@ -133,7 +133,7 @@ class PartyServiceManager: NSObject { //Host Methods func initializeSession(){ self.session = MCSession(peer: self.myPeerID, securityIdentity: nil, encryptionPreference: MCEncryptionPreference.Required) - println("Started Browsing for peers") + println("Initialized Peer-To-Peer Connection") } func setSong(media: MPMediaItem!){ @@ -180,6 +180,7 @@ extension PartyServiceManager: MCNearbyServiceBrowserDelegate{ if(peerID.displayName != self.myPeerID.displayName) { NSLog("%@", "foundPeer: \(peerID)") self.foundPeers.append(peerID.displayName) + self.serviceBrowser.invitePeer(peerID, toSession: self.session, withContext: nil, timeout: NSTimeInterval(10.00)) } @@ -199,6 +200,7 @@ extension PartyServiceManager: MCNearbyServiceAdvertiserDelegate{ func advertiser(advertiser: MCNearbyServiceAdvertiser!, didReceiveInvitationFromPeer peerID: MCPeerID!, withContext context: NSData!, invitationHandler: ((Bool, MCSession!) -> Void)!) { NSLog("%@", "invitingPeer: \(peerID)") + invitationHandler(true, self.session) } } diff --git a/GetHip/SettingsDetailViewWrapper.swift b/GetHip/SettingsDetailViewWrapper.swift index 9978e3c..1a2bb8e 100644 --- a/GetHip/SettingsDetailViewWrapper.swift +++ b/GetHip/SettingsDetailViewWrapper.swift @@ -219,20 +219,12 @@ class ProfileDetailViewController: UIViewController, UINavigationControllerDeleg // Do any additional setup after loading the view. } - + override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } - //MARK: -Image Picker Delegate - func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) { - - } - - func imagePickerControllerDidCancel(picker: UIImagePickerController) { - dismissViewControllerAnimated(true, completion: nil) - } /* // MARK: - Navigation @@ -245,3 +237,14 @@ class ProfileDetailViewController: UIViewController, UINavigationControllerDeleg */ } + +extension ProfileDetailViewController: UIImagePickerControllerDelegate{ + //MARK: -Image Picker Delegate + func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) { + + } + + func imagePickerControllerDidCancel(picker: UIImagePickerController) { + dismissViewControllerAnimated(true, completion: nil) + } +} diff --git a/GetHip/SongSelectionViewController.swift b/GetHip/SongSelectionViewController.swift index 3750c43..c1e59b5 100644 --- a/GetHip/SongSelectionViewController.swift +++ b/GetHip/SongSelectionViewController.swift @@ -27,22 +27,24 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl let songFilterAction = UIAlertAction(title: "Songs", style: .Default, handler: { (alert: UIAlertAction!) -> Void in self.filter = "Songs" - cell.filterBtn.titleLabel?.text = self.filter self.table.reloadData() + cell.filterBtn.titleLabel?.text = self.filter + }) let albumFilterAction = UIAlertAction(title: "Albums", style: .Default, handler: { (alert: UIAlertAction!) -> Void in self.filter = "Albums" - cell.filterBtn.titleLabel?.text = self.filter self.table.reloadData() + cell.filterBtn.titleLabel?.text = self.filter }) let artistFilterAction = UIAlertAction(title: "Artists", style: .Default, handler: { (alert: UIAlertAction!) -> Void in self.filter = "Artists" - cell.filterBtn.titleLabel?.text = self.filter self.table.reloadData() + cell.filterBtn.titleLabel?.text = self.filter + }) switch self.filter { @@ -83,6 +85,10 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl // Dispose of any resources that can be recreated. } + func setData(prty:PartyServiceManager){ + self.party = prty + } + func numberOfSectionsInTableView(tableView: UITableView) -> Int { // #warning Potentially incomplete method implementation. // Return the number of sections. @@ -156,6 +162,8 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl var songs = songsQuery.items var rowItem: MPMediaItem = songs[indexPath.row - 1] as! MPMediaItem self.party.setSong(rowItem) + self.performSegueWithIdentifier("LoadingPartySegue", sender: nil) + } } @@ -254,14 +262,17 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl } - /* + // 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. + if(segue.identifier == "LoadingPartySegue"){ + let vc: LoadingPartyViewController = (segue.destinationViewController as? LoadingPartyViewController)! + vc.setData(self.party) + + } } - */ + } diff --git a/GetHip/TestInviteFriendsController.swift b/GetHip/TestInviteFriendsController.swift index 2f93804..71af68a 100644 --- a/GetHip/TestInviteFriendsController.swift +++ b/GetHip/TestInviteFriendsController.swift @@ -135,7 +135,9 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl invited.append(self.frnds[i]) } } - + self.partyData.invitedFriends = invited + let vc: SongSelectionViewController = (segue.destinationViewController as? SongSelectionViewController)! + vc.setData(self.partyData) println(invited.count) }