Finished joining party screen, working on currently playing screen and functionality

This commit is contained in:
Okechi 2016-02-10 23:25:22 -05:00
parent 7f5afd95fd
commit 1f0284f357
11 changed files with 322 additions and 37 deletions

View File

@ -55,6 +55,8 @@
3E43B8C91C37639C002F97A7 /* FBSDKCoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E1BDA751C3713F900EE3B84 /* FBSDKCoreKit.framework */; }; 3E43B8C91C37639C002F97A7 /* FBSDKCoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E1BDA751C3713F900EE3B84 /* FBSDKCoreKit.framework */; };
3E43B8CA1C37639C002F97A7 /* FBSDKLoginKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */; }; 3E43B8CA1C37639C002F97A7 /* FBSDKLoginKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */; };
3E43B8CF1C376F9F002F97A7 /* Logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E43B8CE1C376F9F002F97A7 /* Logo.png */; }; 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 */; }; 3E5952631C39DBC900C88C71 /* Friends.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E59525A1C39DBC900C88C71 /* Friends.png */; };
3E5952641C39DBC900C88C71 /* Friends@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E59525B1C39DBC900C88C71 /* Friends@2x.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 */; }; 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 */; }; 3E5952891C39EB6100C88C71 /* Turntable.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E5952861C39EB6100C88C71 /* Turntable.png */; };
3E59528A1C39EB6100C88C71 /* Turntable@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E5952871C39EB6100C88C71 /* Turntable@2x.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 */; }; 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 */; }; 3E627FC31C55978E005C0372 /* PartySessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E627FC21C55978E005C0372 /* PartySessionManager.swift */; };
3E627FE61C55AE35005C0372 /* NSInputStream+URLInitialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E627FC81C55AE35005C0372 /* NSInputStream+URLInitialization.m */; }; 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 */; }; 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 = "<group>"; }; 3E43B8C41C375E73002F97A7 /* Bolts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Bolts.framework; path = ../../FacebookSDK/Bolts.framework; sourceTree = "<group>"; };
3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBSDKLoginKit.framework; path = ../../FacebookSDK/FBSDKLoginKit.framework; sourceTree = "<group>"; }; 3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBSDKLoginKit.framework; path = ../../FacebookSDK/FBSDKLoginKit.framework; sourceTree = "<group>"; };
3E43B8CE1C376F9F002F97A7 /* Logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Logo.png; path = "../../../Dropbox/gethip/Screens/6 Login/Assets/Logo.png"; sourceTree = "<group>"; }; 3E43B8CE1C376F9F002F97A7 /* Logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Logo.png; path = "../../../Dropbox/gethip/Screens/6 Login/Assets/Logo.png"; sourceTree = "<group>"; };
3E5485B21C69A7DA00E7D5AB /* LoadingPartyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingPartyViewController.swift; sourceTree = "<group>"; };
3E5485B41C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvitedCollectionViewCell.swift; sourceTree = "<group>"; };
3E59525A1C39DBC900C88C71 /* Friends.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Friends.png; path = "../Get Hip/Get Hip/Assets/Friends.png"; sourceTree = "<group>"; }; 3E59525A1C39DBC900C88C71 /* Friends.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Friends.png; path = "../Get Hip/Get Hip/Assets/Friends.png"; sourceTree = "<group>"; };
3E59525B1C39DBC900C88C71 /* Friends@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Friends@2x.png"; path = "../Get Hip/Get Hip/Assets/Friends@2x.png"; sourceTree = "<group>"; }; 3E59525B1C39DBC900C88C71 /* Friends@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Friends@2x.png"; path = "../Get Hip/Get Hip/Assets/Friends@2x.png"; sourceTree = "<group>"; };
3E59525C1C39DBC900C88C71 /* Friends@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Friends@3x.png"; path = "../Get Hip/Get Hip/Assets/Friends@3x.png"; sourceTree = "<group>"; }; 3E59525C1C39DBC900C88C71 /* Friends@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Friends@3x.png"; path = "../Get Hip/Get Hip/Assets/Friends@3x.png"; sourceTree = "<group>"; };
@ -204,6 +209,7 @@
3E5952861C39EB6100C88C71 /* Turntable.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Turntable.png; path = "../Get Hip/Get Hip/Assets/Turntable.png"; sourceTree = "<group>"; }; 3E5952861C39EB6100C88C71 /* Turntable.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Turntable.png; path = "../Get Hip/Get Hip/Assets/Turntable.png"; sourceTree = "<group>"; };
3E5952871C39EB6100C88C71 /* Turntable@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Turntable@2x.png"; path = "../Get Hip/Get Hip/Assets/Turntable@2x.png"; sourceTree = "<group>"; }; 3E5952871C39EB6100C88C71 /* Turntable@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Turntable@2x.png"; path = "../Get Hip/Get Hip/Assets/Turntable@2x.png"; sourceTree = "<group>"; };
3E5952881C39EB6100C88C71 /* Turntable@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Turntable@3x.png"; path = "../Get Hip/Get Hip/Assets/Turntable@3x.png"; sourceTree = "<group>"; }; 3E5952881C39EB6100C88C71 /* Turntable@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Turntable@3x.png"; path = "../Get Hip/Get Hip/Assets/Turntable@3x.png"; sourceTree = "<group>"; };
3E5BD3101C6C424300266B16 /* CurrentlyPlayingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrentlyPlayingViewController.swift; sourceTree = "<group>"; };
3E627FC21C55978E005C0372 /* PartySessionManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PartySessionManager.swift; sourceTree = "<group>"; }; 3E627FC21C55978E005C0372 /* PartySessionManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PartySessionManager.swift; sourceTree = "<group>"; };
3E627FC71C55AE35005C0372 /* NSInputStream+URLInitialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSInputStream+URLInitialization.h"; sourceTree = "<group>"; }; 3E627FC71C55AE35005C0372 /* NSInputStream+URLInitialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSInputStream+URLInitialization.h"; sourceTree = "<group>"; };
3E627FC81C55AE35005C0372 /* NSInputStream+URLInitialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSInputStream+URLInitialization.m"; sourceTree = "<group>"; }; 3E627FC81C55AE35005C0372 /* NSInputStream+URLInitialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSInputStream+URLInitialization.m"; sourceTree = "<group>"; };
@ -320,6 +326,8 @@
3E34125A1C54C73A006226E0 /* PartySession.swift */, 3E34125A1C54C73A006226E0 /* PartySession.swift */,
3E627FC21C55978E005C0372 /* PartySessionManager.swift */, 3E627FC21C55978E005C0372 /* PartySessionManager.swift */,
3E101F071C52E65300C895CA /* PartyServiceManager.swift */, 3E101F071C52E65300C895CA /* PartyServiceManager.swift */,
3E5BD30F1C6C41F300266B16 /* CurrentlyPlaying */,
3E5485B11C69A77B00E7D5AB /* LoadingParty */,
3E3412551C54C2BC006226E0 /* SelectSong */, 3E3412551C54C2BC006226E0 /* SelectSong */,
3EBE976D1C53E5CF0079B54A /* InviteFriends */, 3EBE976D1C53E5CF0079B54A /* InviteFriends */,
); );
@ -472,6 +480,15 @@
name = IPhone6; name = IPhone6;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
3E5485B11C69A77B00E7D5AB /* LoadingParty */ = {
isa = PBXGroup;
children = (
3E5485B21C69A7DA00E7D5AB /* LoadingPartyViewController.swift */,
3E5485B41C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift */,
);
name = LoadingParty;
sourceTree = "<group>";
};
3E5952591C39DB2800C88C71 /* CreateJoinOrReturnToPartyScreen */ = { 3E5952591C39DB2800C88C71 /* CreateJoinOrReturnToPartyScreen */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -503,6 +520,14 @@
name = CreateJoinOrReturnToPartyScreen; name = CreateJoinOrReturnToPartyScreen;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
3E5BD30F1C6C41F300266B16 /* CurrentlyPlaying */ = {
isa = PBXGroup;
children = (
3E5BD3101C6C424300266B16 /* CurrentlyPlayingViewController.swift */,
);
name = CurrentlyPlaying;
sourceTree = "<group>";
};
3E627FC01C5543FB005C0372 /* User Authentication */ = { 3E627FC01C5543FB005C0372 /* User Authentication */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -769,6 +794,7 @@
3E627FEA1C55AE35005C0372 /* TDAudioFileStream.m in Sources */, 3E627FEA1C55AE35005C0372 /* TDAudioFileStream.m in Sources */,
3E627FC31C55978E005C0372 /* PartySessionManager.swift in Sources */, 3E627FC31C55978E005C0372 /* PartySessionManager.swift in Sources */,
3E627FE61C55AE35005C0372 /* NSInputStream+URLInitialization.m in Sources */, 3E627FE61C55AE35005C0372 /* NSInputStream+URLInitialization.m in Sources */,
3E5485B51C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift in Sources */,
3E3412571C54C31F006226E0 /* SongSelectionViewController.swift in Sources */, 3E3412571C54C31F006226E0 /* SongSelectionViewController.swift in Sources */,
3E627FE81C55AE35005C0372 /* TDAudioMetaInfo.m in Sources */, 3E627FE81C55AE35005C0372 /* TDAudioMetaInfo.m in Sources */,
3E34125B1C54C73A006226E0 /* PartySession.swift in Sources */, 3E34125B1C54C73A006226E0 /* PartySession.swift in Sources */,
@ -782,6 +808,7 @@
3E1AAD141C3BD92600809367 /* FriendsListViewController.swift in Sources */, 3E1AAD141C3BD92600809367 /* FriendsListViewController.swift in Sources */,
3E326BCE1C51C77600F785CF /* SettingsCellWrapper.swift in Sources */, 3E326BCE1C51C77600F785CF /* SettingsCellWrapper.swift in Sources */,
3E627FF31C55AE35005C0372 /* TDAudioPlayerConstants.m in Sources */, 3E627FF31C55AE35005C0372 /* TDAudioPlayerConstants.m in Sources */,
3E5485B31C69A7DA00E7D5AB /* LoadingPartyViewController.swift in Sources */,
3E3B14DC1C5BBB3B001C437F /* PendingRequestViewController.swift in Sources */, 3E3B14DC1C5BBB3B001C437F /* PendingRequestViewController.swift in Sources */,
3E379EF61C3E646000F7BCCD /* ParseNetDebug.m in Sources */, 3E379EF61C3E646000F7BCCD /* ParseNetDebug.m in Sources */,
3E627FED1C55AE35005C0372 /* TDAudioQueueBufferManager.m in Sources */, 3E627FED1C55AE35005C0372 /* TDAudioQueueBufferManager.m in Sources */,
@ -800,6 +827,7 @@
3E1BDA521C37111D00EE3B84 /* AppDelegate.swift in Sources */, 3E1BDA521C37111D00EE3B84 /* AppDelegate.swift in Sources */,
3E627FF11C55AE35005C0372 /* TDAudioInputStreamer.m in Sources */, 3E627FF11C55AE35005C0372 /* TDAudioInputStreamer.m in Sources */,
3E4169551C398A5B00B193AF /* SignUpViewController.swift in Sources */, 3E4169551C398A5B00B193AF /* SignUpViewController.swift in Sources */,
3E5BD3111C6C424300266B16 /* CurrentlyPlayingViewController.swift in Sources */,
3E627FEE1C55AE35005C0372 /* TDAudioQueueController.m in Sources */, 3E627FEE1C55AE35005C0372 /* TDAudioQueueController.m in Sources */,
3E627FE71C55AE35005C0372 /* NSMutableArray+QueueMethods.m in Sources */, 3E627FE71C55AE35005C0372 /* NSMutableArray+QueueMethods.m in Sources */,
3E3B14DE1C5BCC9B001C437F /* FriendRequestViewController.swift in Sources */, 3E3B14DE1C5BCC9B001C437F /* FriendRequestViewController.swift in Sources */,
@ -940,6 +968,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "$PROJECT_NAME/Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "$PROJECT_NAME/Bridging-Header.h";
TARGETED_DEVICE_FAMILY = 1;
}; };
name = Debug; name = Debug;
}; };
@ -964,6 +993,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "$PROJECT_NAME/Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "$PROJECT_NAME/Bridging-Header.h";
TARGETED_DEVICE_FAMILY = 1;
}; };
name = Release; name = Release;
}; };

View File

@ -19,7 +19,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat
// var app = UIApplication.sharedApplication() // var app = UIApplication.sharedApplication()
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 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() application.registerForRemoteNotifications()
//create new CLLocaationManager //create new CLLocaationManager
/*var locationStarted = false /*var locationStarted = false
locationManager.delegate = self*/ locationManager.delegate = self*/
@ -108,9 +112,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat
}) })
} }
/*
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) { func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
NSLog("Did register for remote notifications with device token (%@)", deviceToken) 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) { func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
@ -119,8 +127,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat
} }
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) { func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
PFPush.handlePush(userInfo)
}*/ }

View File

@ -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.
}
*/
}

View File

@ -38,6 +38,16 @@ class HomeScreenViewController: UIViewController {
self.partyData.setPeerID((self.userData[0].displayName)) self.partyData.setPeerID((self.userData[0].displayName))
self.partyData.setAdvertiser() 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){ func loadID(notification: NSNotification){
@ -75,11 +85,6 @@ class HomeScreenViewController: UIViewController {
//initialize host role //initialize host role
self.partyData.setRole(PeerType(rawValue: 0)!) 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) vc.setData(self.userData, frndData: self.friendData, party: self.partyData)
} }

View File

@ -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!
}

View File

@ -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)
}
}
}

