Finally working on multiplier part of app
@ -121,6 +121,7 @@
|
||||
3E7D37D71C75D80F002E682F /* Lower@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7D37D61C75D80F002E682F /* Lower@2x.png */; };
|
||||
3E7D37D91C75D882002E682F /* B2P Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7D37D81C75D882002E682F /* B2P Icon@2x.png */; };
|
||||
3E7D37DB1C75D899002E682F /* B2P Button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7D37DA1C75D899002E682F /* B2P Button@2x.png */; };
|
||||
3EB6B39B1C87B8AE006B674D /* JoiningPartyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EB6B39A1C87B8AE006B674D /* JoiningPartyViewController.swift */; };
|
||||
3EB8845D1C6C647700CCDCCE /* Add More@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EB8845B1C6C647700CCDCCE /* Add More@2x.png */; };
|
||||
3EB8845E1C6C647700CCDCCE /* Leave Party@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EB8845C1C6C647700CCDCCE /* Leave Party@2x.png */; };
|
||||
3EBE97661C53CEDA0079B54A /* Send Invites Button.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EBE97651C53CEDA0079B54A /* Send Invites Button.png */; };
|
||||
@ -284,6 +285,7 @@
|
||||
3E7D37D61C75D80F002E682F /* Lower@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Lower@2x.png"; path = "../../../Dropbox/Gethip/For final/Volume/i5 Volume/Lower@2x.png"; sourceTree = "<group>"; };
|
||||
3E7D37D81C75D882002E682F /* B2P Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "B2P Icon@2x.png"; path = "../../../Dropbox/Gethip/For final/Back To Party/i5/B2P Icon@2x.png"; sourceTree = "<group>"; };
|
||||
3E7D37DA1C75D899002E682F /* B2P Button@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "B2P Button@2x.png"; path = "../../../Dropbox/Gethip/For final/Back To Party/i5/B2P Button@2x.png"; sourceTree = "<group>"; };
|
||||
3EB6B39A1C87B8AE006B674D /* JoiningPartyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JoiningPartyViewController.swift; sourceTree = "<group>"; };
|
||||
3EB8845B1C6C647700CCDCCE /* Add More@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Add More@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Party Screens/Party Screen/Assets/Add More@2x.png"; sourceTree = "<group>"; };
|
||||
3EB8845C1C6C647700CCDCCE /* Leave Party@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Leave Party@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Party Screens/Party Screen/Assets/Leave Party@2x.png"; sourceTree = "<group>"; };
|
||||
3EBE97651C53CEDA0079B54A /* Send Invites Button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Send Invites Button.png"; path = "../../../Dropbox/Gethip/Screens/Friends + Invite Screens/i6/Invite Friends/Send Invites Button.png"; sourceTree = "<group>"; };
|
||||
@ -698,6 +700,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3E6D43881C7831B100CA805F /* InvitedToPartyViewController.swift */,
|
||||
3EB6B39A1C87B8AE006B674D /* JoiningPartyViewController.swift */,
|
||||
);
|
||||
name = InvitedToParty;
|
||||
sourceTree = "<group>";
|
||||
@ -773,7 +776,12 @@
|
||||
TargetAttributes = {
|
||||
3E1BDA4B1C37111D00EE3B84 = {
|
||||
CreatedOnToolsVersion = 6.3.2;
|
||||
DevelopmentTeam = 24WJ762CQL;
|
||||
DevelopmentTeam = VYHHTUJ5PS;
|
||||
SystemCapabilities = {
|
||||
com.apple.BackgroundModes = {
|
||||
enabled = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
3E1BDA631C37111D00EE3B84 = {
|
||||
CreatedOnToolsVersion = 6.3.2;
|
||||
@ -898,6 +906,7 @@
|
||||
3EDA82E31C4741C70081ED53 /* FriendDataSource.swift in Sources */,
|
||||
3EDA82E11C473E900081ED53 /* FriendData.swift in Sources */,
|
||||
3E627FF21C55AE35005C0372 /* TDAudioOutputStreamer.m in Sources */,
|
||||
3EB6B39B1C87B8AE006B674D /* JoiningPartyViewController.swift in Sources */,
|
||||
3E379F051C3F982900F7BCCD /* FriendsCell.swift in Sources */,
|
||||
3E1BDA571C37111D00EE3B84 /* ViewController.swift in Sources */,
|
||||
3E1AAD141C3BD92600809367 /* FriendsListViewController.swift in Sources */,
|
||||
@ -1056,6 +1065,7 @@
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = NO;
|
||||
INFOPLIST_FILE = GetHip/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -1081,6 +1091,7 @@
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = NO;
|
||||
INFOPLIST_FILE = GetHip/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
||||
@ -16,13 +16,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat
|
||||
var window: UIWindow?
|
||||
// var locationStarted = false
|
||||
var locationManager: CLLocationManager!
|
||||
// var app = UIApplication.sharedApplication()
|
||||
var backgroundMode:UIBackgroundTaskIdentifier!
|
||||
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()
|
||||
//let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil)
|
||||
//application.registerUserNotificationSettings(settings)
|
||||
//application.registerForRemoteNotifications()
|
||||
|
||||
//create new CLLocaationManager
|
||||
/*var locationStarted = false
|
||||
@ -76,7 +77,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat
|
||||
|
||||
|
||||
func applicationDidEnterBackground(application: UIApplication) {
|
||||
// locationManager.startUpdatingLocation()
|
||||
locationManager.startUpdatingLocation()
|
||||
self.backgroundMode = self.app.beginBackgroundTaskWithExpirationHandler({
|
||||
//called 3 secs before time expires
|
||||
//kill session and advertiser
|
||||
self.app.endBackgroundTask(self.backgroundMode)
|
||||
self.backgroundMode = UIBackgroundTaskInvalid
|
||||
})
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(application: UIApplication) {
|
||||
@ -85,6 +92,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat
|
||||
|
||||
func applicationDidBecomeActive(application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
|
||||
//work on reinitializing session
|
||||
self.backgroundMode = UIBackgroundTaskInvalid
|
||||
FBSDKAppEvents.activateApp()
|
||||
}
|
||||
|
||||
|
||||
@ -44,14 +44,14 @@ class BackToHomeScreenViewController: UIViewController {
|
||||
let nav: UINavigationController = (segue.destinationViewController as? UINavigationController)!
|
||||
|
||||
let vc: SettingsTableViewController = (nav.viewControllers[0] as? SettingsTableViewController)!
|
||||
vc.setData(self.userData, prty: self.partyData)
|
||||
vc.setData(self.userData, prty: self.partyData, frends: self.friendData, request: self.requestData)
|
||||
}
|
||||
|
||||
if segue.identifier == "FromPartyFriendsSegue" {
|
||||
let nav: UINavigationController = (segue.destinationViewController as? UINavigationController)!
|
||||
|
||||
let vc: FriendsListViewController = (nav.viewControllers[0] as? FriendsListViewController)!
|
||||
vc.setData(self.friendData, requst: self.requestData, party: self.partyData)
|
||||
vc.setData(self.friendData, requst: self.requestData, party: self.partyData, user: self.userData)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,13 +8,17 @@
|
||||
|
||||
import UIKit
|
||||
import MediaPlayer
|
||||
import AVFoundation
|
||||
|
||||
class CurrentlyPlayingViewController: UIViewController {
|
||||
class CurrentlyPlayingViewController: UIViewController{
|
||||
//persistant data
|
||||
var party: PartyServiceManager!
|
||||
var usr: [UserParseData] = []
|
||||
var frnds: [FriendData] = []
|
||||
var requestData: [FriendData] = []
|
||||
var audioPlayer: AVPlayer!
|
||||
var playing = true
|
||||
var timer = NSTimer()
|
||||
|
||||
//controller data
|
||||
@IBOutlet var songImg: UIImageView!
|
||||
@ -27,8 +31,22 @@ class CurrentlyPlayingViewController: UIViewController {
|
||||
//Host buttons
|
||||
@IBOutlet var volCtrl: UISlider!
|
||||
@IBOutlet var ppfButton: UIButton!
|
||||
@IBAction func playPauseFav(sender: UIButton){
|
||||
|
||||
@IBAction func volChng(sender: UISlider){
|
||||
self.audioPlayer.volume = sender.value
|
||||
}
|
||||
@IBAction func playPauseFav(sender: UIButton){
|
||||
if(playing == true){
|
||||
self.audioPlayer.pause()
|
||||
self.playing = false
|
||||
self.ppfButton.setBackgroundImage(UIImage(named: "Play-52.png"), forState: UIControlState.Normal)
|
||||
|
||||
}else{
|
||||
self.audioPlayer.play()
|
||||
self.playing = true
|
||||
self.ppfButton.setBackgroundImage(UIImage(named: "Pause-52.png"), forState: UIControlState.Normal)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,15 +57,29 @@ class CurrentlyPlayingViewController: UIViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.audioPlayer = AVPlayer(URL: self.party.currentSong.valueForProperty(MPMediaItemPropertyAssetURL) as! NSURL)
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
self.songImg.image = self.party.currentSong.valueForProperty(MPMediaItemPropertyArtwork).imageWithSize(songImg.frame.size)
|
||||
self.titleLabel.text = (self.party.currentSong.valueForProperty(MPMediaItemPropertyTitle) as? String!)!
|
||||
self.artistAndAlbumLabel.text = (self.party.currentSong.valueForProperty(MPMediaItemPropertyArtist) as? String!)! + " - " + (self.party.currentSong.valueForProperty(MPMediaItemPropertyAlbumTitle) as? String!)!
|
||||
|
||||
self.audioPlayer.volume = self.volCtrl.value
|
||||
self.maxLabel.text = String(stringInterpolationSegment: self.audioPlayer.currentItem.duration.value)
|
||||
self.audioPlayer.play()
|
||||
self.timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("updateLabels"), userInfo: nil, repeats: true)
|
||||
|
||||
}
|
||||
|
||||
func updateLabels(){
|
||||
var timeLeft = self.audioPlayer.currentItem.duration.value - self.audioPlayer.currentTime().value
|
||||
var interval = timeLeft
|
||||
var seconds = interval%60
|
||||
println(seconds)
|
||||
var minutes = (interval/60)%60
|
||||
println(minutes)
|
||||
//self.maxLabel.text
|
||||
//self.minLabel.text
|
||||
}
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
|
||||
@ -7,11 +7,13 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MultipeerConnectivity
|
||||
|
||||
class FriendsListViewController: UIViewController, UITableViewDelegate, UITableViewDataSource/*PFQueryTableViewController*/ {
|
||||
class FriendsListViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, PartyServiceManagerDelegate {
|
||||
//var manager = FriendDataSource()
|
||||
var friends = []
|
||||
var request = []
|
||||
var user: [UserParseData]!
|
||||
var party: PartyServiceManager!
|
||||
|
||||
@IBOutlet weak var table: UITableView!
|
||||
@ -27,16 +29,18 @@ class FriendsListViewController: UIViewController, UITableViewDelegate, UITableV
|
||||
self.performSegueWithIdentifier("FriendRequestSegue", sender: nil)
|
||||
}
|
||||
|
||||
func setData(frnds:[FriendData], requst: [FriendData], party: PartyServiceManager){
|
||||
func setData(frnds:[FriendData], requst: [FriendData], party: PartyServiceManager, user: [UserParseData]){
|
||||
self.friends = frnds
|
||||
self.request = requst
|
||||
self.party = party
|
||||
self.user = user
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.table.delegate = self
|
||||
self.table.dataSource = self
|
||||
self.party.delegate = self
|
||||
self.title = "Friends"
|
||||
self.navigationController?.navigationBarHidden = false
|
||||
|
||||
@ -181,3 +185,29 @@ class FriendsListViewController: UIViewController, UITableViewDelegate, UITableV
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension FriendsListViewController: PartyServiceManagerDelegate {
|
||||
func foundPeer() {
|
||||
|
||||
}
|
||||
|
||||
func lostPeer() {
|
||||
|
||||
}
|
||||
|
||||
func invitationWasRecieved(peerID: MCPeerID, invitationHandler: ((Bool, MCSession!) -> Void)!) {
|
||||
var storyboard = UIStoryboard(name: "Main", bundle: nil)
|
||||
var vc: InvitedToPartyViewController = storyboard.instantiateViewControllerWithIdentifier("InvitedToPartyVC") as! InvitedToPartyViewController!
|
||||
vc.setData(self.party, user: self.user, friends: (self.friends as! [FriendData]), request: (self.request as! [FriendData]), invHand: invitationHandler, fromPeer: peerID)
|
||||
self.presentViewController(vc, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func connectedWithPeer(peerID: MCPeerID) {
|
||||
|
||||
}
|
||||
|
||||
func didRecieveInstruction(dictionary: Dictionary<String, AnyObject>){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,8 +7,9 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MultipeerConnectivity
|
||||
|
||||
class HomeScreenViewController: UIViewController {
|
||||
class HomeScreenViewController: UIViewController, PartyServiceManagerDelegate {
|
||||
var usrDataManager: UserParseDataSource!
|
||||
var frndDataManager: FriendDataSource!
|
||||
var friendData: [FriendData] = []
|
||||
@ -40,10 +41,13 @@ class HomeScreenViewController: UIViewController {
|
||||
|
||||
if(self.firstTime == true){
|
||||
self.partyData.setPeerID((self.userData[0].displayName))
|
||||
self.partyData.initializeSession()
|
||||
|
||||
self.partyData.setAdvertiser()
|
||||
|
||||
//start peer-to-peer advertising
|
||||
self.partyData.startListening()
|
||||
self.partyData.delegate = self
|
||||
self.firstTime = false
|
||||
}
|
||||
|
||||
@ -54,14 +58,6 @@ class HomeScreenViewController: UIViewController {
|
||||
}
|
||||
|
||||
|
||||
@IBAction func testGuest(sender: UIButton){
|
||||
var storyboard = UIStoryboard(name: "Main", bundle: nil)
|
||||
var vc: InvitedToPartyViewController = storyboard.instantiateViewControllerWithIdentifier("InvitedToPartyVC") as! InvitedToPartyViewController!
|
||||
vc.setData(self.partyData, user: self.userData, friends: self.friendData, request: self.requestData)
|
||||
self.presentViewController(vc, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@ -116,14 +112,14 @@ class HomeScreenViewController: UIViewController {
|
||||
let nav: UINavigationController = (segue.destinationViewController as? UINavigationController)!
|
||||
|
||||
let vc: SettingsTableViewController = (nav.viewControllers[0] as? SettingsTableViewController)!
|
||||
vc.setData(self.userData, prty: self.partyData)
|
||||
vc.setData(self.userData, prty: self.partyData, frends: self.friendData, request: self.requestData)
|
||||
}
|
||||
|
||||
if segue.identifier == "FriendListSegue" {
|
||||
let nav: UINavigationController = (segue.destinationViewController as? UINavigationController)!
|
||||
|
||||
let vc: FriendsListViewController = (nav.viewControllers[0] as? FriendsListViewController)!
|
||||
vc.setData(self.friendData, requst: self.requestData, party: self.partyData)
|
||||
vc.setData(self.friendData, requst: self.requestData, party: self.partyData, user: self.userData)
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,3 +134,31 @@ class HomeScreenViewController: UIViewController {
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
extension HomeScreenViewController: PartyServiceManagerDelegate {
|
||||
func foundPeer() {
|
||||
|
||||
}
|
||||
|
||||
func lostPeer() {
|
||||
|
||||
}
|
||||
|
||||
func invitationWasRecieved(peerID: MCPeerID, invitationHandler: ((Bool, MCSession!) -> Void)!) {
|
||||
var storyboard = UIStoryboard(name: "Main", bundle: nil)
|
||||
var vc: InvitedToPartyViewController = storyboard.instantiateViewControllerWithIdentifier("InvitedToPartyVC") as! InvitedToPartyViewController!
|
||||
vc.setData(self.partyData, user: self.userData, friends: self.friendData, request: self.requestData, invHand: invitationHandler, fromPeer: peerID)
|
||||
self.presentViewController(vc, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func connectedWithPeer(peerID: MCPeerID) {
|
||||
|
||||
}
|
||||
|
||||
func didRecieveInstruction(dictionary: Dictionary<String, AnyObject>){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
175
GetHip/Images-3.xcassets/AppIcon.appiconset/Contents.json
Normal file
@ -0,0 +1,175 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-Small.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-Small@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-Small@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-Spotlight-40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-Spotlight-40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "57x57",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "57x57",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-Small-1.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-Small@2x-1.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-Spotlight-40.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-Spotlight-40@2x-1.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "50x50",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "50x50",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "72x72",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "72x72",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "car",
|
||||
"size" : "120x120",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "24x24",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "notificationCenter",
|
||||
"subtype" : "38mm"
|
||||
},
|
||||
{
|
||||
"size" : "27.5x27.5",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "notificationCenter",
|
||||
"subtype" : "42mm"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "watch",
|
||||
"role" : "companionSettings",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "watch",
|
||||
"role" : "companionSettings",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "appLauncher",
|
||||
"subtype" : "38mm"
|
||||
},
|
||||
{
|
||||
"size" : "44x44",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "longLook",
|
||||
"subtype" : "42mm"
|
||||
},
|
||||
{
|
||||
"size" : "86x86",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "quickLook",
|
||||
"subtype" : "38mm"
|
||||
},
|
||||
{
|
||||
"size" : "98x98",
|
||||
"idiom" : "watch",
|
||||
"scale" : "2x",
|
||||
"role" : "quickLook",
|
||||
"subtype" : "42mm"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-60@2x.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-60@3x.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-Small-1.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-Small.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-Small@2x-1.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-Small@2x.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-Small@3x.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon@2x.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>oonyeje.Kroleo.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<string>com.Kroleo.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
@ -37,6 +37,12 @@
|
||||
<string>Get Hip!</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>audio</string>
|
||||
<string>location</string>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
|
||||
@ -7,27 +7,60 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MultipeerConnectivity
|
||||
|
||||
class InvitedToPartyViewController: UIViewController {
|
||||
class InvitedToPartyViewController: UIViewController , PartyServiceManagerDelegate{
|
||||
var friendData: [FriendData] = []
|
||||
var requestData: [FriendData] = []
|
||||
var userData: [UserParseData] = []
|
||||
var partyData: PartyServiceManager!
|
||||
var inviteHandle: ((Bool, MCSession!) -> Void)!
|
||||
private var fromPeer: MCPeerID!
|
||||
|
||||
@IBOutlet var img: UIImageView!
|
||||
@IBOutlet var inviteTxt: UITextView!
|
||||
|
||||
@IBAction func declineInvite(sender: UIButton){
|
||||
self.inviteHandle(false, self.partyData.session)
|
||||
self.dismissViewControllerAnimated(true, completion: nil)
|
||||
}
|
||||
|
||||
@IBAction func acceptInvite(sender: UIButton){
|
||||
|
||||
self.inviteHandle(true, self.partyData.session)
|
||||
self.performSegueWithIdentifier("JoiningPartySegue", sender: self)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
var query = PFQuery(className: "_User")
|
||||
query.whereKey("username", equalTo: self.fromPeer.displayName)
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), {() -> Void in
|
||||
query.getFirstObjectInBackgroundWithBlock({
|
||||
(object: PFObject?, error: NSError?) -> Void in
|
||||
if(error == nil){
|
||||
self.inviteTxt.text = "You have been invited by " + (object?.objectForKey("username")! as? String)! + " to join a Party!"
|
||||
|
||||
//download profile imge
|
||||
var img = object!.objectForKey("profilePicture")! as? PFFile
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), {
|
||||
img!.getDataInBackgroundWithBlock({
|
||||
(imgData, error) -> Void in
|
||||
|
||||
var downloadedImg = UIImage(data: imgData!)
|
||||
self.img.image = downloadedImg
|
||||
self.img.layer.cornerRadius = self.img.frame.size.width/2
|
||||
self.img.clipsToBounds = true
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
@ -35,11 +68,13 @@ class InvitedToPartyViewController: UIViewController {
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
func setData(prty:PartyServiceManager, user: [UserParseData], friends: [FriendData], request: [FriendData]){
|
||||
func setData(prty:PartyServiceManager, user: [UserParseData], friends: [FriendData], request: [FriendData], invHand: ((Bool, MCSession!) -> Void)!, fromPeer: MCPeerID){
|
||||
self.partyData = prty
|
||||
self.userData = user
|
||||
self.friendData = friends
|
||||
self.requestData = request
|
||||
self.inviteHandle = invHand
|
||||
self.fromPeer = fromPeer
|
||||
}
|
||||
// MARK: - Navigation
|
||||
|
||||
@ -50,17 +85,48 @@ class InvitedToPartyViewController: UIViewController {
|
||||
let nav: UINavigationController = (segue.destinationViewController as? UINavigationController)!
|
||||
|
||||
let vc: SettingsTableViewController = (nav.viewControllers[0] as? SettingsTableViewController)!
|
||||
vc.setData(self.userData, prty: self.partyData)
|
||||
vc.setData(self.userData, prty: self.partyData, frends: self.friendData, request: self.requestData)
|
||||
}
|
||||
|
||||
if segue.identifier == "InvitedToPartyFriendsSegue" {
|
||||
let nav: UINavigationController = (segue.destinationViewController as? UINavigationController)!
|
||||
|
||||
let vc: FriendsListViewController = (nav.viewControllers[0] as? FriendsListViewController)!
|
||||
vc.setData(self.friendData, requst: self.requestData, party: self.partyData)
|
||||
vc.setData(self.friendData, requst: self.requestData, party: self.partyData, user: self.userData)
|
||||
}
|
||||
|
||||
if segue.identifier == "JoiningPartySegue" {
|
||||
let vc: JoiningPartyViewController = (segue.destinationViewController as? JoiningPartyViewController)!
|
||||
|
||||
vc.setData(self.friendData, requst: self.requestData, party: self.partyData, user: self.userData)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
extension InvitedToPartyViewController: PartyServiceManagerDelegate {
|
||||
|
||||
func foundPeer() {
|
||||
|
||||
}
|
||||
|
||||
func lostPeer() {
|
||||
|
||||
}
|
||||
|
||||
func invitationWasRecieved(peerID: MCPeerID, invitationHandler: ((Bool, MCSession!) -> Void)!) {
|
||||
|
||||
}
|
||||
|
||||
func connectedWithPeer(peerID: MCPeerID) {
|
||||
println("mark 0")
|
||||
}
|
||||
|
||||
func didRecieveInstruction(dictionary: Dictionary<String, AnyObject>){
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
73
GetHip/JoiningPartyViewController.swift
Normal file
@ -0,0 +1,73 @@
|
||||
//
|
||||
// JoiningPartyViewController.swift
|
||||
// GetHip
|
||||
//
|
||||
// Created by Okechi on 3/2/16.
|
||||
// Copyright (c) 2016 Kroleo. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MultipeerConnectivity
|
||||
|
||||
class JoiningPartyViewController: UIViewController ,PartyServiceManagerDelegate{
|
||||
var friends = []
|
||||
var request = []
|
||||
var user: [UserParseData]!
|
||||
var party: PartyServiceManager!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
self.party.delegate = self
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
func setData(frnds:[FriendData], requst: [FriendData], party: PartyServiceManager, user: [UserParseData]){
|
||||
self.friends = frnds
|
||||
self.request = requst
|
||||
self.party = party
|
||||
self.user = user
|
||||
}
|
||||
|
||||
/*
|
||||
// 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.
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
extension JoiningPartyViewController: PartyServiceManagerDelegate {
|
||||
|
||||
func foundPeer() {
|
||||
|
||||
}
|
||||
|
||||
func lostPeer() {
|
||||
|
||||
}
|
||||
|
||||
func invitationWasRecieved(peerID: MCPeerID, invitationHandler: ((Bool, MCSession!) -> Void)!) {
|
||||
|
||||
}
|
||||
|
||||
func connectedWithPeer(peerID: MCPeerID) {
|
||||
println("mark 2")
|
||||
var dictionary: [String: String] = ["sender": self.party.myPeerID.displayName, "instruction": "joined_party"]
|
||||
self.party.sendInstruction(dictionary, toPeer: peerID)
|
||||
}
|
||||
|
||||
func didRecieveInstruction(dictionary: Dictionary<String, AnyObject>){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,8 +8,9 @@
|
||||
|
||||
import UIKit
|
||||
import MediaPlayer
|
||||
import MultipeerConnectivity
|
||||
|
||||
class LoadingPartyViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate{
|
||||
class LoadingPartyViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, PartyServiceManagerDelegate{
|
||||
//persistant data
|
||||
var party: PartyServiceManager!
|
||||
var usr: [UserParseData] = []
|
||||
@ -22,7 +23,7 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
||||
@IBOutlet var songLabel: UILabel!
|
||||
@IBOutlet var timerLabel: UILabel!
|
||||
var timer = NSTimer()
|
||||
var counter = 30
|
||||
var counter = 60
|
||||
|
||||
@IBAction func cancelInvites(sender: UIButton){
|
||||
self.dismissViewControllerAnimated(true, completion: nil)
|
||||
@ -47,6 +48,7 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
||||
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
|
||||
//NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateThumbnail:", name: "peerConnected", object: nil)
|
||||
self.timerLabel.text = String(counter)
|
||||
self.timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("updateCounter"), userInfo: nil, repeats: true)
|
||||
}
|
||||
@ -56,9 +58,13 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
func updateThumbnil(notification: NSNotification){
|
||||
|
||||
}
|
||||
|
||||
func updateCounter(){
|
||||
self.timerLabel.text = String(counter--)
|
||||
if(self.counter == -2){
|
||||
if(self.counter == -1){
|
||||
self.timer.invalidate()
|
||||
self.performSegueWithIdentifier("CurrentlyPlayingSegue", sender: nil)
|
||||
}
|
||||
@ -112,3 +118,51 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
||||
|
||||
|
||||
}
|
||||
|
||||
extension LoadingPartyViewController: PartyServiceManagerDelegate {
|
||||
|
||||
func foundPeer() {
|
||||
|
||||
}
|
||||
|
||||
func lostPeer() {
|
||||
|
||||
}
|
||||
|
||||
func invitationWasRecieved(peerID: MCPeerID, invitationHandler: ((Bool, MCSession!) -> Void)!) {
|
||||
|
||||
}
|
||||
|
||||
func connectedWithPeer(peerID: MCPeerID) {
|
||||
println(self.party.myPeerID.displayName + " connected to " + peerID.displayName)
|
||||
var i = 0
|
||||
for(index, aFriend) in enumerate(self.party.invitedFriends) {
|
||||
if aFriend.displayName == peerID.displayName {
|
||||
i = index
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let cell: InvitedCollectionViewCell = self.invitedFriends.dequeueReusableCellWithReuseIdentifier("InvitedCollectionCell", forIndexPath: NSIndexPath(index: i)) as! InvitedCollectionViewCell
|
||||
|
||||
cell.alpha = 1.0
|
||||
|
||||
|
||||
}
|
||||
|
||||
func didRecieveInstruction(dictionary: Dictionary<String, AnyObject>){
|
||||
//extract data from dictionary
|
||||
println("mark 3")
|
||||
let data = dictionary["data"] as? NSData
|
||||
let fromPeer = dictionary["fromPeer"] as! MCPeerID
|
||||
|
||||
//convert data to dictionary object with instruction
|
||||
let dataDictionary = NSKeyedUnarchiver.unarchiveObjectWithData(data!) as! Dictionary<String, String>
|
||||
|
||||
//check if this is an instruction being sent
|
||||
if let instruction = dataDictionary["instruction"] {
|
||||
println(instruction)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -47,14 +47,23 @@ class LoginController: UIViewController, PFLogInViewControllerDelegate, UITextFi
|
||||
PFUser.logInWithUsernameInBackground(userEmailField.text!, password: password.text!, block: {
|
||||
(user, error) -> Void in
|
||||
|
||||
if(error == nil){
|
||||
if(user != nil){
|
||||
self.performSegueWithIdentifier("LoginToHomeSegue", sender: self)
|
||||
}else{
|
||||
|
||||
var alert = UIAlertController(title: "Invalid Login", message: "Your username/email or password is incorrect!", preferredStyle: .Alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: nil)}))
|
||||
|
||||
self.presentViewController(alert, animated: true, completion: nil)
|
||||
}
|
||||
}else{
|
||||
let alert = UIAlertController(title: "Network Error", message: error?.description, preferredStyle: .Alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: nil)}))
|
||||
|
||||
self.presentViewController(alert, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="j0X-k4-h6H">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@ -191,10 +192,10 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1123" y="2058"/>
|
||||
</scene>
|
||||
<!--View Controller-->
|
||||
<!--Joining Party View Controller-->
|
||||
<scene sceneID="PXH-Ng-lFX">
|
||||
<objects>
|
||||
<viewController id="jhT-5c-UMD" sceneMemberID="viewController">
|
||||
<viewController id="jhT-5c-UMD" customClass="JoiningPartyViewController" customModule="GetHip" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="bQJ-lX-fQH"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="RR8-vy-khf"/>
|
||||
@ -239,12 +240,6 @@
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="so3-St-AQ6">
|
||||
<rect key="frame" x="99" y="254" width="122" height="122"/>
|
||||
</imageView>
|
||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" text="You have been invited by User to join a Party!" textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="SM0-PN-2rz">
|
||||
<rect key="frame" x="47" y="157" width="226" height="89"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="21"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||
</textView>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qlt-XA-jzm">
|
||||
<rect key="frame" x="271" y="44" width="30" height="29"/>
|
||||
<state key="normal" image="Settings.png">
|
||||
@ -281,12 +276,19 @@
|
||||
<segue destination="hDZ-CA-Hsj" kind="show" identifier="InvitedToPartyFriendsSegue" id="41S-h6-flP"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" text="You have been invited by User to join a Party!" textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="SM0-PN-2rz">
|
||||
<rect key="frame" x="47" y="157" width="226" height="89"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="21"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||
</textView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
|
||||
<connections>
|
||||
<outlet property="img" destination="so3-St-AQ6" id="T0w-OK-mUA"/>
|
||||
<outlet property="inviteTxt" destination="SM0-PN-2rz" id="7Ji-Uu-j84"/>
|
||||
<segue destination="jhT-5c-UMD" kind="show" identifier="JoiningPartySegue" id="U4V-ga-nL4"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
@ -623,9 +625,6 @@
|
||||
<state key="normal" image="Star@3x.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="testGuest:" destination="i3K-xv-zw1" eventType="touchUpInside" id="YpK-nZ-p8K"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NHH-gh-nMz" userLabel="Friends">
|
||||
<rect key="frame" x="19" y="44" width="56" height="32"/>
|
||||
@ -1292,17 +1291,10 @@
|
||||
</label>
|
||||
<slider opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" minimumValueImage="Lower.png" maximumValueImage="Raise.png" translatesAutoresizingMaskIntoConstraints="NO" id="AA9-Xx-q9o">
|
||||
<rect key="frame" x="26" y="465" width="268" height="31"/>
|
||||
</slider>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sFb-YR-QlX">
|
||||
<rect key="frame" x="138" y="505" width="44" height="43"/>
|
||||
<state key="normal" image="Pause-52.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="favoriteSong:" destination="5Fd-vs-lX1" eventType="touchUpInside" id="I7l-Fn-CW4"/>
|
||||
<action selector="playPauseFav:" destination="5Fd-vs-lX1" eventType="touchUpInside" id="AgY-Dl-2AA"/>
|
||||
<action selector="volChng:" destination="5Fd-vs-lX1" eventType="valueChanged" id="hT1-f1-qOr"/>
|
||||
</connections>
|
||||
</button>
|
||||
</slider>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="V0r-OV-CXi">
|
||||
<rect key="frame" x="226" y="16" width="81" height="41"/>
|
||||
<state key="normal" image="Party.png">
|
||||
@ -1312,6 +1304,15 @@
|
||||
<segue destination="enX-CI-fki" kind="show" identifier="InPartySegue" id="OD2-Xh-xf2"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sFb-YR-QlX">
|
||||
<rect key="frame" x="138" y="505" width="44" height="43"/>
|
||||
<state key="normal" backgroundImage="Pause-52.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="playPauseFav:" destination="5Fd-vs-lX1" eventType="touchUpInside" id="AgY-Dl-2AA"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
@ -1646,9 +1647,9 @@
|
||||
<image name="Turntable@3x.png" width="434" height="434"/>
|
||||
</resources>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="WxI-P3-JZ9"/>
|
||||
<segue reference="OpG-wQ-NAH"/>
|
||||
<segue reference="wiM-xb-lpR"/>
|
||||
<segue reference="5pn-ck-WiI"/>
|
||||
<segue reference="hDN-yC-fGj"/>
|
||||
<segue reference="41S-h6-flP"/>
|
||||
<segue reference="OpG-wQ-NAH"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
|
||||
@ -16,10 +16,12 @@ protocol PartyServiceManagerDelegate {
|
||||
|
||||
func lostPeer()
|
||||
|
||||
func invitationWasRecieved(fromPeer: String)
|
||||
func invitationWasRecieved(peerID: MCPeerID, invitationHandler: ((Bool, MCSession!) -> Void)!)
|
||||
|
||||
func connectedWithPeer(peerID: MCPeerID)
|
||||
|
||||
func didRecieveInstruction(dictionary: Dictionary<String, AnyObject>)
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -52,30 +54,13 @@ class PartyServiceManager: NSObject {
|
||||
var role: PeerType! = nil
|
||||
var currentHost: String!
|
||||
|
||||
var connectingPeersDictionary = NSMutableDictionary()
|
||||
var connectedPeersDictionary = NSMutableDictionary()
|
||||
var disconnectedPeersDictionary = NSMutableDictionary()
|
||||
|
||||
//party variables
|
||||
var currentSong: MPMediaItem! = nil
|
||||
|
||||
/*init(){
|
||||
|
||||
//self.serviceAdvertiser = MCNearbyServiceAdvertiser(peer: self.myPeerID, discoveryInfo: nil, serviceType: self.PartyServiceType)
|
||||
//super.init()
|
||||
//self.serviceAdvertiser.delegate = self
|
||||
|
||||
}*/
|
||||
|
||||
/*deinit {
|
||||
//stop all session services
|
||||
self.serviceAdvertiser.stopAdvertisingPeer()
|
||||
self.serviceBrowser.stopBrowsingForPeers()
|
||||
}*/
|
||||
|
||||
/*lazy var session: MCSession = {
|
||||
let session = MCSession(peer: self.myPeerID, securityIdentity: nil, encryptionPreference: MCEncryptionPreference.Required)
|
||||
|
||||
}()*/
|
||||
|
||||
//Peer Initializer
|
||||
func setPeerID(dispName: String){
|
||||
@ -99,6 +84,30 @@ class PartyServiceManager: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
func isPeerFound(peer: MCPeerID) -> Bool {
|
||||
for i in 0..<self.foundPeers.count{
|
||||
if(self.foundPeers[i].displayName == peer.displayName){
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//Party Instruction Sender
|
||||
func sendInstruction(dictionary: Dictionary<String, String>, toPeer: MCPeerID) -> Bool {
|
||||
|
||||
let dataToSend = NSKeyedArchiver.archivedDataWithRootObject(dictionary)
|
||||
let peersArray = NSArray(object: toPeer)
|
||||
var error: NSError?
|
||||
|
||||
if !(self.session.sendData(dataToSend, toPeers: peersArray as [AnyObject], withMode: MCSessionSendDataMode.Reliable, error: &error)){
|
||||
println(error?.localizedDescription)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
//Listening methods
|
||||
func setAdvertiser(){
|
||||
self.serviceAdvertiser = MCNearbyServiceAdvertiser(peer: self.myPeerID, discoveryInfo: nil, serviceType: self.PartyServiceType)
|
||||
@ -208,20 +217,25 @@ extension PartyServiceManager: MCNearbyServiceBrowserDelegate{
|
||||
|
||||
func browser(browser: MCNearbyServiceBrowser!, foundPeer peerID: MCPeerID!, withDiscoveryInfo info: [NSObject : AnyObject]!) {
|
||||
|
||||
if(!isPeerFound(peerID)){
|
||||
if(peerID.displayName != self.myPeerID.displayName) {
|
||||
NSLog("%@", "foundPeer: \(peerID)")
|
||||
self.foundPeers.append(peerID)
|
||||
self.delegate?.foundPeer()
|
||||
//self.serviceBrowser.invitePeer(peerID, toSession: self.session, withContext: nil, timeout: NSTimeInterval(10.00))
|
||||
//self.serviceBrowser.invitePeer(peerID, toSession: self.session, withContext: nil, timeout: NSTimeInterval(60.00))
|
||||
|
||||
}
|
||||
|
||||
//implement way of picking which friends from friend list are invited
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
func browser(browser: MCNearbyServiceBrowser!, lostPeer peerID: MCPeerID!) {
|
||||
NSLog("%@", "lostPeer: \(peerID)")
|
||||
|
||||
if(isPeerFound(peerID)){
|
||||
for(index, aPeer) in enumerate(foundPeers) {
|
||||
if aPeer == peerID{
|
||||
foundPeers.removeAtIndex(index)
|
||||
@ -231,6 +245,9 @@ extension PartyServiceManager: MCNearbyServiceBrowserDelegate{
|
||||
|
||||
delegate?.lostPeer()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
extension PartyServiceManager: MCNearbyServiceAdvertiserDelegate{
|
||||
@ -242,7 +259,7 @@ extension PartyServiceManager: MCNearbyServiceAdvertiserDelegate{
|
||||
func advertiser(advertiser: MCNearbyServiceAdvertiser!, didReceiveInvitationFromPeer peerID: MCPeerID!, withContext context: NSData!, invitationHandler: ((Bool, MCSession!) -> Void)!) {
|
||||
NSLog("%@", "invitingPeer: \(peerID)")
|
||||
self.setRole(PeerType(rawValue: 3)!)
|
||||
invitationHandler(true, self.session)
|
||||
delegate?.invitationWasRecieved(peerID, invitationHandler: invitationHandler)
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,10 +267,20 @@ extension PartyServiceManager: MCSessionDelegate{
|
||||
|
||||
func session(session: MCSession!, peer peerID: MCPeerID!, didChangeState state: MCSessionState) {
|
||||
NSLog("%@", "peer \(peerID) didChangeState: \(state.stringValue())")
|
||||
if(state == MCSessionState.Connected){
|
||||
println(self.myPeerID.displayName + " connected to " + peerID.displayName)
|
||||
println("mark 1")
|
||||
self.delegate?.connectedWithPeer(peerID)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func session(session: MCSession!, didReceiveData data: NSData!, fromPeer peerID: MCPeerID!) {
|
||||
NSLog("%@", "didRecieveData: \(data)")
|
||||
|
||||
let dictionary: [String: AnyObject] = ["data": data, "fromPeer": peerID]
|
||||
self.delegate?.didRecieveInstruction(dictionary)
|
||||
|
||||
}
|
||||
|
||||
func session(session: MCSession!, didReceiveStream stream: NSInputStream!, withName streamName: String!, fromPeer peerID: MCPeerID!) {
|
||||
|
||||
@ -7,11 +7,14 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MultipeerConnectivity
|
||||
|
||||
class SettingsTableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
|
||||
class SettingsTableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, PartyServiceManagerDelegate {
|
||||
// var manager = UserParseDataSource()
|
||||
var user = []
|
||||
var party: PartyServiceManager!
|
||||
var friendData: [FriendData] = []
|
||||
var requestData: [FriendData] = []
|
||||
|
||||
@IBOutlet weak var logOutBtn: UIButton!
|
||||
@IBOutlet weak var table: UITableView!
|
||||
@ -38,9 +41,11 @@ class SettingsTableViewController: UIViewController, UITableViewDataSource, UITa
|
||||
|
||||
}
|
||||
|
||||
func setData(usr:[UserParseData], prty: PartyServiceManager){
|
||||
func setData(usr:[UserParseData], prty: PartyServiceManager, frends: [FriendData], request: [FriendData]){
|
||||
self.user = usr
|
||||
self.party = prty
|
||||
self.friendData = frends
|
||||
self.requestData = request
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
@ -54,6 +59,7 @@ class SettingsTableViewController: UIViewController, UITableViewDataSource, UITa
|
||||
self.table.delegate = self
|
||||
self.navigationController?.navigationBarHidden = false
|
||||
self.table.tableFooterView = UIView(frame: CGRectZero)
|
||||
self.party.delegate = self
|
||||
//NSNotificationCenter.defaultCenter().addObserver(self, selector: "refreshTable:", name: "refreshSettingsView", object: nil)
|
||||
|
||||
self.table.reloadData()
|
||||
@ -288,3 +294,30 @@ class SettingsTableViewController: UIViewController, UITableViewDataSource, UITa
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
extension SettingsTableViewController: PartyServiceManagerDelegate {
|
||||
func foundPeer() {
|
||||
|
||||
}
|
||||
|
||||
func lostPeer() {
|
||||
|
||||
}
|
||||
|
||||
func invitationWasRecieved(peerID: MCPeerID, invitationHandler: ((Bool, MCSession!) -> Void)!) {
|
||||
var storyboard = UIStoryboard(name: "Main", bundle: nil)
|
||||
var vc: InvitedToPartyViewController = storyboard.instantiateViewControllerWithIdentifier("InvitedToPartyVC") as! InvitedToPartyViewController!
|
||||
vc.setData(self.party, user: self.user as! [UserParseData], friends: self.friendData, request: self.requestData, invHand: invitationHandler, fromPeer: peerID)
|
||||
self.presentViewController(vc, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func connectedWithPeer(peerID: MCPeerID) {
|
||||
|
||||
}
|
||||
|
||||
func didRecieveInstruction(dictionary: Dictionary<String, AnyObject>){
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -276,6 +276,17 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
|
||||
let vc: LoadingPartyViewController = (segue.destinationViewController as? LoadingPartyViewController)!
|
||||
vc.setData(self.party, user: self.usr, friends: self.frnds, request: self.requestData)
|
||||
|
||||
for i_peer in self.party.invitedFriends{
|
||||
for peer in self.party.foundPeers {
|
||||
if (peer.displayName == i_peer.displayName){
|
||||
self.party.serviceBrowser.invitePeer(peer, toSession: self.party.session, withContext: nil, timeout: 1000.0)
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl
|
||||
var requestData: [FriendData] = []
|
||||
var isFriendSelected: [Bool] = []
|
||||
var isInvitable: [Bool] = []
|
||||
var invitableCount = 0
|
||||
var partyData: PartyServiceManager! = nil
|
||||
|
||||
@IBOutlet weak var table: UITableView!
|
||||
@ -29,6 +30,24 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl
|
||||
|
||||
@IBAction func sendInvites(sender: UIButton) {
|
||||
var numSelected = 0
|
||||
var data = NSData()
|
||||
for(index, bool) in enumerate(self.isFriendSelected) {
|
||||
if bool == true {
|
||||
|
||||
//search for foundpeer in array
|
||||
/*for peer in self.partyData.foundPeers {
|
||||
if (peer.displayName == self.frnds[index].displayName){
|
||||
self.partyData.serviceBrowser.invitePeer(peer, toSession: self.partyData.session, withContext: data, timeout: 3600.0)
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
self.partyData.serviceBrowser.stopBrowsingForPeers()
|
||||
|
||||
for booli in self.isFriendSelected {
|
||||
if booli == true {
|
||||
@ -64,24 +83,22 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl
|
||||
self.table.dataSource = self
|
||||
self.table.delegate = self
|
||||
self.partyData.delegate = self
|
||||
//start browsing for peers
|
||||
self.partyData.setBrowser()
|
||||
self.partyData.startBrowser()
|
||||
self.partyData.initializeSession()
|
||||
self.navigationController?.navigationBarHidden = false
|
||||
|
||||
/*
|
||||
for foundPeer in self.partyData.foundPeers {
|
||||
for friend in self.frnds {
|
||||
if foundPeer.displayName == friend.displayName {
|
||||
for(index, aFriend) in enumerate(self.frnds) {
|
||||
if aFriend.displayName == friend.displayName {
|
||||
self.isInvitable[index] = true
|
||||
self.invitableCount++
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -92,6 +109,12 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl
|
||||
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
|
||||
}
|
||||
|
||||
override func viewWillAppear(animated: Bool) {
|
||||
//start browsing for peers
|
||||
self.partyData.setBrowser()
|
||||
self.partyData.startBrowser()
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
@ -108,12 +131,25 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl
|
||||
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
// #warning Incomplete method implementation.
|
||||
// Return the number of rows in the section.
|
||||
return self.frnds.count
|
||||
|
||||
return self.invitableCount
|
||||
//return self.frnds.count
|
||||
}
|
||||
|
||||
|
||||
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
let friend = self.frnds[indexPath.row]
|
||||
|
||||
//iterate through the currently found peers and display only friends who are available
|
||||
var friend: FriendData!
|
||||
|
||||
for i in 0..<self.frnds.count {
|
||||
if(self.isInvitable[i] == true){
|
||||
friend = self.frnds[i]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//friend = self.frnds[indexPath.row]
|
||||
let cell = self.table.dequeueReusableCellWithIdentifier("TestInviteCell", forIndexPath: indexPath) as? TestInviteFriendsCell
|
||||
|
||||
//sets display name of friend (print for debugging purposes)
|
||||
@ -136,10 +172,11 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl
|
||||
cell!.rdioButton.layer.cornerRadius = cell!.rdioButton.frame.size.width/2
|
||||
cell!.rdioButton.clipsToBounds = true
|
||||
|
||||
//for testing purposes - MPCBrowsing
|
||||
/*for testing purposes - MPCBrowsing
|
||||
if(self.isInvitable[indexPath.row] == true){
|
||||
cell!.proImage.alpha = 0.5
|
||||
}
|
||||
*/
|
||||
|
||||
return cell!
|
||||
}
|
||||
@ -221,19 +258,41 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl
|
||||
}
|
||||
|
||||
extension TestInviteFriendsController: PartyServiceManagerDelegate {
|
||||
|
||||
func foundPeer() {
|
||||
for foundPeer in self.partyData.foundPeers {
|
||||
for friend in self.frnds {
|
||||
if foundPeer.displayName == friend.displayName {
|
||||
for(index, aFriend) in enumerate(self.frnds) {
|
||||
if aFriend.displayName == friend.displayName {
|
||||
self.isInvitable[index] = true
|
||||
self.invitableCount++
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.table.reloadData()
|
||||
}
|
||||
|
||||
func lostPeer() {
|
||||
self.invitableCount--
|
||||
self.table.reloadData()
|
||||
}
|
||||
|
||||
func invitationWasRecieved(fromPeer: String) {
|
||||
func invitationWasRecieved(peerID: MCPeerID, invitationHandler: ((Bool, MCSession!) -> Void)!) {
|
||||
|
||||
}
|
||||
|
||||
func connectedWithPeer(peerID: MCPeerID) {
|
||||
|
||||
}
|
||||
|
||||
func didRecieveInstruction(dictionary: Dictionary<String, AnyObject>){
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||