streaming working; will work on repeating the song selection cycle so party can continue. Will complete that as well as any residual work in rest of views and displaying who is in current party
@ -49,6 +49,8 @@
|
|||||||
3E4169491C385F1000B193AF /* 1x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E4169481C385F1000B193AF /* 1x.png */; };
|
3E4169491C385F1000B193AF /* 1x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E4169481C385F1000B193AF /* 1x.png */; };
|
||||||
3E4169551C398A5B00B193AF /* SignUpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E4169541C398A5B00B193AF /* SignUpViewController.swift */; };
|
3E4169551C398A5B00B193AF /* SignUpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E4169541C398A5B00B193AF /* SignUpViewController.swift */; };
|
||||||
3E4169571C399C4D00B193AF /* Images-3.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E4169561C399C4D00B193AF /* Images-3.xcassets */; };
|
3E4169571C399C4D00B193AF /* Images-3.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E4169561C399C4D00B193AF /* Images-3.xcassets */; };
|
||||||
|
3E41D74C1C8D17E100FFD846 /* icon-120.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E41D74B1C8D17E100FFD846 /* icon-120.png */; };
|
||||||
|
3E41D74E1C8D17F300FFD846 /* Icon-60.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E41D74D1C8D17F300FFD846 /* Icon-60.png */; };
|
||||||
3E438ADE1C572DFD0055C97A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3E438ADD1C572DFD0055C97A /* Main.storyboard */; };
|
3E438ADE1C572DFD0055C97A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3E438ADD1C572DFD0055C97A /* Main.storyboard */; };
|
||||||
3E438AE61C5738EF0055C97A /* Create@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E438AE11C5738EF0055C97A /* Create@2x.png */; };
|
3E438AE61C5738EF0055C97A /* Create@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E438AE11C5738EF0055C97A /* Create@2x.png */; };
|
||||||
3E438AE71C5738EF0055C97A /* Friends@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E438AE21C5738EF0055C97A /* Friends@2x.png */; };
|
3E438AE71C5738EF0055C97A /* Friends@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E438AE21C5738EF0055C97A /* Friends@2x.png */; };
|
||||||
@ -196,6 +198,8 @@
|
|||||||
3E4169481C385F1000B193AF /* 1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = 1x.png; path = "../../../Dropbox/Gethip/Screens/Logo Screen/6 Logo Screen/1x.png"; sourceTree = "<group>"; };
|
3E4169481C385F1000B193AF /* 1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = 1x.png; path = "../../../Dropbox/Gethip/Screens/Logo Screen/6 Logo Screen/1x.png"; sourceTree = "<group>"; };
|
||||||
3E4169541C398A5B00B193AF /* SignUpViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignUpViewController.swift; sourceTree = "<group>"; };
|
3E4169541C398A5B00B193AF /* SignUpViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignUpViewController.swift; sourceTree = "<group>"; };
|
||||||
3E4169561C399C4D00B193AF /* Images-3.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Images-3.xcassets"; sourceTree = "<group>"; };
|
3E4169561C399C4D00B193AF /* Images-3.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Images-3.xcassets"; sourceTree = "<group>"; };
|
||||||
|
3E41D74B1C8D17E100FFD846 /* icon-120.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-120.png"; sourceTree = "<group>"; };
|
||||||
|
3E41D74D1C8D17F300FFD846 /* Icon-60.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-60.png"; sourceTree = "<group>"; };
|
||||||
3E438ADD1C572DFD0055C97A /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
|
3E438ADD1C572DFD0055C97A /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
|
||||||
3E438AE11C5738EF0055C97A /* Create@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Create@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Home/Icon Assets/Create@2x.png"; sourceTree = "<group>"; };
|
3E438AE11C5738EF0055C97A /* Create@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Create@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Home/Icon Assets/Create@2x.png"; sourceTree = "<group>"; };
|
||||||
3E438AE21C5738EF0055C97A /* Friends@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Friends@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Home/Icon Assets/Friends@2x.png"; sourceTree = "<group>"; };
|
3E438AE21C5738EF0055C97A /* Friends@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Friends@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Home/Icon Assets/Friends@2x.png"; sourceTree = "<group>"; };
|
||||||
@ -419,6 +423,8 @@
|
|||||||
3E1BDA4F1C37111D00EE3B84 /* Supporting Files */ = {
|
3E1BDA4F1C37111D00EE3B84 /* Supporting Files */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
3E41D74D1C8D17F300FFD846 /* Icon-60.png */,
|
||||||
|
3E41D74B1C8D17E100FFD846 /* icon-120.png */,
|
||||||
3E1BDA501C37111D00EE3B84 /* Info.plist */,
|
3E1BDA501C37111D00EE3B84 /* Info.plist */,
|
||||||
);
|
);
|
||||||
name = "Supporting Files";
|
name = "Supporting Files";
|
||||||
@ -845,6 +851,7 @@
|
|||||||
3E438AE91C5738EF0055C97A /* Star@2x.png in Resources */,
|
3E438AE91C5738EF0055C97A /* Star@2x.png in Resources */,
|
||||||
3E5BD3151C6C45CE00266B16 /* Home Copy@2x.png in Resources */,
|
3E5BD3151C6C45CE00266B16 /* Home Copy@2x.png in Resources */,
|
||||||
3E5952831C39DDA800C88C71 /* Settings@3x.png in Resources */,
|
3E5952831C39DDA800C88C71 /* Settings@3x.png in Resources */,
|
||||||
|
3E41D74C1C8D17E100FFD846 /* icon-120.png in Resources */,
|
||||||
3E7BB8E21C5B4A350005B834 /* Change Song@2x.png in Resources */,
|
3E7BB8E21C5B4A350005B834 /* Change Song@2x.png in Resources */,
|
||||||
3E59526B1C39DBC900C88C71 /* Star@3x.png in Resources */,
|
3E59526B1C39DBC900C88C71 /* Star@3x.png in Resources */,
|
||||||
3E59527B1C39DDA800C88C71 /* Create.png in Resources */,
|
3E59527B1C39DDA800C88C71 /* Create.png in Resources */,
|
||||||
@ -862,6 +869,7 @@
|
|||||||
3E59526F1C39DC1E00C88C71 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2.png in Resources */,
|
3E59526F1C39DC1E00C88C71 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2.png in Resources */,
|
||||||
3E59527F1C39DDA800C88C71 /* Group@2x.png in Resources */,
|
3E59527F1C39DDA800C88C71 /* Group@2x.png in Resources */,
|
||||||
3E5952691C39DBC900C88C71 /* Star.png in Resources */,
|
3E5952691C39DBC900C88C71 /* Star.png in Resources */,
|
||||||
|
3E41D74E1C8D17F300FFD846 /* Icon-60.png in Resources */,
|
||||||
3E59527C1C39DDA800C88C71 /* Create@2x.png in Resources */,
|
3E59527C1C39DDA800C88C71 /* Create@2x.png in Resources */,
|
||||||
3E7D37D51C75D7EF002E682F /* Raise@2x.png in Resources */,
|
3E7D37D51C75D7EF002E682F /* Raise@2x.png in Resources */,
|
||||||
3E59526A1C39DBC900C88C71 /* Star@2x.png in Resources */,
|
3E59526A1C39DBC900C88C71 /* Star@2x.png in Resources */,
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class FriendData {
|
class FriendData: NSObject, NSCoding {
|
||||||
var displayName: String!
|
var displayName: String!
|
||||||
var profileImg: UIImageView!
|
var profileImg: UIImageView!
|
||||||
var status: String!
|
var status: String!
|
||||||
@ -17,8 +17,39 @@ class FriendData {
|
|||||||
self.displayName = display
|
self.displayName = display
|
||||||
self.profileImg = nil
|
self.profileImg = nil
|
||||||
self.status = status
|
self.status = status
|
||||||
|
super.init()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//MARK: NSCoding
|
||||||
|
required init(coder aDecoder: NSCoder){
|
||||||
|
self.displayName = aDecoder.decodeObjectForKey("displayName") as! String
|
||||||
|
self.profileImg = aDecoder.decodeObjectForKey("profileImg") as! UIImageView!
|
||||||
|
self.status = aDecoder.decodeObjectForKey("status") as! String
|
||||||
|
|
||||||
|
super.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
func encodeWithCoder(aCoder: NSCoder){
|
||||||
|
aCoder.encodeObject(self.displayName, forKey: "displayName")
|
||||||
|
aCoder.encodeObject(self.profileImg, forKey: "profileImg")
|
||||||
|
aCoder.encodeObject(self.status, forKey: "status")
|
||||||
|
}
|
||||||
|
|
||||||
|
//Mark: NSObject
|
||||||
|
|
||||||
|
override func isEqual(object: AnyObject?) -> Bool{
|
||||||
|
if let object = object as? FriendData {
|
||||||
|
return self.displayName == object.displayName
|
||||||
|
&& self.profileImg == object.profileImg
|
||||||
|
&& self.status == object.status
|
||||||
|
}else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override var hash: Int {
|
||||||
|
return self.displayName.hashValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class HomeScreenViewController: UIViewController, PartyServiceManagerDelegate {
|
|||||||
var userData: [UserParseData] = []
|
var userData: [UserParseData] = []
|
||||||
let partyData = PartyServiceManager()
|
let partyData = PartyServiceManager()
|
||||||
var firstTime: Bool = true
|
var firstTime: Bool = true
|
||||||
|
private var firstTimeBrowsing: Bool = true
|
||||||
@IBOutlet weak var CreateAPartyBtn: UIButton!
|
@IBOutlet weak var CreateAPartyBtn: UIButton!
|
||||||
|
|
||||||
|
|
||||||
@ -33,6 +33,15 @@ class HomeScreenViewController: UIViewController, PartyServiceManagerDelegate {
|
|||||||
self.friendData.append(pendingFriend)
|
self.friendData.append(pendingFriend)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//start browsing for peers
|
||||||
|
self.partyData.setBrowser()
|
||||||
|
self.partyData.startBrowser()
|
||||||
|
|
||||||
|
//self.partyData.delegate = self
|
||||||
|
self.firstTime = false
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func refreshUserData(notification:NSNotification){
|
func refreshUserData(notification:NSNotification){
|
||||||
@ -47,12 +56,13 @@ class HomeScreenViewController: UIViewController, PartyServiceManagerDelegate {
|
|||||||
self.partyData.setAdvertiser()
|
self.partyData.setAdvertiser()
|
||||||
self.partyData.startListening()
|
self.partyData.startListening()
|
||||||
|
|
||||||
|
self.frndDataManager = FriendDataSource()
|
||||||
//start browsing for peers
|
//start browsing for peers
|
||||||
self.partyData.setBrowser()
|
//self.partyData.setBrowser()
|
||||||
self.partyData.startBrowser()
|
//self.partyData.startBrowser()
|
||||||
|
|
||||||
self.partyData.delegate = self
|
self.partyData.delegate = self
|
||||||
self.firstTime = false
|
//self.firstTime = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -87,7 +97,6 @@ class HomeScreenViewController: UIViewController, PartyServiceManagerDelegate {
|
|||||||
self.friendData = []
|
self.friendData = []
|
||||||
dispatch_async(dispatch_get_main_queue(), {
|
dispatch_async(dispatch_get_main_queue(), {
|
||||||
self.usrDataManager = UserParseDataSource()
|
self.usrDataManager = UserParseDataSource()
|
||||||
self.frndDataManager = FriendDataSource()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -141,6 +150,14 @@ class HomeScreenViewController: UIViewController, PartyServiceManagerDelegate {
|
|||||||
|
|
||||||
extension HomeScreenViewController: PartyServiceManagerDelegate {
|
extension HomeScreenViewController: PartyServiceManagerDelegate {
|
||||||
func foundPeer() {
|
func foundPeer() {
|
||||||
|
if(self.firstTimeBrowsing == true){
|
||||||
|
//used for finding nearby friends when starting a party
|
||||||
|
for i in 0..<self.friendData.count{
|
||||||
|
self.partyData.isInvitable.append(false)
|
||||||
|
}
|
||||||
|
self.firstTimeBrowsing = false
|
||||||
|
}
|
||||||
|
|
||||||
for foundPeer in self.partyData.foundPeers {
|
for foundPeer in self.partyData.foundPeers {
|
||||||
for friend in self.friendData {
|
for friend in self.friendData {
|
||||||
if foundPeer.displayName == friend.displayName {
|
if foundPeer.displayName == friend.displayName {
|
||||||
|
|||||||
BIN
GetHip/Icon-60.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
@ -69,54 +69,62 @@
|
|||||||
{
|
{
|
||||||
"size" : "40x40",
|
"size" : "40x40",
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"filename" : "Icon-Spotlight-40.png",
|
"filename" : "Icon-40.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "40x40",
|
"size" : "40x40",
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"filename" : "Icon-Spotlight-40@2x-1.png",
|
"filename" : "Icon-40@2x-1.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
|
||||||
"size" : "50x50",
|
"size" : "50x50",
|
||||||
|
"idiom" : "ipad",
|
||||||
|
"filename" : "Icon-Small-50.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
|
||||||
"size" : "50x50",
|
"size" : "50x50",
|
||||||
|
"idiom" : "ipad",
|
||||||
|
"filename" : "Icon-Small-50@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
|
||||||
"size" : "72x72",
|
"size" : "72x72",
|
||||||
|
"idiom" : "ipad",
|
||||||
|
"filename" : "Icon-72.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
|
||||||
"size" : "72x72",
|
"size" : "72x72",
|
||||||
|
"idiom" : "ipad",
|
||||||
|
"filename" : "Icon-72@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
|
||||||
"size" : "76x76",
|
"size" : "76x76",
|
||||||
|
"idiom" : "ipad",
|
||||||
|
"filename" : "Icon-76.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
|
||||||
"size" : "76x76",
|
"size" : "76x76",
|
||||||
|
"idiom" : "ipad",
|
||||||
|
"filename" : "Icon-76@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "car",
|
|
||||||
"size" : "120x120",
|
"size" : "120x120",
|
||||||
|
"idiom" : "car",
|
||||||
|
"filename" : "Icon-Spotlight-40@3x-1.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "24x24",
|
"size" : "24x24",
|
||||||
"idiom" : "watch",
|
"idiom" : "watch",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
|
"filename" : "Icon-24@2x.png",
|
||||||
"role" : "notificationCenter",
|
"role" : "notificationCenter",
|
||||||
"subtype" : "38mm"
|
"subtype" : "38mm"
|
||||||
},
|
},
|
||||||
@ -124,18 +132,21 @@
|
|||||||
"size" : "27.5x27.5",
|
"size" : "27.5x27.5",
|
||||||
"idiom" : "watch",
|
"idiom" : "watch",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
|
"filename" : "Icon-27.5@2x.png",
|
||||||
"role" : "notificationCenter",
|
"role" : "notificationCenter",
|
||||||
"subtype" : "42mm"
|
"subtype" : "42mm"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "29x29",
|
"size" : "29x29",
|
||||||
"idiom" : "watch",
|
"idiom" : "watch",
|
||||||
|
"filename" : "Icon-29@2x.png",
|
||||||
"role" : "companionSettings",
|
"role" : "companionSettings",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "29x29",
|
"size" : "29x29",
|
||||||
"idiom" : "watch",
|
"idiom" : "watch",
|
||||||
|
"filename" : "Icon-29@3x.png",
|
||||||
"role" : "companionSettings",
|
"role" : "companionSettings",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
},
|
},
|
||||||
@ -143,6 +154,7 @@
|
|||||||
"size" : "40x40",
|
"size" : "40x40",
|
||||||
"idiom" : "watch",
|
"idiom" : "watch",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
|
"filename" : "Icon-40@2x.png",
|
||||||
"role" : "appLauncher",
|
"role" : "appLauncher",
|
||||||
"subtype" : "38mm"
|
"subtype" : "38mm"
|
||||||
},
|
},
|
||||||
@ -150,6 +162,7 @@
|
|||||||
"size" : "44x44",
|
"size" : "44x44",
|
||||||
"idiom" : "watch",
|
"idiom" : "watch",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
|
"filename" : "Icon-44@2x.png",
|
||||||
"role" : "longLook",
|
"role" : "longLook",
|
||||||
"subtype" : "42mm"
|
"subtype" : "42mm"
|
||||||
},
|
},
|
||||||
@ -157,6 +170,7 @@
|
|||||||
"size" : "86x86",
|
"size" : "86x86",
|
||||||
"idiom" : "watch",
|
"idiom" : "watch",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
|
"filename" : "Icon-86@2x.png",
|
||||||
"role" : "quickLook",
|
"role" : "quickLook",
|
||||||
"subtype" : "38mm"
|
"subtype" : "38mm"
|
||||||
},
|
},
|
||||||
@ -164,6 +178,7 @@
|
|||||||
"size" : "98x98",
|
"size" : "98x98",
|
||||||
"idiom" : "watch",
|
"idiom" : "watch",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
|
"filename" : "Icon-98@2x.png",
|
||||||
"role" : "quickLook",
|
"role" : "quickLook",
|
||||||
"subtype" : "42mm"
|
"subtype" : "42mm"
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-24@2x.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-27.5@2x.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-29@2x.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-29@3x.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-40.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-40@2x-1.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-40@2x.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-44@2x.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-72.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-72@2x.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-76.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-76@2x.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-86@2x.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-98@2x.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-Small-50.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
GetHip/Images-3.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
@ -49,8 +49,11 @@ class InPartyViewController: UIViewController, UICollectionViewDataSource, UICol
|
|||||||
|
|
||||||
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
|
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
|
||||||
|
|
||||||
|
var cell: InvitedCollectionViewCell!
|
||||||
|
|
||||||
|
if(self.party.role == PeerType.Host_Creator){
|
||||||
let friend = self.party.invitedFriends[indexPath.row]
|
let friend = self.party.invitedFriends[indexPath.row]
|
||||||
let cell: InvitedCollectionViewCell = self.friendsInParty.dequeueReusableCellWithReuseIdentifier("InvitedCollectionCell", forIndexPath: indexPath) as! InvitedCollectionViewCell
|
cell = self.friendsInParty.dequeueReusableCellWithReuseIdentifier("InvitedCollectionCell", forIndexPath: indexPath) as! InvitedCollectionViewCell
|
||||||
|
|
||||||
if friend.profileImg == nil {
|
if friend.profileImg == nil {
|
||||||
cell.friendImage.backgroundColor = UIColor.grayColor()
|
cell.friendImage.backgroundColor = UIColor.grayColor()
|
||||||
@ -62,6 +65,10 @@ class InPartyViewController: UIViewController, UICollectionViewDataSource, UICol
|
|||||||
//rounds uiimage and configures UIImageView
|
//rounds uiimage and configures UIImageView
|
||||||
cell.friendImage.layer.cornerRadius = cell.friendImage.frame.size.width/2
|
cell.friendImage.layer.cornerRadius = cell.friendImage.frame.size.width/2
|
||||||
cell.friendImage.clipsToBounds = true
|
cell.friendImage.clipsToBounds = true
|
||||||
|
}else{
|
||||||
|
cell = InvitedCollectionViewCell()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return cell
|
return cell
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,11 @@
|
|||||||
<string>en</string>
|
<string>en</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
|
<key>CFBundleIconFiles</key>
|
||||||
|
<array>
|
||||||
|
<string>Icon-60.png</string>
|
||||||
|
<string>icon-120.png</string>
|
||||||
|
</array>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>com.Kroleo.$(PRODUCT_NAME:rfc1034identifier)</string>
|
<string>com.Kroleo.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
@ -30,7 +35,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>2</string>
|
||||||
<key>FacebookAppID</key>
|
<key>FacebookAppID</key>
|
||||||
<string>1166375230058840</string>
|
<string>1166375230058840</string>
|
||||||
<key>FacebookDisplayName</key>
|
<key>FacebookDisplayName</key>
|
||||||
|
|||||||
@ -27,6 +27,7 @@ class InvitedToPartyViewController: UIViewController , PartyServiceManagerDelega
|
|||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func acceptInvite(sender: UIButton){
|
@IBAction func acceptInvite(sender: UIButton){
|
||||||
|
self.partyData.currentHost = self.fromPeer.displayName
|
||||||
self.inviteHandle(true, self.partyData.session)
|
self.inviteHandle(true, self.partyData.session)
|
||||||
self.performSegueWithIdentifier("JoiningPartySegue", sender: self)
|
self.performSegueWithIdentifier("JoiningPartySegue", sender: self)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class JoiningPartyViewController: UIViewController ,PartyServiceManagerDelegate{
|
|||||||
var request = []
|
var request = []
|
||||||
var user: [UserParseData]!
|
var user: [UserParseData]!
|
||||||
var party: PartyServiceManager!
|
var party: PartyServiceManager!
|
||||||
|
private var isHostConnected = false
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
@ -64,13 +65,28 @@ extension JoiningPartyViewController: PartyServiceManagerDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func invitationWasRecieved(peerID: MCPeerID, invitationHandler: ((Bool, MCSession!) -> Void)!) {
|
func invitationWasRecieved(peerID: MCPeerID, invitationHandler: ((Bool, MCSession!) -> Void)!) {
|
||||||
|
if(self.isHostConnected == true){
|
||||||
|
if(self.party.connectedPeersDictionary[ peerID.displayName] == nil){
|
||||||
|
invitationHandler(true, self.party.session)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func connectedWithPeer(peerID: MCPeerID) {
|
func connectedWithPeer(peerID: MCPeerID) {
|
||||||
println("mark 2")
|
println("mark 2")
|
||||||
var dictionary: Dictionary<String,String> = ["sender": self.party.myPeerID.displayName, "instruction": "joined_party"]
|
|
||||||
|
|
||||||
|
if(self.isHostConnected == false){
|
||||||
|
var dictionary: Dictionary<String,AnyObject> = Dictionary<String,AnyObject>()
|
||||||
|
dictionary["sender"] = self.party.myPeerID.displayName
|
||||||
|
dictionary["instruction"] = "joined_party"
|
||||||
self.party.sendInstruction(dictionary, toPeer: peerID)
|
self.party.sendInstruction(dictionary, toPeer: peerID)
|
||||||
|
self.isHostConnected = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func didRecieveInstruction(dictionary: Dictionary<String, AnyObject>){
|
func didRecieveInstruction(dictionary: Dictionary<String, AnyObject>){
|
||||||
@ -86,6 +102,8 @@ extension JoiningPartyViewController: PartyServiceManagerDelegate {
|
|||||||
self.dismissViewControllerAnimated(true, completion: nil)
|
self.dismissViewControllerAnimated(true, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (instruction == "start_party"){
|
if (instruction == "start_party"){
|
||||||
println("mark 4")
|
println("mark 4")
|
||||||
self.performSegueWithIdentifier("EnteringPartySegue", sender: self)
|
self.performSegueWithIdentifier("EnteringPartySegue", sender: self)
|
||||||
|
|||||||
@ -23,8 +23,10 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
|||||||
@IBOutlet var invitedFriends: UICollectionView!
|
@IBOutlet var invitedFriends: UICollectionView!
|
||||||
@IBOutlet var songLabel: UILabel!
|
@IBOutlet var songLabel: UILabel!
|
||||||
@IBOutlet var timerLabel: UILabel!
|
@IBOutlet var timerLabel: UILabel!
|
||||||
|
var arePeersReady = Dictionary<String, Bool>()
|
||||||
|
private var firstPass: Bool = true
|
||||||
var timer = NSTimer()
|
var timer = NSTimer()
|
||||||
var counter = 60
|
var counter = 30
|
||||||
|
|
||||||
@IBAction func cancelInvites(sender: UIButton){
|
@IBAction func cancelInvites(sender: UIButton){
|
||||||
self.dismissViewControllerAnimated(true, completion: nil)
|
self.dismissViewControllerAnimated(true, completion: nil)
|
||||||
@ -44,6 +46,7 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
|||||||
self.invitedFriends.dataSource = self
|
self.invitedFriends.dataSource = self
|
||||||
self.invitedFriends.delegate = self
|
self.invitedFriends.delegate = self
|
||||||
|
|
||||||
|
if(self.firstPass){
|
||||||
// Do any additional setup after loading the view.
|
// Do any additional setup after loading the view.
|
||||||
self.songImg.image = self.party.currentSong.valueForProperty(MPMediaItemPropertyArtwork).imageWithSize(songImg.frame.size)
|
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!)!
|
self.songLabel.text = (self.party.currentSong.valueForProperty(MPMediaItemPropertyTitle) as? String!)! + " by " + (self.party.currentSong.valueForProperty(MPMediaItemPropertyArtist) as? String!)!
|
||||||
@ -52,6 +55,9 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
|||||||
//NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateThumbnail:", name: "peerConnected", object: nil)
|
//NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateThumbnail:", name: "peerConnected", object: nil)
|
||||||
self.timerLabel.text = String(counter)
|
self.timerLabel.text = String(counter)
|
||||||
self.timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("updateCounter"), userInfo: nil, repeats: true)
|
self.timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("updateCounter"), userInfo: nil, repeats: true)
|
||||||
|
self.firstPass = false
|
||||||
|
}
|
||||||
|
|
||||||
self.party.delegate = self
|
self.party.delegate = self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,18 +66,107 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
|||||||
// Dispose of any resources that can be recreated.
|
// Dispose of any resources that can be recreated.
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateThumbnil(notification: NSNotification){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateCounter(){
|
func updateCounter(){
|
||||||
self.timerLabel.text = String(counter--)
|
self.timerLabel.text = String(counter--)
|
||||||
|
println(self.timerLabel.text)
|
||||||
if(self.counter == -1){
|
if(self.counter == -1){
|
||||||
self.timer.invalidate()
|
self.timer.invalidate()
|
||||||
self.performSegueWithIdentifier("CurrentlyPlayingSegue", sender: nil)
|
prepareAndCheckPeers()
|
||||||
|
//self.timer = NSTimer.scheduledTimerWithTimeInterval(10, target: self, selector: Selector("prepareAndCheckPeers"), userInfo: nil, repeats: false)
|
||||||
|
//self.performSegueWithIdentifier("CurrentlyPlayingSegue", sender: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//selector functions for prepareAndCheckPeers selector function
|
||||||
|
func checkIfReady(){
|
||||||
|
for peer in self.party.session.connectedPeers as! [MCPeerID] {
|
||||||
|
var dictionary: [String: AnyObject] = ["sender": self.party.myPeerID, "instruction": "are_you_ready", "connectedPeers": (self.party.session.connectedPeers as! [MCPeerID])]
|
||||||
|
self.party.sendInstruction(dictionary, toPeer: peer)
|
||||||
|
}
|
||||||
|
|
||||||
|
var delayStart = NSTimer.scheduledTimerWithTimeInterval(15, target: self, selector: Selector("attemptToStart"), userInfo: nil, repeats: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func startParty(){
|
||||||
|
var dictionary: [String: String] = ["sender": self.party.myPeerID.displayName, "instruction": "start_party"]
|
||||||
|
|
||||||
|
for peer in self.party.session.connectedPeers as! [MCPeerID] {
|
||||||
|
self.party.sendInstruction(dictionary, toPeer: peer )
|
||||||
|
}
|
||||||
|
|
||||||
|
self.performSegueWithIdentifier("CurrentlyPlayingSegue", sender: self)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func attemptToStart(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for peer in self.party.session.connectedPeers as! [MCPeerID] {
|
||||||
|
if self.arePeersReady[peer.displayName] == false{
|
||||||
|
var dictionary: [String: String] = ["sender": self.party.myPeerID.displayName, "instruction": "disconnect"]
|
||||||
|
self.party.sendInstruction(dictionary, toPeer: peer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var delTimer = NSTimer.scheduledTimerWithTimeInterval(5, target: self, selector: Selector("startParty"), userInfo: nil, repeats: false)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func prepareAndCheckPeers(){
|
||||||
|
|
||||||
|
for connPeers in self.party.session.connectedPeers as! [MCPeerID] {
|
||||||
|
self.arePeersReady[connPeers.displayName] = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for invited in self.party.invitedFriends {
|
||||||
|
var joinedPeer: MCPeerID? = self.party.connectedPeersDictionary[invited.displayName] as? MCPeerID
|
||||||
|
|
||||||
|
if joinedPeer == nil {
|
||||||
|
for aPeer in self.party.foundPeers {
|
||||||
|
|
||||||
|
if aPeer.displayName == invited.displayName {
|
||||||
|
self.party.session.cancelConnectPeer(aPeer)
|
||||||
|
self.party.disconnectedPeersDictionary.setValue(aPeer, forKey: aPeer.displayName)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//sends array of currently connected peers to every connected peer to set up mesh streaming network
|
||||||
|
var currentlyConnected : [FriendData]! = []
|
||||||
|
for peer in self.party.session.connectedPeers as! [MCPeerID]{
|
||||||
|
for friend in self.party.invitedFriends {
|
||||||
|
if peer.displayName == friend.displayName {
|
||||||
|
currentlyConnected.append(friend)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var userDat = FriendData(display: self.usr[0].displayName, status: "")
|
||||||
|
userDat.profileImg = UIImageView(image: self.usr[0].profileImg.image)
|
||||||
|
currentlyConnected.append(userDat)
|
||||||
|
|
||||||
|
var dictionaryConnected: [String: AnyObject] = ["sender": self.party.myPeerID, "instruction": "connect_to_other_peers", "connectedPeers": self.party.session.connectedPeers as! [MCPeerID], "friendData": currentlyConnected]
|
||||||
|
self.party.sendInstruction(dictionaryConnected, toPeer: joinedPeer!)
|
||||||
|
var delayCheck = NSTimer.scheduledTimerWithTimeInterval(5, target: self, selector: Selector("checkIfReady"), userInfo: nil, repeats: false)
|
||||||
|
|
||||||
|
|
||||||
|
//var dictionary: [String: String] = ["sender": self.party.myPeerID.displayName, "instruction": "start_party"]
|
||||||
|
//self.party.sendInstruction(dictionary, toPeer: joinedPeer! )
|
||||||
|
|
||||||
|
//start streaming to connected peers
|
||||||
|
//self.party.outputStreamers[joinedPeer!.displayName]!.start()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func setData(prty:PartyServiceManager, user: [UserParseData], friends: [FriendData], request: [FriendData]){
|
func setData(prty:PartyServiceManager, user: [UserParseData], friends: [FriendData], request: [FriendData]){
|
||||||
self.party = prty
|
self.party = prty
|
||||||
self.usr = user
|
self.usr = user
|
||||||
@ -94,7 +189,11 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
|||||||
//rounds uiimage and configures UIImageView
|
//rounds uiimage and configures UIImageView
|
||||||
cell.friendImage.layer.cornerRadius = cell.friendImage.frame.size.width/2
|
cell.friendImage.layer.cornerRadius = cell.friendImage.frame.size.width/2
|
||||||
cell.friendImage.clipsToBounds = true
|
cell.friendImage.clipsToBounds = true
|
||||||
|
|
||||||
|
if(self.party.connectedPeersDictionary[friend.displayName] == nil){
|
||||||
cell.alpha = 0.5
|
cell.alpha = 0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return cell
|
return cell
|
||||||
|
|
||||||
@ -113,7 +212,8 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
|||||||
// Get the new view controller using segue.destinationViewController.
|
// Get the new view controller using segue.destinationViewController.
|
||||||
// Pass the selected object to the new view controller.
|
// Pass the selected object to the new view controller.
|
||||||
if(segue.identifier == "CurrentlyPlayingSegue"){
|
if(segue.identifier == "CurrentlyPlayingSegue"){
|
||||||
|
/*
|
||||||
|
//PLACE THIS CODE IN A SEPARATE FUNCTION SO YOU CAN CONTROL TIMING BETTER AND MAKE SURE ALL PEERS ARE READY BEFORE MOVING ON
|
||||||
//ends invitations with outstanding peers
|
//ends invitations with outstanding peers
|
||||||
for invited in self.party.invitedFriends {
|
for invited in self.party.invitedFriends {
|
||||||
var joinedPeer: MCPeerID? = self.party.connectedPeersDictionary[invited.displayName] as? MCPeerID
|
var joinedPeer: MCPeerID? = self.party.connectedPeersDictionary[invited.displayName] as? MCPeerID
|
||||||
@ -128,6 +228,18 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
//sends array of currently connected peers to every connected peer to set up mesh streaming network
|
||||||
|
var currentlyConnected : [FriendData]!
|
||||||
|
for peer in self.party.session.connectedPeers as! [MCPeerID]{
|
||||||
|
for friend in self.party.invitedFriends {
|
||||||
|
if peer.displayName == friend.displayName {
|
||||||
|
currentlyConnected.append(friend)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var dictionaryConnected: [String: AnyObject] = ["sender": self.party.myPeerID, "instruction": "connect_to_other_peers", "connectedPeers": self.party.session.connectedPeers as! [MCPeerID], "friendData": currentlyConnected]
|
||||||
|
self.party.sendInstruction(dictionaryConnected, toPeer: joinedPeer!)
|
||||||
|
//END OF NOTE
|
||||||
|
|
||||||
var dictionary: [String: String] = ["sender": self.party.myPeerID.displayName, "instruction": "start_party"]
|
var dictionary: [String: String] = ["sender": self.party.myPeerID.displayName, "instruction": "start_party"]
|
||||||
self.party.sendInstruction(dictionary, toPeer: joinedPeer! )
|
self.party.sendInstruction(dictionary, toPeer: joinedPeer! )
|
||||||
@ -148,7 +260,7 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource,
|
|||||||
println(error?.localizedDescription)
|
println(error?.localizedDescription)
|
||||||
return false
|
return false
|
||||||
}*/
|
}*/
|
||||||
|
*/
|
||||||
let vc: CurrentlyPlayingViewController = (segue.destinationViewController as? CurrentlyPlayingViewController)!
|
let vc: CurrentlyPlayingViewController = (segue.destinationViewController as? CurrentlyPlayingViewController)!
|
||||||
vc.setData(self.party, user: self.usr, friends: self.frnds, request: self.requestData)
|
vc.setData(self.party, user: self.usr, friends: self.frnds, request: self.requestData)
|
||||||
}
|
}
|
||||||
@ -195,11 +307,11 @@ extension LoadingPartyViewController: PartyServiceManagerDelegate {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.party.connectedPeersDictionary.setValue(fromPeer, forKey: fromPeer.displayName)
|
|
||||||
//let cell: InvitedCollectionViewCell = self.invitedFriends.dequeueReusableCellWithReuseIdentifier("InvitedCollectionCell", forIndexPath: NSIndexPath(index: i)) as! InvitedCollectionViewCell
|
|
||||||
|
|
||||||
//cell.alpha = 1.0
|
|
||||||
println(instruction)
|
|
||||||
|
self.party.connectedPeersDictionary.setValue(fromPeer, forKey: fromPeer.displayName)
|
||||||
|
self.invitedFriends.reloadData()
|
||||||
|
|
||||||
|
|
||||||
//prepares party for the guest peers
|
//prepares party for the guest peers
|
||||||
@ -262,6 +374,12 @@ extension LoadingPartyViewController: PartyServiceManagerDelegate {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(instruction == "ready"){
|
||||||
|
self.arePeersReady[fromPeer.displayName] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
println(instruction)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ enum HostSignalType: String {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PartyServiceManager: NSObject {
|
class PartyServiceManager: NSObject, AnyObject {
|
||||||
|
|
||||||
let PartyServiceType = "GetHip-Party"
|
let PartyServiceType = "GetHip-Party"
|
||||||
var serviceAdvertiser: MCNearbyServiceAdvertiser! = nil
|
var serviceAdvertiser: MCNearbyServiceAdvertiser! = nil
|
||||||
@ -56,6 +56,7 @@ class PartyServiceManager: NSObject {
|
|||||||
var currentHost: String!
|
var currentHost: String!
|
||||||
|
|
||||||
var connectedPeersDictionary = NSMutableDictionary()
|
var connectedPeersDictionary = NSMutableDictionary()
|
||||||
|
var connecingPeersDictionary = NSMutableDictionary()
|
||||||
var disconnectedPeersDictionary = NSMutableDictionary()
|
var disconnectedPeersDictionary = NSMutableDictionary()
|
||||||
|
|
||||||
//party-creator variables
|
//party-creator variables
|
||||||
@ -138,6 +139,37 @@ class PartyServiceManager: NSObject {
|
|||||||
println(self.currentSongTitle)
|
println(self.currentSongTitle)
|
||||||
self.currentSongIMG = UIImage(data: (dataDictionary["songImage"] as! NSData))
|
self.currentSongIMG = UIImage(data: (dataDictionary["songImage"] as! NSData))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (instruction == "connect_to_other_peers"){
|
||||||
|
for peer in dataDictionary["connectedPeers"] as! [MCPeerID] {
|
||||||
|
if((peer != self.myPeerID) && (peer != dataDictionary["sender"] as! MCPeerID) && (self.connectedPeersDictionary[peer.displayName] == nil)){
|
||||||
|
|
||||||
|
self.serviceBrowser.invitePeer(peer, toSession: self.session, withContext: nil, timeout: 10)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for peer in dataDictionary["friendData"] as! [FriendData] {
|
||||||
|
println(peer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (instruction == "are_you_ready"){
|
||||||
|
var ready = true
|
||||||
|
for peer in dataDictionary["connectedPeers"] as! [MCPeerID] {
|
||||||
|
if (self.connectedPeersDictionary[peer.displayName] == nil) && (peer != self.myPeerID) {
|
||||||
|
ready = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ready == true {
|
||||||
|
var dictionary: [String: String] = ["sender": self.myPeerID.displayName, "instruction": "ready"]
|
||||||
|
self.sendInstruction(dictionary, toPeer: fromPeer)
|
||||||
|
}else{
|
||||||
|
self.session.disconnect()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (instruction!, fromPeer)
|
return (instruction!, fromPeer)
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
@ -308,14 +340,20 @@ extension PartyServiceManager: MCSessionDelegate{
|
|||||||
func session(session: MCSession!, peer peerID: MCPeerID!, didChangeState state: MCSessionState) {
|
func session(session: MCSession!, peer peerID: MCPeerID!, didChangeState state: MCSessionState) {
|
||||||
NSLog("%@", "peer \(peerID) didChangeState: \(state.stringValue())")
|
NSLog("%@", "peer \(peerID) didChangeState: \(state.stringValue())")
|
||||||
if(state == MCSessionState.Connected){
|
if(state == MCSessionState.Connected){
|
||||||
|
|
||||||
println(self.myPeerID.displayName + " connected to " + peerID.displayName)
|
println(self.myPeerID.displayName + " connected to " + peerID.displayName)
|
||||||
println("mark 1")
|
println("mark 1")
|
||||||
|
self.connectedPeersDictionary[peerID.displayName] = peerID
|
||||||
self.delegate?.connectedWithPeer(peerID)
|
self.delegate?.connectedWithPeer(peerID)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state == MCSessionState.NotConnected){
|
if(state == MCSessionState.NotConnected){
|
||||||
NSLog("%@", "peer \(peerID) didChangeState: \(state.stringValue())")
|
NSLog("%@", "peer \(peerID) didChangeState: \(state.stringValue())")
|
||||||
|
self.disconnectedPeersDictionary[peerID.displayName] = peerID
|
||||||
|
if self.connectedPeersDictionary[peerID.displayName] != nil{
|
||||||
|
// self.connectedPeersDictionary[peerID.displayName] = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,8 +22,8 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl
|
|||||||
|
|
||||||
@IBAction func cancelInvites(sender: UIBarButtonItem) {
|
@IBAction func cancelInvites(sender: UIBarButtonItem) {
|
||||||
//println("Browser service deinitialized and browser deinitialized")
|
//println("Browser service deinitialized and browser deinitialized")
|
||||||
self.partyData.stopBrowsing()
|
//self.partyData.stopBrowsing()
|
||||||
self.partyData.serviceBrowser = nil
|
//self.partyData.serviceBrowser = nil
|
||||||
|
|
||||||
self.parentViewController?.dismissViewControllerAnimated(true, completion: nil)
|
self.parentViewController?.dismissViewControllerAnimated(true, completion: nil)
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl
|
|||||||
|
|
||||||
for i in 0..<self.frnds.count{
|
for i in 0..<self.frnds.count{
|
||||||
self.isFriendSelected.append(false)
|
self.isFriendSelected.append(false)
|
||||||
self.partyData.isInvitable.append(false)
|
//self.partyData.isInvitable.append(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
GetHip/icon-120.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |