diff --git a/GetHip/AppDelegate.swift b/GetHip/AppDelegate.swift index 557d61c..04b7719 100644 --- a/GetHip/AppDelegate.swift +++ b/GetHip/AppDelegate.swift @@ -41,6 +41,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat print(paths[0]) startSignificantChangeUpdates() + + //check if user logged in on app startup + if(PFUser.currentUser() != nil){ + + var storyboard = UIStoryboard(name: "Main", bundle: nil) + + var initialViewController = storyboard.instantiateViewControllerWithIdentifier("HomeVC") as! HomeScreenViewController + self.window?.rootViewController = initialViewController + self.window?.makeKeyAndVisible() + + } + return true } diff --git a/GetHip/FriendRequestViewController.swift b/GetHip/FriendRequestViewController.swift index db379ba..66e717d 100644 --- a/GetHip/FriendRequestViewController.swift +++ b/GetHip/FriendRequestViewController.swift @@ -103,6 +103,8 @@ class FriendRequestViewController: UIViewController{ super.viewDidLoad() searchBar.delegate = self self.displayImage.layer.cornerRadius = self.displayImage.frame.size.width/2 + self.displayImage.clipsToBounds = true + self.sendRequest.enabled = false self.sendRequest.tintColor = UIColor.grayColor() diff --git a/GetHip/FriendsListViewController.swift b/GetHip/FriendsListViewController.swift index e3b5db4..1df14a2 100644 --- a/GetHip/FriendsListViewController.swift +++ b/GetHip/FriendsListViewController.swift @@ -32,12 +32,14 @@ class FriendsListViewController: UIViewController, UITableViewDelegate, UITableV self.request = requst self.party = party } + override func viewDidLoad() { super.viewDidLoad() self.table.delegate = self self.table.dataSource = self self.title = "Friends" self.navigationController?.navigationBarHidden = false + //self.navigationItem.rightBarButtonItem = self.editButtonItem() //self.friends = manager.getFriends() @@ -47,6 +49,7 @@ class FriendsListViewController: UIViewController, UITableViewDelegate, UITableV } + /*func refreshTable(notification: NSNotification){ self.friends = manager.getFriends() self.table.reloadData() @@ -96,9 +99,8 @@ class FriendsListViewController: UIViewController, UITableViewDelegate, UITableV //rounds uiimage and configures UIImageView //cell!.proImage.layer.borderWidth = 3.0 - //cell!.proImage.clipsToBounds = true cell!.proImage.layer.cornerRadius = cell!.proImage.frame.size.width/2 - + cell!.proImage.clipsToBounds = true //cell!.proImage.layer.borderColor = UIColor.whiteColor().CGColor //cell!.proImage.layer.masksToBounds = true diff --git a/GetHip/HomeScreenViewController.swift b/GetHip/HomeScreenViewController.swift index 2bc1e97..2908cbd 100644 --- a/GetHip/HomeScreenViewController.swift +++ b/GetHip/HomeScreenViewController.swift @@ -9,12 +9,13 @@ import UIKit class HomeScreenViewController: UIViewController { - var usrDataManager = UserParseDataSource() - var frndDataManager = FriendDataSource() + var usrDataManager: UserParseDataSource! + var frndDataManager: FriendDataSource! var friendData: [FriendData] = [] var requestData: [FriendData] = [] var userData: [UserParseData] = [] let partyData = PartyServiceManager() + var firstTime: Bool = true @IBOutlet weak var CreateAPartyBtn: UIButton! @@ -34,13 +35,18 @@ class HomeScreenViewController: UIViewController { } func refreshUserData(notification:NSNotification){ + self.userData = self.usrDataManager.getUser() - self.partyData.setPeerID((self.userData[0].displayName)) - self.partyData.setAdvertiser() + if(self.firstTime == true){ + self.partyData.setPeerID((self.userData[0].displayName)) + self.partyData.setAdvertiser() + + //start peer-to-peer advertising + self.partyData.startListening() + self.firstTime = false + } - //start peer-to-peer advertising - self.partyData.startListening() } func loadID(notification: NSNotification){ @@ -70,7 +76,21 @@ class HomeScreenViewController: UIViewController { NSNotificationCenter.defaultCenter().addObserver(self, selector: "refreshFriendData:", name: "refreshTableView", object: nil) - NSNotificationCenter.defaultCenter().addObserver(self, selector: "refreshUserData:", name: "refreshSettingsView", object: nil) } + NSNotificationCenter.defaultCenter().addObserver(self, selector: "refreshUserData:", name: "refreshSettingsView", object: nil) + + + + } + + override func viewWillAppear(animated: Bool) { + self.userData = [] + self.friendData = [] + dispatch_async(dispatch_get_main_queue(), { + self.usrDataManager = UserParseDataSource() + self.frndDataManager = FriendDataSource() + }) + + } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() diff --git a/GetHip/InPartyViewController.swift b/GetHip/InPartyViewController.swift index 4dbdc28..937cf3d 100644 --- a/GetHip/InPartyViewController.swift +++ b/GetHip/InPartyViewController.swift @@ -60,12 +60,8 @@ class InPartyViewController: UIViewController, UICollectionViewDataSource, UICol } //rounds uiimage and configures UIImageView - //cell!.proImage.layer.borderWidth = 3.0 - //cell!.proImage.clipsToBounds = true cell.friendImage.layer.cornerRadius = cell.friendImage.frame.size.width/2 - //cell.alpha = 0.5 - //cell!.proImage.layer.borderColor = UIColor.whiteColor().CGColor - //cell!.proImage.layer.masksToBounds = true + cell.friendImage.clipsToBounds = true return cell diff --git a/GetHip/LoadingPartyViewController.swift b/GetHip/LoadingPartyViewController.swift index 5b11a96..448314f 100644 --- a/GetHip/LoadingPartyViewController.swift +++ b/GetHip/LoadingPartyViewController.swift @@ -84,12 +84,9 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource, } //rounds uiimage and configures UIImageView - //cell!.proImage.layer.borderWidth = 3.0 - //cell!.proImage.clipsToBounds = true cell.friendImage.layer.cornerRadius = cell.friendImage.frame.size.width/2 + cell.friendImage.clipsToBounds = true cell.alpha = 0.5 - //cell!.proImage.layer.borderColor = UIColor.whiteColor().CGColor - //cell!.proImage.layer.masksToBounds = true return cell diff --git a/GetHip/LoginController.swift b/GetHip/LoginController.swift index 4bc66cc..78f6dd7 100644 --- a/GetHip/LoginController.swift +++ b/GetHip/LoginController.swift @@ -38,16 +38,20 @@ class LoginController: UIViewController, PFLogInViewControllerDelegate, UITextFi @IBAction func signUpBtnPressed(sender: UIButton){ self.performSegueWithIdentifier("signUpSegue", sender: self) } + + + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. //check if user already signed in - if(PFUser.currentUser() != nil){ + /*if(PFUser.currentUser() != nil){ presentLoggedInAlert() + + }*/ - } self.userEmailField.delegate = self self.password.delegate = self self.signIn.layer.borderWidth = 1 diff --git a/GetHip/Main.storyboard b/GetHip/Main.storyboard index 4efc03a..fd6cdd4 100644 --- a/GetHip/Main.storyboard +++ b/GetHip/Main.storyboard @@ -1646,9 +1646,9 @@ - - - + + + diff --git a/GetHip/PartyServiceManager.swift b/GetHip/PartyServiceManager.swift index dccf9e6..75b7476 100644 --- a/GetHip/PartyServiceManager.swift +++ b/GetHip/PartyServiceManager.swift @@ -90,7 +90,7 @@ class PartyServiceManager: NSObject { func chooseNextHost(){ var numPeers = self.connectedPeers().count - var nextHostIndex = Int(arc4random_uniform(UInt32(numPeers))) + var nextHostIndex: Int = Int(arc4random_uniform(UInt32(numPeers))) if (self.connectedPeers()[nextHostIndex].displayName == self.currentHost){ chooseNextHost() diff --git a/GetHip/PendingRequestViewController.swift b/GetHip/PendingRequestViewController.swift index 681d755..325b849 100644 --- a/GetHip/PendingRequestViewController.swift +++ b/GetHip/PendingRequestViewController.swift @@ -143,10 +143,8 @@ class PendingRequestViewController: UITableViewController { } //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!.proImg.clipsToBounds = true //cell!.proImage.layer.borderColor = UIColor.whiteColor().CGColor //cell!.proImage.layer.masksToBounds = true diff --git a/GetHip/SettingsDetailViewWrapper.swift b/GetHip/SettingsDetailViewWrapper.swift index e225942..8e5286e 100644 --- a/GetHip/SettingsDetailViewWrapper.swift +++ b/GetHip/SettingsDetailViewWrapper.swift @@ -212,6 +212,7 @@ class ProfileDetailViewController: UIViewController, UINavigationControllerDeleg self.img.image = self.profileImg.image! } self.img.layer.cornerRadius = self.img!.frame.size.width/2 + self.img.clipsToBounds = true self.ChngPhtoBtn!.layer.borderWidth = 1 self.ChngPhtoBtn!.layer.cornerRadius = 5 diff --git a/GetHip/SettingsTableViewController.swift b/GetHip/SettingsTableViewController.swift index 98dce24..7f82ab0 100644 --- a/GetHip/SettingsTableViewController.swift +++ b/GetHip/SettingsTableViewController.swift @@ -53,6 +53,7 @@ class SettingsTableViewController: UIViewController, UITableViewDataSource, UITa self.table.dataSource = self self.table.delegate = self self.navigationController?.navigationBarHidden = false + self.table.tableFooterView = UIView(frame: CGRectZero) //NSNotificationCenter.defaultCenter().addObserver(self, selector: "refreshTable:", name: "refreshSettingsView", object: nil) self.table.reloadData() diff --git a/GetHip/TestInviteFriendsController.swift b/GetHip/TestInviteFriendsController.swift index 26ed0ef..1df1ba2 100644 --- a/GetHip/TestInviteFriendsController.swift +++ b/GetHip/TestInviteFriendsController.swift @@ -131,11 +131,10 @@ class TestInviteFriendsController: UIViewController, UITableViewDelegate, UITabl //rounds uiimage and configures UIImageView //cell!.proImage.layer.borderWidth = 3.0 - //cell!.proImage.clipsToBounds = true cell!.proImage.layer.cornerRadius = cell!.proImage.frame.size.width/2 - //cell!.proImage.layer.borderColor = UIColor.whiteColor().CGColor - //cell!.proImage.layer.masksToBounds = true + cell!.proImage.clipsToBounds = true cell!.rdioButton.layer.cornerRadius = cell!.rdioButton.frame.size.width/2 + cell!.rdioButton.clipsToBounds = true //for testing purposes - MPCBrowsing if(self.isInvitable[indexPath.row] == true){