From 68f5da116df2262e66c5adfa3338d255504eb03b Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Wed, 15 Mar 2023 23:06:15 +0530 Subject: [PATCH] Setting up notification class to test --- VDSSample.xcodeproj/project.pbxproj | 4 ++ .../ViewControllers/MenuViewController.swift | 3 +- .../NotificationViewController.swift | 58 +++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 VDSSample/ViewControllers/NotificationViewController.swift diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index a63c81b..3102bd5 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -32,6 +32,7 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 445BA07929C088470036A7C5 /* NotificationViewController.swift */; }; 5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; }; EA0FC2C12912DC5500DF80B4 /* TextLinkCaretViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */; }; EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9C289966EF000CA526 /* AppDelegate.swift */; }; @@ -113,6 +114,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 445BA07929C088470036A7C5 /* NotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewController.swift; sourceTree = ""; }; 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = ""; }; EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLinkCaretViewController.swift; sourceTree = ""; }; EA3C3B99289966EF000CA526 /* VDSSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VDSSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -297,6 +299,7 @@ EA5E305B295111050082B959 /* TileletViewController.swift */, EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */, EA3C3BB328996775000CA526 /* ToggleViewController.swift */, + 445BA07929C088470036A7C5 /* NotificationViewController.swift */, ); path = ViewControllers; sourceTree = ""; @@ -452,6 +455,7 @@ EA3C3BB628996775000CA526 /* MenuViewController.swift in Sources */, EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */, EA5E3050294D11540082B959 /* TileContainerViewController.swift in Sources */, + 445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */, EAF7F11A28A14A0E00B287F5 /* RadioButtonViewController.swift in Sources */, EA89204628B66CE2006B9984 /* ScrollViewController.swift in Sources */, EA3C3B9F289966EF000CA526 /* SceneDelegate.swift in Sources */, diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index 8fdf1e0..f3daed8 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -88,7 +88,8 @@ class MenuViewController: UITableViewController { MenuComponent(title: "TileContainer", completed: true, viewController: TileContainerViewController.self), MenuComponent(title: "Tilelet", completed: false, viewController: TileletViewController.self), MenuComponent(title: "TitleLockup", completed: true, viewController: TitleLockupViewController.self), - MenuComponent(title: "Toggle", completed: true, viewController: ToggleViewController.self) + MenuComponent(title: "Toggle", completed: true, viewController: ToggleViewController.self), + MenuComponent(title: "Notification", completed: false, viewController: NotificationViewController.self) ] override func numberOfSections(in tableView: UITableView) -> Int { diff --git a/VDSSample/ViewControllers/NotificationViewController.swift b/VDSSample/ViewControllers/NotificationViewController.swift new file mode 100644 index 0000000..550d7b4 --- /dev/null +++ b/VDSSample/ViewControllers/NotificationViewController.swift @@ -0,0 +1,58 @@ +// +// NotificationViewController.swift +// VDSSample +// +// Created by Nadigadda, Sumanth on 14/03/23. +// + +import Foundation +import VDS + +class NotificationViewController: BaseViewController { + + var notificationView = Notification() + + lazy var notificationTypePickerSelectorView = { + PickerSelectorView(title: "Info", + picker: self.picker, + items: Notification.NotificationStyle.allCases) + }() + + override func viewDidLoad() { + super.viewDidLoad() + + notificationView.titleLabel.text = "Good morning" + notificationView.subTitleLabel.text = "SecondLabel information" + + let firstButton = Button() + firstButton.use = .secondary + firstButton.size = .small + + let secondButton = Button() + secondButton.use = .primary + secondButton.size = .small + + notificationView.buttonsView.buttons = [firstButton,secondButton] + addContentTopView(view: notificationView) + + setupForm() + setupPicker() + } + + func setupForm() { + addFormRow(label: "Surface", view: surfacePickerSelectorView) + addFormRow(label: "Style", view: notificationTypePickerSelectorView) + } + + func setupPicker() { + surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.notificationView.surface = item + self?.contentTopView.backgroundColor = item.color + } + + notificationTypePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.notificationView.type = item + } + + } +}