Almost finished friend request system, just need to implement parse code. Also need to fix table view cells and view hierarchies in some views

This commit is contained in:
Okechi 2016-01-29 12:21:36 -05:00
parent 6d50dfcafc
commit d39b473f21
9 changed files with 283 additions and 13 deletions

View File

@ -41,6 +41,8 @@
3E379F021C3F794500F7BCCD /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E379EFC1C3F794500F7BCCD /* Security.framework */; }; 3E379F021C3F794500F7BCCD /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E379EFC1C3F794500F7BCCD /* Security.framework */; };
3E379F031C3F794500F7BCCD /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E379EFD1C3F794500F7BCCD /* StoreKit.framework */; }; 3E379F031C3F794500F7BCCD /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E379EFD1C3F794500F7BCCD /* StoreKit.framework */; };
3E379F051C3F982900F7BCCD /* FriendsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E379F041C3F982900F7BCCD /* FriendsCell.swift */; }; 3E379F051C3F982900F7BCCD /* FriendsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E379F041C3F982900F7BCCD /* FriendsCell.swift */; };
3E3B14DC1C5BBB3B001C437F /* PendingRequestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3B14DB1C5BBB3B001C437F /* PendingRequestViewController.swift */; };
3E3B14DE1C5BCC9B001C437F /* FriendRequestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3B14DD1C5BCC9B001C437F /* FriendRequestViewController.swift */; };
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 */; };
@ -162,6 +164,8 @@
3E379EFD1C3F794500F7BCCD /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; 3E379EFD1C3F794500F7BCCD /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
3E379F041C3F982900F7BCCD /* FriendsCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FriendsCell.swift; sourceTree = "<group>"; }; 3E379F041C3F982900F7BCCD /* FriendsCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FriendsCell.swift; sourceTree = "<group>"; };
3E3842E11C3E15DE005DD1FB /* ParseNetDebug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParseNetDebug.h; sourceTree = "<group>"; }; 3E3842E11C3E15DE005DD1FB /* ParseNetDebug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParseNetDebug.h; sourceTree = "<group>"; };
3E3B14DB1C5BBB3B001C437F /* PendingRequestViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PendingRequestViewController.swift; sourceTree = "<group>"; };
3E3B14DD1C5BCC9B001C437F /* FriendRequestViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FriendRequestViewController.swift; 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>"; }; 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>"; };
@ -291,6 +295,8 @@
3E379F041C3F982900F7BCCD /* FriendsCell.swift */, 3E379F041C3F982900F7BCCD /* FriendsCell.swift */,
3EDA82E01C473E900081ED53 /* FriendData.swift */, 3EDA82E01C473E900081ED53 /* FriendData.swift */,
3E1AAD131C3BD92600809367 /* FriendsListViewController.swift */, 3E1AAD131C3BD92600809367 /* FriendsListViewController.swift */,
3E3B14DB1C5BBB3B001C437F /* PendingRequestViewController.swift */,
3E3B14DD1C5BCC9B001C437F /* FriendRequestViewController.swift */,
); );
name = FriendListSource; name = FriendListSource;
sourceTree = "<group>"; sourceTree = "<group>";
@ -775,6 +781,7 @@
3E1AAD141C3BD92600809367 /* FriendsListViewController.swift in Sources */, 3E1AAD141C3BD92600809367 /* FriendsListViewController.swift in Sources */,
3E326BCE1C51C77600F785CF /* SettingsCellWrapper.swift in Sources */, 3E326BCE1C51C77600F785CF /* SettingsCellWrapper.swift in Sources */,
3E627FF31C55AE35005C0372 /* TDAudioPlayerConstants.m in Sources */, 3E627FF31C55AE35005C0372 /* TDAudioPlayerConstants.m in Sources */,
3E3B14DC1C5BBB3B001C437F /* PendingRequestViewController.swift in Sources */,
3E379EF61C3E646000F7BCCD /* ParseNetDebug.m in Sources */, 3E379EF61C3E646000F7BCCD /* ParseNetDebug.m in Sources */,
3E627FED1C55AE35005C0372 /* TDAudioQueueBufferManager.m in Sources */, 3E627FED1C55AE35005C0372 /* TDAudioQueueBufferManager.m in Sources */,
3EBE976F1C53E6950079B54A /* InviteFriendCell.swift in Sources */, 3EBE976F1C53E6950079B54A /* InviteFriendCell.swift in Sources */,
@ -794,6 +801,7 @@
3E4169551C398A5B00B193AF /* SignUpViewController.swift in Sources */, 3E4169551C398A5B00B193AF /* SignUpViewController.swift in Sources */,
3E627FEE1C55AE35005C0372 /* TDAudioQueueController.m in Sources */, 3E627FEE1C55AE35005C0372 /* TDAudioQueueController.m in Sources */,
3E627FE71C55AE35005C0372 /* NSMutableArray+QueueMethods.m in Sources */, 3E627FE71C55AE35005C0372 /* NSMutableArray+QueueMethods.m in Sources */,
3E3B14DE1C5BCC9B001C437F /* FriendRequestViewController.swift in Sources */,
3E18D4931C51F6230012F7DF /* UserParseData.swift in Sources */, 3E18D4931C51F6230012F7DF /* UserParseData.swift in Sources */,
3E5952851C39E54A00C88C71 /* HomeScreenViewController.swift in Sources */, 3E5952851C39E54A00C88C71 /* HomeScreenViewController.swift in Sources */,
); );

