Merged branch RDB-Add-Name-To-Sign-Up-Flow into Rapid-Dev-Branch

This commit is contained in:
Okechi Onyeje 2016-08-28 10:51:35 -04:00
commit 33f5b51974
10 changed files with 649 additions and 661 deletions

View File

@ -40,6 +40,7 @@
3EC3252F1CF894E500626C48 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EC3252E1CF894E500626C48 /* AVFoundation.framework */; };
3ECEDB871CF9C722003566B3 /* ListingPreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECEDB861CF9C722003566B3 /* ListingPreviewViewController.swift */; };
3EDE75AE1D67B92F00BC3472 /* CategoryPopUpController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EDE75AD1D67B92F00BC3472 /* CategoryPopUpController.swift */; };
3EF422B21D73262000B9A3EB /* UserCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EF422B11D73262000B9A3EB /* UserCell.swift */; };
3EFB0E331D0B968300A05D7A /* SideMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EFB0E321D0B968300A05D7A /* SideMenuView.swift */; };
3F8E0464700649BDD8B552B1 /* Pods_Vendoo_VendooTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B876489113F498AF1D2FD7E9 /* Pods_Vendoo_VendooTests.framework */; };
A87525ED0EE7D42D9A7708D8 /* Pods_Vendoo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23ECC3C8465826BD6AC74A02 /* Pods_Vendoo.framework */; };
@ -105,6 +106,7 @@
3EC3252E1CF894E500626C48 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
3ECEDB861CF9C722003566B3 /* ListingPreviewViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListingPreviewViewController.swift; sourceTree = "<group>"; };
3EDE75AD1D67B92F00BC3472 /* CategoryPopUpController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CategoryPopUpController.swift; sourceTree = "<group>"; };
3EF422B11D73262000B9A3EB /* UserCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserCell.swift; sourceTree = "<group>"; };
3EFB0E321D0B968300A05D7A /* SideMenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideMenuView.swift; sourceTree = "<group>"; };
7D1FC6F6278B48A7BA9A9E03 /* Pods_Vendoo_VendooUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Vendoo_VendooUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A44ED233D6B5454EF92FEB08 /* Pods-Vendoo-VendooUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Vendoo-VendooUITests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Vendoo-VendooUITests/Pods-Vendoo-VendooUITests.debug.xcconfig"; sourceTree = "<group>"; };
@ -328,6 +330,7 @@
3E1AA4331D0DD0B2005FCCBB /* Settings */,
3EFB0E321D0B968300A05D7A /* SideMenuView.swift */,
3E1AA4311D0DA071005FCCBB /* MenuPanelViewController.swift */,
3EF422B11D73262000B9A3EB /* UserCell.swift */,
);
name = Menu;
sourceTree = "<group>";
@ -751,6 +754,7 @@
3E1DC3CF1D42328C0091BC60 /* CategoryCell.swift in Sources */,
3EC325111CF703A600626C48 /* ItemCell.swift in Sources */,
3EA668A11D02836C00EE57A8 /* EbayWebServiceManager.swift in Sources */,
3EF422B21D73262000B9A3EB /* UserCell.swift in Sources */,
3ECEDB871CF9C722003566B3 /* ListingPreviewViewController.swift in Sources */,
3E1B1F0B1D2493EE00DBCF08 /* EtsySettingsViewController.swift in Sources */,
3EC325231CF7DA5500626C48 /* HomeViewController.swift in Sources */,

BIN
Vendoo/.DS_Store vendored

Binary file not shown.

View File

@ -31,11 +31,9 @@ class FirebaseManager: NSObject {
// do some stuff once
if(!snapshot.hasChild(self.user_email)){
let user = ["user_Listings": "","listing_Keys": "","favorite_listings_keys": ""]
// let userUpdates = ["/Users/\((NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!)" : user]
let user = ["name": (NSUserDefaults.standardUserDefaults().objectForKey("name") as? String)!, "user_Listings": "", "listing_Keys": "", "favorite_listings_keys": ""]
self.ref.child("Users").child(self.user_email).setValue(user)
//self.ref.child("Users").setValue(["email": (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!])
}
})

View File

@ -23,15 +23,21 @@ class HomeViewController: UITabBarController {
// Do any additional setup after loading the view.
dispatch_async(dispatch_get_main_queue(), {
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)/user_Listings").observeSingleEventOfType( .Value, withBlock: {
//get all listing information for current user
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)").observeSingleEventOfType( .Value, withBlock: {
(snapshot) -> Void in
let listingDict = snapshot.value as? [String : AnyObject]
let userDict = snapshot.value as? [String : AnyObject]
let listingDict = userDict!["user_Listings"] as? [String : AnyObject]
NSUserDefaults.standardUserDefaults().setObject(userDict!["name"] as? String, forKey: "name")
if listingDict != nil {
dispatch_async(dispatch_get_main_queue(), {
for (key, values) in listingDict! {
let serviceGroup: dispatch_group_t = dispatch_group_create()
self.firebaseManager.ref.observeSingleEventOfType(.Value, withBlock: { snapshot in

View File

@ -1388,7 +1388,7 @@
<color key="separatorColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="sectionIndexBackgroundColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="User_Cell" id="hae-qr-YYv">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="User_Cell" id="hae-qr-YYv" customClass="UserCell" customModule="Vendoo" customModuleProvider="target">
<rect key="frame" x="0.0" y="1" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="hae-qr-YYv" id="jVD-It-v2S">
@ -1396,14 +1396,14 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Hi User" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="QxU-Ol-czq">
<rect key="frame" x="17" y="4" width="66" height="26"/>
<rect key="frame" x="17" y="4" width="208" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="user@email.com" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="CH5-dW-4wI">
<rect key="frame" x="17" y="20" width="114" height="26"/>
<rect key="frame" x="17" y="20" width="208" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.43529411759999997" green="0.4431372549" blue="0.47450980390000003" alpha="1" colorSpace="calibratedRGB"/>
@ -1418,6 +1418,10 @@
</button>
</subviews>
</tableViewCellContentView>
<connections>
<outlet property="email" destination="CH5-dW-4wI" id="dTu-Qs-a3W"/>
<outlet property="name" destination="QxU-Ol-czq" id="GGJ-j1-f1P"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Notifications_Cell" id="TpL-A6-BYb">
<rect key="frame" x="0.0" y="45" width="375" height="44"/>
@ -1593,7 +1597,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="9G8-XI-ptI">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<rect key="frame" x="0.0" y="72" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="9G8-XI-ptI" id="r3f-6Q-p1g">
<rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/>
@ -1610,7 +1614,7 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="JJa-O7-kym">
<rect key="frame" x="0.0" y="72" width="375" height="44"/>
<rect key="frame" x="0.0" y="116" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="JJa-O7-kym" id="bCt-1V-IW1">
<rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/>
@ -1671,7 +1675,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Change_Pass_Cell" id="ceq-sl-ClT">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<rect key="frame" x="0.0" y="72" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ceq-sl-ClT" id="Waq-fu-UxD">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
@ -1688,7 +1692,7 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Delete_Account_Cell" id="Lha-cf-Sfc">
<rect key="frame" x="0.0" y="72" width="375" height="44"/>
<rect key="frame" x="0.0" y="116" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Lha-cf-Sfc" id="kmF-Sb-d0c">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
@ -2446,10 +2450,10 @@
<image name="start" width="50" height="50"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="Ds4-LY-IRj"/>
<segue reference="syc-IR-LNQ"/>
<segue reference="nWA-7e-2Ec"/>
<segue reference="Gnt-iE-cW9"/>
<segue reference="NOz-ya-avj"/>
<segue reference="rkZ-c8-XJc"/>
<segue reference="eaI-bm-1aI"/>
</inferredMetricsTieBreakers>
<color key="tintColor" red="0.2784313725" green="0.80392156859999997" blue="0.68235294120000001" alpha="1" colorSpace="calibratedRGB"/>

View File

@ -99,7 +99,11 @@ extension MenuPanelViewController: UITableViewDataSource
let cell: UITableViewCell
switch(indexPath.row){
case 0:
cell = self.table.dequeueReusableCellWithIdentifier("User_Cell")!
cell = (self.table.dequeueReusableCellWithIdentifier("User_Cell", forIndexPath: indexPath) as! UserCell)
(cell as! UserCell).name.text = "Hi " + (NSUserDefaults.standardUserDefaults().objectForKey("name") as? String)!
(cell as! UserCell).email.text = (NSUserDefaults.standardUserDefaults().objectForKey("email") as? String)!
break
case 1:
cell = self.table.dequeueReusableCellWithIdentifier("Notifications_Cell")!

View File

@ -6,10 +6,11 @@
// Copyright © 2016 Okechi Onyeje. All rights reserved.
//
//NEED TO PROMPT NEW USER THAT THEY HAVE BEEN LOGGED IN, NEED TO ADD AN INDICTOR TO LET USER KNOW THEY NEED TO WAIT AND NEED TO SEGUE TO MAIN SCREEN VIEW CONTROLLER
//@FIXME: NEED TO PROMPT NEW USER THAT THEY HAVE BEEN LOGGED IN, NEED TO ADD AN INDICTOR TO LET USER KNOW THEY NEED TO WAIT AND NEED TO SEGUE TO MAIN SCREEN VIEW CONTROLLER
import UIKit
import FirebaseAuth
import Firebase
import Locksmith
class SignUpViewController: UIViewController {
@ -43,43 +44,56 @@ class SignUpViewController: UIViewController {
extension SignUpViewController {
@IBAction func signUpUser(sender: AnyObject) {
let finalEmail = email!.text!.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet())
if isValidEmail(finalEmail){
if( (self.email.text != "") && (self.name.text != "") && (self.password.text != "")) {
let finalEmail = email!.text!.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet())
FIRAuth.auth()?.createUserWithEmail(email.text!, password: password.text!) { (user, error) in
if error != nil {
/*
if ( error!.userInfo[("error_name" as NSObject!)] == "ERROR_WEAK_PASSWORD"){
}
*/
print("user could not be created")
print(error!.localizedDescription)
return
}
else{
//save user account
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "signedIn")
NSUserDefaults.standardUserDefaults().setObject(self.email.text, forKey: "email")
//save user credentials in Keychain
do{
try Locksmith.saveData(["pass": self.password.text!], forUserAccount: self.email.text!, inService: "vendoo")
print("account credentials saved")
if isValidEmail(finalEmail){
FIRAuth.auth()?.createUserWithEmail(email.text!, password: password.text!) { (user, error) in
if error != nil {
/*
if ( error!.userInfo[("error_name" as NSObject!)] == "ERROR_WEAK_PASSWORD"){
}
*/
print("user could not be created")
print(error!.localizedDescription)
return
}
catch{
//could not save data to keychain
print("account credentials could not be saved")
else{
//save user account
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "signedIn")
NSUserDefaults.standardUserDefaults().setObject(self.email.text, forKey: "email")
NSUserDefaults.standardUserDefaults().setObject(self.name.text, forKey: "name")
//save user credentials in Keychain
do{
try Locksmith.saveData(["pass": self.password.text!], forUserAccount: self.email.text!, inService: "vendoo")
print("account credentials saved")
}
catch{
//could not save data to keychain
print("account credentials could not be saved")
}
self.performSegueWithIdentifier("HomeScreenSegue", sender:nil)
}
self.performSegueWithIdentifier("HomeScreenSegue", sender:nil)
}
}
}else {
var alert = UIAlertController(title: "Missing Required Fields", message: "You are missing required field(s) to complete your Vendoo sign up. Please make sure the email, name, and password fields have been filled.", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: {(action: UIAlertAction!) in
}))
self.presentViewController(alert, animated: true, completion: nil)
}
}

19
Vendoo/UserCell.swift Normal file
View File

@ -0,0 +1,19 @@
//
// UserCell.swift
// Vendoo
//
// Created by Okechi Onyeje on 8/28/16.
// Copyright © 2016 Okechi Onyeje. All rights reserved.
//
import UIKit
class UserCell: UITableViewCell {
@IBOutlet weak var name: UILabel!
@IBOutlet weak var email: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
}