skeleton code for new item posting almost complete, just need to work out a few bugs here and there. Once this is complete just need to integrate the four api's and the rest of firebase

This commit is contained in:
Okechi Onyeje 2016-05-29 00:08:39 -04:00
parent 53f949611a
commit a0e8b382b2
8 changed files with 300 additions and 58 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -58,11 +58,11 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "Vendoo/NetworksTableViewController.swift" filePath = "Vendoo/NetworksTableViewController.swift"
timestampString = "486128108.896927" timestampString = "486180405.211327"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "55" startingLineNumber = "51"
endingLineNumber = "55" endingLineNumber = "51"
landmarkName = "setNetworkSelectFunctionality(_:)" landmarkName = "setNetworkSelectFunctionality(_:)"
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
@ -74,11 +74,11 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "Vendoo/NetworksTableViewController.swift" filePath = "Vendoo/NetworksTableViewController.swift"
timestampString = "486128108.896927" timestampString = "486187285.19423"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "91" startingLineNumber = "104"
endingLineNumber = "91" endingLineNumber = "104"
landmarkName = "tableView(_:cellForRowAtIndexPath:)" landmarkName = "tableView(_:cellForRowAtIndexPath:)"
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
@ -90,14 +90,46 @@
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "Vendoo/NetworksTableViewController.swift" filePath = "Vendoo/NetworksTableViewController.swift"
timestampString = "486128132.689875" timestampString = "486187285.19423"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "380" startingLineNumber = "402"
endingLineNumber = "380" endingLineNumber = "402"
landmarkName = "tableView(_:didSelectRowAtIndexPath:)" landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
landmarkType = "5"> landmarkType = "5">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/NetworksTableViewController.swift"
timestampString = "486187285.19423"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "79"
endingLineNumber = "79"
landmarkName = "prepareForSegue(_:sender:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ItemImagePickerViewController.swift"
timestampString = "486187559.395902"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "60"
endingLineNumber = "60"
landmarkName = "prepareForSegue(_:sender:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints> </Breakpoints>
</Bucket> </Bucket>

BIN
Vendoo/.DS_Store vendored

Binary file not shown.

View File

@ -203,65 +203,74 @@
<!--camera--> <!--camera-->
<scene sceneID="R99-0r-4lb"> <scene sceneID="R99-0r-4lb">
<objects> <objects>
<viewController title="camera" id="0di-oP-cGQ" customClass="ItemImagePickerViewController" customModule="Vendoo" customModuleProvider="target" sceneMemberID="viewController"> <viewController title="camera" hidesBottomBarWhenPushed="YES" id="0di-oP-cGQ" customClass="ItemImagePickerViewController" customModule="Vendoo" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="aVi-aL-yft"> <view key="view" contentMode="scaleToFill" id="aVi-aL-yft">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="375" height="623"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="459-0A-OZB"> <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="459-0A-OZB">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="375" height="623"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="ktF-gc-qhF"> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder=" Item Name" minimumFontSize="17" id="QIK-Tn-AHX">
<rect key="frame" x="0.0" y="31" width="375" height="240"/> <rect key="frame" x="0.0" y="324" width="375" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/>
<color key="backgroundColor" red="1" green="0.94432476799999998" blue="0.29461320000000002" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</imageView> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<pickerView contentMode="scaleToFill" id="3Ch-bX-pSF" userLabel="CategoryPicker"> <pickerView contentMode="scaleToFill" id="3Ch-bX-pSF" userLabel="CategoryPicker">
<rect key="frame" x="0.0" y="489" width="375" height="116"/> <rect key="frame" x="-1" y="443" width="376" height="45"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="tintColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/> <color key="tintColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
</pickerView> </pickerView>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Item Name" textAlignment="center" minimumFontSize="17" id="PQC-e5-VHo" userLabel="price"> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder=" Price" minimumFontSize="17" id="PQC-e5-VHo" userLabel="price">
<rect key="frame" x="0.0" y="437" width="375" height="30"/> <rect key="frame" x="0.0" y="405" width="375" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/> <textInputTraits key="textInputTraits"/>
</textField> </textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Description" textAlignment="center" minimumFontSize="17" id="LS5-23-ZeW"> <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="Description" textAlignment="natural" id="osz-kc-aer">
<rect key="frame" x="0.0" y="385" width="375" height="30"/> <rect key="frame" x="0.0" y="362" width="375" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/> <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textField> </textView>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Item Name" textAlignment="center" minimumFontSize="17" id="QIK-Tn-AHX"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="ktF-gc-qhF">
<rect key="frame" x="0.0" y="333" width="375" height="30"/> <rect key="frame" x="-1" y="64" width="375" height="252"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/>
<color key="backgroundColor" red="1" green="0.94432476799999998" blue="0.29461320000000002" alpha="1" colorSpace="calibratedRGB"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="w7U-gh-R0T">
<rect key="frame" x="0.0" y="570" width="375" height="53"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/> <color key="backgroundColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
<textInputTraits key="textInputTraits"/> <state key="normal" title="Select Your Networks">
</textField> <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="chooseSellerNetworks:" destination="0di-oP-cGQ" eventType="touchUpInside" id="ikm-E8-hAv"/>
</connections>
</button>
</subviews> </subviews>
</scrollView> </scrollView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="w7U-gh-R0T">
<rect key="frame" x="164" y="608" width="46" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Next"/>
<connections>
<action selector="chooseSellerNetworks:" destination="0di-oP-cGQ" eventType="touchUpInside" id="ikm-E8-hAv"/>
</connections>
</button>
</subviews> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view> </view>
<extendedEdge key="edgesForExtendedLayout" top="YES"/>
<tabBarItem key="tabBarItem" title="Camera" image="camera" id="2Qf-xv-SNc"/> <tabBarItem key="tabBarItem" title="Camera" image="camera" id="2Qf-xv-SNc"/>
<toolbarItems/> <toolbarItems/>
<nil key="simulatedBottomBarMetrics"/> <simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/> <simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<connections> <connections>
<outlet property="categoryPicker" destination="3Ch-bX-pSF" id="bhR-9x-9gU"/> <outlet property="categoryPicker" destination="3Ch-bX-pSF" id="bhR-9x-9gU"/>
<outlet property="containerScrollView" destination="459-0A-OZB" id="p7Q-my-T9M"/> <outlet property="containerScrollView" destination="459-0A-OZB" id="p7Q-my-T9M"/>
<outlet property="itemDescription" destination="LS5-23-ZeW" id="Pfi-A6-QPV"/> <outlet property="itemDescription" destination="osz-kc-aer" id="qN7-31-UDs"/>
<outlet property="itemName" destination="QIK-Tn-AHX" id="YsY-i0-9oR"/> <outlet property="itemName" destination="QIK-Tn-AHX" id="YsY-i0-9oR"/>
<outlet property="itemPrice" destination="PQC-e5-VHo" id="2Xi-s1-i8r"/> <outlet property="itemPrice" destination="PQC-e5-VHo" id="2Xi-s1-i8r"/>
<outlet property="possibleItemImage" destination="ktF-gc-qhF" id="Jcq-yA-9LA"/> <outlet property="possibleItemImage" destination="ktF-gc-qhF" id="Jcq-yA-9LA"/>
@ -272,10 +281,10 @@
</objects> </objects>
<point key="canvasLocation" x="1643.5" y="1115.5"/> <point key="canvasLocation" x="1643.5" y="1115.5"/>
</scene> </scene>
<!--Networks Table View Controller--> <!--Select Networks-->
<scene sceneID="Psr-WG-l4G"> <scene sceneID="Psr-WG-l4G">
<objects> <objects>
<viewController id="7B0-PA-tjd" customClass="NetworksTableViewController" customModule="Vendoo" customModuleProvider="target" sceneMemberID="viewController"> <viewController title="Select Networks" id="7B0-PA-tjd" customClass="NetworksTableViewController" customModule="Vendoo" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="d7h-ON-Th9"> <view key="view" contentMode="scaleToFill" id="d7h-ON-Th9">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@ -436,6 +445,17 @@
</navigationItem> </navigationItem>
</items> </items>
</navigationBar> </navigationBar>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="6LK-LC-WU6">
<rect key="frame" x="0.0" y="623" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
<state key="normal" title="Listing Preview">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="showListingPreview:" destination="7B0-PA-tjd" eventType="touchUpInside" id="Unf-Xj-xbU"/>
</connections>
</button>
</subviews> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view> </view>
@ -448,7 +468,7 @@
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="6Ls-Ti-JQK" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="6Ls-Ti-JQK" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="2179" y="1123"/> <point key="canvasLocation" x="2178.5" y="1122.5"/>
</scene> </scene>
<!--Listing Preview--> <!--Listing Preview-->
<scene sceneID="Qqe-CL-BDJ"> <scene sceneID="Qqe-CL-BDJ">
@ -489,7 +509,7 @@
<action selector="draftItem:" destination="gfQ-Y2-Mqh" eventType="touchUpInside" id="Dss-pL-WfA"/> <action selector="draftItem:" destination="gfQ-Y2-Mqh" eventType="touchUpInside" id="Dss-pL-WfA"/>
</connections> </connections>
</button> </button>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" usesAttributedText="YES" id="WuZ-2K-lz7"> <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" usesAttributedText="YES" selectable="NO" id="WuZ-2K-lz7">
<rect key="frame" x="103" y="303" width="251" height="32"/> <rect key="frame" x="103" y="303" width="251" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@ -510,7 +530,7 @@
<color key="textColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" usesAttributedText="YES" id="Jh9-KG-0Yt"> <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" usesAttributedText="YES" selectable="NO" id="Jh9-KG-0Yt">
<rect key="frame" x="103" y="455" width="251" height="33"/> <rect key="frame" x="103" y="455" width="251" height="33"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@ -538,7 +558,7 @@
<color key="textColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="1" green="0.674443664" blue="0.43274429120000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" usesAttributedText="YES" id="u7b-0N-xli"> <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" usesAttributedText="YES" selectable="NO" id="u7b-0N-xli">
<rect key="frame" x="103" y="343" width="251" height="104"/> <rect key="frame" x="103" y="343" width="251" height="104"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@ -552,7 +572,7 @@
</attributedString> </attributedString>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/> <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView> </textView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" usesAttributedText="YES" id="ije-TG-4S5"> <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" usesAttributedText="YES" selectable="NO" id="ije-TG-4S5">
<rect key="frame" x="103" y="495" width="251" height="33"/> <rect key="frame" x="103" y="495" width="251" height="33"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@ -1182,6 +1202,6 @@
<inferredMetricsTieBreakers> <inferredMetricsTieBreakers>
<segue reference="nWA-7e-2Ec"/> <segue reference="nWA-7e-2Ec"/>
<segue reference="0Jz-Zn-QDr"/> <segue reference="0Jz-Zn-QDr"/>
<segue reference="NOz-ya-avj"/> <segue reference="vCG-jU-HYF"/>
</inferredMetricsTieBreakers> </inferredMetricsTieBreakers>
</document> </document>

