mirror of
https://bitbucket.org/vendoo/vendoo_v1.0.git
synced 2025-12-25 11:47:40 +00:00
facebook posting integration done, just need to fine tune the checks and add firebase to save the listing information in the user's account
This commit is contained in:
parent
734bc8d26b
commit
3cd0da8977
Binary file not shown.
@ -10,45 +10,13 @@
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486403080.878544"
|
||||
timestampString = "486462859.733613"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "35"
|
||||
endingLineNumber = "35"
|
||||
landmarkName = "FacebookGraphAPIManager"
|
||||
landmarkType = "3">
|
||||
<Locations>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.FacebookGraphAPIManager.isAuthorized.setter : Swift.Bool"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486426967.061218"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "35"
|
||||
endingLineNumber = "35"
|
||||
offsetFromSymbolStart = "27">
|
||||
</Location>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.FacebookGraphAPIManager.init () -> Vendoo.FacebookGraphAPIManager"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486426967.061401"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "35"
|
||||
endingLineNumber = "35"
|
||||
offsetFromSymbolStart = "584">
|
||||
</Location>
|
||||
</Locations>
|
||||
startingLineNumber = "155"
|
||||
endingLineNumber = "155"
|
||||
landmarkName = "makePOSTResquest(_:params:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
@ -57,13 +25,29 @@
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486403080.878544"
|
||||
filePath = "Vendoo/ListingPreviewViewController.swift"
|
||||
timestampString = "486462867.093209"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "63"
|
||||
endingLineNumber = "63"
|
||||
landmarkName = "authorizeApp(_:)"
|
||||
startingLineNumber = "92"
|
||||
endingLineNumber = "92"
|
||||
landmarkName = "publishItem(_:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/ListingPreviewViewController.swift"
|
||||
timestampString = "486462875.331208"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "55"
|
||||
endingLineNumber = "55"
|
||||
landmarkName = "setListing()"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
@ -74,254 +58,14 @@
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486407553.29875"
|
||||
timestampString = "486465261.252783"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "114"
|
||||
endingLineNumber = "114"
|
||||
landmarkName = "authorizeApp(_:)"
|
||||
startingLineNumber = "163"
|
||||
endingLineNumber = "163"
|
||||
landmarkName = "makePOSTResquest(_:params:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486407553.29875"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "139"
|
||||
endingLineNumber = "139"
|
||||
landmarkName = "makeGETRequest(_:params:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486407553.29875"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "146"
|
||||
endingLineNumber = "146"
|
||||
landmarkName = "makeGETRequest(_:params:)"
|
||||
landmarkType = "5">
|
||||
<Locations>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.FacebookGraphAPIManager.makeGETRequest (Swift.ImplicitlyUnwrappedOptional<Swift.String>, params : Swift.ImplicitlyUnwrappedOptional<Swift.Dictionary<__ObjC.NSObject, Swift.AnyObject>>) -> Swift.Bool"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486426967.148932"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "149"
|
||||
endingLineNumber = "149"
|
||||
offsetFromSymbolStart = "1020">
|
||||
</Location>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.FacebookGraphAPIManager.(makeGETRequest (Swift.ImplicitlyUnwrappedOptional<Swift.String>, params : Swift.ImplicitlyUnwrappedOptional<Swift.Dictionary<__ObjC.NSObject, Swift.AnyObject>>) -> Swift.Bool).(closure #1)"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486426967.149049"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "149"
|
||||
endingLineNumber = "149"
|
||||
offsetFromSymbolStart = "254">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "486404728.171853"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "424"
|
||||
endingLineNumber = "424"
|
||||
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
|
||||
landmarkType = "5">
|
||||
<Locations>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.NetworksTableViewController.tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -> ()"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "486426967.178522"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "424"
|
||||
endingLineNumber = "424"
|
||||
offsetFromSymbolStart = "14599">
|
||||
</Location>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.NetworksTableViewController.tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -> ()"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "486426967.179193"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "424"
|
||||
endingLineNumber = "424"
|
||||
offsetFromSymbolStart = "17180">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "486403506.007886"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "149"
|
||||
endingLineNumber = "149"
|
||||
landmarkName = "tableView(_:cellForRowAtIndexPath:)"
|
||||
landmarkType = "5">
|
||||
<Locations>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.NetworksTableViewController.tableView (__ObjC.UITableView, cellForRowAtIndexPath : __ObjC.NSIndexPath) -> __ObjC.UITableViewCell"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "486426967.180204"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "149"
|
||||
endingLineNumber = "149"
|
||||
offsetFromSymbolStart = "2553">
|
||||
</Location>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.NetworksTableViewController.tableView (__ObjC.UITableView, cellForRowAtIndexPath : __ObjC.NSIndexPath) -> __ObjC.UITableViewCell"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "486426967.180347"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "149"
|
||||
endingLineNumber = "149"
|
||||
offsetFromSymbolStart = "3458">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486407553.29875"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "165"
|
||||
endingLineNumber = "165"
|
||||
landmarkName = "makeDELETIONResquest(_:params:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/NetworksTableViewController.swift"
|
||||
timestampString = "486404876.015616"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "427"
|
||||
endingLineNumber = "427"
|
||||
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486407544.786775"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "97"
|
||||
endingLineNumber = "97"
|
||||
landmarkName = "authorizeApp(_:)"
|
||||
landmarkType = "5">
|
||||
<Locations>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.FacebookGraphAPIManager.(authorizeApp (__ObjC.UIViewController) -> Swift.Bool).(closure #1).(closure #1).(closure #1)"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486426967.190073"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "97"
|
||||
endingLineNumber = "97"
|
||||
offsetFromSymbolStart = "15">
|
||||
</Location>
|
||||
<Location
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Vendoo.FacebookGraphAPIManager.(authorizeApp (__ObjC.UIViewController) -> Swift.Bool).(closure #1).(closure #1).(closure #1).(closure #1)"
|
||||
moduleName = "Vendoo"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FacebookGraphAPIManager.swift"
|
||||
timestampString = "486426967.190291"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "100"
|
||||
endingLineNumber = "100"
|
||||
offsetFromSymbolStart = "16">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
||||
BIN
Vendoo/.DS_Store
vendored
BIN
Vendoo/.DS_Store
vendored
Binary file not shown.
@ -66,7 +66,7 @@ extension FacebookGraphAPIManager {
|
||||
if(FBSDKAccessToken.currentAccessToken() == nil){
|
||||
var boolResult:Bool = false
|
||||
dispatch_async(dispatch_get_main_queue(), { () -> Void in
|
||||
self.login.logInWithReadPermissions([/*"publish_actions", */"public_profile"], fromViewController: viewcontroller, handler: {
|
||||
self.login.logInWithReadPermissions(["user_posts","public_profile"], fromViewController: viewcontroller, handler: {
|
||||
(result, error) -> Void in
|
||||
|
||||
if (error != nil) {
|
||||
@ -88,7 +88,7 @@ extension FacebookGraphAPIManager {
|
||||
FBSDKAccessToken.setCurrentAccessToken(result.token)
|
||||
|
||||
print("user logged in through facebook")
|
||||
self.makeGETRequest("",params: nil)
|
||||
self.makeGETRequest("me",params: nil)
|
||||
|
||||
}
|
||||
if(!FBSDKAccessToken.currentAccessToken().hasGranted("publish_actions")){
|
||||
@ -114,7 +114,7 @@ extension FacebookGraphAPIManager {
|
||||
else{
|
||||
print(FBSDKAccessToken.currentAccessToken())
|
||||
print("user already logged in")
|
||||
self.makeGETRequest("",params: nil)
|
||||
self.makeGETRequest("me",params: nil)
|
||||
return true
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ extension FacebookGraphAPIManager {
|
||||
|
||||
func deAuthorizeApp(viewcontroller: UIViewController) -> Bool{
|
||||
|
||||
return self.makeDELETIONResquest("/permissions", params: nil)
|
||||
return self.makeDELETIONResquest("me/permissions", params: nil)
|
||||
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ extension FacebookGraphAPIManager {
|
||||
//when making request make sure path starts with '/'
|
||||
func makeGETRequest(requestPath: String!, params: [NSObject: AnyObject]!) -> Bool{
|
||||
|
||||
let graphRequest: FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me" + requestPath, parameters: params)
|
||||
let graphRequest: FBSDKGraphRequest = FBSDKGraphRequest(graphPath: requestPath, parameters: params)
|
||||
var boolResult: Bool = false
|
||||
|
||||
graphRequest.startWithCompletionHandler({
|
||||
@ -154,24 +154,33 @@ extension FacebookGraphAPIManager {
|
||||
//used to post to users timeline, path must start with '/'
|
||||
func makePOSTResquest(requestPath: String!, params: [NSObject: AnyObject]!){
|
||||
|
||||
let graphRequest: FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me" + requestPath, parameters: params, HTTPMethod: "POST")
|
||||
graphRequest.startWithCompletionHandler({
|
||||
(id, result, error) -> Void in
|
||||
print(result)
|
||||
})
|
||||
|
||||
/*if(FBSDKAccessToken.currentAccessToken() != nil && FBSDKAccessToken.currentAccessToken().hasGranted("pubish_actions")){*/
|
||||
|
||||
let graphRequest: FBSDKGraphRequest = FBSDKGraphRequest(graphPath: requestPath, parameters: params, HTTPMethod: "POST")
|
||||
graphRequest.startWithCompletionHandler({
|
||||
(id, result, error) -> Void in
|
||||
print(result)
|
||||
//save id in firebase so retrieval can be done later
|
||||
})
|
||||
//}
|
||||
/*else{
|
||||
print("must reauthenticate facebook")
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
//used to delete permissions and listings from users timeline, path must start with '/'
|
||||
func makeDELETIONResquest(requestPath: String!, params: [NSObject: AnyObject]!) -> Bool{
|
||||
|
||||
let graphRequest: FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me" + requestPath, parameters: params, HTTPMethod: "DELETE")
|
||||
let graphRequest: FBSDKGraphRequest = FBSDKGraphRequest(graphPath: requestPath, parameters: params, HTTPMethod: "DELETE")
|
||||
var boolResult: Bool = false
|
||||
dispatch_async(dispatch_get_main_queue(), {
|
||||
graphRequest.startWithCompletionHandler({
|
||||
(id, result, error) -> Void in
|
||||
print(result)
|
||||
|
||||
if(requestPath == "/permssions"){
|
||||
if(requestPath == "me/permssions"){
|
||||
if(error == nil){
|
||||
//this part is not getting called but almost have the oauth done
|
||||
boolResult = true
|
||||
|
||||
@ -59,13 +59,15 @@ class ItemImagePickerViewController: UIViewController {
|
||||
if(segue.identifier == "SelectNetworkSegue"){
|
||||
print(self.itemName.text!)
|
||||
print(self.itemDescription.text!)
|
||||
//print(self.possibleItemImage.image!)
|
||||
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)]]
|
||||
|
||||
var dict: Dictionary<String, AnyObject!> = ["title":self.itemName.text!, "description":self.itemDescription.text!, "price":self.itemPrice.text!, "category":self.pickerData[self.categoryPicker.selectedRowInComponent(0)]]
|
||||
dict["picture"] = self.possibleItemImage
|
||||
(segue.destinationViewController as! NetworksTableViewController).setListingDictionary(dict)
|
||||
(segue.destinationViewController as! NetworksTableViewController).setFBManager(((self.tabBarController as? HomeViewController)?.fbGraphManager)!)
|
||||
|
||||
(segue.destinationViewController as! NetworksTableViewController).setNetworkSelectFunctionality(true)
|
||||
print(self.categoryPicker.selectedRowInComponent(0))
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,9 @@ class ListingPreviewViewController: UIViewController {
|
||||
|
||||
//class variables
|
||||
private var networksDictionary: Dictionary<String, Bool> = Dictionary<String, Bool>()
|
||||
private var graphManager: FacebookGraphAPIManager! = nil
|
||||
private var itemListingDictionary: Dictionary<String, AnyObject>! = Dictionary<String, AnyObject>()
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@ -40,25 +43,33 @@ class ListingPreviewViewController: UIViewController {
|
||||
self.networks.backgroundView?.backgroundColor = UIColor.whiteColor()
|
||||
}
|
||||
|
||||
override func viewDidAppear(animated: Bool) {
|
||||
self.setListing()
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
func setListing(pic: UIImage, title: String, description: String, price: String, category: String){
|
||||
func setListing(){
|
||||
|
||||
//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
|
||||
*/
|
||||
|
||||
self.itemPicture.image = (self.itemListingDictionary["picture"] as? UIImageView)!.image
|
||||
self.itemTitle.text = self.itemListingDictionary["title"] as! String
|
||||
self.itemDescription.text = self.itemListingDictionary["description"] as! String
|
||||
self.itemPrice.text = self.itemListingDictionary["price"] as! String
|
||||
self.itemCategory.text = self.itemListingDictionary["category"] as! String
|
||||
}
|
||||
|
||||
func setDictionary(dictionary:Dictionary<String, Bool>){
|
||||
self.networksDictionary = dictionary
|
||||
func setDictionary(netdictionary:Dictionary<String, Bool>, itemdictionary: Dictionary<String, AnyObject!>){
|
||||
self.networksDictionary = netdictionary
|
||||
self.itemListingDictionary = itemdictionary
|
||||
}
|
||||
|
||||
func setFBManager(fbManager: FacebookGraphAPIManager){
|
||||
self.graphManager = fbManager
|
||||
}
|
||||
|
||||
|
||||
@ -80,6 +91,12 @@ extension ListingPreviewViewController {
|
||||
|
||||
@IBAction func publishItem(sender: AnyObject) {
|
||||
|
||||
//publish items to facebook if it is selected
|
||||
let str = "**"+self.itemTitle.text!+"**"+"\n\n"+"Sellng for: "+self.itemPrice.text!+"\n\n"+self.itemDescription.text!
|
||||
let parameters = ["message":str]
|
||||
|
||||
self.graphManager.makePOSTResquest("me/feed", params: parameters)
|
||||
|
||||
}
|
||||
|
||||
@IBAction func draftItem(sender: AnyObject) {
|
||||
@ -142,18 +159,45 @@ extension ListingPreviewViewController: UICollectionViewDataSource {
|
||||
|
||||
switch (indexPath.row){
|
||||
case 0:
|
||||
|
||||
cell = collectionView.dequeueReusableCellWithReuseIdentifier("ebay", forIndexPath: indexPath)
|
||||
|
||||
if(self.networksDictionary["ebay"] == false){
|
||||
cell.hidden = true
|
||||
}
|
||||
else{
|
||||
cell.hidden = false
|
||||
}
|
||||
break
|
||||
|
||||
case 1:
|
||||
cell = collectionView.dequeueReusableCellWithReuseIdentifier("amazon", forIndexPath: indexPath)
|
||||
|
||||
if(self.networksDictionary["amazon"] == false){
|
||||
cell.hidden = true
|
||||
}
|
||||
else{
|
||||
cell.hidden = false
|
||||
}
|
||||
break
|
||||
case 2:
|
||||
cell = collectionView.dequeueReusableCellWithReuseIdentifier("etsy", forIndexPath: indexPath)
|
||||
|
||||
if(self.networksDictionary["etsy"] == false){
|
||||
cell.hidden = true
|
||||
}
|
||||
else{
|
||||
cell.hidden = false
|
||||
}
|
||||
break
|
||||
default:
|
||||
cell = collectionView.dequeueReusableCellWithReuseIdentifier("facebook", forIndexPath: indexPath)
|
||||
|
||||
if(self.networksDictionary["facebook"] == false){
|
||||
cell.hidden = true
|
||||
}
|
||||
else{
|
||||
cell.hidden = false
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,8 @@ class NetworksTableViewController: UIViewController {
|
||||
private var networkToggleOrSelect: Bool = false
|
||||
private var networksDictionary: Dictionary<String, Bool> = ["ebay":false, "amazon":false,"etsy":false,"facebook":false]
|
||||
private var itemListingDictionary: Dictionary<String, AnyObject>! = Dictionary<String, AnyObject>()
|
||||
private var graphManager: FacebookGraphAPIManager! = nil
|
||||
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
@ -63,6 +65,10 @@ extension NetworksTableViewController {
|
||||
|
||||
}
|
||||
|
||||
func setFBManager(fbManager: FacebookGraphAPIManager){
|
||||
self.graphManager = fbManager
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -75,9 +81,10 @@ extension NetworksTableViewController {
|
||||
// Pass the selected object to the new view controller.
|
||||
|
||||
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)
|
||||
(segue.destinationViewController as! ListingPreviewViewController).setDictionary(self.networksDictionary, itemdictionary: self.itemListingDictionary)
|
||||
(segue.destinationViewController as! ListingPreviewViewController).setFBManager(self.graphManager)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -121,6 +128,7 @@ extension NetworksTableViewController: UITableViewDataSource {
|
||||
default:
|
||||
//loads network cell for ebay
|
||||
cell = (self.tableView.dequeueReusableCellWithIdentifier("facebook", forIndexPath: indexPath) as! FBTableViewCell)
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
@ -146,10 +154,12 @@ extension NetworksTableViewController: UITableViewDataSource {
|
||||
//loads network cell for facebook
|
||||
cell = (self.tableView.dequeueReusableCellWithIdentifier("facebook", forIndexPath: indexPath) as! FBTableViewCell)
|
||||
|
||||
if((self.tabBarController as? HomeViewController)?.fbGraphManager.isAuthorized)!{
|
||||
let tabBar = self.tabBarController
|
||||
if((tabBar as? HomeViewController)?.fbGraphManager.isAuthorized == true){
|
||||
|
||||
(cell as! FBTableViewCell).networkToggle.setOn(true, animated: false)
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -445,7 +455,7 @@ extension NetworksTableViewController: UITableViewDelegate {
|
||||
let didSucceed: Bool = ((tabBar as? HomeViewController)?.fbGraphManager.authorizeApp(self))!
|
||||
|
||||
cell.networkToggle.on = didSucceed
|
||||
//self.fbGraphManager.authorizeApp(self)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user