mirror of
https://github.com/oonyeje/Get-Hip.git
synced 2025-12-25 03:37:40 +00:00
Added restriction to adding a friend already in friend list, added camera and library access to settings menu to change user photo, will add parse connections to change photo and add profile image queries tomorrow or this weekend 2/05/16-2/07/16
This commit is contained in:
parent
ea10811a37
commit
7f5afd95fd
@ -672,6 +672,7 @@
|
||||
TargetAttributes = {
|
||||
3E1BDA4B1C37111D00EE3B84 = {
|
||||
CreatedOnToolsVersion = 6.3.2;
|
||||
DevelopmentTeam = 24WJ762CQL;
|
||||
};
|
||||
3E1BDA631C37111D00EE3B84 = {
|
||||
CreatedOnToolsVersion = 6.3.2;
|
||||
@ -922,6 +923,8 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Users/okechi/Documents/FacebookSDK,
|
||||
@ -935,6 +938,7 @@
|
||||
"$(SDKROOT)/usr/lib/system",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "$PROJECT_NAME/Bridging-Header.h";
|
||||
};
|
||||
name = Debug;
|
||||
@ -943,6 +947,8 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Users/okechi/Documents/FacebookSDK,
|
||||
@ -956,6 +962,7 @@
|
||||
"$(SDKROOT)/usr/lib/system",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "$PROJECT_NAME/Bridging-Header.h";
|
||||
};
|
||||
name = Release;
|
||||
|
||||
@ -15,11 +15,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat
|
||||
|
||||
var window: UIWindow?
|
||||
// var locationStarted = false
|
||||
// var locationManager: CLLocationManager = CLLocationManager()
|
||||
var locationManager: CLLocationManager!
|
||||
// var app = UIApplication.sharedApplication()
|
||||
|
||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
||||
|
||||
application.registerForRemoteNotifications()
|
||||
//create new CLLocaationManager
|
||||
/*var locationStarted = false
|
||||
locationManager.delegate = self*/
|
||||
@ -36,6 +36,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat
|
||||
let paths = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
|
||||
print(paths[0])*/
|
||||
|
||||
startSignificantChangeUpdates()
|
||||
return true
|
||||
}
|
||||
|
||||
@ -77,6 +78,50 @@ class AppDelegate: UIResponder, UIApplicationDelegate , CLLocationManagerDelegat
|
||||
self.saveContext()
|
||||
}
|
||||
|
||||
//Core Location
|
||||
func startSignificantChangeUpdates(){
|
||||
|
||||
if(locationManager == nil){
|
||||
locationManager = CLLocationManager()
|
||||
}
|
||||
|
||||
locationManager.delegate = self
|
||||
locationManager.startMonitoringSignificantLocationChanges()
|
||||
}
|
||||
|
||||
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
|
||||
var location: CLLocation! = locations.last as! CLLocation
|
||||
var geo:PFGeoPoint! = PFGeoPoint(location: location)
|
||||
|
||||
var query = PFQuery(className: "_User")
|
||||
var currentUser = PFUser.currentUser()
|
||||
|
||||
query.whereKey("username", equalTo: (currentUser?.username as String!))
|
||||
|
||||
query.getFirstObjectInBackgroundWithBlock({
|
||||
(object: PFObject?, error: NSError?) -> Void in
|
||||
|
||||
if(error == nil){
|
||||
object?.setObject(geo, forKey: "location")
|
||||
object?.saveInBackground()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
|
||||
NSLog("Did register for remote notifications with device token (%@)", deviceToken)
|
||||
}
|
||||
|
||||
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
|
||||
NSLog("Did Fail to register for remote notifications")
|
||||
NSLog("%@, %@", error, error.localizedDescription)
|
||||
}
|
||||
|
||||
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
// MARK: - Core Data stack
|
||||
|
||||
@ -133,12 +133,12 @@ extension FriendRequestViewController: UITextFieldDelegate{
|
||||
self.searchedUsername = searchBar.text
|
||||
var inFriendsList: Bool = false
|
||||
|
||||
/*for name in self.frnds{
|
||||
for name in self.frnds{
|
||||
if name == self.searchedUsername{
|
||||
inFriendsList = true
|
||||
break
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if(inFriendsList == false){
|
||||
var query = PFQuery(className: "_User")
|
||||
query.whereKey("username", equalTo: searchedUsername)
|
||||
@ -157,6 +157,7 @@ extension FriendRequestViewController: UITextFieldDelegate{
|
||||
})
|
||||
}else{
|
||||
let alert = UIAlertController(title: "Already Friends", message: "You are already friends with this user!", 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)
|
||||
}
|
||||
|
||||
|
||||
@ -141,10 +141,12 @@ class FriendsListViewController: UIViewController, UITableViewDelegate, UITableV
|
||||
}
|
||||
|
||||
if segue.identifier == "FriendRequestSegue" {
|
||||
/* var frndNames: [String] = []
|
||||
var frndNames: [String] = []
|
||||
println(self.friends.count)
|
||||
for i in 0...self.friends.count-1{
|
||||
var str:String! = self.friends[i].displayName as String!
|
||||
frndNames.append(str)
|
||||
var frends: FriendData! = self.friends[i] as! FriendData
|
||||
println(frends.displayName!)
|
||||
frndNames.append(frends.displayName!)
|
||||
}
|
||||
|
||||
/*for name in self.friends{
|
||||
@ -154,7 +156,7 @@ class FriendsListViewController: UIViewController, UITableViewDelegate, UITableV
|
||||
}*/
|
||||
|
||||
let vc: FriendRequestViewController = (segue.destinationViewController as? FriendRequestViewController)!
|
||||
vc.setData(frndNames)*/
|
||||
vc.setData(frndNames)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Username" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="J2y-S7-GWi">
|
||||
<rect key="frame" x="78" y="21" width="89" height="21"/>
|
||||
<rect key="frame" x="78" y="21" width="234" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@ -262,7 +262,7 @@
|
||||
<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="Rnb-lz-mp4" kind="show" identifier="PendingRequestSegue" id="Q5N-t6-TQW"/>
|
||||
<segue destination="QG7-6d-dTi" kind="showDetail" identifier="NoRequestSegue" id="4Uy-oz-55l"/>
|
||||
<segue destination="QG7-6d-dTi" kind="show" identifier="NoRequestSegue" id="4Uy-oz-55l"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="2xN-Sf-spI" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
||||
@ -59,6 +59,9 @@ class PendingRequestViewController: UITableViewController {
|
||||
if(error == nil){
|
||||
object!.setObject("accepted", forKey: "RequestStatus")
|
||||
object!.save()
|
||||
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -67,11 +70,17 @@ class PendingRequestViewController: UITableViewController {
|
||||
})
|
||||
})
|
||||
|
||||
cell.proImg.hidden = true
|
||||
cell.acceptButton.hidden = true
|
||||
cell.denyButton.hidden = true
|
||||
var tempString = cell.friendName.text!
|
||||
cell.friendName.text = "You added " + tempString + "!!"
|
||||
//self.table.reloadData()
|
||||
|
||||
}
|
||||
|
||||
@IBAction func didRejectFriend(sender: AnyObject?){
|
||||
|
||||
|
||||
}
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
@ -159,9 +159,9 @@ class EmailDetailViewController: UIViewController {
|
||||
|
||||
}
|
||||
|
||||
class ProfileDetailViewController: UIViewController {
|
||||
class ProfileDetailViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
|
||||
var profileImg: UIImageView!
|
||||
|
||||
private var picker = UIImagePickerController()
|
||||
|
||||
@IBOutlet weak var img: UIImageView!
|
||||
@IBOutlet weak var ChngPhtoBtn: UIButton!
|
||||
@ -169,7 +169,32 @@ class ProfileDetailViewController: UIViewController {
|
||||
|
||||
|
||||
@IBAction func changePhoto(sender: UIButton) {
|
||||
//code to change profileImg
|
||||
let captureMenu = UIAlertController(title: nil, message:nil, preferredStyle: .ActionSheet)
|
||||
|
||||
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: {
|
||||
(alert: UIAlertAction!) -> Void in
|
||||
})
|
||||
|
||||
let cameraAction = UIAlertAction(title: "Take a New Pic", style: .Default, handler: {
|
||||
(alert: UIAlertAction!) -> Void in
|
||||
self.picker.allowsEditing = false
|
||||
self.picker.sourceType = UIImagePickerControllerSourceType.Camera
|
||||
self.picker.cameraCaptureMode = .Photo
|
||||
self.presentViewController(self.picker, animated: true, completion: nil)
|
||||
|
||||
})
|
||||
|
||||
let galleryAction = UIAlertAction(title: "Select a Profile Pic", style: .Default, handler: {
|
||||
(alert: UIAlertAction!) -> Void in
|
||||
self.picker.allowsEditing = false
|
||||
self.picker.sourceType = .PhotoLibrary
|
||||
self.presentViewController(self.picker, animated: true, completion: nil)
|
||||
})
|
||||
|
||||
captureMenu.addAction(galleryAction)
|
||||
captureMenu.addAction(cameraAction)
|
||||
captureMenu.addAction(cancelAction)
|
||||
self.presentViewController(captureMenu, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
|
||||
@ -190,6 +215,7 @@ class ProfileDetailViewController: UIViewController {
|
||||
self.ChngPhtoBtn!.layer.borderWidth = 1
|
||||
self.ChngPhtoBtn!.layer.cornerRadius = 5
|
||||
self.ChngPhtoBtn!.layer.borderColor = UIColor.blackColor().CGColor
|
||||
self.picker.delegate = self
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
@ -199,6 +225,14 @@ class ProfileDetailViewController: UIViewController {
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
//MARK: -Image Picker Delegate
|
||||
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) {
|
||||
|
||||
}
|
||||
|
||||
func imagePickerControllerDidCancel(picker: UIImagePickerController) {
|
||||
dismissViewControllerAnimated(true, completion: nil)
|
||||
}
|
||||
|
||||
/*
|
||||
// MARK: - Navigation
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
class ViewController: UIViewController, PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate{
|
||||
|
||||
var autoSignin: Bool! = true
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view, typically from a nib
|
||||
@ -35,7 +35,10 @@ class ViewController: UIViewController, PFLogInViewControllerDelegate, PFSignUpV
|
||||
self.presentViewController(loginViewController, animated: false, completion: nil)
|
||||
}
|
||||
else{
|
||||
presentLoggedInAlert()
|
||||
|
||||
presentLoggedInAlert()
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -49,6 +52,7 @@ class ViewController: UIViewController, PFLogInViewControllerDelegate, PFSignUpV
|
||||
func logInViewController(logInController: PFLogInViewController, didLogInUser user: PFUser) {
|
||||
self.dismissViewControllerAnimated(true, completion: nil)
|
||||
presentLoggedInAlert()
|
||||
self.autoSignin = false
|
||||
}
|
||||
|
||||
func signUpViewController(signUpController: PFSignUpViewController, didSignUpUser user: PFUser) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user