View File

@ -11,9 +11,14 @@ import Foundation
class FriendData { class FriendData {
var displayName: String! var displayName: String!
var profileImg: UIImage! var profileImg: UIImage!
var status: String!
init(display: String){ init(display: String, status: String){
self.displayName = display self.displayName = display
self.profileImg = nil self.profileImg = nil
self.status = status
} }
} }

View File

@ -30,6 +30,7 @@ class FriendDataSource{
//var image:UIImage = UIImage() //var image:UIImage = UIImage()
let userName = object.objectForKey("OtherUser")!.objectForKey("username") as! String let userName = object.objectForKey("OtherUser")!.objectForKey("username") as! String
let requestStatus = object.objectForKey("RequestStatus")! as! String
/* let pimage:PFFile = object["profilePicture"] as! PFFile /* let pimage:PFFile = object["profilePicture"] as! PFFile
@ -41,7 +42,7 @@ class FriendDataSource{
} }
})*/ })*/
var newFriend: FriendData = FriendData(display: userName) var newFriend: FriendData = FriendData(display: userName, status: requestStatus)
//print(userName) //print(userName)
self.dataSource.append(newFriend) self.dataSource.append(newFriend)

View File

@ -0,0 +1,43 @@
//
// FriendRequestViewController.swift
// GetHip
//
// Created by Okechi on 1/29/16.
// Copyright (c) 2016 Kroleo. All rights reserved.
//
import UIKit
class FriendRequestViewController: UIViewController {
@IBOutlet var displayImage: UIImageView!
@IBOutlet var foundName: UILabel!
@IBOutlet var sendRequest: UIButton!
@IBOutlet var searchBar: UISearchBar!
override func viewDidLoad() {
super.viewDidLoad()
self.displayImage.layer.cornerRadius = self.displayImage.frame.size.width/2
self.sendRequest.enabled = false
self.sendRequest.tintColor = UIColor.grayColor()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}

View File

@ -25,6 +25,7 @@ class FriendsCell: UITableViewCell {
class FriendRequestCell: UITableViewCell { class FriendRequestCell: UITableViewCell {
@IBOutlet var requestNumber: UILabel!
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
@ -34,3 +35,19 @@ class FriendRequestCell: UITableViewCell {
super.setSelected(selected, animated: animated) super.setSelected(selected, animated: animated)
} }
} }
class PendingFriendCell: UITableViewCell {
@IBOutlet var proImg: UIImageView!
@IBOutlet var friendName: UILabel!
@IBOutlet var denyButton: UIButton!
@IBOutlet var acceptButton: UIButton!
override func awakeFromNib() {
super.awakeFromNib()
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
}

View File

@ -11,6 +11,7 @@ import UIKit
class FriendsListViewController: UIViewController, UITableViewDelegate, UITableViewDataSource/*PFQueryTableViewController*/ { class FriendsListViewController: UIViewController, UITableViewDelegate, UITableViewDataSource/*PFQueryTableViewController*/ {
//var manager = FriendDataSource() //var manager = FriendDataSource()
var friends = [] var friends = []
var request = []
@IBOutlet weak var table: UITableView! @IBOutlet weak var table: UITableView!
@ -19,10 +20,13 @@ class FriendsListViewController: UIViewController, UITableViewDelegate, UITableV
self.parentViewController?.dismissViewControllerAnimated(true, completion: nil) self.parentViewController?.dismissViewControllerAnimated(true, completion: nil)
} }
@IBAction func addFriend(sender: UIBarButtonItem){
self.performSegueWithIdentifier("FriendRequestSegue", sender: nil)
}
func setData(frnds:[FriendData], requst: [FriendData]){
func setData(frnds:[FriendData]){
self.friends = frnds self.friends = frnds
self.request = requst
} }
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
@ -60,6 +64,8 @@ class FriendsListViewController: UIViewController, UITableViewDelegate, UITableV
if( indexPath.row == 0){ if( indexPath.row == 0){
let cell = self.table.dequeueReusableCellWithIdentifier("RequestCell", forIndexPath: indexPath) as? FriendRequestCell let cell = self.table.dequeueReusableCellWithIdentifier("RequestCell", forIndexPath: indexPath) as? FriendRequestCell
//sets count for current number of request
cell?.requestNumber.text = String(self.request.count)
return cell! return cell!
} }
@ -95,6 +101,18 @@ class FriendsListViewController: UIViewController, UITableViewDelegate, UITableV
} }
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if(indexPath.row == 0){
if(self.request.count == 0){
self.performSegueWithIdentifier("NoRequestSegue", sender: nil)
}else{
self.performSegueWithIdentifier("PendingRequestSegue", sender: nil)
}
}
}
override func setEditing(editing: Bool, animated: Bool) { override func setEditing(editing: Bool, animated: Bool) {
super.setEditing(editing, animated: animated) super.setEditing(editing, animated: animated)
self.table.setEditing(editing, animated: true) self.table.setEditing(editing, animated: true)
@ -114,4 +132,17 @@ class FriendsListViewController: UIViewController, UITableViewDelegate, UITableV
} }
} }
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "PendingRequestSegue" {
let vc: PendingRequestViewController = (segue.destinationViewController as? PendingRequestViewController)!
vc.setData(self.request as! [FriendData])
}
if segue.identifier == "FriendRequestSegue" {
}
}
} }

View File

@ -12,6 +12,7 @@ class HomeScreenViewController: UIViewController {
var usrDataManager = UserParseDataSource() var usrDataManager = UserParseDataSource()
var frndDataManager = FriendDataSource() var frndDataManager = FriendDataSource()
var friendData: [FriendData] = [] var friendData: [FriendData] = []
var requestData: [FriendData] = []
var userData: [UserParseData] = [] var userData: [UserParseData] = []
let partyData = PartyServiceManager() let partyData = PartyServiceManager()
@ -20,7 +21,16 @@ class HomeScreenViewController: UIViewController {
//async data update methods //async data update methods
func refreshFriendData(notification:NSNotification){ func refreshFriendData(notification:NSNotification){
self.friendData = self.frndDataManager.getFriends()
let friendInfo = self.frndDataManager.getFriends()
for pendingFriend in friendInfo {
if pendingFriend.status == "pending"{
self.requestData.append(pendingFriend)
}else{
self.friendData.append(pendingFriend)
}
}
} }
func refreshUserData(notification:NSNotification){ func refreshUserData(notification:NSNotification){
@ -85,7 +95,7 @@ class HomeScreenViewController: UIViewController {
let nav: UINavigationController = (segue.destinationViewController as? UINavigationController)! let nav: UINavigationController = (segue.destinationViewController as? UINavigationController)!
let vc: FriendsListViewController = (nav.viewControllers[0] as? FriendsListViewController)! let vc: FriendsListViewController = (nav.viewControllers[0] as? FriendsListViewController)!
vc.setData(self.friendData) vc.setData(self.friendData, requst: self.requestData)
} }
} }

View File

@ -26,10 +26,10 @@
</objects> </objects>
<point key="canvasLocation" x="671" y="362"/> <point key="canvasLocation" x="671" y="362"/>
</scene> </scene>
<!--View Controller--> <!--Friend Request View Controller-->
<scene sceneID="cB3-Zf-GpF"> <scene sceneID="cB3-Zf-GpF">
<objects> <objects>
<viewController id="Iog-DT-pLJ" sceneMemberID="viewController"> <viewController id="Iog-DT-pLJ" customClass="FriendRequestViewController" customModule="GetHip" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides> <layoutGuides>
<viewControllerLayoutGuide type="top" id="eI1-Ht-sHw"/> <viewControllerLayoutGuide type="top" id="eI1-Ht-sHw"/>
<viewControllerLayoutGuide type="bottom" id="TbO-r5-p5C"/> <viewControllerLayoutGuide type="bottom" id="TbO-r5-p5C"/>
@ -55,12 +55,22 @@
<rect key="frame" x="92" y="172" width="137" height="137"/> <rect key="frame" x="92" y="172" width="137" height="137"/>
<color key="backgroundColor" red="0.47790404040000001" green="0.47790404040000001" blue="0.47790404040000001" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="0.47790404040000001" green="0.47790404040000001" blue="0.47790404040000001" alpha="1" colorSpace="calibratedRGB"/>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="No Friend Found :(" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wxx-ws-paN">
<rect key="frame" x="0.0" y="143" width="320" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view> </view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/> <simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<connections> <connections>
<outlet property="displayImage" destination="dcC-PI-dUM" id="Lxu-7b-iya"/>
<outlet property="foundName" destination="wxx-ws-paN" id="wjW-kZ-8UT"/>
<outlet property="searchBar" destination="h8Q-XM-pW1" id="MKf-3P-5b3"/>
<outlet property="searchDisplayController" destination="NMM-eX-IwK" id="umT-fC-wZJ"/> <outlet property="searchDisplayController" destination="NMM-eX-IwK" id="umT-fC-wZJ"/>
<outlet property="sendRequest" destination="Gck-Ni-mM6" id="TI6-8O-dns"/>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ADA-FB-J9A" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="ADA-FB-J9A" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -79,13 +89,13 @@
<!--Friend Requests--> <!--Friend Requests-->
<scene sceneID="8SI-mK-KE7"> <scene sceneID="8SI-mK-KE7">
<objects> <objects>
<tableViewController title="Friend Requests" id="Rnb-lz-mp4" sceneMemberID="viewController"> <tableViewController title="Friend Requests" id="Rnb-lz-mp4" customClass="PendingRequestViewController" customModule="GetHip" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="6eb-it-ynj"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="6eb-it-ynj">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/> <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes> <prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="65" id="0aX-nL-3Yl"> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="PendingCell" rowHeight="65" id="0aX-nL-3Yl" customClass="PendingFriendCell" customModule="GetHip" customModuleProvider="target">
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="0aX-nL-3Yl" id="pEH-Wf-32b"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="0aX-nL-3Yl" id="pEH-Wf-32b">
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
@ -113,6 +123,12 @@
</button> </button>
</subviews> </subviews>
</tableViewCellContentView> </tableViewCellContentView>
<connections>
<outlet property="acceptButton" destination="u49-z7-QQX" id="09O-Sv-ynY"/>
<outlet property="denyButton" destination="VKQ-62-km5" id="H9w-vc-REN"/>
<outlet property="friendName" destination="J2y-S7-GWi" id="jHl-D1-hbb"/>
<outlet property="proImg" destination="SGy-7j-oTR" id="Lyq-1c-xEA"/>
</connections>
</tableViewCell> </tableViewCell>
</prototypes> </prototypes>
<connections> <connections>
@ -121,6 +137,9 @@
</connections> </connections>
</tableView> </tableView>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/> <simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<connections>
<outlet property="table" destination="6eb-it-ynj" id="47m-Vo-uMm"/>
</connections>
</tableViewController> </tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="eVC-XV-G1v" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="eVC-XV-G1v" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
@ -194,6 +213,9 @@
</label> </label>
</subviews> </subviews>
</tableViewCellContentView> </tableViewCellContentView>
<connections>
<outlet property="requestNumber" destination="TSY-RW-sS0" id="Bfr-KC-qfd"/>
</connections>
</tableViewCell> </tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="FriendCell" rowHeight="65" id="bPE-sl-MJy" customClass="FriendsCell" customModule="GetHip" customModuleProvider="target"> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="FriendCell" rowHeight="65" id="bPE-sl-MJy" customClass="FriendsCell" customModule="GetHip" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/> <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
@ -228,15 +250,19 @@
<action selector="dismissFriendView:" destination="Wv2-hP-rqT" id="kJQ-nN-1dX"/> <action selector="dismissFriendView:" destination="Wv2-hP-rqT" id="kJQ-nN-1dX"/>
</connections> </connections>
</barButtonItem> </barButtonItem>
<barButtonItem key="rightBarButtonItem" systemItem="add" id="3QF-Yw-Pq0"/> <barButtonItem key="rightBarButtonItem" systemItem="add" id="3QF-Yw-Pq0">
<connections>
<action selector="addFriend:" destination="Wv2-hP-rqT" id="HtN-NM-NLa"/>
</connections>
</barButtonItem>
</navigationItem> </navigationItem>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/> <simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<connections> <connections>
<outlet property="searchDisplayController" destination="HND-c4-uRE" id="EAG-al-7RJ"/> <outlet property="searchDisplayController" destination="HND-c4-uRE" id="EAG-al-7RJ"/>
<outlet property="table" destination="Bxz-d2-wT5" id="iuG-He-Fll"/> <outlet property="table" destination="Bxz-d2-wT5" id="iuG-He-Fll"/>
<segue destination="Iog-DT-pLJ" kind="show" identifier="FriendRequestSegue" id="7VN-Pi-TCg"/> <segue destination="Iog-DT-pLJ" kind="show" identifier="FriendRequestSegue" id="7VN-Pi-TCg"/>
<segue destination="Rnb-lz-mp4" kind="show" identifier="PendingRequestsSegue" id="Q5N-t6-TQW"/> <segue destination="Rnb-lz-mp4" kind="show" identifier="PendingRequestSegue" id="Q5N-t6-TQW"/>
<segue destination="QG7-6d-dTi" kind="showDetail" identifier="NoFriendRequestSegue" id="4Uy-oz-55l"/> <segue destination="QG7-6d-dTi" kind="showDetail" identifier="NoRequestSegue" id="4Uy-oz-55l"/>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="2xN-Sf-spI" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="2xN-Sf-spI" userLabel="First Responder" sceneMemberID="firstResponder"/>

View File

@ -0,0 +1,129 @@
//
// PendingRequestViewController.swift
// GetHip
//
// Created by Okechi on 1/29/16.
// Copyright (c) 2016 Kroleo. All rights reserved.
//
import UIKit
class PendingRequestViewController: UITableViewController {
@IBOutlet var table:UITableView!
var requests = []
override func viewDidLoad() {
super.viewDidLoad()
self.title = "Friend Requests"
self.table.dataSource = self
self.table.delegate = self
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func setData(data: [FriendData]){
self.requests = data
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return self.requests.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let pending = self.requests[indexPath.row] as? FriendData
let cell = self.table.dequeueReusableCellWithIdentifier("PendingCell", forIndexPath: indexPath) as? PendingFriendCell
//sets display name of friend (print for debugging purposes)
cell!.friendName.text = pending!.displayName
//println(friend!.displayName)
//sets profile image of current cell
//checks if friend user has a profile image or not
if pending?.profileImg == nil {
cell!.proImg.backgroundColor = UIColor.grayColor()
}
else{
}
//rounds uiimage and configures UIImageView
//cell!.proImage.layer.borderWidth = 3.0
//cell!.proImage.clipsToBounds = true
cell!.proImg.layer.cornerRadius = cell!.proImg.frame.size.width/2
//cell!.proImage.layer.borderColor = UIColor.whiteColor().CGColor
//cell!.proImage.layer.masksToBounds = true
return cell!
}
/*
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return NO if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
// Delete the row from the data source
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return NO if you do not want the item to be re-orderable.
return true
}
*/
/*
// 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.
}
*/
}