Merged branch Rapid-Dev-Branch into master

This commit is contained in:
Okechi Onyeje 2016-11-10 21:35:15 -05:00
commit ed66ebaa45
19 changed files with 1966 additions and 149 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -127,6 +127,11 @@
<key>primary</key>
<true/>
</dict>
<key>0EB19C1377A747F81110D44E2D5FCF78</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>0FF38C485BD8E73F614C919F834D6EAB</key>
<dict>
<key>primary</key>

View File

@ -16,6 +16,7 @@
3E1B1F0B1D2493EE00DBCF08 /* EtsySettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E1B1F0A1D2493EE00DBCF08 /* EtsySettingsViewController.swift */; };
3E1DC3CD1D4232490091BC60 /* CategoriesTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E1DC3CC1D4232490091BC60 /* CategoriesTableViewController.swift */; };
3E1DC3CF1D42328C0091BC60 /* CategoryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E1DC3CE1D42328C0091BC60 /* CategoryCell.swift */; };
3E3A004A1D76680E00A3A5B6 /* ServiceNotificationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3A00491D76680E00A3A5B6 /* ServiceNotificationManager.swift */; };
3E4897D11D0067030069F742 /* FirebaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E4897D01D0067030069F742 /* FirebaseManager.swift */; };
3E6CC3571CF2A94B00E00A70 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6CC3561CF2A94B00E00A70 /* AppDelegate.swift */; };
3E6CC3591CF2A94B00E00A70 /* SignInViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6CC3581CF2A94B00E00A70 /* SignInViewController.swift */; };
@ -40,6 +41,8 @@
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 */; };
3EE734E61DCD34AE00F771AE /* NotificationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EE734E51DCD34AE00F771AE /* NotificationsViewController.swift */; };
3EE734E81DCD34B900F771AE /* NotificationTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EE734E71DCD34B900F771AE /* NotificationTableViewCell.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 */; };
@ -74,6 +77,7 @@
3E1B1F0A1D2493EE00DBCF08 /* EtsySettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EtsySettingsViewController.swift; sourceTree = "<group>"; };
3E1DC3CC1D4232490091BC60 /* CategoriesTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CategoriesTableViewController.swift; sourceTree = "<group>"; };
3E1DC3CE1D42328C0091BC60 /* CategoryCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CategoryCell.swift; sourceTree = "<group>"; };
3E3A00491D76680E00A3A5B6 /* ServiceNotificationManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceNotificationManager.swift; sourceTree = "<group>"; };
3E4897D01D0067030069F742 /* FirebaseManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FirebaseManager.swift; sourceTree = "<group>"; };
3E6CC3531CF2A94B00E00A70 /* Vendoo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Vendoo.app; sourceTree = BUILT_PRODUCTS_DIR; };
3E6CC3561CF2A94B00E00A70 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@ -106,6 +110,8 @@
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>"; };
3EE734E51DCD34AE00F771AE /* NotificationsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationsViewController.swift; sourceTree = "<group>"; };
3EE734E71DCD34B900F771AE /* NotificationTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationTableViewCell.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; };
@ -171,6 +177,7 @@
3E4897CE1D0062860069F742 /* Services */ = {
isa = PBXGroup;
children = (
3E3A00491D76680E00A3A5B6 /* ServiceNotificationManager.swift */,
3EA668941D026E2A00EE57A8 /* EbayServices */,
3E4897CF1D00629B0069F742 /* FirebaseServices */,
3E7CF3FF1CF6363200F486B2 /* EtsyServices */,
@ -324,9 +331,19 @@
name = NewItemPostingSession;
sourceTree = "<group>";
};
3EE734E41DCD347900F771AE /* Notifications */ = {
isa = PBXGroup;
children = (
3EE734E71DCD34B900F771AE /* NotificationTableViewCell.swift */,
3EE734E51DCD34AE00F771AE /* NotificationsViewController.swift */,
);
name = Notifications;
sourceTree = "<group>";
};
3EFB0E2F1D0B95B200A05D7A /* Menu */ = {
isa = PBXGroup;
children = (
3EE734E41DCD347900F771AE /* Notifications */,
3E1AA4331D0DD0B2005FCCBB /* Settings */,
3EFB0E321D0B968300A05D7A /* SideMenuView.swift */,
3E1AA4311D0DA071005FCCBB /* MenuPanelViewController.swift */,
@ -741,6 +758,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3EE734E81DCD34B900F771AE /* NotificationTableViewCell.swift in Sources */,
3E6CC35B1CF2A94B00E00A70 /* SignUpViewController.swift in Sources */,
3E1AA4321D0DA071005FCCBB /* MenuPanelViewController.swift in Sources */,
3E4897D11D0067030069F742 /* FirebaseManager.swift in Sources */,
@ -753,11 +771,13 @@
3E7CF3FC1CF5FE9400F486B2 /* RecoverPasswordViewController.swift in Sources */,
3E1DC3CF1D42328C0091BC60 /* CategoryCell.swift in Sources */,
3EC325111CF703A600626C48 /* ItemCell.swift in Sources */,
3E3A004A1D76680E00A3A5B6 /* ServiceNotificationManager.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 */,
3EE734E61DCD34AE00F771AE /* NotificationsViewController.swift in Sources */,
3EC3252D1CF894C400626C48 /* ItemImagePickerViewController.swift in Sources */,
3E1DC3CD1D4232490091BC60 /* CategoriesTableViewController.swift in Sources */,
3E7CF4011CF6366300F486B2 /* EtsyRESTAPIManager.swift in Sources */,

View File

@ -0,0 +1,786 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "286"
endingLineNumber = "286"
landmarkName = "listingHasEnded(_:ebayInfo:amazonInfo:etsyInfo:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "293"
endingLineNumber = "293"
landmarkName = "listingHasEnded(_:ebayInfo:amazonInfo:etsyInfo:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EtsyRESTAPIManager.swift"
timestampString = "498402567.760806"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "625"
endingLineNumber = "625"
landmarkName = "getListingInfo(_:onCompletion:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EtsyRESTAPIManager.swift"
timestampString = "498399550.82937"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "618"
endingLineNumber = "618"
landmarkName = "getListingInfo(_:onCompletion:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EtsyRESTAPIManager.swift"
timestampString = "498402567.760806"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "623"
endingLineNumber = "623"
landmarkName = "getListingInfo(_:onCompletion:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ServiceNotificationManager.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "236"
endingLineNumber = "236">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500475450.307316"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "373"
endingLineNumber = "373"
landmarkName = "listingHasNewNotifications(_:ebayInfo:amazonInfo:etsyInfo:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500475450.307316"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "375"
endingLineNumber = "375"
landmarkName = "listingHasNewNotifications(_:ebayInfo:amazonInfo:etsyInfo:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/FacebookGraphAPIManager.swift"
timestampString = "500214475.708805"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "243"
endingLineNumber = "243"
landmarkName = "getListingInfo(_:onCompletion:)"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.FacebookGraphAPIManager.getListingInfo (Swift.ImplicitlyUnwrappedOptional&lt;Swift.String&gt;, onCompletion : Swift.ImplicitlyUnwrappedOptional&lt;(Swift.Optional&lt;Swift.AnyObject&gt;, Swift.Optional&lt;__ObjC.NSError&gt;) -&gt; ()&gt;) -&gt; ()"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FacebookGraphAPIManager.swift"
timestampString = "499916772.054646"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "244"
endingLineNumber = "244"
offsetFromSymbolStart = "357">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.FacebookGraphAPIManager.(getListingInfo (Swift.ImplicitlyUnwrappedOptional&lt;Swift.String&gt;, onCompletion : Swift.ImplicitlyUnwrappedOptional&lt;(Swift.Optional&lt;Swift.AnyObject&gt;, Swift.Optional&lt;__ObjC.NSError&gt;) -&gt; ()&gt;) -&gt; ()).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FacebookGraphAPIManager.swift"
timestampString = "499916772.054749"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "245"
endingLineNumber = "245"
offsetFromSymbolStart = "23">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/FacebookGraphAPIManager.swift"
timestampString = "500215169.912319"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "252"
endingLineNumber = "252"
landmarkName = "getListingInfo(_:onCompletion:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/FacebookGraphAPIManager.swift"
timestampString = "500215169.912319"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "255"
endingLineNumber = "255"
landmarkName = "FacebookGraphAPIManager"
landmarkType = "3">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/FacebookGraphAPIManager.swift"
timestampString = "500215169.912319"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "257"
endingLineNumber = "257">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ServiceNotificationManager.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "164"
endingLineNumber = "164"
landmarkName = "pollServices()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ServiceNotificationManager.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "170"
endingLineNumber = "170"
landmarkName = "pollServices()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ServiceNotificationManager.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "203"
endingLineNumber = "203"
landmarkName = "pollServices()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500475450.307316"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "403"
endingLineNumber = "403"
landmarkName = "listingHasNewNotifications(_:ebayInfo:amazonInfo:etsyInfo:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500475450.307316"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "410"
endingLineNumber = "410"
landmarkName = "listingHasNewNotifications(_:ebayInfo:amazonInfo:etsyInfo:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ServiceNotificationManager.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "174"
endingLineNumber = "174"
landmarkName = "pollServices()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "153"
endingLineNumber = "153"
landmarkName = "viewDidLoad()"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.HomeViewController.(viewDidLoad () -&gt; ()).(closure #1).(closure #1).(closure #1).(closure #1).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift"
timestampString = "500214480.386596"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "146"
endingLineNumber = "146"
offsetFromSymbolStart = "2573">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.HomeViewController.(viewDidLoad () -&gt; ()).(closure #1).(closure #1).(closure #1).(closure #1).(closure #1).(closure #2)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift"
timestampString = "500214480.386715"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "146"
endingLineNumber = "146"
offsetFromSymbolStart = "22978">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "165"
endingLineNumber = "165"
landmarkName = "viewDidLoad()"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.HomeViewController.(viewDidLoad () -&gt; ()).(closure #1).(closure #1).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift"
timestampString = "500215171.289152"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "155"
endingLineNumber = "155"
offsetFromSymbolStart = "1675">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.HomeViewController.(viewDidLoad () -&gt; ()).(closure #1).(closure #1).(closure #1).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift"
timestampString = "500215171.289318"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "155"
endingLineNumber = "155"
offsetFromSymbolStart = "1537">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/NotificationTableViewCell.swift"
timestampString = "499993520.858648"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "13"
endingLineNumber = "13"
landmarkName = "NotificationTableViewCell"
landmarkType = "3">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/FacebookGraphAPIManager.swift"
timestampString = "500214387.985452"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "245"
endingLineNumber = "245"
landmarkName = "getListingInfo(_:onCompletion:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/FacebookGraphAPIManager.swift"
timestampString = "500215169.912319"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "249"
endingLineNumber = "249"
landmarkName = "getListingInfo(_:onCompletion:)"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.FacebookGraphAPIManager.(getListingInfo (Swift.ImplicitlyUnwrappedOptional&lt;Swift.String&gt;, onCompletion : Swift.ImplicitlyUnwrappedOptional&lt;(Swift.Optional&lt;Swift.AnyObject&gt;, Swift.Optional&lt;__ObjC.NSError&gt;) -&gt; ()&gt;) -&gt; ()).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FacebookGraphAPIManager.swift"
timestampString = "500214480.389538"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "249"
endingLineNumber = "249"
offsetFromSymbolStart = "233">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.FacebookGraphAPIManager.(getListingInfo (Swift.ImplicitlyUnwrappedOptional&lt;Swift.String&gt;, onCompletion : Swift.ImplicitlyUnwrappedOptional&lt;(Swift.Optional&lt;Swift.AnyObject&gt;, Swift.Optional&lt;__ObjC.NSError&gt;) -&gt; ()&gt;) -&gt; ()).(closure #1).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/FacebookGraphAPIManager.swift"
timestampString = "500214480.389655"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "249"
endingLineNumber = "249"
offsetFromSymbolStart = "254">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "152"
endingLineNumber = "152"
landmarkName = "viewDidLoad()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "150"
endingLineNumber = "150"
landmarkName = "viewDidLoad()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "151"
endingLineNumber = "151"
landmarkName = "viewDidLoad()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/FacebookGraphAPIManager.swift"
timestampString = "500215169.912319"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "247"
endingLineNumber = "247"
landmarkName = "getListingInfo(_:onCompletion:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/ServiceNotificationManager.swift"
timestampString = "500219461.305955"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "128"
endingLineNumber = "128"
landmarkName = "pollServices()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "310"
endingLineNumber = "310"
landmarkName = "listingHasEnded(_:ebayInfo:amazonInfo:etsyInfo:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "313"
endingLineNumber = "313"
landmarkName = "listingHasEnded(_:ebayInfo:amazonInfo:etsyInfo:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500473804.952967"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "322"
endingLineNumber = "322"
landmarkName = "listingHasEnded(_:ebayInfo:amazonInfo:etsyInfo:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500475450.307316"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "335"
endingLineNumber = "335"
landmarkName = "listingHasEnded(_:ebayInfo:amazonInfo:etsyInfo:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500474943.700874"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "33"
endingLineNumber = "33"
landmarkName = "viewDidLoad()"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.HomeViewController.(viewDidLoad () -&gt; ()).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift"
timestampString = "500479034.794063"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "33"
endingLineNumber = "33"
offsetFromSymbolStart = "19">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.HomeViewController.(viewDidLoad () -&gt; ()).(closure #1).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/HomeViewController.swift"
timestampString = "500479034.794166"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "36"
endingLineNumber = "36"
offsetFromSymbolStart = "48">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/HomeViewController.swift"
timestampString = "500474964.899818"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "36"
endingLineNumber = "36"
landmarkName = "viewDidLoad()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/NotificationsViewController.swift"
timestampString = "500478897.162903"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "45"
endingLineNumber = "45"
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.NotificationsViewController.tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -&gt; ()"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/NotificationsViewController.swift"
timestampString = "500479034.795518"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "45"
endingLineNumber = "45"
offsetFromSymbolStart = "101">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.NotificationsViewController.(tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -&gt; ()).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/NotificationsViewController.swift"
timestampString = "500479034.795677"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "45"
endingLineNumber = "45"
offsetFromSymbolStart = "19">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.NotificationsViewController.(tableView (__ObjC.UITableView, didSelectRowAtIndexPath : __ObjC.NSIndexPath) -&gt; ()).(closure #1).(closure #1)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/NotificationsViewController.swift"
timestampString = "500479034.795815"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "45"
endingLineNumber = "45"
offsetFromSymbolStart = "15">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/NotificationsViewController.swift"
timestampString = "500479690.07453"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "58"
endingLineNumber = "58"
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

BIN
Vendoo/.DS_Store vendored

Binary file not shown.

View File

@ -19,11 +19,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
//configures firebase for app use
FIRApp.configure()
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let view: UIViewController!
if NSUserDefaults.standardUserDefaults().boolForKey("signedIn"){
view = storyboard.instantiateViewControllerWithIdentifier("SignInViewController")
}else {
view = storyboard.instantiateViewControllerWithIdentifier("SignUp")
}
self.window?.rootViewController = view
self.window?.makeKeyAndVisible()
//configure facebook for app
return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)

View File

@ -41,6 +41,9 @@ class EbayWebServiceManager: NSObject {
private var isGettingSubCategories: Bool = false
private var isRevisingListing: Bool = false
private var requestGroup: dispatch_group_t = dispatch_group_create()
var isGettingNotification: Bool = false
private var qtySold: Int!
private var currItemQuantity: Int!
//---------------------------------------------//
@ -346,6 +349,27 @@ extension EbayWebServiceManager {
self.catDetailLevel = detailLevel
self.requestMaker(soapMessage, theRequest: theRequest)
}
func getListingInfo(listingID: String, onComplete: ServiceResponse?){
var soapMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<GetItemRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\">" +
"<RequesterCredentials>" +
"<eBayAuthToken>\(self.xmlResponseDictionary["eBayAuthToken"] as! String)</eBayAuthToken>" +
"</RequesterCredentials>"
soapMessage = soapMessage +
"<ItemID>\(listingID)</ItemID>" +
"</GetItemRequest>"
let url = NSURL(string: self.baseURL)
let theRequest = NSMutableURLRequest(URL: url!)
theRequest.addValue("GetItem", forHTTPHeaderField: "X-EBAY-API-CALL-NAME")
self.completion = onComplete
self.isGettingNotification = true
self.requestMaker(soapMessage, theRequest: theRequest)
}
}
extension EbayWebServiceManager: NSURLConnectionDelegate {
@ -471,21 +495,23 @@ extension EbayWebServiceManager: NSXMLParserDelegate {
self.completion(nil, nil)
break
case "UserID" :
print(string)
EbayWebServiceManager.settingsDictionary["userID"] = string
NSUserDefaults.standardUserDefaults().setObject(EbayWebServiceManager.settingsDictionary, forKey: "ebaySettings")
print(self.xmlResponseDictionary["eBayAuthToken"])
let soapmessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<GetCategoriesRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\">" +
"<RequesterCredentials><eBayAuthToken>\(self.xmlResponseDictionary["eBayAuthToken"] as! String)</eBayAuthToken>" +
"</RequesterCredentials><CategorySiteID>0</CategorySiteID><DetailLevel>ReturnAll</DetailLevel><LevelLimit>1</LevelLimit>" +
"</GetCategoriesRequest>"
let url = NSURL(string: self.baseURL)
let theRequest = NSMutableURLRequest(URL: url!)
theRequest.addValue("GetCategories", forHTTPHeaderField: "X-EBAY-API-CALL-NAME")
self.completion(nil, nil)
self.requestMaker(soapmessage, theRequest: theRequest)
if(!self.isGettingNotification) {
print(string)
EbayWebServiceManager.settingsDictionary["userID"] = string
NSUserDefaults.standardUserDefaults().setObject(EbayWebServiceManager.settingsDictionary, forKey: "ebaySettings")
print(self.xmlResponseDictionary["eBayAuthToken"])
let soapmessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<GetCategoriesRequest xmlns=\"urn:ebay:apis:eBLBaseComponents\">" +
"<RequesterCredentials><eBayAuthToken>\(self.xmlResponseDictionary["eBayAuthToken"] as! String)</eBayAuthToken>" +
"</RequesterCredentials><CategorySiteID>0</CategorySiteID><DetailLevel>ReturnAll</DetailLevel><LevelLimit>1</LevelLimit>" +
"</GetCategoriesRequest>"
let url = NSURL(string: self.baseURL)
let theRequest = NSMutableURLRequest(URL: url!)
theRequest.addValue("GetCategories", forHTTPHeaderField: "X-EBAY-API-CALL-NAME")
self.completion(nil, nil)
self.requestMaker(soapmessage, theRequest: theRequest)
}
break
/*
Used to build both the top level categories, and subcategories on request during item listing workflow
@ -497,9 +523,16 @@ extension EbayWebServiceManager: NSXMLParserDelegate {
self.catLevel = string
break
case "CategoryName" :
if(!self.isGettingSubCategories) {
if((EbayWebServiceManager.settingsDictionary["categories"]) == nil) {
EbayWebServiceManager.settingsDictionary["categories"] = Dictionary<String , Dictionary<String, AnyObject>>()
if (!self.isGettingNotification) {
if(!self.isGettingSubCategories) {
if((EbayWebServiceManager.settingsDictionary["categories"]) == nil) {
EbayWebServiceManager.settingsDictionary["categories"] = Dictionary<String , Dictionary<String, AnyObject>>()
}
var dict: Dictionary<String, Dictionary<String, AnyObject>> = (EbayWebServiceManager.settingsDictionary["categories"]!) as! Dictionary<String, Dictionary<String, AnyObject>>
dict[string] = ["cat_id": self.catID, "isLeaf": false, "level": self.catLevel]
EbayWebServiceManager.settingsDictionary["categories"] = dict
NSUserDefaults.standardUserDefaults().setObject(EbayWebServiceManager.settingsDictionary, forKey: "ebaySettings")
}
var dict: Dictionary<String, Dictionary<String, AnyObject>> = (EbayWebServiceManager.settingsDictionary["categories"]!) as! Dictionary<String, Dictionary<String, AnyObject>>
@ -509,16 +542,17 @@ extension EbayWebServiceManager: NSXMLParserDelegate {
}
else {
if "\(self.catDetailLevel)" == self.catLevel {
/*if "\(self.catDetailLevel)" == self.catLevel {
if((self.subCategories[string] == nil )){
self.subCategories[string] = ["cat_id": self.catID, "isLeaf": false, "level": self.catLevel]
}
}
self.currentCategory = string*/
}
self.currentCategory = string
break
case "LeafCategory":
@ -547,13 +581,38 @@ extension EbayWebServiceManager: NSXMLParserDelegate {
Used during the listing creation process to save the new listing id, as well as adding pictures to the new listing
*/
case "ItemID":
self.completion(string, nil)
if (!self.isGettingNotification) {
self.completion(string, nil)
}
break
case "ReviseItemResponse":
self.isRevisingListing = true
break
/*
Used for retrieving listing info for notifications
*/
case "Quantity":
if self.isGettingNotification {
print("Quantity: \(string)")
self.currItemQuantity = Int(string)
}
break
case "QuantitySold":
if self.isGettingNotification {
print("QuantitySold: \(string)")
self.qtySold = Int(string)
}
break
case "ListingStatus":
if self.isGettingNotification {
print("ListingStatus: \(string)")
self.completion(["status":string, "quantitySold": self.qtySold, "itemQuantity": self.currItemQuantity], nil)
self.qtySold = nil
self.currItemQuantity = nil
}
break
default:
//print(string)
print("\(self.currentElementName):\(string)")

View File

@ -608,6 +608,28 @@ extension EtsyRESTAPIManager {
)
}
//gets listing info
func getListingInfo (request: String, onCompletion: ServiceResponse?) {
self.oauthswift.client.get(self.baseURL + request,
success: {
(data, response) -> Void in
let dataString = NSString(data: data, encoding: NSUTF8StringEncoding)
let dict = self.convertStringToDictionary(dataString! as String)
print(dict)
print(response)
var dict2 = (dict!["results"] as! [[String : AnyObject]])
let listingState = dict2[0]["state"] as! String
onCompletion!(["status":listingState], nil)
}, failure: {
(error) -> Void in
print(error)
}
)}
//sends the pregenerated url as a request to api service
func sendPOSTRequest(request: String, var body: [String: AnyObject]?, onCompletion: ServiceResponse?) {

View File

@ -238,4 +238,18 @@ extension FacebookGraphAPIManager {
return boolResult
}
func getListingInfo(requestPath: String!, onCompletion: ServiceResponse!){
let graphRequest:FBSDKGraphRequest = FBSDKGraphRequest(graphPath: requestPath, parameters: nil, HTTPMethod: "GET")
dispatch_async(dispatch_get_main_queue(), {
graphRequest.startWithCompletionHandler({
(id, result, error) -> Void in
if error == nil {
onCompletion((result as! [String : AnyObject])["data"] as! [[String:AnyObject]],nil)
}
})
})
}
}

View File

@ -16,11 +16,16 @@ class HomeViewController: UITabBarController {
let firebaseManager = FirebaseManager()
let ebayGraphManager = EbayWebServiceManager()
var userListings: [Listing] = []
var endedListings: [Listing] = []
var soldListings: [Listing] = []
var notificationsManager = ServiceNotificationManager()
var notifications: [Dictionary<String, AnyObject>] = (NSUserDefaults.standardUserDefaults().objectForKey("notifications") == nil ? [] : (NSUserDefaults.standardUserDefaults().objectForKey("notifications") as! [Dictionary<String, AnyObject>]))
override func viewDidLoad() {
super.viewDidLoad()
ServiceNotificationManager.delegate = self
self.notificationsManager.setManagers(fbGraphManager, fireManager: firebaseManager, ebayManager: ebayGraphManager, etsyManager: etsyManager)
// Do any additional setup after loading the view.
dispatch_async(dispatch_get_main_queue(), {
@ -32,14 +37,27 @@ class HomeViewController: UITabBarController {
let listingDict = userDict!["user_Listings"] as? [String : AnyObject]
//sync notifications
/*if userDict!["notifications"] != nil {
self.notifications = []
for (_, v) in userDict!["notifications"] as! [String : AnyObject] {
if v["seen"] as! Bool == false {
self.notifications.append(v as! Dictionary<String, AnyObject>)
}
}
NSUserDefaults.standardUserDefaults().setObject(self.notifications, forKey: "notifications")
}*/
NSUserDefaults.standardUserDefaults().setObject(userDict!["name"] as? String, forKey: "name")
if listingDict != nil {
var notificationStartTracker = 0
dispatch_async(dispatch_get_main_queue(), {
//let notificationStartGroup = dispatch_group_create()
for (key, values) in listingDict! {
let serviceGroup: dispatch_group_t = dispatch_group_create()
//dispatch_group_enter(notificationStartGroup)
self.firebaseManager.ref.observeSingleEventOfType(.Value, withBlock: { snapshot in
let databaseDict = snapshot.value as! [String : AnyObject]
@ -54,6 +72,7 @@ class HomeViewController: UITabBarController {
if(error != nil){
print("problem retrieving items")
notificationStartTracker += 1
}else{
let mainImage = UIImage(data: dataMain!)
@ -74,6 +93,9 @@ class HomeViewController: UITabBarController {
count+=1
if(count == 4){
dispatch_group_leave(serviceGroup)
notificationStartTracker += 1
//dispatch_group_enter(notificationStartGroup)
//dispatch_group_leave(notificationStartGroup)
}
})
@ -83,20 +105,58 @@ class HomeViewController: UITabBarController {
dispatch_group_notify(serviceGroup, dispatch_get_main_queue(), {
print(listingImages.count)
let listingInfo = values as? [String : AnyObject]
self.userListings.append(
Listing(itemTitle: (listingInfo!["listingTitle"] as? String)!,
itemCategory: listingInfo!["listingCategory"] as? String,
itemQuantity: (listingInfo!["listingQuantity"] as? String)!,
itemPrice: listingInfo!["listingPrice"] as? String,
itemDescription: listingInfo!["listingDescription"] as? String,
itemImages: listingImages,
isDraftListing: (listingInfo!["isListingDraft"] as? Bool)!,
itemKey: key,
networksSellingOn: (listingInfo!["networks"] as? Dictionary<String, Bool>)!
))
NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil)
if listingInfo!["listingStatus"] == nil {
self.userListings.append(
Listing(itemTitle: (listingInfo!["listingTitle"] as? String)!,
itemCategory: listingInfo!["listingCategory"] as? String,
itemQuantity: (listingInfo!["listingQuantity"] as? String)!,
itemPrice: listingInfo!["listingPrice"] as? String,
itemDescription: listingInfo!["listingDescription"] as? String,
itemImages: listingImages,
isDraftListing: (listingInfo!["isListingDraft"] as? Bool)!,
itemKey: key,
networksSellingOn: (listingInfo!["networks"] as? Dictionary<String, Bool>)!
))
}
else if listingInfo!["listingStatus"] as? String == "Ended" {
self.endedListings.append(
Listing(itemTitle: (listingInfo!["listingTitle"] as? String)!,
itemCategory: listingInfo!["listingCategory"] as? String,
itemQuantity: (listingInfo!["listingQuantity"] as? String)!,
itemPrice: listingInfo!["listingPrice"] as? String,
itemDescription: listingInfo!["listingDescription"] as? String,
itemImages: listingImages,
isDraftListing: (listingInfo!["isListingDraft"] as? Bool)!,
itemKey: key,
networksSellingOn: (listingInfo!["networks"] as? Dictionary<String, Bool>)!
))
}
else if listingInfo!["listingStatus"] as? String == "Sold" {
self.soldListings.append(
Listing(itemTitle: (listingInfo!["listingTitle"] as? String)!,
itemCategory: listingInfo!["listingCategory"] as? String,
itemQuantity: (listingInfo!["listingQuantity"] as? String)!,
itemPrice: listingInfo!["listingPrice"] as? String,
itemDescription: listingInfo!["listingDescription"] as? String,
itemImages: listingImages,
isDraftListing: (listingInfo!["isListingDraft"] as? Bool)!,
itemKey: key,
networksSellingOn: (listingInfo!["networks"] as? Dictionary<String, Bool>)!
))
}
print(notificationStartTracker)
if(notificationStartTracker == listingDict?.count){
NSNotificationCenter.defaultCenter().postNotificationName("finished_fetching_listings", object: nil)
self.notificationsManager.setListings(self.userListings)
self.notificationsManager.startServicePolling()
}
})
@ -108,6 +168,11 @@ class HomeViewController: UITabBarController {
}
/*
dispatch_group_notify(notificationStartGroup, dispatch_get_main_queue(), {
})*/
@ -139,3 +204,239 @@ class HomeViewController: UITabBarController {
}
extension HomeViewController: ServiceNotificationManagerDelegate {
func listingHasFinishedRetrievingNotifications() {
NSUserDefaults.standardUserDefaults().setObject(self.notifications, forKey: "notifications")
}
func listingHasStartedRetrievingNotifications() {
}
func listingHasEnded(fbInfo: AnyObject?, ebayInfo: AnyObject?, amazonInfo: AnyObject?, etsyInfo: AnyObject?) {
var notificationArray: [[String: AnyObject]] = self.notifications
if (fbInfo != nil) {
notificationArray.append(
[
"network": "facebook",
"message": (ebayInfo as! [String : AnyObject])["notification"] as! String,
"type": "ended",
"seen":false,
"key": (ebayInfo as! [String : AnyObject])["listingKey"] as! String,
"UUID": NSUUID().UUIDString
]
)
}
if (ebayInfo != nil) {
let notification = [
"network": "ebay",
"message": (ebayInfo as! [String : AnyObject])["notification"] as! String,
"type": (ebayInfo as! [String : AnyObject])["type"] as! String,
"seen":false,
"key": (ebayInfo as! [String : AnyObject])["listingKey"] as! String,
"UUID": NSUUID().UUIDString
]
notificationArray.append(
notification as! [String : AnyObject]
)
self.endedListings.appendContentsOf( self.userListings.filter({$0.key == ((ebayInfo as! [String : AnyObject])["listingKey"] as! String)}))
self.userListings = self.userListings.filter({$0.key != ((ebayInfo as! [String : AnyObject])["listingKey"] as! String)})
let itemsView = self.viewControllers![0] as! ItemTableViewController
/*self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)/user_Listings/\(((ebayInfo as! [String : AnyObject])["listingKey"] as! String))").observeSingleEventOfType( .Value, withBlock: {
(snapshot) -> Void in
var listingDict = snapshot.value as? [String : AnyObject]
listingDict!["listingStatus"] = "Ended"
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)/user_Listings/\(((ebayInfo as! [String : AnyObject])["listingKey"] as! String))").setValue(listingDict)
itemsView.itemTable.reloadData()
})*/
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)").observeSingleEventOfType( .Value, withBlock: {
(snapshot) -> Void in
var userDict = snapshot.value as? [String : AnyObject]
var notifications = userDict!["notifications"] as? [String: AnyObject]
if notifications == nil {
userDict!["notifications"] = [((ebayInfo as! [String : AnyObject])["listingKey"] as! String):notification]
}else {
notifications![((ebayInfo as! [String : AnyObject])["listingKey"] as! String)] = notification
userDict!["notifications"] = notifications
}
var listings = userDict!["user_Listings"] as! [String: AnyObject]
var listingDict = (listings[((ebayInfo as! [String : AnyObject])["listingKey"] as! String)] as! [String : AnyObject])
listingDict["listingStatus"] = "Ended"
//save everything back to their respective dictionaries
listings[((ebayInfo as! [String : AnyObject])["listingKey"] as! String)] = listingDict
userDict!["user_Listings"] = listings
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)").setValue(userDict, withCompletionBlock: {
(error, reference) -> Void in
if error == nil {
//reload data for notifications
NSUserDefaults.standardUserDefaults().setObject(notificationArray, forKey: "notifications")
itemsView.itemTable.reloadData()
}
})
})
}
if (amazonInfo != nil) {
notificationArray.append(
[
"network": "amazon",
"message": (ebayInfo as! [String : AnyObject])["notification"] as! String,
"type": (ebayInfo as! [String : AnyObject])["type"] as! String,
"seen":false,
"key": (ebayInfo as! [String : AnyObject])["listingKey"] as! String,
"UUID": NSUUID().UUIDString
]
)
}
if (etsyInfo != nil) {
let notification = [
"network": "etsy",
"message": (etsyInfo as! [String : AnyObject])["notification"] as! String,
"type": "ended",
"seen":false,
"key": (etsyInfo as! [String : AnyObject])["listingKey"] as! String,
"UUID": NSUUID().UUIDString
]
notificationArray.append(
notification as! [String : AnyObject]
)
self.endedListings.appendContentsOf( self.userListings.filter({$0.key == ((etsyInfo as! [String : AnyObject])["listingKey"] as! String)}))
self.userListings = self.userListings.filter({$0.key != ((etsyInfo as! [String : AnyObject])["listingKey"] as! String)})
let itemsView = self.viewControllers![0] as! ItemTableViewController
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)").observeSingleEventOfType( .Value, withBlock: {
(snapshot) -> Void in
var userDict = snapshot.value as? [String : AnyObject]
var notifications = userDict!["notifications"] as? [String: AnyObject]
if notifications == nil {
userDict!["notifications"] = [((etsyInfo as! [String : AnyObject])["listingKey"] as! String):notification]
}else {
notifications![((etsyInfo as! [String : AnyObject])["listingKey"] as! String)] = notification
userDict!["notifications"] = notifications
}
var listings = userDict!["user_Listings"] as! [String: AnyObject]
var listingDict = (listings[((etsyInfo as! [String : AnyObject])["listingKey"] as! String)] as! [String : AnyObject])
listingDict["listingStatus"] = "Ended"
//save everything back to their respective dictionaries
listings[((etsyInfo as! [String : AnyObject])["listingKey"] as! String)] = listingDict
userDict!["user_Listings"] = listings
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)").setValue(userDict, withCompletionBlock: {
(error, reference) -> Void in
if error == nil {
//reload data for notifications
NSUserDefaults.standardUserDefaults().setObject(notificationArray, forKey: "notifications")
itemsView.itemTable.reloadData()
}
})
})
}
}
func listingHasNewNotifications(fbInfo: AnyObject?, ebayInfo: AnyObject?, amazonInfo: AnyObject?, etsyInfo: AnyObject?) {
var notificationArray: [Dictionary<String, AnyObject>] = self.notifications
if (fbInfo != nil) {
notificationArray.append(fbInfo as! [String : AnyObject])
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)").observeSingleEventOfType(.Value, withBlock: {
(snapshot) -> Void in
var userDict = snapshot.value as? [String : AnyObject]
if (userDict!["notifications"] != nil) {
var notificationsFir = userDict!["notifications"] as! [String : AnyObject]
notificationsFir[fbInfo!["UUID"] as! String] = fbInfo
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)/notifications").setValue(notificationsFir, withCompletionBlock: {
(error, reference) -> Void in
if error == nil {
NSUserDefaults.standardUserDefaults().setObject(notificationArray, forKey: "notifications")
}
})
}else {
let id = (fbInfo!["UUID"] as! String)
print(id)
userDict!["notifications"] = ([ id : fbInfo as! [String:AnyObject]])
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)").setValue(userDict, withCompletionBlock: {
(error, reference) -> Void in
if error == nil {
NSUserDefaults.standardUserDefaults().setObject(notificationArray, forKey: "notifications")
}
})
}
})
}
if (ebayInfo != nil) {
notificationArray.append(
[
"network": "ebay",
"message": (ebayInfo as! [String : AnyObject])["notification"] as! String,
"type": (ebayInfo as! [String : AnyObject])["type"] as! String,
"key": (ebayInfo as! [String : AnyObject])["listingKey"] as! String,
"UUID": NSUUID().UUIDString
]
)
}
if (amazonInfo != nil) {
notificationArray.append(
[
"network": "amazon",
"message": (ebayInfo as! [String : AnyObject])["notification"] as! String,
"type": "",
"key": (ebayInfo as! [String : AnyObject])["listingKey"] as! String,
"UUID": NSUUID().UUIDString
]
)
}
if (etsyInfo != nil) {
notificationArray.append(
[
"network": "etsy",
"message": (etsyInfo as! [String : AnyObject])["notification"] as! String,
"type": (etsyInfo as! [String : AnyObject])["type"] as! String,
"key": (etsyInfo as! [String : AnyObject])["listingKey"] as! String,
"UUID": NSUUID().UUIDString
]
)
}
//@TODO: add firbase logic to add notifications and delete already viewed notifications
//reload data for notifications
}
}

View File

@ -45,6 +45,8 @@ class ItemImagePickerViewController: UIViewController {
private var imageIndex: Int!
private var isEditing: Bool = false
private var currentInformation: Dictionary<String, AnyObject>!
override func viewDidLoad() {
super.viewDidLoad()
@ -292,7 +294,7 @@ extension ItemImagePickerViewController: UIImagePickerControllerDelegate, UINavi
(alert: UIAlertAction!) -> Void in
})
let cameraAction = UIAlertAction(title: "Take a New Pic", style: .Default, handler: {
let cameraAction = UIAlertAction(title: "Take a New Item Picture", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in
self.picker.allowsEditing = false
self.picker.sourceType = UIImagePickerControllerSourceType.Camera
@ -301,7 +303,7 @@ extension ItemImagePickerViewController: UIImagePickerControllerDelegate, UINavi
})
let galleryAction = UIAlertAction(title: "Select a Profile Pic", style: .Default, handler: {
let galleryAction = UIAlertAction(title: "Select a Picture for Your Item", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in
self.picker.allowsEditing = false
self.picker.sourceType = .PhotoLibrary

View File

@ -80,6 +80,12 @@ class ItemTableViewController: UIViewController {
}
// MARK: - IBAction
extension ItemTableViewController {
@IBAction func segSwitch(sender: UISegmentedControl) {
self.itemTable.reloadData()
}
}
// MARK: - Navigation
extension ItemTableViewController {
@ -129,63 +135,143 @@ extension ItemTableViewController: UITableViewDataSource{
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return ((self.tabBarController as? HomeViewController)?.userListings.count)!
if self.tableSegmentController.selectedSegmentIndex == 0 {
return ((self.tabBarController as? HomeViewController)?.userListings.count)!
}
else if tableSegmentController.selectedSegmentIndex == 1 {
return ((self.tabBarController as? HomeViewController)?.endedListings.count)!
}
else{
return ((self.tabBarController as? HomeViewController)?.soldListings.count)!
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: ItemCell! = (tableView.dequeueReusableCellWithIdentifier("Item Cell", forIndexPath: indexPath) as! ItemCell)
// Configure the cell...
//for each listing cell generated need to find the marketplaces it belongs to, the listing price, the name of the item, the status of the item, and the item image.
//Once these objects are retrieved, access the ItemCell properties and manipulate as needed
cell.itemImage.image = (self.tabBarController as? HomeViewController)?.userListings[indexPath.row].images[0] //come back
cell.itemName.text = (self.tabBarController as? HomeViewController)!.userListings[indexPath.row].title
cell.itemPrice.text = (self.tabBarController as? HomeViewController)!.userListings[indexPath.row].price
//check if item is published
if((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].isDraft!){
cell.itemStatus.text = "Status: Unpublished"
dispatch_async(dispatch_get_main_queue(), {
cell.alpha = 0.5
})
if self.tableSegmentController.selectedSegmentIndex == 0 {
cell.itemImage.image = (self.tabBarController as? HomeViewController)?.userListings[indexPath.row].images[0] //come back
cell.itemName.text = (self.tabBarController as? HomeViewController)!.userListings[indexPath.row].title
cell.itemPrice.text = (self.tabBarController as? HomeViewController)!.userListings[indexPath.row].price
}else {
cell.itemStatus.text = "Status: Active"
}
if(!((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].networks["areNetworksChosen"])!){
cell.networks.hidden = true
}else{
dispatch_async(dispatch_get_main_queue(), {
if(!((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].networks["ebay"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true
}
if(!((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].networks["amazon"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true
}
if(!((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].networks["etsy"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = true
//check if item is published
if((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].isDraft!){
cell.itemStatus.text = "Status: Unpublished"
dispatch_async(dispatch_get_main_queue(), {
}
if(!((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].networks["facebook"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = true
}
})
cell.alpha = 0.5
})
}else {
cell.itemStatus.text = "Status: Active"
}
if(!((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].networks["areNetworksChosen"])!){
cell.networks.hidden = true
}else{
dispatch_async(dispatch_get_main_queue(), {
if(!((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].networks["ebay"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true
}
if(!((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].networks["amazon"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true
}
if(!((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].networks["etsy"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = true
}
if(!((self.tabBarController as? HomeViewController)!.userListings[indexPath.row].networks["facebook"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = true
}
})
}
}
else if tableSegmentController.selectedSegmentIndex == 1 {
cell.itemImage.image = (self.tabBarController as? HomeViewController)?.endedListings[indexPath.row].images[0] //come back
cell.itemName.text = (self.tabBarController as? HomeViewController)!.endedListings[indexPath.row].title
cell.itemPrice.text = (self.tabBarController as? HomeViewController)!.endedListings[indexPath.row].price
cell.itemStatus.text = "Status: Unsold"
if(!((self.tabBarController as? HomeViewController)!.endedListings[indexPath.row].networks["areNetworksChosen"])!){
cell.networks.hidden = true
}else{
dispatch_async(dispatch_get_main_queue(), {
if(!((self.tabBarController as? HomeViewController)!.endedListings[indexPath.row].networks["ebay"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true
}
if(!((self.tabBarController as? HomeViewController)!.endedListings[indexPath.row].networks["amazon"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true
}
if(!((self.tabBarController as? HomeViewController)!.endedListings[indexPath.row].networks["etsy"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = true
}
if(!((self.tabBarController as? HomeViewController)!.endedListings[indexPath.row].networks["facebook"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = true
}
})
}
}
else{
cell.itemImage.image = (self.tabBarController as? HomeViewController)?.soldListings[indexPath.row].images[0] //come back
cell.itemName.text = (self.tabBarController as? HomeViewController)!.soldListings[indexPath.row].title
cell.itemPrice.text = (self.tabBarController as? HomeViewController)!.soldListings[indexPath.row].price
cell.itemStatus.text = "Status: Sold"
if(!((self.tabBarController as? HomeViewController)!.soldListings[indexPath.row].networks["areNetworksChosen"])!){
cell.networks.hidden = true
}else{
dispatch_async(dispatch_get_main_queue(), {
if(!((self.tabBarController as? HomeViewController)!.soldListings[indexPath.row].networks["ebay"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 0, inSection: 0))?.hidden = true
}
if(!((self.tabBarController as? HomeViewController)!.soldListings[indexPath.row].networks["amazon"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 1, inSection: 0))?.hidden = true
}
if(!((self.tabBarController as? HomeViewController)!.soldListings[indexPath.row].networks["etsy"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 2, inSection: 0))?.hidden = true
}
if(!((self.tabBarController as? HomeViewController)!.soldListings[indexPath.row].networks["facebook"])!){
cell.networks.cellForItemAtIndexPath(NSIndexPath(forRow: 3, inSection: 0))?.hidden = true
}
})
}
}
return cell
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
self.selectedListing = (self.tabBarController as? HomeViewController)?.userListings[indexPath.row]
if self.tableSegmentController.selectedSegmentIndex == 0 {
self.selectedListing = (self.tabBarController as? HomeViewController)?.userListings[indexPath.row]
}
else if tableSegmentController.selectedSegmentIndex == 1 {
self.selectedListing = (self.tabBarController as? HomeViewController)?.endedListings[indexPath.row]
}
else{
self.selectedListing = (self.tabBarController as? HomeViewController)?.soldListings[indexPath.row]
}
self.performSegueWithIdentifier("ItemDetailSegue", sender: self)
}
}

View File

@ -20,6 +20,7 @@ class Listing : NSObject {
var images: [UIImage]!
var key: String!
var networks: Dictionary<String, Bool>!
var listingStatus: String!
init(itemTitle:String, itemCategory: String!, itemQuantity: String!, itemPrice: String!, itemDescription: String!, itemImages: [UIImage], isDraftListing: Bool, itemKey: String, networksSellingOn: Dictionary<String, Bool>){

View File

@ -157,7 +157,7 @@
<!--signUp-->
<scene sceneID="gw9-WW-JKc">
<objects>
<viewController title="signUp" id="PkF-1J-5AZ" customClass="SignUpViewController" customModule="Vendoo" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="SignUp" title="signUp" id="PkF-1J-5AZ" customClass="SignUpViewController" customModule="Vendoo" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="6cj-br-zY3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@ -491,7 +491,7 @@
<rect key="frame" x="0.0" y="1" width="375" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="acC-eR-nNa" id="yUA-0e-cbV">
<rect key="frame" x="0.0" y="0.0" width="375" height="99"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="99.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ebay_icon" id="7It-fU-0EG">
@ -515,6 +515,9 @@
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" id="7Q7-qK-aGr">
<rect key="frame" x="307" y="34" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<action selector="toggleNetworkSelection:" destination="7B0-PA-tjd" eventType="valueChanged" id="EnM-Bm-fpQ"/>
</connections>
</switch>
</subviews>
</tableViewCellContentView>
@ -526,7 +529,7 @@
<rect key="frame" x="0.0" y="101" width="375" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2Cb-tk-QlG" id="Adl-PW-EHy">
<rect key="frame" x="0.0" y="0.0" width="375" height="99"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="99.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="amazon_icon" id="fPK-fm-tET">
@ -550,6 +553,9 @@
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" id="TCc-Ei-qHU">
<rect key="frame" x="309" y="34" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<action selector="toggleNetworkSelection:" destination="7B0-PA-tjd" eventType="valueChanged" id="INb-4k-6kb"/>
</connections>
</switch>
</subviews>
</tableViewCellContentView>
@ -561,7 +567,7 @@
<rect key="frame" x="0.0" y="201" width="375" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="R8s-EW-CYG" id="LkI-ex-htQ">
<rect key="frame" x="0.0" y="0.0" width="375" height="99"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="99.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="etsy_icon" id="PDs-eE-upV">
@ -585,6 +591,9 @@
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" id="unb-A5-8G6">
<rect key="frame" x="312" y="34" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<action selector="toggleNetworkSelection:" destination="7B0-PA-tjd" eventType="valueChanged" id="QfN-uQ-b6i"/>
</connections>
</switch>
</subviews>
</tableViewCellContentView>
@ -596,7 +605,7 @@
<rect key="frame" x="0.0" y="301" width="375" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="xYX-kc-DDZ" id="npb-CY-Fjx">
<rect key="frame" x="0.0" y="0.0" width="375" height="99"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="99.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="facebook_icon" id="KPG-M6-vs4">
@ -620,6 +629,9 @@
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" id="Uk5-WJ-w8g">
<rect key="frame" x="312" y="34" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<action selector="toggleNetworkSelection:" destination="7B0-PA-tjd" eventType="valueChanged" id="kjy-0g-c4g"/>
</connections>
</switch>
</subviews>
</tableViewCellContentView>
@ -631,7 +643,7 @@
<rect key="frame" x="0.0" y="401" width="375" height="39"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="9j4-EI-pMS" id="a2e-WJ-7dG">
<rect key="frame" x="0.0" y="0.0" width="375" height="38"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="38.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Recomended Marketplaces" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ARt-Sv-6t0">
@ -649,7 +661,7 @@
<rect key="frame" x="0.0" y="440" width="375" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="X0o-qm-Gtd" id="HHH-by-zJb">
<rect key="frame" x="0.0" y="0.0" width="375" height="99"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="99.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="facebook_grey" id="V9I-Zd-xQh">
@ -949,7 +961,7 @@
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ebay" id="qet-e3-dU6">
<rect key="frame" x="0.0" y="11" width="40" height="40"/>
<rect key="frame" x="0.0" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -965,7 +977,7 @@
<size key="customSize" width="40" height="40"/>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="1" contentMode="center" reuseIdentifier="amazon" id="SEr-aZ-MWl">
<rect key="frame" x="45" y="11" width="40" height="40"/>
<rect key="frame" x="45" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -980,7 +992,7 @@
</view>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="2" contentMode="center" reuseIdentifier="etsy" id="IdF-c7-R14">
<rect key="frame" x="90" y="11" width="40" height="40"/>
<rect key="frame" x="90" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -995,7 +1007,7 @@
</view>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="3" contentMode="center" reuseIdentifier="facebook" id="yWZ-NA-tkb">
<rect key="frame" x="135" y="11" width="40" height="40"/>
<rect key="frame" x="135" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -1230,14 +1242,18 @@
</navigationItem>
</items>
</navigationBar>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" id="X2D-np-ma4">
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" id="X2D-np-ma4">
<rect key="frame" x="0.0" y="44" width="375" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<segments>
<segment title="Selling"/>
<segment title="Unsold"/>
<segment title="Sold"/>
</segments>
<color key="tintColor" red="0.2784313725" green="0.80392156859999997" blue="0.68235294120000001" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<action selector="segSwitch:" destination="Iwh-sn-a0Q" eventType="valueChanged" id="YfI-EH-qgs"/>
</connections>
</segmentedControl>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="123" sectionHeaderHeight="1" sectionFooterHeight="28" id="Thg-pb-lhN">
<rect key="frame" x="0.0" y="72" width="375" height="543"/>
@ -1248,7 +1264,7 @@
<rect key="frame" x="0.0" y="1" width="375" height="123"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="zmO-fi-nTP" id="CoK-hy-32b">
<rect key="frame" x="0.0" y="0.0" width="375" height="122"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="122.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="account" id="eWu-ob-xKv">
@ -1297,7 +1313,7 @@
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ebay" id="bUa-Lo-TSK">
<rect key="frame" x="0.0" y="11" width="40" height="40"/>
<rect key="frame" x="0.0" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -1313,7 +1329,7 @@
<size key="customSize" width="40" height="40"/>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="1" contentMode="center" reuseIdentifier="amazon" id="mXI-4r-eAB">
<rect key="frame" x="45" y="11" width="40" height="40"/>
<rect key="frame" x="45" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -1328,7 +1344,7 @@
</view>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="2" contentMode="center" reuseIdentifier="etsy" id="8Ch-qr-5oN">
<rect key="frame" x="90" y="11" width="40" height="40"/>
<rect key="frame" x="90" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -1343,7 +1359,7 @@
</view>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="3" contentMode="center" reuseIdentifier="facebook" id="iK6-ar-Cjj">
<rect key="frame" x="135" y="11" width="40" height="40"/>
<rect key="frame" x="135" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -1431,7 +1447,7 @@
<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">
<rect key="frame" x="0.0" y="0.0" width="375" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<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">
@ -1466,7 +1482,7 @@
<rect key="frame" x="0.0" y="45" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="TpL-A6-BYb" id="8n5-6b-Lkb">
<rect key="frame" x="0.0" y="0.0" width="342" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Notifications" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="BkZ-cf-De2">
@ -1497,7 +1513,7 @@
<rect key="frame" x="0.0" y="89" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="YaV-d2-gKc" id="Mwa-Ev-lbd">
<rect key="frame" x="0.0" y="0.0" width="342" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Settings" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Sc6-4z-l2a">
@ -1521,7 +1537,7 @@
<rect key="frame" x="0.0" y="133" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="sws-bZ-U3f" id="rn0-3E-sbt">
<rect key="frame" x="0.0" y="0.0" width="342" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sales" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="6ms-Qf-N3Y">
@ -1542,7 +1558,7 @@
<rect key="frame" x="0.0" y="177" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Ak8-L0-HzG" id="Pyf-Ej-3gc">
<rect key="frame" x="0.0" y="0.0" width="342" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="FAQ" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Al0-Rw-25S">
@ -1563,7 +1579,7 @@
<rect key="frame" x="0.0" y="221" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Usj-YV-mfI" id="oFF-Ie-d4Y">
<rect key="frame" x="0.0" y="0.0" width="342" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Getting Started" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="uVQ-tG-zdQ">
@ -1625,49 +1641,40 @@
<!--Notifications-->
<scene sceneID="bwB-9L-Y2n">
<objects>
<viewController title="Notifications" id="6TW-al-QKg" sceneMemberID="viewController">
<viewController title="Notifications" id="6TW-al-QKg" customClass="NotificationsViewController" customModule="Vendoo" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="bnY-Wo-CEl">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="Nv6-ae-lFl">
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="69" sectionHeaderHeight="28" sectionFooterHeight="28" id="Nv6-ae-lFl">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<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"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="notification_cell" rowHeight="69" id="9G8-XI-ptI" customClass="NotificationTableViewCell" customModule="Vendoo" customModuleProvider="target">
<rect key="frame" x="0.0" y="72" width="375" height="69"/>
<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"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="68.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Item 1 Sold for $xx.xx" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="vbB-Fw-hYm">
<rect key="frame" x="8" y="11" width="191" height="21"/>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" text="Notification message" textAlignment="natural" selectable="NO" id="cSU-p4-wQb">
<rect key="frame" x="8" y="0.0" width="220" height="60.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</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"/>
<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"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="User 2 sent a message on x marketplace" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="0Gf-Sl-5ve">
<rect key="frame" x="8" y="11" width="326" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="pcX-cs-Mea">
<rect key="frame" x="262" y="0.0" width="65" height="60.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
</tableViewCellContentView>
<connections>
<outlet property="message" destination="cSU-p4-wQb" id="H6a-7K-wX5"/>
<outlet property="network" destination="pcX-cs-Mea" id="V3q-tc-ePD"/>
</connections>
</tableViewCell>
</prototypes>
</tableView>
@ -1675,9 +1682,16 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="tMF-8P-hq8">
<barButtonItem key="leftBarButtonItem" systemItem="stop" id="nNk-we-8b0"/>
<barButtonItem key="leftBarButtonItem" systemItem="stop" id="nNk-we-8b0">
<connections>
<action selector="dismissNotifications:" destination="6TW-al-QKg" id="Gka-rW-dn3"/>
</connections>
</barButtonItem>
</navigationItem>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<connections>
<outlet property="notificationTable" destination="Nv6-ae-lFl" id="aqB-TZ-as0"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="34F-M2-Thr" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@ -1714,10 +1728,10 @@
<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"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Change Password" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="PGB-Ei-aRg">
@ -1731,10 +1745,10 @@
</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"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Delete Account" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Q9i-1T-SF9">
@ -1800,7 +1814,7 @@
<rect key="frame" x="0.0" y="1" width="375" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="9h0-NL-4Hr" id="nH9-sh-wm7">
<rect key="frame" x="0.0" y="0.0" width="375" height="99"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="99.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ebay_icon" id="rL9-kJ-Bb5">
@ -1857,7 +1871,7 @@
<rect key="frame" x="0.0" y="101" width="375" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="lJK-BB-qHp" id="tfe-wC-9ai">
<rect key="frame" x="0.0" y="0.0" width="375" height="99"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="99.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="amazon_icon" id="MPn-yv-kPb">
@ -1914,7 +1928,7 @@
<rect key="frame" x="0.0" y="201" width="375" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Vwl-4p-5OR" id="V1b-eK-a5x">
<rect key="frame" x="0.0" y="0.0" width="375" height="99"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="99.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="etsy_icon" id="kzI-Ab-HOW">
@ -1971,7 +1985,7 @@
<rect key="frame" x="0.0" y="301" width="375" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5QP-17-Ojk" id="c3M-kx-tkP">
<rect key="frame" x="0.0" y="0.0" width="375" height="99"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="99.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="facebook_icon" id="lWY-QV-lQe">
@ -2057,7 +2071,7 @@
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5Fn-QZ-2Pk" id="atN-Th-uzO">
<rect key="frame" x="0.0" y="0.0" width="342" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
@ -2108,7 +2122,7 @@
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="NVz-An-tWd" id="YDe-Pd-Fu2">
<rect key="frame" x="0.0" y="0.0" width="375" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="pKO-dl-Ggb">
@ -2130,7 +2144,7 @@
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ebay" id="mCV-zx-xeL">
<rect key="frame" x="0.0" y="11" width="40" height="40"/>
<rect key="frame" x="0.0" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -2146,7 +2160,7 @@
<size key="customSize" width="40" height="40"/>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="1" contentMode="center" reuseIdentifier="amazon" id="LkM-kC-Zpp">
<rect key="frame" x="45" y="11" width="40" height="40"/>
<rect key="frame" x="45" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -2161,7 +2175,7 @@
</view>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="2" contentMode="center" reuseIdentifier="etsy" id="LmS-RK-wqT">
<rect key="frame" x="90" y="11" width="40" height="40"/>
<rect key="frame" x="90" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -2176,7 +2190,7 @@
</view>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="3" contentMode="center" reuseIdentifier="facebook" id="E6f-Dd-zq3">
<rect key="frame" x="135" y="11" width="40" height="40"/>
<rect key="frame" x="135" y="10.5" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@ -2490,10 +2504,11 @@
</resources>
<inferredMetricsTieBreakers>
<segue reference="rkZ-c8-XJc"/>
<segue reference="KKl-Gj-ZVc"/>
<segue reference="nUj-1v-ftF"/>
<segue reference="syc-IR-LNQ"/>
<segue reference="Ds4-LY-IRj"/>
<segue reference="vCG-jU-HYF"/>
<segue reference="nWA-7e-2Ec"/>
<segue reference="NOz-ya-avj"/>
<segue reference="KKl-Gj-ZVc"/>
</inferredMetricsTieBreakers>
<color key="tintColor" red="0.2784313725" green="0.80392156859999997" blue="0.68235294120000001" alpha="1" colorSpace="calibratedRGB"/>
</document>

View File

@ -860,4 +860,71 @@ extension NetworksTableViewController {
}
}
@IBAction func toggleNetworkSelection(sender: UISwitch) {
switch (sender.superview?.superview?.classForCoder){
case is EbayTableViewCell.Type:
//selection code for ebay
if((sender.superview?.superview as! EbayTableViewCell).networkToggle.on){
//code to select network
self.networksDictionary["ebay"] = true
}
else{
//code to deselect network
self.networksDictionary["ebay"] = false
}
break
case is AmazonTableViewCell.Type:
//selection code for amazon
if((sender.superview?.superview as! AmazonTableViewCell).networkToggle.on){
//code to select network
self.networksDictionary["amazon"] = true
}
else{
//code to deselect network
self.networksDictionary["amazon"] = false
}
break
case is EtsyTableViewCell.Type:
//selection code for etsy
if((sender.superview?.superview as! EtsyTableViewCell).networkToggle.on){
//code to select network
self.networksDictionary["etsy"] = true
}
else{
//code to deselect network
self.networksDictionary["etsy"] = false
}
break
case is FBTableViewCell.Type:
//selection code for facebook
if((sender.superview?.superview as! FBTableViewCell).networkToggle.on){
//code to select network
self.networksDictionary["facebook"] = true
}
else{
//code to deselect network
self.networksDictionary["facebook"] = false
}
break
default:
break
}
}
}

View File

@ -0,0 +1,26 @@
//
// NotificationTableViewCell.swift
// Vendoo
//
// Created by Okechi Onyeje on 11/2/16.
// Copyright © 2016 Okechi Onyeje. All rights reserved.
//
import UIKit
class NotificationTableViewCell: UITableViewCell {
@IBOutlet weak var message: UITextView!
@IBOutlet weak var network: UIImageView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}

View File

@ -0,0 +1,166 @@
//
// NotificationsViewController.swift
// Vendoo
//
// Created by Okechi Onyeje on 11/2/16.
// Copyright © 2016 Okechi Onyeje. All rights reserved.
//
import UIKit
class NotificationsViewController: UIViewController {
var notifications: [Dictionary<String, AnyObject>]! = (NSUserDefaults.standardUserDefaults().objectForKey("notifications") == nil ? [] : (NSUserDefaults.standardUserDefaults().objectForKey("notifications") as! [Dictionary<String, AnyObject>]))
var fireBase = FirebaseManager()
@IBOutlet weak var notificationTable: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
self.notificationTable.dataSource = self
self.notificationTable.delegate = self
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
extension NotificationsViewController: UITableViewDelegate {
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
var notification = self.notifications[indexPath.row]
switch ( notification["network"] as! String) {
case "facebook":
let alert = UIAlertController(title: "New Comment from \(notification["senderName"] as! String)", message: (notification["commentMessage"] as! String), preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "Mark as Dismissed", style: .Default, handler: {
(action) -> Void in
notification["seen"] = true
self.notifications[indexPath.row] = notification
self.fireBase.ref.child("Users/\(self.fireBase.user_email)/notifications/\(notification["UUID"] as! String)").setValue(notification, withCompletionBlock: {
(error, reference) -> Void in
if error == nil {
self.notifications = self.notifications.filter({$0["seen"] as! Bool == false})
NSUserDefaults.standardUserDefaults().setObject(self.notifications, forKey: "notifications")
self.notificationTable.reloadData()
alert.dismissViewControllerAnimated(true, completion: nil)
}
})
}))
alert.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: {(action) -> Void in}))
self.presentViewController(alert, animated: true, completion: nil)
break
case "ebay":
let alert = UIAlertController(title: "New Notification", message: "Would you like to dismiss this notification?", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "Mark as Dismissed", style: .Default, handler: {
(action) -> Void in
notification["seen"] = true
self.notifications[indexPath.row] = notification
self.fireBase.ref.child("Users/\(self.fireBase.user_email)/notifications/\(notification["UUID"] as! String)").setValue(notification, withCompletionBlock: {
(error, reference) -> Void in
if error == nil {
self.notifications = self.notifications.filter({$0["seen"] as! Bool == false})
NSUserDefaults.standardUserDefaults().setObject(self.notifications, forKey: "notifications")
self.notificationTable.reloadData()
alert.dismissViewControllerAnimated(true, completion: nil)
}
})
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: {(action) -> Void in}))
self.presentViewController(alert, animated: true, completion: nil)
break
case "etsy":
let alert = UIAlertController(title: "New Notification", message: "Would you like to dismiss this notification?", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "Mark as Dismissed", style: .Default, handler: {
(action) -> Void in
notification["seen"] = true
self.notifications[indexPath.row] = notification
self.fireBase.ref.child("Users/\(self.fireBase.user_email)/notifications/\(notification["UUID"] as! String)").setValue(notification, withCompletionBlock: {
(error, reference) -> Void in
if error == nil {
self.notifications = self.notifications.filter({$0["seen"] as! Bool == false})
NSUserDefaults.standardUserDefaults().setObject(self.notifications, forKey: "notifications")
self.notificationTable.reloadData()
alert.dismissViewControllerAnimated(true, completion: nil)
}
})
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: {(action) -> Void in}))
self.presentViewController(alert, animated: true, completion: nil)
break
case "amazon":
break
default:
break
}
}
}
extension NotificationsViewController: UITableViewDataSource {
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: NotificationTableViewCell! = self.notificationTable.dequeueReusableCellWithIdentifier("notification_cell") as! NotificationTableViewCell
let notification = self.notifications[indexPath.row]
switch ( notification["network"] as! String) {
case "facebook":
cell.message.text = notification["notification"] as! String
cell.network.image = UIImage(named: "facebook_icon")
break
case "ebay":
cell.message.text = notification["message"] as! String
cell.network.image = UIImage(named: "ebay_icon")
break
case "etsy":
cell.message.text = notification["message"] as! String
cell.network.image = UIImage(named: "etsy_icon")
break
case "amazon":
break
default:
break
}
return cell
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.notifications.count
}
}
extension NotificationsViewController /*IBoutlets*/ {
@IBAction func dismissNotifications(sender: AnyObject){
let vc = self.storyboard?.instantiateViewControllerWithIdentifier("Reveal View Controller")
self.presentViewController(vc!, animated: false, completion: nil)
}
}

View File

@ -0,0 +1,233 @@
//
// ServiceNotificationManager.swift
// Vendoo
//
// Created by Okechi Onyeje on 8/30/16.
// Copyright © 2016 Okechi Onyeje. All rights reserved.
//
import Foundation
protocol ServiceNotificationManagerDelegate {
func listingHasEnded(fbInfo: AnyObject?, ebayInfo: AnyObject?, amazonInfo: AnyObject?, etsyInfo: AnyObject?)
func listingHasNewNotifications(fbInfo: AnyObject?, ebayInfo: AnyObject?, amazonInfo: AnyObject?, etsyInfo: AnyObject?)
func listingHasFinishedRetrievingNotifications()
func listingHasStartedRetrievingNotifications()
}
class ServiceNotificationManager: NSObject {
var etsyManager: EtsyRESTAPIManager!
var fbGraphManager: FacebookGraphAPIManager!
var firebaseManager: FirebaseManager!
var ebayGraphManager: EbayWebServiceManager!
var userListings: [Listing] = []
var timer: NSTimer!
static var delegate: ServiceNotificationManagerDelegate?
override init() {
super.init()
}
func startServicePolling() {
//timer = NSTimer.scheduledTimerWithTimeInterval(60.0, target: self, selector: #selector(ServiceNotificationManager.pollServices), userInfo: nil, repeats: true)
pollServices()
}
func stopServicePolling() {
timer.invalidate()
}
func setManagers(fbManager: FacebookGraphAPIManager, fireManager: FirebaseManager, ebayManager: EbayWebServiceManager, etsyManager: EtsyRESTAPIManager){
self.fbGraphManager = fbManager
self.firebaseManager = fireManager
self.ebayGraphManager = ebayManager
self.etsyManager = etsyManager
}
func setListings(listings: [Listing]) {
self.userListings = listings
}
func pollServices(){
let notificationGroup = dispatch_group_create()
for listing in userListings {
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)/user_Listings/\(listing.key)").observeSingleEventOfType( .Value, withBlock: {
(snapshot) -> Void in
//dispatch_group_enter(notificationGroup)
let listingDict = snapshot.value as? [String : AnyObject]
if !(listingDict!["isListingDraft"] as! Bool) {
if let networksDict = listingDict!["networkIDs"] as? [String : AnyObject] {
let ebayID = (networksDict["ebay"] as? String)
let facebookID = (networksDict["facebook"] as? String)
let etsyID = (networksDict["etsy"] as? Int)
let amazonID = (networksDict["amazon"] as? String)
//@TODO: Skeleton for Notfications Manager is set up. Need to implement listing request for each listing to retrieve relevant notifications for user such as if listing has ended
if(ebayID != nil){
if self.ebayGraphManager.isAuthorized {
self.ebayGraphManager.isGettingNotification = true
self.ebayGraphManager.getListingInfo(ebayID!, onComplete: {
(listingNotificationInfo, error) -> Void in
//dispatch_group_leave(notificationGroup)
let info = (listingNotificationInfo as! [String : AnyObject])
if(info["status"] as! String == "Ended") {
if((info["quantitySold"] as! Int) > 0) {
//@TODO: Add both firbase logic and code logic to do notifications for sold listings
if (((info["itemQuantity"] as! Int) - (info["quantitySold"] as! Int)) == 0) {
ServiceNotificationManager.delegate?.listingHasNewNotifications(
nil,
ebayInfo: [
"type": "Sold",
"notification": "Your listing \"\(listingDict!["listingTitle"] as! String)\" has sold out on ebay.",
"listingKey": listing.key],
amazonInfo: nil,
etsyInfo: nil
)
}
}else{
ServiceNotificationManager.delegate?.listingHasEnded(
nil,
ebayInfo: [
"type": "Ended",
"notification": "Your listing \"\(listingDict!["listingTitle"] as! String)\" has ended on ebay.",
"listingKey": listing.key],
amazonInfo: nil,
etsyInfo: nil
)
}
}
})
}
}
if(facebookID != nil){
if(self.fbGraphManager.isAuthorized) {
self.fbGraphManager.getListingInfo ("/\(facebookID!)/comments", onCompletion: {
(listingNotificationInfo, error) -> Void in
dispatch_async(dispatch_get_main_queue(), {
self.firebaseManager.ref.child("Users/\(self.firebaseManager.user_email)").observeEventType(.Value, withBlock: {
(snapshot) -> Void in
let notifications = ((snapshot.value as? [String : AnyObject])!["notifications"]) as? [String : AnyObject]
for commentInfo in (listingNotificationInfo as! [[String: AnyObject]]) {
let fromInfo = commentInfo["from"] as! [String : AnyObject]
if notifications != nil {
if notifications![(commentInfo["id"] as! String)] == nil {
let commentDict = [
"UUID":(commentInfo["id"] as! String),
"commentMessage":(commentInfo["message"] as! String),
"network":"facebook",
"notification": "Your item \"\(listingDict!["listingTitle"] as! String)\" has a new comment.",
"key": listing.key,
"seen":false,
"senderID":(fromInfo["id"]! as! String),
"senderName":(fromInfo["name"]! as! String),
"type":"FBComment"
]
ServiceNotificationManager.delegate?.listingHasNewNotifications(commentDict, ebayInfo: nil, amazonInfo: nil, etsyInfo: nil)
}
}else{
let commentDict = [
"UUID":(commentInfo["id"] as! String),
"commentMessage":(commentInfo["message"] as! String),
"network":"facebook",
"notification": "Your item \"\(listingDict!["listingTitle"] as! String)\" has a new comment.",
"key": listing.key,
"seen":false,
"senderID":(fromInfo["id"]! as! String),
"senderName":(fromInfo["name"]! as! String),
"type":"FBComment"
]
ServiceNotificationManager.delegate?.listingHasNewNotifications(commentDict, ebayInfo: nil, amazonInfo: nil, etsyInfo: nil)
}
}
})
})
})
}
}
if(etsyID != nil){
if (self.etsyManager.isAuthorized) {
self.etsyManager.getListingInfo ("/listings/\(etsyID!)", onCompletion: {
(listingNotificationInfo, error) -> Void in
let info = (listingNotificationInfo as! [String : AnyObject])
//@TODO: Test this code with the draft condition for both expired and sold_out
if ((info["status"] as! String == "expired") || (info["status"] as! String == "removed")) {
ServiceNotificationManager.delegate?.listingHasEnded(
nil,
ebayInfo: nil,
amazonInfo: nil,
etsyInfo: [
"type": "Ended",
"notification": "Your listing \"\(listingDict!["listingTitle"] as! String)\" has ended on etsy.",
"listingKey": listing.key]
)
}else if info["status"] as! String == "sold_out" {
ServiceNotificationManager.delegate?.listingHasNewNotifications(
nil,
ebayInfo: nil,
amazonInfo: nil,
etsyInfo: [
"type": "Sold",
"notification": "Your listing \"\(listingDict!["listingTitle"] as! String)\" has sold out on etsy.",
"listingKey": listing.key]
)
} else if info["status"] as! String == "draft" {
}
})
}
}
if(amazonID != nil){
}
//dispatch_group_leave(notificationGroup)
}else {
// dispatch_group_leave(notificationGroup)
}
}else {
//dispatch_group_leave(notificationGroup)
}
})
}
self.ebayGraphManager.isGettingNotification = false
//dispatch_group_notify(notificationGroup, dispatch_get_main_queue(), {
//self.delegate?.listingHasNewNotifications(nil, ebayInfo: nil, amazonInfo: nil, etsyInfo: nil)
//})
}
}