View File

@ -644,7 +644,7 @@
<!--Loading Party--> <!--Loading Party-->
<scene sceneID="LIL-lT-hZJ"> <scene sceneID="LIL-lT-hZJ">
<objects> <objects>
<viewController title="Loading Party" id="C6s-vA-8F4" sceneMemberID="viewController"> <viewController title="Loading Party" id="C6s-vA-8F4" customClass="LoadingPartyViewController" customModule="GetHip" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides> <layoutGuides>
<viewControllerLayoutGuide type="top" id="Ho3-BC-prZ"/> <viewControllerLayoutGuide type="top" id="Ho3-BC-prZ"/>
<viewControllerLayoutGuide type="bottom" id="VGM-iY-3D2"/> <viewControllerLayoutGuide type="bottom" id="VGM-iY-3D2"/>
@ -666,7 +666,7 @@
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout> </collectionViewFlowLayout>
<cells> <cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="InvitedCollectionCell" id="flV-pJ-j2W"> <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="InvitedCollectionCell" id="flV-pJ-j2W" customClass="InvitedCollectionViewCell" customModule="GetHip" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/> <rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
@ -679,8 +679,15 @@
</subviews> </subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view> </view>
<connections>
<outlet property="friendImage" destination="vfW-Rs-nkH" id="GQs-NP-3tl"/>
</connections>
</collectionViewCell> </collectionViewCell>
</cells> </cells>
<connections>
<outlet property="dataSource" destination="C6s-vA-8F4" id="mnd-HU-wEj"/>
<outlet property="delegate" destination="C6s-vA-8F4" id="00s-dO-Lj4"/>
</connections>
</collectionView> </collectionView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="syM-XP-IbG"> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="syM-XP-IbG">
<rect key="frame" x="0.0" y="527" width="320" height="41"/> <rect key="frame" x="0.0" y="527" width="320" height="41"/>
@ -689,6 +696,9 @@
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections>
<action selector="cancelInvites:" destination="C6s-vA-8F4" eventType="touchUpInside" id="Ay7-D4-Wc4"/>
</connections>
</button> </button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gvV-XF-lQc"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gvV-XF-lQc">
<rect key="frame" x="100" y="288" width="121" height="21"/> <rect key="frame" x="100" y="288" width="121" height="21"/>
@ -709,6 +719,15 @@
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vmk-P9-oz6" userLabel="Change Song">
<rect key="frame" x="84" y="262" width="153" height="25"/>
<state key="normal" backgroundImage="Change Song.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="chngSong:" destination="C6s-vA-8F4" eventType="touchUpInside" id="hYe-ea-pjO"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ka6-m2-5hr"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ka6-m2-5hr">
<rect key="frame" x="70" y="20" width="180" height="21"/> <rect key="frame" x="70" y="20" width="180" height="21"/>
<attributedString key="attributedText"> <attributedString key="attributedText">
@ -722,20 +741,59 @@
</attributedString> </attributedString>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vmk-P9-oz6" userLabel="Change Song"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Starting in:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="g1w-zi-xQ8">
<rect key="frame" x="84" y="262" width="153" height="25"/> <rect key="frame" x="105" y="444" width="111" height="21"/>
<state key="normal" backgroundImage="Change Song.png"> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
</state> <nil key="highlightedColor"/>
</button> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="W8b-ej-1Jf">
<rect key="frame" x="139" y="478" width="42" height="21"/>
<attributedString key="attributedText">
<fragment content="30">
<attributes>
<color key="NSColor" cocoaTouchSystemColor="darkTextColor"/>
<font key="NSFont" size="17" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
</subviews> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view> </view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/> <simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<connections>
<outlet property="invitedFriends" destination="fnx-cI-MJO" id="9Ec-6U-lHi"/>
<outlet property="songImg" destination="J3e-IP-vgR" id="XbU-dJ-nEJ"/>
<outlet property="songLabel" destination="4wF-iM-37c" id="NZN-MI-Rbz"/>
<outlet property="timerLabel" destination="W8b-ej-1Jf" id="haa-hj-pLU"/>
<segue destination="5Fd-vs-lX1" kind="show" identifier="CurrentlyPlayingSegue" id="8uU-Fo-Lw5"/>
</connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="znj-Yd-xhQ" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="znj-Yd-xhQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="3672" y="-630"/> <point key="canvasLocation" x="3346" y="-630"/>
</scene>
<!--Currently Playing View Controller-->
<scene sceneID="GJX-js-Rhq">
<objects>
<viewController id="5Fd-vs-lX1" customClass="CurrentlyPlayingViewController" customModule="GetHip" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="BJ6-Uk-a0g"/>
<viewControllerLayoutGuide type="bottom" id="JcA-Xl-P8T"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="7bf-oI-myh">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="qk5-ei-kCM" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3869" y="-630"/>
</scene> </scene>
<!--Song Selection View Controller--> <!--Song Selection View Controller-->
<scene sceneID="IkJ-pX-wAP"> <scene sceneID="IkJ-pX-wAP">