View File

@ -6,6 +6,10 @@
// Copyright © 2016 Okechi Onyeje. All rights reserved. // Copyright © 2016 Okechi Onyeje. All rights reserved.
// //
/*
need to make this class display a top navigation bar so user may cancel the new item posting if need be
*/
import UIKit import UIKit
class ItemImagePickerViewController: UIViewController { class ItemImagePickerViewController: UIViewController {
@ -13,7 +17,7 @@ class ItemImagePickerViewController: UIViewController {
//Outlets //Outlets
@IBOutlet weak var possibleItemImage: UIImageView! @IBOutlet weak var possibleItemImage: UIImageView!
@IBOutlet weak var itemName: UITextField! @IBOutlet weak var itemName: UITextField!
@IBOutlet weak var itemDescription: UITextField! @IBOutlet weak var itemDescription: UITextView!
@IBOutlet weak var itemPrice: UITextField! @IBOutlet weak var itemPrice: UITextField!
@IBOutlet weak var categoryPicker: UIPickerView! @IBOutlet weak var categoryPicker: UIPickerView!
@IBOutlet weak var containerScrollView: UIScrollView! @IBOutlet weak var containerScrollView: UIScrollView!
@ -26,9 +30,13 @@ class ItemImagePickerViewController: UIViewController {
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
// Connect data: // Connect data:
self.categoryPicker.delegate = self self.categoryPicker.delegate = self
self.categoryPicker.dataSource = self self.categoryPicker.dataSource = self
self.itemDescription.delegate = self
self.itemName.delegate = self
self.itemPrice.delegate = self
// Input data into the Array: // Input data into the Array:
pickerData = ["Category 1", "Category 2", "Category 3", "Category 4", "Category 5", "Category 6"] pickerData = ["Category 1", "Category 2", "Category 3", "Category 4", "Category 5", "Category 6"]
@ -49,7 +57,16 @@ class ItemImagePickerViewController: UIViewController {
// Pass the selected object to the new view controller. // Pass the selected object to the new view controller.
if(segue.identifier == "SelectNetworkSegue"){ if(segue.identifier == "SelectNetworkSegue"){
(segue.destinationViewController as! NetworksTableViewController).setNetworkSelectFunctionality(true) print(self.itemName.text!)
print(self.itemDescription.text!)
//print(self.possibleItemImage.image!)
print(self.itemPrice.text!)
let dict: Dictionary<String, AnyObject> = ["title":self.itemName.text!, "description":self.itemDescription.text!, "picture": UIImage() /*"picture":self.possibleItemImage.image!*/ , "price":self.itemPrice.text!, "category":self.pickerData[self.categoryPicker.selectedRowInComponent(0)]]
(segue.destinationViewController as! NetworksTableViewController).setListingDictionary(dict)
print(self.categoryPicker.selectedRowInComponent(0))
} }
@ -96,6 +113,56 @@ extension ItemImagePickerViewController: UIPickerViewDataSource {
} }
extension ItemImagePickerViewController: UITextViewDelegate {
func textViewDidBeginEditing(textView: UITextView) {
if (textView.text! == "Description") {
textView.text = ""
textView.textColor = UIColor.blackColor()
//optional
}
textView.becomeFirstResponder()
}
func textViewDidEndEditing(textView: UITextView) {
if (textView.text! == "") {
textView.text = "Description"
textView.textColor = UIColor.lightGrayColor()
//optional
}
textView.resignFirstResponder()
}
func textViewDidChange(textView: UITextView) {
let fixedWidth = textView.frame.size.width
textView.sizeThatFits(CGSize(width: fixedWidth, height: CGFloat.max))
let newSize = textView.sizeThatFits(CGSize(width: fixedWidth, height: CGFloat.max))
var newFrame = textView.frame
newFrame.size = CGSize(width: max(newSize.width, fixedWidth), height: newSize.height)
textView.frame = newFrame;
}
}
extension ItemImagePickerViewController: UITextFieldDelegate {
func textFieldShouldReturn(textField: UITextField) -> Bool {
self.view.endEditing(true)
return false
}
func hideKeyboard() {
self.view.endEditing(true)
}
func textFieldDidBeginEditing(textField: UITextField) {
self.containerScrollView.setContentOffset(CGPointMake(0, 200), animated: true)
}
func textFieldDidEndEditing(textField: UITextField) {
self.containerScrollView.setContentOffset(CGPointMake(0, 0), animated: true)
}
}
//Mark: - IBActions //Mark: - IBActions
extension ItemImagePickerViewController { extension ItemImagePickerViewController {

View File

@ -6,6 +6,13 @@
// Copyright © 2016 Okechi Onyeje. All rights reserved. // Copyright © 2016 Okechi Onyeje. All rights reserved.
// //
/*
NOTES:
need to display navigation bar so user can navigate back to previous screens if changes need to be made
*/
import UIKit import UIKit
class ListingPreviewViewController: UIViewController { class ListingPreviewViewController: UIViewController {
@ -19,11 +26,18 @@ class ListingPreviewViewController: UIViewController {
@IBOutlet weak var itemCategory: UITextView! @IBOutlet weak var itemCategory: UITextView!
@IBOutlet weak var networks: UICollectionView! @IBOutlet weak var networks: UICollectionView!
//class variables
private var networksDictionary: Dictionary<String, Bool> = Dictionary<String, Bool>()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
// Initialization code
self.networks.delegate = self
self.networks.dataSource = self
self.networks.backgroundView?.backgroundColor = UIColor.whiteColor()
} }
override func didReceiveMemoryWarning() { override func didReceiveMemoryWarning() {
@ -31,6 +45,22 @@ class ListingPreviewViewController: UIViewController {
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
} }
func setListing(pic: UIImage, title: String, description: String, price: String, category: String){
//fatal error: unexpectedly found nil while unwrapping an Optional value <- need to figure this out
/*
self.itemPicture.image = pic
self.itemTitle.text = title
self.itemDescription.text = description
self.itemPrice.text = price
self.itemCategory.text = category
*/
}
func setDictionary(dictionary:Dictionary<String, Bool>){
self.networksDictionary = dictionary
}
/* /*
// MARK: - Navigation // MARK: - Navigation
@ -58,3 +88,77 @@ extension ListingPreviewViewController {
} }
extension ListingPreviewViewController: UICollectionViewDelegate {
/*
// Uncomment this method to specify if the specified item should be highlighted during tracking
override func collectionView(collectionView: UICollectionView, shouldHighlightItemAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
*/
/*
// Uncomment this method to specify if the specified item should be selected
override func collectionView(collectionView: UICollectionView, shouldSelectItemAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
*/
/*
// Uncomment these methods to specify if an action menu should be displayed for the specified item, and react to actions performed on the item
override func collectionView(collectionView: UICollectionView, shouldShowMenuForItemAtIndexPath indexPath: NSIndexPath) -> Bool {
return false
}
override func collectionView(collectionView: UICollectionView, canPerformAction action: Selector, forItemAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) -> Bool {
return false
}
override func collectionView(collectionView: UICollectionView, performAction action: Selector, forItemAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) {
}
*/
}
//Mark: - UICollectionViewDataSource methods
//need to dynamically show, hide, and rearrange the network cells based on users choice of networks
extension ListingPreviewViewController: UICollectionViewDataSource {
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of items
return 4
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell: UICollectionViewCell!
switch (indexPath.row){
case 0:
cell = collectionView.dequeueReusableCellWithReuseIdentifier("ebay", forIndexPath: indexPath)
break
case 1:
cell = collectionView.dequeueReusableCellWithReuseIdentifier("amazon", forIndexPath: indexPath)
break
case 2:
cell = collectionView.dequeueReusableCellWithReuseIdentifier("etsy", forIndexPath: indexPath)
break
default:
cell = collectionView.dequeueReusableCellWithReuseIdentifier("facebook", forIndexPath: indexPath)
break
}
return cell
}
}

View File

@ -12,8 +12,7 @@
//Make it so u are accessing REST api service managers from TabController //Make it so u are accessing REST api service managers from TabController
//to promote more centralized code. //to promote more centralized code.
//For now putting rest service managers in this controller file to test OAuth: EtsyRESTServiceManager, //need to make the class control the navigation bar by changing the buttons on it to show a back button in the case where class is controlling network selection, and hide back button for the case where class is controlling network authorization
//FacebookGraphAPIServiceManager, EbayServiceManager, and AmazonServiceManager.
*/ */
import UIKit import UIKit
@ -26,12 +25,9 @@ class NetworksTableViewController: UIViewController {
//class variables //class variables
private var networkToggleOrSelect: Bool = false private var networkToggleOrSelect: Bool = false
private var networksDictionary: Dictionary<String, Bool> = ["ebay":false, "amazon":false,"etsy":false,"facebook":false] private var networksDictionary: Dictionary<String, Bool> = ["ebay":false, "amazon":false,"etsy":false,"facebook":false]
private var itemListingDictionary: Dictionary<String, AnyObject>! = Dictionary<String, AnyObject>()
//temporary class variables /*TESTING*/
//let etsyManager = EtsyRESTAPIManager()
//let fbGraphManager = FacebookGraphAPIManager()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
@ -58,6 +54,17 @@ class NetworksTableViewController: UIViewController {
} }
//MARK: - class methods Network Selection when creating a new listing
extension NetworksTableViewController {
func setListingDictionary(listingDictionary: Dictionary<String, AnyObject>){
self.itemListingDictionary = listingDictionary
}
}
// MARK: - Navigation // MARK: - Navigation
extension NetworksTableViewController { extension NetworksTableViewController {
@ -68,7 +75,9 @@ extension NetworksTableViewController {
// Pass the selected object to the new view controller. // Pass the selected object to the new view controller.
if(segue.identifier == "ItemPreviewSegue"){ if(segue.identifier == "ItemPreviewSegue"){
(segue.destinationViewController as! ListingPreviewViewController).setListing(self.itemListingDictionary["picture"] as! UIImage, title: self.itemListingDictionary["title"] as! String, description: self.itemListingDictionary["description"] as! String, price: self.itemListingDictionary["price"] as! String, category: self.itemListingDictionary["category"] as! String)
(segue.destinationViewController as! ListingPreviewViewController).setDictionary(self.networksDictionary)
} }
} }
} }
@ -150,6 +159,15 @@ extension NetworksTableViewController: UITableViewDataSource {
} }
//MARK: - IBActions
extension NetworksTableViewController {
@IBAction func showListingPreview(sender: AnyObject) {
self.performSegueWithIdentifier("ItemPreviewSegue", sender: self)
}
}
//SET UP TO ADD EACH INTEGRATION AS DEVELOPMENT GETS TO IT //SET UP TO ADD EACH INTEGRATION AS DEVELOPMENT GETS TO IT
@ -434,6 +452,7 @@ extension NetworksTableViewController: UITableViewDelegate {
} }
/* /*
// Override to support conditional editing of the table view. // Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {