diff --git a/Podfile b/Podfile index ca0df02..93d6fff 100644 --- a/Podfile +++ b/Podfile @@ -9,5 +9,6 @@ target 'Restaurant Royale' do pod 'Firebase/Core' pod 'Firebase/Auth' pod 'Firebase/Firestore' + pod 'Firebase/Storage' end diff --git a/Podfile.lock b/Podfile.lock index c91d7df..dfe31c9 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -16,6 +16,9 @@ PODS: - Firebase/Firestore (5.12.0): - Firebase/CoreOnly - FirebaseFirestore (= 0.14.0) + - Firebase/Storage (5.12.0): + - Firebase/CoreOnly + - FirebaseStorage (= 3.0.3) - FirebaseAnalytics (5.3.0): - FirebaseCore (~> 5.1) - FirebaseInstanceID (~> 3.3) @@ -54,6 +57,10 @@ PODS: - FirebaseCore (~> 5.1) - GoogleUtilities/Environment (~> 5.3) - GoogleUtilities/UserDefaults (~> 5.3) + - FirebaseStorage (3.0.3): + - FirebaseAuthInterop (~> 1.0) + - FirebaseCore (~> 5.1) + - GTMSessionFetcher/Core (~> 1.1) - GoogleAppMeasurement (5.3.0): - GoogleUtilities/AppDelegateSwizzler (~> 5.2) - GoogleUtilities/MethodSwizzler (~> 5.2) @@ -120,6 +127,7 @@ DEPENDENCIES: - Firebase/Auth - Firebase/Core - Firebase/Firestore + - Firebase/Storage SPEC REPOS: https://github.com/cocoapods/specs.git: @@ -131,6 +139,7 @@ SPEC REPOS: - FirebaseCore - FirebaseFirestore - FirebaseInstanceID + - FirebaseStorage - GoogleAppMeasurement - GoogleUtilities - gRPC @@ -152,6 +161,7 @@ SPEC CHECKSUMS: FirebaseCore: 027d350adc039aa5483357c6f56556f117c5170e FirebaseFirestore: 6dc97a9685c421767cc96bf644fc963166cddbe7 FirebaseInstanceID: e2fa4cb35ef5558c200f7f0ad8a53e212215f93e + FirebaseStorage: 3d22c041370593e639fba013d1eb698a8dae2881 GoogleAppMeasurement: 5029d78f2b438bd30ffb44e6c558b57c21622727 GoogleUtilities: bb6ff5a302c97a0bc9820dad775505778c5a2676 gRPC: 9d4c549f37c7cef22478634bac7a0405b6e3dbfb @@ -164,6 +174,6 @@ SPEC CHECKSUMS: nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48 Protobuf: 1eb9700044745f00181c136ef21b8ff3ad5a0fd5 -PODFILE CHECKSUM: d2740cbdd7cbc9a150f30c247bb6f6895699b54f +PODFILE CHECKSUM: af335cb31ba2f1b5b4631fdac5f3a5c4da153617 COCOAPODS: 1.5.3 diff --git a/Restaurant Royale.xcodeproj/project.pbxproj b/Restaurant Royale.xcodeproj/project.pbxproj index 3a666b3..43ee4dc 100644 --- a/Restaurant Royale.xcodeproj/project.pbxproj +++ b/Restaurant Royale.xcodeproj/project.pbxproj @@ -8,10 +8,10 @@ /* Begin PBXBuildFile section */ 0131FCF721B08F3A0087BAA6 /* TabViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0131FCF621B08F3A0087BAA6 /* TabViewController.swift */; }; - 0131FCF921B0933F0087BAA6 /* RewardsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0131FCF821B0933F0087BAA6 /* RewardsViewController.swift */; }; + 0131FCF921B0933F0087BAA6 /* SearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0131FCF821B0933F0087BAA6 /* SearchViewController.swift */; }; + 01A7E02121C1836700C5D5DC /* TableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01A7E02021C1836700C5D5DC /* TableViewCell.swift */; }; + 01A7E02321C184D900C5D5DC /* infoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01A7E02221C184D900C5D5DC /* infoViewController.swift */; }; 30362D0621B319FC00AB07E8 /* gif.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30362D0521B319FC00AB07E8 /* gif.swift */; }; - 30362D0821B31A1700AB07E8 /* money.gif in Resources */ = {isa = PBXBuildFile; fileRef = 30362D0721B31A1600AB07E8 /* money.gif */; }; - 30362D0A21B31A2100AB07E8 /* slots.gif in Resources */ = {isa = PBXBuildFile; fileRef = 30362D0921B31A2100AB07E8 /* slots.gif */; }; CB00DE048DF123642887EB65 /* Pods_Restaurant_Royale.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E00D4DEFE6DFD07D30EAC895 /* Pods_Restaurant_Royale.framework */; }; D90CB6531A739B7A00228A1F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D90CB6521A739B7A00228A1F /* AppDelegate.swift */; }; D90CB6581A739B7A00228A1F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D90CB6561A739B7A00228A1F /* Main.storyboard */; }; @@ -22,21 +22,27 @@ D90CB6821A73CBC600228A1F /* AddGeotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D90CB67C1A73B2BD00228A1F /* AddGeotificationViewController.swift */; }; D9835AF31AA6076800D265BC /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9835AF21AA6076800D265BC /* Utilities.swift */; }; D9C1AF6C1A77CD6C00A06B2F /* Apple.gpx in Resources */ = {isa = PBXBuildFile; fileRef = D9C1AF6B1A77CD6C00A06B2F /* Apple.gpx */; }; + E978543221C053BD003313D1 /* money.gif in Resources */ = {isa = PBXBuildFile; fileRef = E978543121C053BD003313D1 /* money.gif */; }; + E978543421C053CA003313D1 /* rouletteWheel.gif in Resources */ = {isa = PBXBuildFile; fileRef = E978543321C053CA003313D1 /* rouletteWheel.gif */; }; + E978543621C053D5003313D1 /* slots.gif in Resources */ = {isa = PBXBuildFile; fileRef = E978543521C053D5003313D1 /* slots.gif */; }; + E978543821C05DAC003313D1 /* profileHeader.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E978543721C05DAB003313D1 /* profileHeader.jpg */; }; E9CC65DF219CD82500B3EDE1 /* InitialViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9CC65DE219CD82500B3EDE1 /* InitialViewController.swift */; }; E9CC65E1219CDE5D00B3EDE1 /* SignUpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9CC65E0219CDE5D00B3EDE1 /* SignUpViewController.swift */; }; E9CC65E3219CDE6700B3EDE1 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9CC65E2219CDE6700B3EDE1 /* LoginViewController.swift */; }; E9CC65E5219CE1E500B3EDE1 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9CC65E4219CE1E500B3EDE1 /* ProfileViewController.swift */; }; E9F340BE21B63A6C00779987 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = E9F340BD21B63A6C00779987 /* GoogleService-Info.plist */; }; E9F340C021B63F1600779987 /* Restaurant.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F340BF21B63F1600779987 /* Restaurant.swift */; }; + E9F340C221BF86B900779987 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F340C121BF86B900779987 /* Constants.swift */; }; + E9FD90A321C07E0900864EA7 /* RestaurantManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9FD90A221C07E0900864EA7 /* RestaurantManager.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0131FCF621B08F3A0087BAA6 /* TabViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabViewController.swift; sourceTree = ""; }; - 0131FCF821B0933F0087BAA6 /* RewardsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RewardsViewController.swift; sourceTree = ""; }; + 0131FCF821B0933F0087BAA6 /* SearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewController.swift; sourceTree = ""; }; + 01A7E02021C1836700C5D5DC /* TableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewCell.swift; sourceTree = ""; }; + 01A7E02221C184D900C5D5DC /* infoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = infoViewController.swift; sourceTree = ""; }; 2C7E16726DE474D67283AED2 /* Pods-Restaurant Royale.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Restaurant Royale.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Restaurant Royale/Pods-Restaurant Royale.debug.xcconfig"; sourceTree = ""; }; 30362D0521B319FC00AB07E8 /* gif.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = gif.swift; sourceTree = ""; }; - 30362D0721B31A1600AB07E8 /* money.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = money.gif; sourceTree = ""; }; - 30362D0921B31A2100AB07E8 /* slots.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = slots.gif; sourceTree = ""; }; 308B7289218FDB950027F45B /* TollyToLocal.gpx */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = TollyToLocal.gpx; sourceTree = ""; }; 7DBB1DD8B77C6707E9D01F9D /* Pods-Restaurant Royale.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Restaurant Royale.release.xcconfig"; path = "Pods/Target Support Files/Pods-Restaurant Royale/Pods-Restaurant Royale.release.xcconfig"; sourceTree = ""; }; A16373B92054471A0065C2D9 /* Google.gpx */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Google.gpx; sourceTree = ""; }; @@ -53,12 +59,18 @@ D9835AF21AA6076800D265BC /* Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = ""; }; D9C1AF6B1A77CD6C00A06B2F /* Apple.gpx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Apple.gpx; sourceTree = ""; }; E00D4DEFE6DFD07D30EAC895 /* Pods_Restaurant_Royale.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Restaurant_Royale.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E978543121C053BD003313D1 /* money.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = money.gif; path = Images.xcassets/money.dataset/money.gif; sourceTree = ""; }; + E978543321C053CA003313D1 /* rouletteWheel.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = rouletteWheel.gif; path = Images.xcassets/rouletteWheel.dataset/rouletteWheel.gif; sourceTree = ""; }; + E978543521C053D5003313D1 /* slots.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = slots.gif; path = Images.xcassets/slots.dataset/slots.gif; sourceTree = ""; }; + E978543721C05DAB003313D1 /* profileHeader.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = profileHeader.jpg; sourceTree = ""; }; E9CC65DE219CD82500B3EDE1 /* InitialViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InitialViewController.swift; sourceTree = ""; }; E9CC65E0219CDE5D00B3EDE1 /* SignUpViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpViewController.swift; sourceTree = ""; }; E9CC65E2219CDE6700B3EDE1 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; E9CC65E4219CE1E500B3EDE1 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = ""; }; E9F340BD21B63A6C00779987 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; E9F340BF21B63F1600779987 /* Restaurant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Restaurant.swift; sourceTree = ""; }; + E9F340C121BF86B900779987 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; + E9FD90A221C07E0900864EA7 /* RestaurantManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestaurantManager.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -108,6 +120,7 @@ isa = PBXGroup; children = ( D90CB6521A739B7A00228A1F /* AppDelegate.swift */, + E9F340C121BF86B900779987 /* Constants.swift */, E9CC65DE219CD82500B3EDE1 /* InitialViewController.swift */, E9CC65E0219CDE5D00B3EDE1 /* SignUpViewController.swift */, E9CC65E2219CDE6700B3EDE1 /* LoginViewController.swift */, @@ -116,12 +129,17 @@ D9835AF21AA6076800D265BC /* Utilities.swift */, 30362D0521B319FC00AB07E8 /* gif.swift */, E9F340BF21B63F1600779987 /* Restaurant.swift */, + E978543121C053BD003313D1 /* money.gif */, + E978543521C053D5003313D1 /* slots.gif */, + E978543321C053CA003313D1 /* rouletteWheel.gif */, D90CB6561A739B7A00228A1F /* Main.storyboard */, - 0131FCF821B0933F0087BAA6 /* RewardsViewController.swift */, + 01A7E02021C1836700C5D5DC /* TableViewCell.swift */, + 0131FCF821B0933F0087BAA6 /* SearchViewController.swift */, + 01A7E02221C184D900C5D5DC /* infoViewController.swift */, + E9FD90A221C07E0900864EA7 /* RestaurantManager.swift */, 0131FCF621B08F3A0087BAA6 /* TabViewController.swift */, D90CB6591A739B7A00228A1F /* Images.xcassets */, - 30362D0921B31A2100AB07E8 /* slots.gif */, - 30362D0721B31A1600AB07E8 /* money.gif */, + E978543721C05DAB003313D1 /* profileHeader.jpg */, D90CB65B1A739B7A00228A1F /* LaunchScreen.xib */, D90CB6501A739B7A00228A1F /* Supporting Files */, ); @@ -220,11 +238,13 @@ files = ( D90CB6581A739B7A00228A1F /* Main.storyboard in Resources */, D90CB65D1A739B7A00228A1F /* LaunchScreen.xib in Resources */, - 30362D0A21B31A2100AB07E8 /* slots.gif in Resources */, + E978543621C053D5003313D1 /* slots.gif in Resources */, + E978543821C05DAC003313D1 /* profileHeader.jpg in Resources */, + E978543421C053CA003313D1 /* rouletteWheel.gif in Resources */, D9C1AF6C1A77CD6C00A06B2F /* Apple.gpx in Resources */, D90CB65A1A739B7A00228A1F /* Images.xcassets in Resources */, - 30362D0821B31A1700AB07E8 /* money.gif in Resources */, E9F340BE21B63A6C00779987 /* GoogleService-Info.plist in Resources */, + E978543221C053BD003313D1 /* money.gif in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -299,12 +319,16 @@ E9CC65E1219CDE5D00B3EDE1 /* SignUpViewController.swift in Sources */, 30362D0621B319FC00AB07E8 /* gif.swift in Sources */, D90CB6531A739B7A00228A1F /* AppDelegate.swift in Sources */, + 01A7E02121C1836700C5D5DC /* TableViewCell.swift in Sources */, E9CC65E3219CDE6700B3EDE1 /* LoginViewController.swift in Sources */, E9CC65DF219CD82500B3EDE1 /* InitialViewController.swift in Sources */, + E9FD90A321C07E0900864EA7 /* RestaurantManager.swift in Sources */, D9835AF31AA6076800D265BC /* Utilities.swift in Sources */, 0131FCF721B08F3A0087BAA6 /* TabViewController.swift in Sources */, - 0131FCF921B0933F0087BAA6 /* RewardsViewController.swift in Sources */, + 0131FCF921B0933F0087BAA6 /* SearchViewController.swift in Sources */, + 01A7E02321C184D900C5D5DC /* infoViewController.swift in Sources */, E9CC65E5219CE1E500B3EDE1 /* ProfileViewController.swift in Sources */, + E9F340C221BF86B900779987 /* Constants.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/RestaurantRoyale/.DS_Store b/RestaurantRoyale/.DS_Store index 3ed850d..67d8fe1 100644 Binary files a/RestaurantRoyale/.DS_Store and b/RestaurantRoyale/.DS_Store differ diff --git a/RestaurantRoyale/AddGeotificationViewController.swift b/RestaurantRoyale/AddGeotificationViewController.swift index c6b3269..df178c6 100644 --- a/RestaurantRoyale/AddGeotificationViewController.swift +++ b/RestaurantRoyale/AddGeotificationViewController.swift @@ -1,60 +1,42 @@ import UIKit import MapKit -import FirebaseFirestore - -let db = Firestore.firestore() -let settings = db.settings +import Firebase class AddGeotificationViewController: UIViewController{ - // Two values used to store the random location for the user - var restaurantID = String() - var restaurantName = String() + var manager = RestaurantManager() var randomRestaurant = Restaurant() @IBOutlet weak var slots: UIImageView! @IBOutlet weak var background: UIImageView! @IBOutlet weak var randomRestaurantButton: UIButton! - @IBAction func randomRestaurantRequest(_ sender: UIButton) { - //Perform all actions when a button is tapped - //Want to generate a random number, link it to the index of a restaurant in the restaurants array - //Use that restaurant to generate the next pin drop - //Possibly bring out a text box stating which restaurant was chosen, then asking if user wants to go there - // or select again - - let randomIndex = Int.random(in: 0.. - - + + - + @@ -18,7 +18,7 @@ - + @@ -37,21 +37,24 @@ - + - - - + + - - - + + + + + - + + + + + + + + + + + + + + + + @@ -71,7 +99,7 @@ - + @@ -82,71 +110,104 @@ - + - - - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -154,7 +215,7 @@ - + @@ -165,65 +226,70 @@ - + - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -240,26 +306,23 @@ - + - + - - + - - - - + + @@ -269,14 +332,40 @@ - + + + - + + + + + + + + + + + + + + + @@ -285,7 +374,7 @@ - + @@ -296,7 +385,7 @@ - + @@ -321,7 +410,7 @@ - + @@ -332,14 +421,34 @@ - + + + + - @@ -349,7 +458,7 @@ - + @@ -363,69 +472,152 @@ - + - + - + - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + - + - + diff --git a/RestaurantRoyale/Constants.swift b/RestaurantRoyale/Constants.swift new file mode 100644 index 0000000..95f2c88 --- /dev/null +++ b/RestaurantRoyale/Constants.swift @@ -0,0 +1,29 @@ +// +// Constants.swift +// Restaurant Royale +// +// Created by Netreconlab on 12/11/18. +// Copyright © 2018 Ken Toh. All rights reserved. +// + +import Foundation +import UIKit +import Firebase +import FirebaseStorage + +let db = Firestore.firestore() +let settings = db.settings + +let storage = Storage.storage() + +struct Colors { + static let DarkTangerine = UIColor(red: 255/255, green: 172/255, blue: 20/255, alpha: 1) + static let SunsetOrange = UIColor(red: 255/255, green: 94/255, blue: 91/255, alpha: 1) + static let Timberwolf = UIColor(red: 216/255, green: 216/255, blue: 216/255, alpha: 1) + static let DeepLemon = UIColor(red: 252/255, green: 204/255, blue: 30/255, alpha: 1) + static let Red = UIColor(red: 252/255, green: 49/255, blue: 22/255, alpha: 1) + static let Isabelline = UIColor(red: 247/255, green: 243/255, blue: 237/255, alpha: 1) + static let RifleGray = UIColor(red: 68/255, green: 67/255, blue: 65/255, alpha: 1) + static let MaastrichtBlue = UIColor(red: 8/255, green: 26/255, blue: 42/255, alpha: 1) + +} diff --git a/RestaurantRoyale/Images.xcassets/profileHeader.imageset/Contents.json b/RestaurantRoyale/Images.xcassets/profileHeader.imageset/Contents.json new file mode 100644 index 0000000..6a2dfe4 --- /dev/null +++ b/RestaurantRoyale/Images.xcassets/profileHeader.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "profileHeader.jpg", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/RestaurantRoyale/Images.xcassets/profileHeader.imageset/profileHeader.jpg b/RestaurantRoyale/Images.xcassets/profileHeader.imageset/profileHeader.jpg new file mode 100644 index 0000000..75c49e6 Binary files /dev/null and b/RestaurantRoyale/Images.xcassets/profileHeader.imageset/profileHeader.jpg differ diff --git a/RestaurantRoyale/Images.xcassets/rouletteWheel.dataset/Contents.json b/RestaurantRoyale/Images.xcassets/rouletteWheel.dataset/Contents.json new file mode 100644 index 0000000..4734c36 --- /dev/null +++ b/RestaurantRoyale/Images.xcassets/rouletteWheel.dataset/Contents.json @@ -0,0 +1,12 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "data" : [ + { + "idiom" : "universal", + "filename" : "rouletteWheel.gif" + } + ] +} \ No newline at end of file diff --git a/RestaurantRoyale/Images.xcassets/rouletteWheel.dataset/rouletteWheel.gif b/RestaurantRoyale/Images.xcassets/rouletteWheel.dataset/rouletteWheel.gif new file mode 100644 index 0000000..e25bd95 Binary files /dev/null and b/RestaurantRoyale/Images.xcassets/rouletteWheel.dataset/rouletteWheel.gif differ diff --git a/RestaurantRoyale/Info.plist b/RestaurantRoyale/Info.plist index f73f936..84fac1e 100644 --- a/RestaurantRoyale/Info.plist +++ b/RestaurantRoyale/Info.plist @@ -39,8 +39,6 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight diff --git a/RestaurantRoyale/InitialViewController.swift b/RestaurantRoyale/InitialViewController.swift index c3e95bf..a717ab1 100644 --- a/RestaurantRoyale/InitialViewController.swift +++ b/RestaurantRoyale/InitialViewController.swift @@ -9,25 +9,39 @@ import UIKit import Firebase -class AuthButtons: UIButton { +class InitialViewController: UIViewController { + + @IBOutlet weak var loginButton: UIButton! + @IBOutlet weak var signupButton: UIButton! + @IBOutlet weak var rouletteWheel: UIImageView! - override func awakeFromNib() { + override func viewDidLoad() { + super.viewDidLoad() + + loginButton.layer.cornerRadius = loginButton.frame.size.height / 2 + loginButton.layer.frame.size = CGSize(width: 50, height: 25) + loginButton.layer.masksToBounds = true - layer.cornerRadius = 15 - backgroundColor = UIColor(red: 0.75, green: 0.20, blue: 0.19, alpha: 1.0) - setTitleColor(UIColor.white, for: .normal) + loginButton.layer.borderWidth = 1 + loginButton.layer.borderColor = Colors.Timberwolf.cgColor + signupButton.layer.cornerRadius = signupButton.frame.size.height / 2 + signupButton.layer.masksToBounds = true + + signupButton.layer.borderWidth = 1 + signupButton.layer.borderColor = Colors.Timberwolf.cgColor + + rouletteWheel.loadGif(name: "rouletteWheel") } -} - -class InitialViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + + loginButton.setGradientBackground(colorOne: Colors.DarkTangerine, colorTwo: Colors.SunsetOrange) + signupButton.setGradientBackground(colorOne: Colors.DarkTangerine, colorTwo: Colors.SunsetOrange) + self.view.setGradientBackground(colorOne: Colors.MaastrichtBlue, colorTwo: Colors.RifleGray) - // Do any additional setup after loading the view. } override func viewDidAppear(_ animated: Bool) { @@ -39,15 +53,12 @@ class InitialViewController: UIViewController { } - - /* - // MARK: - Navigation - - // In a storyboard-based application, you will often want to do a little preparation before navigation - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - // Get the new view controller using segue.destination. - // Pass the selected object to the new view controller. - } - */ + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.setNeedsStatusBarAppearanceUpdate() + } + override var preferredStatusBarStyle: UIStatusBarStyle { + return .lightContent + } } diff --git a/RestaurantRoyale/LoginViewController.swift b/RestaurantRoyale/LoginViewController.swift index 5cca307..2f869b3 100644 --- a/RestaurantRoyale/LoginViewController.swift +++ b/RestaurantRoyale/LoginViewController.swift @@ -20,29 +20,35 @@ class LoginViewController: UIViewController { // Do any additional setup after loading the view. } - @IBAction func handleLogin(_ sender: Any) { - guard let email = emailField.text else { return } - guard let password = passwordField.text else { return } - - Auth.auth().signIn(withEmail: email, password: password) { user, error in - - if error == nil && user != nil { - self.dismiss(animated: false, completion: nil) - } else { - print("Error logging in: \(error!.localizedDescription)") - } - } - - } + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + + self.view.setGradientBackground(colorOne: Colors.MaastrichtBlue, colorTwo: Colors.RifleGray) + + } - /* - // MARK: - Navigation - - // In a storyboard-based application, you will often want to do a little preparation before navigation - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - // Get the new view controller using segue.destination. - // Pass the selected object to the new view controller. - } - */ + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.setNeedsStatusBarAppearanceUpdate() + } + override var preferredStatusBarStyle: UIStatusBarStyle { + return .lightContent + } + + @IBAction func handleLogin(_ sender: Any) { + + guard let email = emailField.text else { return } + guard let password = passwordField.text else { return } + + Auth.auth().signIn(withEmail: email, password: password) { user, error in + + if error == nil && user != nil { + self.dismiss(animated: false, completion: nil) + } else { + print("Error logging in: \(error!.localizedDescription)") + } + } + + } } diff --git a/RestaurantRoyale/ProfileViewController.swift b/RestaurantRoyale/ProfileViewController.swift index 39f12d9..78c36f0 100644 --- a/RestaurantRoyale/ProfileViewController.swift +++ b/RestaurantRoyale/ProfileViewController.swift @@ -11,14 +11,20 @@ import Firebase class ProfileViewController: UIViewController { - @IBOutlet weak var favFoodDisplay: UILabel! - @IBOutlet weak var usernameDisplay: UILabel! - @IBOutlet weak var profilePic: UIImageView! - @IBOutlet weak var nameDisplay: UILabel! + @IBOutlet weak var favFoodDisplay: UILabel! + @IBOutlet weak var usernameDisplay: UILabel! + @IBOutlet weak var profilePic: UIImageView! + @IBOutlet weak var nameDisplay: UILabel! + @IBOutlet weak var logoutButton: UIButton! override func viewDidLoad() { super.viewDidLoad() + logoutButton.layer.cornerRadius = logoutButton.frame.size.height / 2 + logoutButton.layer.masksToBounds = true + logoutButton.layer.borderWidth = 1 + logoutButton.layer.borderColor = Colors.Timberwolf.cgColor + let settings = db.settings settings.areTimestampsInSnapshotsEnabled = true db.settings = settings @@ -45,9 +51,25 @@ class ProfileViewController: UIViewController { } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.setNeedsStatusBarAppearanceUpdate() + } + override var preferredStatusBarStyle: UIStatusBarStyle { + return .lightContent + } + @IBAction func handleLogout(_ sender: Any) { try! Auth.auth().signOut() self.dismiss(animated: false, completion: nil) } + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + + logoutButton.setGradientBackground(colorOne: Colors.DarkTangerine, colorTwo: Colors.SunsetOrange) + self.view.setGradientBackground(colorOne: Colors.MaastrichtBlue, colorTwo: Colors.RifleGray) + + } } diff --git a/RestaurantRoyale/Restaurant.swift b/RestaurantRoyale/Restaurant.swift index 8b174f6..d7bdc81 100644 --- a/RestaurantRoyale/Restaurant.swift +++ b/RestaurantRoyale/Restaurant.swift @@ -17,7 +17,6 @@ class Restaurant { var categories = Array() func loadRestaurant(restaurantID: String, completion: @escaping () -> Void) { - let docRef = db.collection("restaurants").document(restaurantID) docRef.getDocument(){ (document, error) in if let document = document { @@ -29,7 +28,7 @@ class Restaurant { let lon = point.longitude self.location = CLLocationCoordinate2D(latitude: lat, longitude: lon) } - self.categories = document.get("categories") as! [String] + self.categories = document.get("type") as! [String] } completion() } diff --git a/RestaurantRoyale/RestaurantManager.swift b/RestaurantRoyale/RestaurantManager.swift new file mode 100644 index 0000000..fc74d2d --- /dev/null +++ b/RestaurantRoyale/RestaurantManager.swift @@ -0,0 +1,112 @@ +// +// RestaurantManager.swift +// Restaurant Royale +// +// Created by Carrier, Kenton on 12/11/18. +// Copyright © 2018 Ken Toh. All rights reserved. +// + +import Foundation +import Firebase +import MapKit + +class RestaurantManager { + + func GetEveryRestaurant(completion: @escaping ([Restaurant]) -> Void){ + + var restaurantsArray = [Restaurant]() + + db.collection("restaurants").order(by: "name").getDocuments() { (querySnapshot, err) in + if let err = err { + print("Error getting documents: \(err)") + completion(restaurantsArray) + } else { + var numAdded = 0 + for document in querySnapshot!.documents { + let nextRestaurant = Restaurant() + nextRestaurant.loadRestaurant(restaurantID: document.documentID, completion: { + restaurantsArray.append(nextRestaurant) + numAdded += 1 + if numAdded == querySnapshot?.count { + completion(restaurantsArray) + } + }) + } + } + } + } + + func GetRestaurantByCategory(category: String, completion: @escaping () -> Void) -> Restaurant { + let randomRestaurant = Restaurant() + + let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" + let randomID = String((0...19).map{ _ in letters.randomElement()! }) + + db.collection("restaurants").whereField("type", arrayContains: category).whereField(FieldPath.documentID(), isGreaterThan: randomID).limit(to: 1).getDocuments() { (querySnapshot, err) in + if let err = err { + print("Error getting documents: \(err)") + } else { + if querySnapshot?.count == 0 { + db.collection("restaurants").whereField(FieldPath.documentID(), isLessThan: randomID).limit(to: 1).getDocuments() { (querySnapshot, err) in + if let err = err { + print("Error getting documents: \(err)") + } else { + for document in querySnapshot!.documents { + randomRestaurant.loadRestaurant(restaurantID: document.documentID, completion: { + completion() + }) + } + } + } + } else { + + for document in querySnapshot!.documents { + randomRestaurant.loadRestaurant(restaurantID: document.documentID, completion: { + completion() + }) + } + + } + } + } + return randomRestaurant + } + + func GetRandomRestaurant(completion: @escaping () -> Void) -> Restaurant { + + let randomRestaurant = Restaurant() + + let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" + let randomID = String((0...19).map{ _ in letters.randomElement()! }) + + db.collection("restaurants").whereField(FieldPath.documentID(), isGreaterThan: randomID).limit(to: 1).getDocuments() { (querySnapshot, err) in + if let err = err { + print("Error getting documents: \(err)") + } else { + if querySnapshot?.count == 0 { + db.collection("restaurants").whereField(FieldPath.documentID(), isLessThan: randomID).limit(to: 1).getDocuments() { (querySnapshot, err) in + if let err = err { + print("Error getting documents: \(err)") + } else { + for document in querySnapshot!.documents { + randomRestaurant.loadRestaurant(restaurantID: document.documentID, completion: { + completion() + }) + } + } + } + } else { + + for document in querySnapshot!.documents { + randomRestaurant.loadRestaurant(restaurantID: document.documentID, completion: { + completion() + }) + } + + } + } + } + return randomRestaurant + } + +} diff --git a/RestaurantRoyale/SearchViewController.swift b/RestaurantRoyale/SearchViewController.swift new file mode 100644 index 0000000..6ec87cf --- /dev/null +++ b/RestaurantRoyale/SearchViewController.swift @@ -0,0 +1,89 @@ +// +// SearchViewController.swift +// Restaurant Royale +// +// Created by Joseph Crocker on 11/29/18. +// Copyright © 2018 Ken Toh. All rights reserved. +// + +import UIKit + +class SearchViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate { + @IBOutlet weak var tableView: UITableView! + @IBOutlet weak var searchBar: UISearchBar! + + var manager = RestaurantManager() + var restaurantArray = [Restaurant]() + + override func viewDidLoad() { + super.viewDidLoad() + + setupSearch() + loadData() + + } + + fileprivate func setupSearch() + { + searchBar.delegate = self + tableView.dataSource = self + tableView.delegate = self + } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return matches.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "TableViewCell") as! TableViewCell + + matches = matches.sorted {$0.name < $1.name} + + let text = matches[indexPath.row].name + + cell.textLabel?.text = text + + return cell + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let vc = storyboard?.instantiateViewController(withIdentifier: "infoViewController") as! infoViewController + + vc.restaurant = matches[indexPath.row] + vc.category = matches[indexPath.row].categories[0] + self.navigationController?.pushViewController(vc, animated: true) + } + + func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { + if (searchText == ""){ + matches = restaurantArray + } + else{ + matches = restaurantArray.filter{$0.name.contains(searchText)} + matches = matches.sorted { $0.name < $1.name } + } + tableView.reloadData() + } + + func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + + fileprivate var matches: [Restaurant] = [] + + func loadData(){ + manager.GetEveryRestaurant(completion: { loaded in + self.restaurantArray = loaded + for restaurant in self.restaurantArray { + print(restaurant.name) + self.matches.append(restaurant) + } + self.tableView.reloadData() + // Do Array things here, like updating the tableview + }) + matches = restaurantArray + matches = matches.sorted { $0.name < $1.name} + tableView.reloadData() + } + +} diff --git a/RestaurantRoyale/SignUpViewController.swift b/RestaurantRoyale/SignUpViewController.swift index cda7038..cd3fb8c 100644 --- a/RestaurantRoyale/SignUpViewController.swift +++ b/RestaurantRoyale/SignUpViewController.swift @@ -25,40 +25,45 @@ class SignUpViewController: UIViewController { @IBAction func backButtonPressed(_ sender: UIButton) { } - /* - // MARK: - Navigation - - // In a storyboard-based application, you will often want to do a little preparation before navigation - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - // Get the new view controller using segue.destination. - // Pass the selected object to the new view controller. - } - */ + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + + self.view.setGradientBackground(colorOne: Colors.MaastrichtBlue, colorTwo: Colors.RifleGray) + + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.setNeedsStatusBarAppearanceUpdate() + } + override var preferredStatusBarStyle: UIStatusBarStyle { + return .lightContent + } - @IBAction func handleSignUp(_ sender: Any) { - guard let username = usernameField.text else { return } - guard let email = emailField.text else { return } - guard let password = passwordField.text else { return } - - Auth.auth().createUser(withEmail: email, password: password) { user, error in - if error == nil && user != nil { - print("User created!") - - let changeRequest = Auth.auth().currentUser?.createProfileChangeRequest() - changeRequest?.displayName = username - changeRequest?.commitChanges { error in - if error == nil { - print("User display name changed!") - self.dismiss(animated: false, completion: nil) - } + @IBAction func handleSignUp(_ sender: Any) { + guard let username = usernameField.text else { return } + guard let email = emailField.text else { return } + guard let password = passwordField.text else { return } + + Auth.auth().createUser(withEmail: email, password: password) { user, error in + if error == nil && user != nil { + print("User created!") + + let changeRequest = Auth.auth().currentUser?.createProfileChangeRequest() + changeRequest?.displayName = username + changeRequest?.commitChanges { error in + if error == nil { + print("User display name changed!") + self.dismiss(animated: false, completion: nil) } - - } else { - print("Error creating user: \(error!.localizedDescription)") } + + } else { + print("Error creating user: \(error!.localizedDescription)") } } + } } diff --git a/RestaurantRoyale/TableViewCell.swift b/RestaurantRoyale/TableViewCell.swift new file mode 100644 index 0000000..051a380 --- /dev/null +++ b/RestaurantRoyale/TableViewCell.swift @@ -0,0 +1,24 @@ +// +// TableViewCell.swift +// Restaurant Royale +// +// Created by Joseph Crocker on 12/12/18. +// Copyright © 2018 Ken Toh. All rights reserved. +// + +import UIKit + +class TableViewCell: UITableViewCell { + + 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 + } + +} diff --git a/RestaurantRoyale/Utilities.swift b/RestaurantRoyale/Utilities.swift index b3a5f1e..dd25bf1 100644 --- a/RestaurantRoyale/Utilities.swift +++ b/RestaurantRoyale/Utilities.swift @@ -34,3 +34,18 @@ extension UIImageView { } } } + +extension UIView { + + func setGradientBackground(colorOne: UIColor, colorTwo: UIColor) { + let gradientLayer = CAGradientLayer() + gradientLayer.frame = bounds + gradientLayer.colors = [colorOne.cgColor, colorTwo.cgColor] + gradientLayer.locations = [0.0, 1.0] + gradientLayer.startPoint = CGPoint(x: 1.0, y: 1.0) + gradientLayer.endPoint = CGPoint(x: 0, y: 0) + + layer.insertSublayer(gradientLayer, at: 0) + } + +} diff --git a/RestaurantRoyale/RewardsViewController.swift b/RestaurantRoyale/infoViewController.swift similarity index 54% rename from RestaurantRoyale/RewardsViewController.swift rename to RestaurantRoyale/infoViewController.swift index 50ea4d3..38b23c7 100644 --- a/RestaurantRoyale/RewardsViewController.swift +++ b/RestaurantRoyale/infoViewController.swift @@ -1,22 +1,34 @@ // -// RewardsViewController.swift +// infoViewController.swift // Restaurant Royale // -// Created by Joseph Crocker on 11/29/18. +// Created by Joseph Crocker on 12/12/18. // Copyright © 2018 Ken Toh. All rights reserved. // import UIKit +import MapKit -class RewardsViewController: UIViewController { +class infoViewController: UIViewController { + @IBOutlet weak var restaurantNameLabel: UITextField! + @IBOutlet weak var categoryLabel: UITextField! + + var restaurant = Restaurant() + var category = "" + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. + restaurantNameLabel.text = restaurant.name + categoryLabel.text = category + } + + @IBAction func mapButton(_ sender: Any) { + restaurant.openMapToRestaurant() } - /* // MARK: - Navigation diff --git a/RestaurantRoyale/money.gif b/RestaurantRoyale/money.gif deleted file mode 100644 index f6df41a..0000000 Binary files a/RestaurantRoyale/money.gif and /dev/null differ diff --git a/RestaurantRoyale/profileHeader.jpg b/RestaurantRoyale/profileHeader.jpg new file mode 100644 index 0000000..75c49e6 Binary files /dev/null and b/RestaurantRoyale/profileHeader.jpg differ diff --git a/RestaurantRoyale/slots.gif b/RestaurantRoyale/slots.gif deleted file mode 100644 index b7bcca3..0000000 Binary files a/RestaurantRoyale/slots.gif and /dev/null differ