diff --git a/Eatery Blue.xcodeproj/project.pbxproj b/Eatery Blue.xcodeproj/project.pbxproj index 35549dd..feffd29 100644 --- a/Eatery Blue.xcodeproj/project.pbxproj +++ b/Eatery Blue.xcodeproj/project.pbxproj @@ -172,7 +172,6 @@ D053BF622CCDAA250060F82C /* EateryListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D053BF612CCDAA250060F82C /* EateryListView.swift */; }; D0548AD72BB5201B0064489D /* ScrollHitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0548AD62BB5201B0064489D /* ScrollHitView.swift */; }; D06230E82CB9D4A70092C04A /* FavoritesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06230E72CB9D4A70092C04A /* FavoritesViewController.swift */; }; - D064656D2C8CE634001902A4 /* NotificationButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D064656C2C8CE634001902A4 /* NotificationButton.swift */; }; D06AE51C2CE1CC4500C0AFF5 /* TabButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06AE51B2CE1CC3700C0AFF5 /* TabButtonView.swift */; }; D0730BB82D2B49AB00F9070A /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0730BB72D2B49A600F9070A /* HomeViewController.swift */; }; D0730BBA2D2B55B500F9070A /* ClearCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0730BB92D2B55B500F9070A /* ClearCollectionViewCell.swift */; }; @@ -192,6 +191,14 @@ D0DAA9D32BA9123200BEDE62 /* CompareMenusFilterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0DAA9D22BA9123200BEDE62 /* CompareMenusFilterViewController.swift */; }; D0DC533E2BBBA48F0034D968 /* Hero in Frameworks */ = {isa = PBXBuildFile; productRef = 2ED2FC122BA2D7AA00621028 /* Hero */; }; D0EC7C362BBA009E00F05F8E /* CompareMenusExternalOnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0EC7C352BBA009E00F05F8E /* CompareMenusExternalOnboardingView.swift */; }; + EE2C69B82D6FED1500838EEB /* NotificationViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE2C69B72D6FED1500838EEB /* NotificationViewCell.swift */; }; + EE2C69BC2D6FED1900838EEB /* NotificationHubView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE2C69BB2D6FED1900838EEB /* NotificationHubView.swift */; }; + EE84023F2D8B8B1300AAF548 /* FavoriteItemNotif.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE84023E2D8B8B1300AAF548 /* FavoriteItemNotif.swift */; }; + EE8402412D8B8B3800AAF548 /* NotificationsHubNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8402402D8B8B3800AAF548 /* NotificationsHubNavigationView.swift */; }; + EE8402432D8B8B6A00AAF548 /* NotificationsHubViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8402422D8B8B6A00AAF548 /* NotificationsHubViewController.swift */; }; + EE8402452D8B8F7700AAF548 /* NotificationButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8402442D8B8F7700AAF548 /* NotificationButton.swift */; }; + EEE0658F2D6AD4BA008DD681 /* NotificationViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE0658E2D6AD4BA008DD681 /* NotificationViewCell.swift */; }; + EEE065932D6ADD7A008DD681 /* NotificationHubView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE065922D6ADD7A008DD681 /* NotificationHubView.swift */; }; FD78B0B32ADF6762007055B4 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD78B0B22ADF6762007055B4 /* String+Extension.swift */; }; FD88925A2AE9B33C0084EDAD /* EateryMemoryCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD8892592AE9B33C0084EDAD /* EateryMemoryCache.swift */; }; FDCCF9472AFB0C8E00557FED /* StayLoggedInSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDCCF9462AFB0C8E00557FED /* StayLoggedInSheet.swift */; }; @@ -366,7 +373,6 @@ D053BF612CCDAA250060F82C /* EateryListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EateryListView.swift; sourceTree = ""; }; D0548AD62BB5201B0064489D /* ScrollHitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollHitView.swift; sourceTree = ""; }; D06230E72CB9D4A70092C04A /* FavoritesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesViewController.swift; sourceTree = ""; }; - D064656C2C8CE634001902A4 /* NotificationButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationButton.swift; sourceTree = ""; }; D06AE51B2CE1CC3700C0AFF5 /* TabButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabButtonView.swift; sourceTree = ""; }; D0730BB72D2B49A600F9070A /* HomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = ""; }; D0730BB92D2B55B500F9070A /* ClearCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClearCollectionViewCell.swift; sourceTree = ""; }; @@ -385,6 +391,14 @@ D0C770A72B9803A900A4828F /* CompareMenusViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompareMenusViewController.swift; sourceTree = ""; }; D0DAA9D22BA9123200BEDE62 /* CompareMenusFilterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompareMenusFilterViewController.swift; sourceTree = ""; }; D0EC7C352BBA009E00F05F8E /* CompareMenusExternalOnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompareMenusExternalOnboardingView.swift; sourceTree = ""; }; + EE2C69B72D6FED1500838EEB /* NotificationViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewCell.swift; sourceTree = ""; }; + EE2C69BB2D6FED1900838EEB /* NotificationHubView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationHubView.swift; sourceTree = ""; }; + EE84023E2D8B8B1300AAF548 /* FavoriteItemNotif.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteItemNotif.swift; sourceTree = ""; }; + EE8402402D8B8B3800AAF548 /* NotificationsHubNavigationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsHubNavigationView.swift; sourceTree = ""; }; + EE8402422D8B8B6A00AAF548 /* NotificationsHubViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsHubViewController.swift; sourceTree = ""; }; + EE8402442D8B8F7700AAF548 /* NotificationButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationButton.swift; sourceTree = ""; }; + EEE0658E2D6AD4BA008DD681 /* NotificationViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewCell.swift; sourceTree = ""; }; + EEE065922D6ADD7A008DD681 /* NotificationHubView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationHubView.swift; sourceTree = ""; }; FD78B0B22ADF6762007055B4 /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; FD8892592AE9B33C0084EDAD /* EateryMemoryCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EateryMemoryCache.swift; sourceTree = ""; }; FDCCF9462AFB0C8E00557FED /* StayLoggedInSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StayLoggedInSheet.swift; sourceTree = ""; }; @@ -995,7 +1009,14 @@ D064656B2C8CE626001902A4 /* Notifications */ = { isa = PBXGroup; children = ( - D064656C2C8CE634001902A4 /* NotificationButton.swift */, + EE8402422D8B8B6A00AAF548 /* NotificationsHubViewController.swift */, + EE2C69BB2D6FED1900838EEB /* NotificationHubView.swift */, + EE2C69B72D6FED1500838EEB /* NotificationViewCell.swift */, + EE84023E2D8B8B1300AAF548 /* FavoriteItemNotif.swift */, + EE8402402D8B8B3800AAF548 /* NotificationsHubNavigationView.swift */, + EEE0658E2D6AD4BA008DD681 /* NotificationViewCell.swift */, + EEE065922D6ADD7A008DD681 /* NotificationHubView.swift */, + EE8402442D8B8F7700AAF548 /* NotificationButton.swift */, ); path = Notifications; sourceTree = ""; @@ -1153,12 +1174,14 @@ 5DF5F7EB2774D8FE001ADCDC /* EateryViewController.swift in Sources */, 5DF304A527791D2C00E2C9A4 /* EateryModelController.swift in Sources */, 5DF938D1277662CC008ED0A1 /* PaymentMethodFilterView.swift in Sources */, + EEE0658F2D6AD4BA008DD681 /* NotificationViewCell.swift in Sources */, 5DDAD4732773D57A00CC98DD /* DummyData.swift in Sources */, 5D1F13B2277638D4001A21B9 /* SheetPresentationController.swift in Sources */, 5DF938D327768B84008ED0A1 /* SheetViewController.swift in Sources */, FD88925A2AE9B33C0084EDAD /* EateryMemoryCache.swift in Sources */, 5DA434B6278B5A17001337FD /* AccountTransactionTableViewCell.swift in Sources */, 5D73C3832780E9DD0020507C /* HomeSearchContentModelController.swift in Sources */, + EE2C69B82D6FED1500838EEB /* NotificationViewCell.swift in Sources */, 5DF304A727791E6300E2C9A4 /* MenuPickerSheetViewController.swift in Sources */, D05063412B9421F30022760B /* CompareMenusEaterySelectionCell.swift in Sources */, 5D73C3BE27822AD30020507C /* EateryBlue.xcdatamodeld in Sources */, @@ -1197,11 +1220,13 @@ 5D468A00277D146500986AFF /* ClearTableViewCell.swift in Sources */, D0A7A3082D3419C300D9B472 /* NSAttributedString+Extension.swift in Sources */, D09D20A52B96DE19004C72ED /* CompareMenusNavigationView.swift in Sources */, + EE8402452D8B8F7700AAF548 /* NotificationButton.swift in Sources */, D0A7A30A2D342E1800D9B472 /* MenusViewController.swift in Sources */, 5D468A15277E3FDC00986AFF /* Networking.swift in Sources */, 5D0CDC4F2774FDAE00AD0E27 /* MenuHeaderView.swift in Sources */, D07A73A32CDB223A009E380C /* FavoritesItemsTableViewCell.swift in Sources */, D04FB87B2BCEE89B0058F732 /* SettingsAppIconCell.swift in Sources */, + EE84023F2D8B8B1300AAF548 /* FavoriteItemNotif.swift in Sources */, 5D73C3C027822CD20020507C /* CoreDataStack.swift in Sources */, 5DA434BA278B6779001337FD /* Locale+Extension.swift in Sources */, 5DF304952777870F00E2C9A4 /* WaitTimesSheetViewController.swift in Sources */, @@ -1254,11 +1279,13 @@ 5D0B9D79279F1DB1004B4AA1 /* SettingsPrivacyView.swift in Sources */, 5DF304AF277921BA00E2C9A4 /* MenuDayPickerView.swift in Sources */, 5D75D6D7278E0D7000832359 /* SettingsLogoutPillButton.swift in Sources */, + EE8402412D8B8B3800AAF548 /* NotificationsHubNavigationView.swift in Sources */, 9920725829CA10E600FFFB92 /* EateryPageViewController.swift in Sources */, 5D75D6E4278E2B9D00832359 /* EateryCardVisualEffectView.swift in Sources */, D0B72AE32D32C2180041C2BA /* MiniSelectionView.swift in Sources */, 5D0CDC492774F15E00AD0E27 /* TimingDataView.swift in Sources */, 5D86EDA1277ED0A500C92A3B /* ListModelController.swift in Sources */, + EE8402432D8B8B6A00AAF548 /* NotificationsHubViewController.swift in Sources */, 5DBB59DD278FA0080028FE59 /* EateryFormatter.swift in Sources */, D09D20A72B97A429004C72ED /* CompareMenusEateryViewController.swift in Sources */, 5DF5F7D6277404C8001ADCDC /* UIFont+Extension.swift in Sources */, @@ -1275,8 +1302,8 @@ 5DF5F7DB27740EFB001ADCDC /* ContainerView.swift in Sources */, 998F6D0A2ABF2C19006B7F18 /* EateryExpandableCardContentView.swift in Sources */, 5DA434BE278B6EC7001337FD /* UITableViewCell+Extension.swift in Sources */, - D064656D2C8CE634001902A4 /* NotificationButton.swift in Sources */, 5DF5F7E127742280001ADCDC /* EaterySmallCardView.swift in Sources */, + EE2C69BC2D6FED1900838EEB /* NotificationHubView.swift in Sources */, 5DF5F7D227740140001ADCDC /* PillFilterButtonView.swift in Sources */, 413780512AC5DFD600EE43FE /* KeychainAccess.swift in Sources */, 5DBA899A2783ED23002DCA6B /* OnboardingViewController.swift in Sources */, @@ -1296,6 +1323,7 @@ 5DCB869C2782396000134066 /* main.swift in Sources */, 5DAE72D5278FC12600284A72 /* NetIDKeychainManager.swift in Sources */, 5DF938CF27764F48008ED0A1 /* SheetPresentationAnimationController.swift in Sources */, + EEE065932D6ADD7A008DD681 /* NotificationHubView.swift in Sources */, 5D698F922788A7FE0054E1AB /* AccountModelController.swift in Sources */, 5D75D6D3278E084E00832359 /* SettingsMainMenuCell.swift in Sources */, ); diff --git a/Eatery Blue/Assets.xcassets/ArrowRound.imageset/Contents.json b/Eatery Blue/Assets.xcassets/ArrowRound.imageset/Contents.json new file mode 100644 index 0000000..ddb391d --- /dev/null +++ b/Eatery Blue/Assets.xcassets/ArrowRound.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Text.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Eatery Blue/Assets.xcassets/ArrowRound.imageset/Text.png b/Eatery Blue/Assets.xcassets/ArrowRound.imageset/Text.png new file mode 100644 index 0000000..38ea89e Binary files /dev/null and b/Eatery Blue/Assets.xcassets/ArrowRound.imageset/Text.png differ diff --git a/Eatery Blue/Assets.xcassets/FavoriteNoNotif.imageset/Contents.json b/Eatery Blue/Assets.xcassets/FavoriteNoNotif.imageset/Contents.json new file mode 100644 index 0000000..86f8ee6 --- /dev/null +++ b/Eatery Blue/Assets.xcassets/FavoriteNoNotif.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "New Notif (1).png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Eatery Blue/Assets.xcassets/FavoriteNoNotif.imageset/New Notif (1).png b/Eatery Blue/Assets.xcassets/FavoriteNoNotif.imageset/New Notif (1).png new file mode 100644 index 0000000..4b74c9c Binary files /dev/null and b/Eatery Blue/Assets.xcassets/FavoriteNoNotif.imageset/New Notif (1).png differ diff --git a/Eatery Blue/Assets.xcassets/FavoriteNotif.imageset/Contents.json b/Eatery Blue/Assets.xcassets/FavoriteNotif.imageset/Contents.json new file mode 100644 index 0000000..639598a --- /dev/null +++ b/Eatery Blue/Assets.xcassets/FavoriteNotif.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "New Notif.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Eatery Blue/Assets.xcassets/FavoriteNotif.imageset/New Notif.png b/Eatery Blue/Assets.xcassets/FavoriteNotif.imageset/New Notif.png new file mode 100644 index 0000000..3cea020 Binary files /dev/null and b/Eatery Blue/Assets.xcassets/FavoriteNotif.imageset/New Notif.png differ diff --git a/Eatery Blue/Extensions/NSAttributedString+Extension.swift b/Eatery Blue/Extensions/NSAttributedString+Extension.swift index 1b664a2..08809fa 100644 --- a/Eatery Blue/Extensions/NSAttributedString+Extension.swift +++ b/Eatery Blue/Extensions/NSAttributedString+Extension.swift @@ -24,4 +24,4 @@ extension NSAttributedString { return output } -} +} \ No newline at end of file diff --git a/Eatery Blue/UI/Carousel/CarouselView.swift b/Eatery Blue/UI/Carousel/CarouselView.swift index dd9587c..52578ea 100644 --- a/Eatery Blue/UI/Carousel/CarouselView.swift +++ b/Eatery Blue/UI/Carousel/CarouselView.swift @@ -26,6 +26,8 @@ class CarouselView: UIView { } /// Navigation controller to push from var navigationController: UINavigationController? + /// An observer to be attatched to this view + private var observer: NSObjectProtocol? /// How many eateries should show in this carousel, -1 if showing all var truncateAfter: Int = -1 { didSet { diff --git a/Eatery Blue/UI/EateryCard/EateryCardShimmerTableViewCell.swift b/Eatery Blue/UI/EateryCard/EateryCardShimmerTableViewCell.swift index d146681..7d95e6f 100644 --- a/Eatery Blue/UI/EateryCard/EateryCardShimmerTableViewCell.swift +++ b/Eatery Blue/UI/EateryCard/EateryCardShimmerTableViewCell.swift @@ -64,4 +64,4 @@ class EateryCardShimmerView: UITableViewCell { gradientLayer.add(animation, forKey: animation.keyPath) } -} +} \ No newline at end of file diff --git a/Eatery Blue/UI/EateryCard/EateryLargeCardView.swift b/Eatery Blue/UI/EateryCard/EateryLargeCardView.swift index 571f4b2..2e311c4 100644 --- a/Eatery Blue/UI/EateryCard/EateryLargeCardView.swift +++ b/Eatery Blue/UI/EateryCard/EateryLargeCardView.swift @@ -240,4 +240,4 @@ class EateryLargeCardView: UICollectionViewCell { alertsStackView.addArrangedSubview(view) } -} +} \ No newline at end of file diff --git a/Eatery Blue/UI/EateryCard/EateryMediumCardView.swift b/Eatery Blue/UI/EateryCard/EateryMediumCardView.swift index 7e77eed..edcb7b0 100644 --- a/Eatery Blue/UI/EateryCard/EateryMediumCardView.swift +++ b/Eatery Blue/UI/EateryCard/EateryMediumCardView.swift @@ -220,4 +220,4 @@ class EateryMediumCardView: UICollectionViewCell { alertsStackView.addArrangedSubview(view) } -} +} \ No newline at end of file diff --git a/Eatery Blue/UI/Favoriting/FavoritesViewController.swift b/Eatery Blue/UI/Favoriting/FavoritesViewController.swift index 632ba28..699f6eb 100644 --- a/Eatery Blue/UI/Favoriting/FavoritesViewController.swift +++ b/Eatery Blue/UI/Favoriting/FavoritesViewController.swift @@ -201,4 +201,3 @@ extension FavoritesViewController: UISearchBarDelegate { } } - diff --git a/Eatery Blue/UI/HomeScreen/HomeViewController.swift b/Eatery Blue/UI/HomeScreen/HomeViewController.swift index ba6206b..bbeda94 100644 --- a/Eatery Blue/UI/HomeScreen/HomeViewController.swift +++ b/Eatery Blue/UI/HomeScreen/HomeViewController.swift @@ -143,6 +143,12 @@ class HomeViewController: UIViewController { navigationController?.hero.isEnabled = false navigationController?.pushViewController(searchViewController, animated: true) } + + navigationView.notificationButton.onTap { [self] _ in + let notifHubViewController = NotificationsHubViewController() + + navigationController?.pushViewController(notifHubViewController, animated: true) + } navigationView.logoRefreshControl.addTarget(self, action: #selector(didRefresh), for: .valueChanged) } diff --git a/Eatery Blue/UI/NavigationView/NavigationView.swift b/Eatery Blue/UI/NavigationView/NavigationView.swift index db25323..c1c873d 100644 --- a/Eatery Blue/UI/NavigationView/NavigationView.swift +++ b/Eatery Blue/UI/NavigationView/NavigationView.swift @@ -41,7 +41,7 @@ class NavigationView: UICollectionReusableView { setUpLargeTitleLabel() // TODO: - NOTIFICATIONS -// addSubview(notificationButton) + addSubview(notificationButton) } private func setUpNormalNavigationBar() { @@ -108,10 +108,10 @@ class NavigationView: UICollectionReusableView { largeTitleLabel.setContentCompressionResistancePriority(.required, for: .vertical) // TODO: - NOTIFICATIONS -// notificationButton.snp.makeConstraints { make in -// make.trailing.equalTo(layoutMarginsGuide) -// make.centerY.equalTo(largeTitleLabel.snp.centerY) -// } + notificationButton.snp.makeConstraints { make in + make.trailing.equalTo(layoutMarginsGuide) + make.centerY.equalTo(largeTitleLabel.snp.centerY) + } } func computeExpandedHeight() -> CGFloat { diff --git a/Eatery Blue/UI/Notifications/FavoriteItemNotif.swift b/Eatery Blue/UI/Notifications/FavoriteItemNotif.swift new file mode 100644 index 0000000..de9a014 --- /dev/null +++ b/Eatery Blue/UI/Notifications/FavoriteItemNotif.swift @@ -0,0 +1,24 @@ +// +// FavoriteItemNotif.swift +// Eatery Blue +// +// Created by Cindy Liang on 2/22/25. +// + +import Foundation +class FavoriteItemNotif { + var itemName: String + var date: String + + //eateries mjight need to be stored in a list + //handle the cases where it is 1 eatery, 2 eateries, 3+ eateries (they will have diff text) + var availableEateries: String + var isSelected: Bool + + init (name:String, date:String,eateries:String) { + self.itemName = name + self.date = date + self.availableEateries = eateries + self.isSelected = false + } +} diff --git a/Eatery Blue/UI/Notifications/NotificationButton.swift b/Eatery Blue/UI/Notifications/NotificationButton.swift index 3919b5e..98046f8 100644 --- a/Eatery Blue/UI/Notifications/NotificationButton.swift +++ b/Eatery Blue/UI/Notifications/NotificationButton.swift @@ -54,6 +54,10 @@ class NotificationButton: ButtonView { let plvc = ProfileLoginModelController(canGoBack: true) // let vc = NotificationViewController(loggedIn: loggedIn) completion?(loggedIn ? UIViewController(): plvc) + +// let notifHubViewController = NotificationHubViewController +// +// navigationController?.pushViewController(notifHubViewController, animated: true) } checkforNotifications() diff --git a/Eatery Blue/UI/Notifications/NotificationHubView.swift b/Eatery Blue/UI/Notifications/NotificationHubView.swift new file mode 100644 index 0000000..6b71426 --- /dev/null +++ b/Eatery Blue/UI/Notifications/NotificationHubView.swift @@ -0,0 +1,129 @@ +// +// NotificationHubView.swift +// Eatery Blue +// +// Created by Cindy Liang on 2/22/25. +// + +import Foundation +import UIKit + +class NotificationHubView: UIView { + + // MARK: - Properties (View) + + let tableView = UITableView() + private let titleLabel = UILabel() + var navigationController: UINavigationController? + + + private var itemData: [FavoriteItemNotif] = [FavoriteItemNotif(name:"Chicken Nuggets",date:"Today",eateries:"At Okies"),FavoriteItemNotif(name:"Chicken Nuggets",date:"Today",eateries:"At Okies"),FavoriteItemNotif(name:"Chicken Nuggets",date:"Today",eateries:"At Okies"),FavoriteItemNotif(name:"Chicken Nuggets",date:"Today",eateries:"At Okies")] + + +// private lazy var dataSource = makeDataSource() + + + // MARK: - Init + + init() { + super.init(frame: .zero) + + setUpSelf() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - Set Up + + private func setUpSelf() { + self.layoutMargins = UIEdgeInsets(top: 8, left: 16, bottom: 4, right: 16) + + addSubview(titleLabel) + setUpTitleLabel() + + setUpTableView() + self.addSubview(tableView) + + setUpConstraints() + + } + + private func setUpTitleLabel(){ + titleLabel.text = "Favorite Items" + titleLabel.font = .eateryNavigationBarTitleFont + titleLabel.textColor = UIColor.Eatery.black + } + + private func setUpTableView() { + + tableView.register(NotificationHubTableViewCell.self, forCellReuseIdentifier: NotificationHubTableViewCell.reuse) + tableView.delegate = self + tableView.dataSource = self + tableView.translatesAutoresizingMaskIntoConstraints = false + tableView.separatorInset = .zero + tableView.separatorStyle = .none + tableView.rowHeight = 80 + } + + private func setUpConstraints() { + + titleLabel.snp.makeConstraints { make in + make.leading.equalTo(layoutMarginsGuide.snp.leading).inset(4) + make.trailing.equalTo(layoutMarginsGuide.snp.trailing) + make.top.equalTo(layoutMarginsGuide.snp.top) + } + + + tableView.snp.makeConstraints { make in + make.bottom.leading.trailing.equalToSuperview() + make.top.equalTo(titleLabel.snp.bottom) + } + } +} + + +extension NotificationHubView: NotificationHubTableViewCellDelegate { + func cellDidRequestNavigation(_ cell: NotificationHubTableViewCell, favoriteItem:FavoriteItemNotif) { + + //TODO: want the items side to be selected not eatery side + let favoritesViewController = FavoritesViewController() + navigationController?.pushViewController(favoritesViewController, animated: true) + favoriteItem.isSelected = true + self.tableView.reloadData() + } + +} + + +extension NotificationHubView: UITableViewDelegate { + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { +// let favoritesViewController = FavoritesViewController() +// +// navigationController?.pushViewController(favoritesViewController, animated: true) + + } + +} + + +extension NotificationHubView: UITableViewDataSource { + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return itemData.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + if let cell = tableView.dequeueReusableCell(withIdentifier: NotificationHubTableViewCell.reuse, for: indexPath) as? NotificationHubTableViewCell{ + cell.configure(favoriteItemData: itemData[indexPath.row] ) + cell.delegate = self + cell.selectionStyle = .none + return cell + } else { + return UITableViewCell() + } + } +} + diff --git a/Eatery Blue/UI/Notifications/NotificationViewCell.swift b/Eatery Blue/UI/Notifications/NotificationViewCell.swift new file mode 100644 index 0000000..e0ea330 --- /dev/null +++ b/Eatery Blue/UI/Notifications/NotificationViewCell.swift @@ -0,0 +1,125 @@ +// +// NotificationViewCell.swift +// Eatery Blue +// +// Created by Cindy Liang on 2/22/25. +// + +import UIKit + +class NotificationHubTableViewCell: UITableViewCell { + + // MARK: - Properties (View) + + private let eateryLabel = UILabel() + private let arrowButton = UIButton() + private let favoriteImage = UIImageView() + private let itemNameLabel = UILabel() + private let itemDateLabel = UILabel() + private let index = Int() + private var favoriteItem = FavoriteItemNotif(name: "", date: "", eateries: "") + weak var delegate: NotificationHubTableViewCellDelegate? + + // MARK: - Properties (Data) + + static let reuse = "NotificationHubTableViewCellReuse" + + // MARK: - Init + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + + setUpSelf() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - Configure + + func configure(favoriteItemData: FavoriteItemNotif) { + favoriteItem = favoriteItemData + itemNameLabel.text = favoriteItemData.itemName + eateryLabel.text = favoriteItemData.availableEateries + itemDateLabel.text = favoriteItemData.date + arrowButton.setImage(UIImage(named:"ArrowRound"), for: .normal) + + + if favoriteItemData.isSelected{ + favoriteImage.image = UIImage(named: "FavoriteNoNotif" ) + } else { + favoriteImage.image = UIImage(named: "FavoriteNotif" ) + } + + } + + + // MARK: - Set Up + private func setUpSelf() { + + self.layoutMargins = UIEdgeInsets(top: 8, left: 16, bottom: 4, right: 16) + + itemNameLabel.font = .systemFont(ofSize: 16, weight: .medium) + contentView.addSubview(itemNameLabel) + + itemDateLabel.font = .systemFont(ofSize: 14, weight: .regular) + itemDateLabel.textColor = .gray + contentView.addSubview(itemDateLabel) + + + eateryLabel.font = .systemFont(ofSize: 12, weight: .medium) + eateryLabel.textColor = .darkGray + contentView.addSubview(eateryLabel) + + + arrowButton.addTarget(self, action: #selector(tapArrowButton), for: .touchUpInside) + arrowButton.translatesAutoresizingMaskIntoConstraints = false + contentView.addSubview(arrowButton) + + contentView.addSubview(favoriteImage) + + setUpConstraints() + + } + + @objc func tapArrowButton(){ + + delegate?.cellDidRequestNavigation(self,favoriteItem:self.favoriteItem) + + } + + private func setUpConstraints() { + favoriteImage.snp.makeConstraints { make in + make.leading.equalTo(layoutMarginsGuide.snp.leading).inset(4) + make.centerY.equalToSuperview() + } + + itemNameLabel.snp.makeConstraints { make in + make.leading.equalTo(favoriteImage.snp.trailing).offset(8) + make.top.equalToSuperview().offset(24) + } + + itemDateLabel.snp.makeConstraints { make in + make.leading.equalTo(itemNameLabel.snp.trailing).offset(8) + make.top.equalToSuperview().offset(26) + } + + eateryLabel.snp.makeConstraints { make in + make.leading.equalTo(favoriteImage.snp.trailing).offset(8) + make.top.equalToSuperview().offset(42) + } + + + arrowButton.snp.makeConstraints { make in + make.trailing.equalToSuperview().offset(-16) + make.top.equalToSuperview().offset(8) + make.bottom.equalToSuperview().offset(-8) + } + + } + +} +protocol NotificationHubTableViewCellDelegate: AnyObject { + func cellDidRequestNavigation(_ cell: NotificationHubTableViewCell,favoriteItem:FavoriteItemNotif) +} diff --git a/Eatery Blue/UI/Notifications/NotificationsHub.swift b/Eatery Blue/UI/Notifications/NotificationsHub.swift new file mode 100644 index 0000000..77dc598 --- /dev/null +++ b/Eatery Blue/UI/Notifications/NotificationsHub.swift @@ -0,0 +1,8 @@ +// +// NotificationsHub.swift +// Eatery Blue +// +// Created by Cindy Liang on 2/22/25. +// + +import Foundation diff --git a/Eatery Blue/UI/Notifications/NotificationsHubNavigationView.swift b/Eatery Blue/UI/Notifications/NotificationsHubNavigationView.swift new file mode 100644 index 0000000..39c455d --- /dev/null +++ b/Eatery Blue/UI/Notifications/NotificationsHubNavigationView.swift @@ -0,0 +1,92 @@ +// +// NotificationsHubNavigationView.swift +// Eatery Blue +// +// Created by Cindy Liang on 2/22/25. +// + +import UIKit + +class NotificationsHubNavigationView: UIView { + + // MARK: - Properties (View) + + private let backButton = ButtonView(content: UIImageView()) + private let placeholderView = UIView() + private let titleLabel = UILabel() + + // MARK: - Properties (Data) + + /// The controller that this view uses to pop on back button press + var navigationController: UINavigationController? + + // MARK: - Init + + override init(frame: CGRect) { + super.init(frame: frame) + setUpSelf() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - Set Up + + private func setUpSelf() { + self.layoutMargins = UIEdgeInsets(top: 8, left: 16, bottom: 4, right: 16) + backgroundColor = .white + + addSubview(backButton) + setUpBackButton() + + addSubview(titleLabel) + setUpTitleLabel() + + + setUpConstraints() + } + + private func setUpBackButton() { + backButton.content.image = UIImage(named: "ArrowLeft") + backButton.shadowColor = UIColor.Eatery.black + backButton.shadowOffset = CGSize(width: 0, height: 4) + backButton.backgroundColor = .white + backButton.layoutMargins = UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 16) + + backButton.buttonPress { [weak self] _ in + guard let self else { return } + + navigationController?.hero.isEnabled = false + navigationController?.popViewController(animated: true) + } + } + + private func setUpTitleLabel() { + titleLabel.text = "Notifications" + titleLabel.font = .eateryNavigationBarLargeTitleFont + titleLabel.textColor = UIColor.Eatery.blue + } + + + + + private func setUpConstraints() { + backButton.snp.makeConstraints { make in + make.leading.equalTo(layoutMarginsGuide.snp.leading) + make.top.equalTo(layoutMarginsGuide.snp.top) + make.width.height.equalTo(42) + } + + + + titleLabel.snp.makeConstraints { make in + make.leading.equalTo(layoutMarginsGuide.snp.leading).inset(4) + make.trailing.equalTo(layoutMarginsGuide.snp.trailing) + make.top.equalTo(backButton.snp.bottom) + make.height.equalTo(42) + } + + } + +} diff --git a/Eatery Blue/UI/Notifications/NotificationsHubViewController.swift b/Eatery Blue/UI/Notifications/NotificationsHubViewController.swift new file mode 100644 index 0000000..f4c9c03 --- /dev/null +++ b/Eatery Blue/UI/Notifications/NotificationsHubViewController.swift @@ -0,0 +1,52 @@ +// +// NotificationsHubViewController.swift +// Eatery Blue +// +// Created by Cindy Liang on 2/22/25. +// + +import Foundation +import UIKit + +class NotificationsHubViewController: UIViewController{ + + private let notifHubNavigationView = NotificationsHubNavigationView() + private let notificationHubView = NotificationHubView() + private let scrollView = UIScrollView() + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .white + self.viewRespectsSystemMinimumLayoutMargins = false + + setUpNotifHubNavigationView() + view.addSubview(notifHubNavigationView) + + setUpNotifHubView() + view.addSubview(notificationHubView) + + setupConstraints() + } + + + private func setUpNotifHubNavigationView() { + notifHubNavigationView.navigationController = navigationController + } + private func setUpNotifHubView(){ + notificationHubView.navigationController = navigationController + } + + func setupConstraints() { + notifHubNavigationView.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview() + make.height.equalTo(150) + } + + notificationHubView.snp.makeConstraints { make in + make.bottom.leading.trailing.equalToSuperview() + make.top.equalTo(notifHubNavigationView.snp.bottom) + } + + } + +}