mirror of
https://github.com/oonyeje/Get-Hip.git
synced 2025-12-25 03:37:40 +00:00
added some validation controls for login and sign in
This commit is contained in:
parent
84453584dd
commit
792cc508b8
@ -58,6 +58,7 @@
|
|||||||
3E43B8C91C37639C002F97A7 /* FBSDKCoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E1BDA751C3713F900EE3B84 /* FBSDKCoreKit.framework */; };
|
3E43B8C91C37639C002F97A7 /* FBSDKCoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E1BDA751C3713F900EE3B84 /* FBSDKCoreKit.framework */; };
|
||||||
3E43B8CA1C37639C002F97A7 /* FBSDKLoginKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */; };
|
3E43B8CA1C37639C002F97A7 /* FBSDKLoginKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */; };
|
||||||
3E43B8CF1C376F9F002F97A7 /* Logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E43B8CE1C376F9F002F97A7 /* Logo.png */; };
|
3E43B8CF1C376F9F002F97A7 /* Logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E43B8CE1C376F9F002F97A7 /* Logo.png */; };
|
||||||
|
3E4AA5211C853E1A00746839 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E4AA5201C853E1A00746839 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png */; };
|
||||||
3E50E0401C74B97300EB9EA9 /* BackToHomeScreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E50E03F1C74B97300EB9EA9 /* BackToHomeScreenViewController.swift */; };
|
3E50E0401C74B97300EB9EA9 /* BackToHomeScreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E50E03F1C74B97300EB9EA9 /* BackToHomeScreenViewController.swift */; };
|
||||||
3E5485B31C69A7DA00E7D5AB /* LoadingPartyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5485B21C69A7DA00E7D5AB /* LoadingPartyViewController.swift */; };
|
3E5485B31C69A7DA00E7D5AB /* LoadingPartyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5485B21C69A7DA00E7D5AB /* LoadingPartyViewController.swift */; };
|
||||||
3E5485B51C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5485B41C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift */; };
|
3E5485B51C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5485B41C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift */; };
|
||||||
@ -120,7 +121,6 @@
|
|||||||
3E7D37D71C75D80F002E682F /* Lower@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7D37D61C75D80F002E682F /* Lower@2x.png */; };
|
3E7D37D71C75D80F002E682F /* Lower@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7D37D61C75D80F002E682F /* Lower@2x.png */; };
|
||||||
3E7D37D91C75D882002E682F /* B2P Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7D37D81C75D882002E682F /* B2P Icon@2x.png */; };
|
3E7D37D91C75D882002E682F /* B2P Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7D37D81C75D882002E682F /* B2P Icon@2x.png */; };
|
||||||
3E7D37DB1C75D899002E682F /* B2P Button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7D37DA1C75D899002E682F /* B2P Button@2x.png */; };
|
3E7D37DB1C75D899002E682F /* B2P Button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7D37DA1C75D899002E682F /* B2P Button@2x.png */; };
|
||||||
3E7D37DD1C75D9C3002E682F /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7D37DC1C75D9C3002E682F /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png */; };
|
|
||||||
3EB8845D1C6C647700CCDCCE /* Add More@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EB8845B1C6C647700CCDCCE /* Add More@2x.png */; };
|
3EB8845D1C6C647700CCDCCE /* Add More@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EB8845B1C6C647700CCDCCE /* Add More@2x.png */; };
|
||||||
3EB8845E1C6C647700CCDCCE /* Leave Party@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EB8845C1C6C647700CCDCCE /* Leave Party@2x.png */; };
|
3EB8845E1C6C647700CCDCCE /* Leave Party@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EB8845C1C6C647700CCDCCE /* Leave Party@2x.png */; };
|
||||||
3EBE97661C53CEDA0079B54A /* Send Invites Button.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EBE97651C53CEDA0079B54A /* Send Invites Button.png */; };
|
3EBE97661C53CEDA0079B54A /* Send Invites Button.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EBE97651C53CEDA0079B54A /* Send Invites Button.png */; };
|
||||||
@ -205,6 +205,7 @@
|
|||||||
3E43B8C41C375E73002F97A7 /* Bolts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Bolts.framework; path = ../../FacebookSDK/Bolts.framework; sourceTree = "<group>"; };
|
3E43B8C41C375E73002F97A7 /* Bolts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Bolts.framework; path = ../../FacebookSDK/Bolts.framework; sourceTree = "<group>"; };
|
||||||
3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBSDKLoginKit.framework; path = ../../FacebookSDK/FBSDKLoginKit.framework; sourceTree = "<group>"; };
|
3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBSDKLoginKit.framework; path = ../../FacebookSDK/FBSDKLoginKit.framework; sourceTree = "<group>"; };
|
||||||
3E43B8CE1C376F9F002F97A7 /* Logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Logo.png; path = "../../../Dropbox/gethip/Screens/6 Login/Assets/Logo.png"; sourceTree = "<group>"; };
|
3E43B8CE1C376F9F002F97A7 /* Logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Logo.png; path = "../../../Dropbox/gethip/Screens/6 Login/Assets/Logo.png"; sourceTree = "<group>"; };
|
||||||
|
3E4AA5201C853E1A00746839 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png"; path = "../../../Dropbox/gethip/Screens/6 Back to Party/6 Back to Party/Asset/Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png"; sourceTree = "<group>"; };
|
||||||
3E50E03F1C74B97300EB9EA9 /* BackToHomeScreenViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackToHomeScreenViewController.swift; sourceTree = "<group>"; };
|
3E50E03F1C74B97300EB9EA9 /* BackToHomeScreenViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackToHomeScreenViewController.swift; sourceTree = "<group>"; };
|
||||||
3E5485B21C69A7DA00E7D5AB /* LoadingPartyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingPartyViewController.swift; sourceTree = "<group>"; };
|
3E5485B21C69A7DA00E7D5AB /* LoadingPartyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingPartyViewController.swift; sourceTree = "<group>"; };
|
||||||
3E5485B41C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvitedCollectionViewCell.swift; sourceTree = "<group>"; };
|
3E5485B41C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvitedCollectionViewCell.swift; sourceTree = "<group>"; };
|
||||||
@ -283,7 +284,6 @@
|
|||||||
3E7D37D61C75D80F002E682F /* Lower@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Lower@2x.png"; path = "../../../Dropbox/Gethip/For final/Volume/i5 Volume/Lower@2x.png"; sourceTree = "<group>"; };
|
3E7D37D61C75D80F002E682F /* Lower@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Lower@2x.png"; path = "../../../Dropbox/Gethip/For final/Volume/i5 Volume/Lower@2x.png"; sourceTree = "<group>"; };
|
||||||
3E7D37D81C75D882002E682F /* B2P Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "B2P Icon@2x.png"; path = "../../../Dropbox/Gethip/For final/Back To Party/i5/B2P Icon@2x.png"; sourceTree = "<group>"; };
|
3E7D37D81C75D882002E682F /* B2P Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "B2P Icon@2x.png"; path = "../../../Dropbox/Gethip/For final/Back To Party/i5/B2P Icon@2x.png"; sourceTree = "<group>"; };
|
||||||
3E7D37DA1C75D899002E682F /* B2P Button@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "B2P Button@2x.png"; path = "../../../Dropbox/Gethip/For final/Back To Party/i5/B2P Button@2x.png"; sourceTree = "<group>"; };
|
3E7D37DA1C75D899002E682F /* B2P Button@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "B2P Button@2x.png"; path = "../../../Dropbox/Gethip/For final/Back To Party/i5/B2P Button@2x.png"; sourceTree = "<group>"; };
|
||||||
3E7D37DC1C75D9C3002E682F /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png"; path = "../../../.Trash/Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png"; sourceTree = "<group>"; };
|
|
||||||
3EB8845B1C6C647700CCDCCE /* Add More@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Add More@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Party Screens/Party Screen/Assets/Add More@2x.png"; sourceTree = "<group>"; };
|
3EB8845B1C6C647700CCDCCE /* Add More@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Add More@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Party Screens/Party Screen/Assets/Add More@2x.png"; sourceTree = "<group>"; };
|
||||||
3EB8845C1C6C647700CCDCCE /* Leave Party@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Leave Party@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Party Screens/Party Screen/Assets/Leave Party@2x.png"; sourceTree = "<group>"; };
|
3EB8845C1C6C647700CCDCCE /* Leave Party@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Leave Party@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Party Screens/Party Screen/Assets/Leave Party@2x.png"; sourceTree = "<group>"; };
|
||||||
3EBE97651C53CEDA0079B54A /* Send Invites Button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Send Invites Button.png"; path = "../../../Dropbox/Gethip/Screens/Friends + Invite Screens/i6/Invite Friends/Send Invites Button.png"; sourceTree = "<group>"; };
|
3EBE97651C53CEDA0079B54A /* Send Invites Button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Send Invites Button.png"; path = "../../../Dropbox/Gethip/Screens/Friends + Invite Screens/i6/Invite Friends/Send Invites Button.png"; sourceTree = "<group>"; };
|
||||||
@ -492,7 +492,7 @@
|
|||||||
3E6D438C1C78969A00CA805F /* CancelInvited@2x.png */,
|
3E6D438C1C78969A00CA805F /* CancelInvited@2x.png */,
|
||||||
3E6D438A1C78968C00CA805F /* Joining@2x.png */,
|
3E6D438A1C78968C00CA805F /* Joining@2x.png */,
|
||||||
3E6D43851C782E3200CA805F /* Decline@2x.png */,
|
3E6D43851C782E3200CA805F /* Decline@2x.png */,
|
||||||
3E7D37DC1C75D9C3002E682F /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png */,
|
3E4AA5201C853E1A00746839 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png */,
|
||||||
3E7D37DA1C75D899002E682F /* B2P Button@2x.png */,
|
3E7D37DA1C75D899002E682F /* B2P Button@2x.png */,
|
||||||
3E7D37D81C75D882002E682F /* B2P Icon@2x.png */,
|
3E7D37D81C75D882002E682F /* B2P Icon@2x.png */,
|
||||||
3E7D37D61C75D80F002E682F /* Lower@2x.png */,
|
3E7D37D61C75D80F002E682F /* Lower@2x.png */,
|
||||||
@ -809,6 +809,7 @@
|
|||||||
3E5BD3161C6C45CE00266B16 /* Party@2x.png in Resources */,
|
3E5BD3161C6C45CE00266B16 /* Party@2x.png in Resources */,
|
||||||
3E7D37D71C75D80F002E682F /* Lower@2x.png in Resources */,
|
3E7D37D71C75D80F002E682F /* Lower@2x.png in Resources */,
|
||||||
3E4169491C385F1000B193AF /* 1x.png in Resources */,
|
3E4169491C385F1000B193AF /* 1x.png in Resources */,
|
||||||
|
3E4AA5211C853E1A00746839 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png in Resources */,
|
||||||
3E5952641C39DBC900C88C71 /* Friends@2x.png in Resources */,
|
3E5952641C39DBC900C88C71 /* Friends@2x.png in Resources */,
|
||||||
3E59528B1C39EB6100C88C71 /* Turntable@3x.png in Resources */,
|
3E59528B1C39EB6100C88C71 /* Turntable@3x.png in Resources */,
|
||||||
3E5952661C39DBC900C88C71 /* Settings.png in Resources */,
|
3E5952661C39DBC900C88C71 /* Settings.png in Resources */,
|
||||||
@ -832,7 +833,6 @@
|
|||||||
3E5952711C39DC1E00C88C71 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@3x.png in Resources */,
|
3E5952711C39DC1E00C88C71 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@3x.png in Resources */,
|
||||||
3E6D438B1C78968C00CA805F /* Joining@2x.png in Resources */,
|
3E6D438B1C78968C00CA805F /* Joining@2x.png in Resources */,
|
||||||
3E33EFDC1C5B56340011B9B5 /* No Friend Requests i5@2x.png in Resources */,
|
3E33EFDC1C5B56340011B9B5 /* No Friend Requests i5@2x.png in Resources */,
|
||||||
3E7D37DD1C75D9C3002E682F /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png in Resources */,
|
|
||||||
3E33EFDA1C5B56340011B9B5 /* Accept@2x.png in Resources */,
|
3E33EFDA1C5B56340011B9B5 /* Accept@2x.png in Resources */,
|
||||||
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 */,
|
||||||
|
|||||||
@ -18,20 +18,45 @@ class LoginController: UIViewController, PFLogInViewControllerDelegate, UITextFi
|
|||||||
|
|
||||||
|
|
||||||
@IBAction func loginBtnPressed(sender: UIButton){
|
@IBAction func loginBtnPressed(sender: UIButton){
|
||||||
//check if user logging in with email, implement later
|
//check if user logging in with email
|
||||||
|
if(contains(self.userEmailField.text!, "@")){
|
||||||
PFUser.logInWithUsernameInBackground(userEmailField.text!, password: password.text!, block: {
|
let predicate: NSPredicate = NSPredicate(format: "(email = %@)", argumentArray: [self.userEmailField.text!])
|
||||||
(user, error) -> Void in
|
var userQuery: PFQuery = PFQuery(className: "_User", predicate: predicate)
|
||||||
|
|
||||||
if(user != nil){
|
//log in user through email look up in db
|
||||||
self.performSegueWithIdentifier("LoginToHomeSegue", sender: self)
|
dispatch_async(dispatch_get_main_queue(), {
|
||||||
}else{
|
userQuery.getFirstObjectInBackgroundWithBlock({
|
||||||
var alert = UIAlertController(title: "Invalid Login", message: "Your username/email or password is incorrect!", preferredStyle: .Alert)
|
(object, error) -> Void in
|
||||||
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: nil)}))
|
|
||||||
|
if(object != nil && error == nil){
|
||||||
|
PFUser.logInWithUsernameInBackground(object!.objectForKey("username") as! String, password: self.password.text!, block: {
|
||||||
|
(user, error) -> Void in
|
||||||
|
|
||||||
|
if(user != nil){
|
||||||
|
self.performSegueWithIdentifier("LoginToHomeSegue", sender: self)
|
||||||
|
}else{
|
||||||
|
var alert = UIAlertController(title: "Invalid Login", message: "Your username/email or password is incorrect!", preferredStyle: .Alert)
|
||||||
|
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: nil)}))
|
||||||
|
|
||||||
|
self.presentViewController(alert, animated: true, completion: nil)
|
||||||
|
}
|
||||||
|
}) }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
PFUser.logInWithUsernameInBackground(userEmailField.text!, password: password.text!, block: {
|
||||||
|
(user, error) -> Void in
|
||||||
|
|
||||||
self.presentViewController(alert, animated: true, completion: nil)
|
if(user != nil){
|
||||||
}
|
self.performSegueWithIdentifier("LoginToHomeSegue", sender: self)
|
||||||
})
|
}else{
|
||||||
|
var alert = UIAlertController(title: "Invalid Login", message: "Your username/email or password is incorrect!", preferredStyle: .Alert)
|
||||||
|
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: nil)}))
|
||||||
|
|
||||||
|
self.presentViewController(alert, animated: true, completion: nil)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1646,9 +1646,9 @@
|
|||||||
<image name="Turntable@3x.png" width="434" height="434"/>
|
<image name="Turntable@3x.png" width="434" height="434"/>
|
||||||
</resources>
|
</resources>
|
||||||
<inferredMetricsTieBreakers>
|
<inferredMetricsTieBreakers>
|
||||||
<segue reference="hjX-RT-64R"/>
|
<segue reference="WxI-P3-JZ9"/>
|
||||||
<segue reference="5pn-ck-WiI"/>
|
|
||||||
<segue reference="bZG-mB-VR5"/>
|
|
||||||
<segue reference="OpG-wQ-NAH"/>
|
<segue reference="OpG-wQ-NAH"/>
|
||||||
|
<segue reference="wiM-xb-lpR"/>
|
||||||
|
<segue reference="5pn-ck-WiI"/>
|
||||||
</inferredMetricsTieBreakers>
|
</inferredMetricsTieBreakers>
|
||||||
</document>
|
</document>
|
||||||
|
|||||||
@ -20,25 +20,67 @@ class SignInController: UIViewController, UINavigationControllerDelegate, UIImag
|
|||||||
|
|
||||||
|
|
||||||
@IBAction func saveNewProfile(sender: UIButton){
|
@IBAction func saveNewProfile(sender: UIButton){
|
||||||
var user = PFUser()
|
if(self.nameField.hasText() == false
|
||||||
var img:PFFile = PFFile(data: UIImagePNGRepresentation(self.profilePic.image))!
|
|| self.userField.hasText() == false
|
||||||
user.username = userField.text!
|
|| self.emailField.hasText() == false
|
||||||
user.password = passField.text!
|
|| self.passField.hasText() == false
|
||||||
user.email = emailField.text!
|
|| self.profilePic.image == nil){
|
||||||
user.setObject(nameField.text!, forKey: "displayName")
|
|
||||||
user.setObject(img, forKey: "profilePicture")
|
|
||||||
|
|
||||||
//sign up new user
|
|
||||||
user.signUpInBackgroundWithBlock({
|
|
||||||
(succeeded: Bool, error: NSError?) -> Void in
|
|
||||||
|
|
||||||
if error == nil {
|
|
||||||
self.performSegueWithIdentifier("SignedUpSegue", sender: self)
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
|
let alert = UIAlertController(title: "Invalid Registration", message: "We're missing some information from you, before we can start the party!", preferredStyle: .Alert)
|
||||||
|
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: nil)}))
|
||||||
|
|
||||||
|
self.presentViewController(alert, animated: true, completion: nil)
|
||||||
|
|
||||||
|
}else{
|
||||||
|
if(!(contains(self.userField.text!, "@") || contains(self.nameField.text!, "@"))){
|
||||||
|
|
||||||
|
let predicate: NSPredicate = NSPredicate(format: "((username = %@) OR (email = %@))", argumentArray: [self.nameField.text!,self.emailField.text!])
|
||||||
|
var userQuery: PFQuery = PFQuery(className: "_User", predicate: predicate)
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), {
|
||||||
|
userQuery.getFirstObjectInBackgroundWithBlock({
|
||||||
|
(object, error) -> Void in
|
||||||
|
|
||||||
|
if(object != nil && error == nil){
|
||||||
|
let alert = UIAlertController(title: "User Info Taken", message: "Sorry this information is already registered to another user. Please try again.", preferredStyle: .Alert)
|
||||||
|
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler:{(action: UIAlertAction!) in alert.dismissViewControllerAnimated(true, completion: nil)}))
|
||||||
|
|
||||||
|
self.presentViewController(alert, animated: true, completion: nil)
|
||||||
|
}else{
|
||||||
|
var user = PFUser()
|
||||||
|
var img:PFFile = PFFile(data: UIImagePNGRepresentation(self.profilePic.image))!
|
||||||
|
user.username = self.userField.text!
|
||||||
|
user.password = self.passField.text!
|
||||||
|
user.email = self.emailField.text!
|
||||||
|
user.setObject(self.nameField.text!, forKey: "displayName")
|
||||||
|
user.setObject(img, forKey: "profilePicture")
|
||||||
|
|
||||||
|
//sign up new user
|
||||||
|
user.signUpInBackgroundWithBlock({
|
||||||
|
(succeeded: Bool, error: NSError?) -> Void in
|
||||||
|
|
||||||
|
if error == nil {
|
||||||
|
self.performSegueWithIdentifier("SignedUpSegue", sender: self)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
let alert = UIAlertController(title: "Illegal Characters", message: "The username or email you entered contains illegal characters such as: '@'", 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)
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func cancelSignUp(){
|
@IBAction func cancelSignUp(){
|
||||||
|
|||||||
@ -14,7 +14,6 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
|
|||||||
var usr: [UserParseData] = []
|
var usr: [UserParseData] = []
|
||||||
var frnds: [FriendData] = []
|
var frnds: [FriendData] = []
|
||||||
var requestData: [FriendData] = []
|
var requestData: [FriendData] = []
|
||||||
|
|
||||||
@IBOutlet weak var table: UITableView!
|
@IBOutlet weak var table: UITableView!
|
||||||
|
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
|
|||||||
self.presentViewController(filterMenu, animated: true, completion: nil)
|
self.presentViewController(filterMenu, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var filter: String! = "Songs"
|
var filter: String! = "Songs"
|
||||||
|
|
||||||
@IBAction func cancelInvites(sender: UIBarButtonItem) {
|
@IBAction func cancelInvites(sender: UIBarButtonItem) {
|
||||||
|
|
||||||
@ -108,14 +107,15 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
|
|||||||
switch self.filter{
|
switch self.filter{
|
||||||
|
|
||||||
//return number of rows for albums
|
//return number of rows for albums
|
||||||
case "albums":
|
case "Albums":
|
||||||
var albumsQuery = MPMediaQuery.albumsQuery()
|
var albumsQuery = MPMediaQuery.albumsQuery()
|
||||||
var albums = albumsQuery.collections
|
var albums = albumsQuery.collections
|
||||||
return albums.count + 1
|
return albums.count + 1
|
||||||
|
|
||||||
//return number of rows for artists
|
//return number of rows for artists
|
||||||
case "artists":
|
case "Artists":
|
||||||
var artistsQuery = MPMediaQuery.artistsQuery()
|
var artistsQuery = MPMediaQuery.artistsQuery()
|
||||||
|
//artistsQuery
|
||||||
var artists = artistsQuery.items
|
var artists = artistsQuery.items
|
||||||
return artists.count + 1
|
return artists.count + 1
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
|
|||||||
switch self.filter{
|
switch self.filter{
|
||||||
|
|
||||||
//return albums cell
|
//return albums cell
|
||||||
case "albums":
|
case "Albums":
|
||||||
let cell = self.table.dequeueReusableCellWithIdentifier("AlbumCell", forIndexPath: indexPath) as? AlbumCell
|
let cell = self.table.dequeueReusableCellWithIdentifier("AlbumCell", forIndexPath: indexPath) as? AlbumCell
|
||||||
|
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
|
|||||||
|
|
||||||
|
|
||||||
//return artists cell
|
//return artists cell
|
||||||
case "artists":
|
case "Artists":
|
||||||
let cell = self.table.dequeueReusableCellWithIdentifier("ArtistCell", forIndexPath: indexPath) as? ArtistCell
|
let cell = self.table.dequeueReusableCellWithIdentifier("ArtistCell", forIndexPath: indexPath) as? ArtistCell
|
||||||
|
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
|
|||||||
switch self.filter{
|
switch self.filter{
|
||||||
|
|
||||||
//return albums cell
|
//return albums cell
|
||||||
case "albums":
|
case "Albums":
|
||||||
let cell = self.table.dequeueReusableCellWithIdentifier("AlbumCell", forIndexPath: indexPath) as? AlbumCell
|
let cell = self.table.dequeueReusableCellWithIdentifier("AlbumCell", forIndexPath: indexPath) as? AlbumCell
|
||||||
|
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ class SongSelectionViewController: UIViewController, UITableViewDelegate, UITabl
|
|||||||
return cell!
|
return cell!
|
||||||
|
|
||||||
//return artists cell
|
//return artists cell
|
||||||
case "artists":
|
case "Artists":
|
||||||
let cell = self.table.dequeueReusableCellWithIdentifier("ArtistCell", forIndexPath: indexPath) as? ArtistCell
|
let cell = self.table.dequeueReusableCellWithIdentifier("ArtistCell", forIndexPath: indexPath) as? ArtistCell
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user