View File

@ -42,7 +42,7 @@ class PartyServiceManager: NSObject {
//peer variables //peer variables
var foundPeers: [String] = [] var foundPeers: [String] = []
var invitedFriends: [String] = [] var invitedFriends: [FriendData] = []
var role: PeerType! = nil var role: PeerType! = nil
var connectingPeersDictionary = NSMutableDictionary() var connectingPeersDictionary = NSMutableDictionary()
@ -133,7 +133,7 @@ class PartyServiceManager: NSObject {
//Host Methods //Host Methods
func initializeSession(){ func initializeSession(){
self.session = MCSession(peer: self.myPeerID, securityIdentity: nil, encryptionPreference: MCEncryptionPreference.Required) 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!){ func setSong(media: MPMediaItem!){
@ -180,6 +180,7 @@ extension PartyServiceManager: MCNearbyServiceBrowserDelegate{
if(peerID.displayName != self.myPeerID.displayName) { if(peerID.displayName != self.myPeerID.displayName) {
NSLog("%@", "foundPeer: \(peerID)") NSLog("%@", "foundPeer: \(peerID)")
self.foundPeers.append(peerID.displayName) 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)!) { func advertiser(advertiser: MCNearbyServiceAdvertiser!, didReceiveInvitationFromPeer peerID: MCPeerID!, withContext context: NSData!, invitationHandler: ((Bool, MCSession!) -> Void)!) {
NSLog("%@", "invitingPeer: \(peerID)") NSLog("%@", "invitingPeer: \(peerID)")
invitationHandler(true, self.session)
} }
} }

View File

@ -219,20 +219,12 @@ class ProfileDetailViewController: UIViewController, UINavigationControllerDeleg
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
override func didReceiveMemoryWarning() { override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning() super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated. // 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 // 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)
}
}

View File

@ -27,22 +27,24 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
let songFilterAction = UIAlertAction(title: "Songs", style: .Default, handler: { let songFilterAction = UIAlertAction(title: "Songs", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in (alert: UIAlertAction!) -> Void in
self.filter = "Songs" self.filter = "Songs"
cell.filterBtn.titleLabel?.text = self.filter
self.table.reloadData() self.table.reloadData()
cell.filterBtn.titleLabel?.text = self.filter
}) })
let albumFilterAction = UIAlertAction(title: "Albums", style: .Default, handler: { let albumFilterAction = UIAlertAction(title: "Albums", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in (alert: UIAlertAction!) -> Void in
self.filter = "Albums" self.filter = "Albums"
cell.filterBtn.titleLabel?.text = self.filter
self.table.reloadData() self.table.reloadData()
cell.filterBtn.titleLabel?.text = self.filter
}) })
let artistFilterAction = UIAlertAction(title: "Artists", style: .Default, handler: { let artistFilterAction = UIAlertAction(title: "Artists", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in (alert: UIAlertAction!) -> Void in
self.filter = "Artists" self.filter = "Artists"
cell.filterBtn.titleLabel?.text = self.filter
self.table.reloadData() self.table.reloadData()
cell.filterBtn.titleLabel?.text = self.filter
}) })
switch self.filter { switch self.filter {
@ -83,6 +85,10 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
} }
func setData(prty:PartyServiceManager){
self.party = prty
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int { func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Potentially incomplete method implementation. // #warning Potentially incomplete method implementation.
// Return the number of sections. // Return the number of sections.
@ -156,6 +162,8 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
var songs = songsQuery.items var songs = songsQuery.items
var rowItem: MPMediaItem = songs[indexPath.row - 1] as! MPMediaItem var rowItem: MPMediaItem = songs[indexPath.row - 1] as! MPMediaItem
self.party.setSong(rowItem) self.party.setSong(rowItem)
self.performSegueWithIdentifier("LoadingPartySegue", sender: nil)
} }
} }
@ -254,14 +262,17 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
} }
/*
// MARK: - Navigation // 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?) { override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController. if(segue.identifier == "LoadingPartySegue"){
// Pass the selected object to the new view controller. let vc: LoadingPartyViewController = (segue.destinationViewController as? LoadingPartyViewController)!
vc.setData(self.party)
}
} }
*/
} }

View File

@ -135,7 +135,9 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl
invited.append(self.frnds[i]) invited.append(self.frnds[i])
} }
} }
self.partyData.invitedFriends = invited
let vc: SongSelectionViewController = (segue.destinationViewController as? SongSelectionViewController)!
vc.setData(self.partyData)
println(invited.count) println(invited.count)
} }