diff --git a/WOKA.xcodeproj/project.pbxproj b/WOKA.xcodeproj/project.pbxproj index 1f488cd..6779dbe 100644 --- a/WOKA.xcodeproj/project.pbxproj +++ b/WOKA.xcodeproj/project.pbxproj @@ -92,6 +92,22 @@ 52A3F6AB2BECBF550000BB0B /* LinkedChildVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3F6AA2BECBF550000BB0B /* LinkedChildVC.swift */; }; 52A3F6AD2BECC0340000BB0B /* TypeAlias.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3F6AC2BECC0340000BB0B /* TypeAlias.swift */; }; 52A3F6AF2BECC0690000BB0B /* LinkedChildVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A3F6AE2BECC0690000BB0B /* LinkedChildVM.swift */; }; + 52A6DC962C4E387F00F63C51 /* Shop.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 52A6DC952C4E387F00F63C51 /* Shop.storyboard */; }; + 52A6DC9C2C4E38E000F63C51 /* ShopListingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DC9B2C4E38E000F63C51 /* ShopListingVC.swift */; }; + 52A6DC9F2C4E3AA600F63C51 /* ShopListingCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 52A6DC9E2C4E3AA600F63C51 /* ShopListingCell.xib */; }; + 52A6DCA02C4E3AA600F63C51 /* ShopListingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DC9D2C4E3AA600F63C51 /* ShopListingCell.swift */; }; + 52A6DCA22C4E3B7500F63C51 /* ShopListingVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DCA12C4E3B7500F63C51 /* ShopListingVM.swift */; }; + 52A6DCA42C4E48AF00F63C51 /* ShopSuperCategoryDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DCA32C4E48AF00F63C51 /* ShopSuperCategoryDM.swift */; }; + 52A6DCAA2C4E59BD00F63C51 /* ShopCategoryDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DCA92C4E59BD00F63C51 /* ShopCategoryDM.swift */; }; + 52A6DCAC2C4E5A1100F63C51 /* ShopCategoryVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DCAB2C4E5A1100F63C51 /* ShopCategoryVC.swift */; }; + 52A6DCAE2C4E5A3900F63C51 /* ShopCategoryVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DCAD2C4E5A3900F63C51 /* ShopCategoryVM.swift */; }; + 52A6DCB02C4E621800F63C51 /* BadgedBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DCAF2C4E621800F63C51 /* BadgedBarButtonItem.swift */; }; + 52A6DCB22C4E73C800F63C51 /* ShopProductsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DCB12C4E73C800F63C51 /* ShopProductsVC.swift */; }; + 52A6DCB42C4E73F100F63C51 /* ShopProductsVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DCB32C4E73F100F63C51 /* ShopProductsVM.swift */; }; + 52A6DCB62C4E748100F63C51 /* ShopSubCategoryDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DCB52C4E748100F63C51 /* ShopSubCategoryDM.swift */; }; + 52A6DCB82C4E754800F63C51 /* ShopProductDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DCB72C4E754800F63C51 /* ShopProductDM.swift */; }; + 52A6DCBB2C4EA46400F63C51 /* ShopProductsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 52A6DCBA2C4EA46400F63C51 /* ShopProductsCell.xib */; }; + 52A6DCBC2C4EA46400F63C51 /* ShopProductsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A6DCB92C4EA46400F63C51 /* ShopProductsCell.swift */; }; 52A981CE2C1AFE66000E0BEC /* FavouriteListingDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A981CD2C1AFE66000E0BEC /* FavouriteListingDM.swift */; }; 52A981D02C1AFEE8000E0BEC /* MyListVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A981CF2C1AFEE8000E0BEC /* MyListVM.swift */; }; 52A981D72C1B0E27000E0BEC /* FavouriteCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A981D52C1B0E27000E0BEC /* FavouriteCell.swift */; }; @@ -377,6 +393,22 @@ 52A3F6AA2BECBF550000BB0B /* LinkedChildVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkedChildVC.swift; sourceTree = ""; }; 52A3F6AC2BECC0340000BB0B /* TypeAlias.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeAlias.swift; sourceTree = ""; }; 52A3F6AE2BECC0690000BB0B /* LinkedChildVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkedChildVM.swift; sourceTree = ""; }; + 52A6DC952C4E387F00F63C51 /* Shop.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Shop.storyboard; sourceTree = ""; }; + 52A6DC9B2C4E38E000F63C51 /* ShopListingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopListingVC.swift; sourceTree = ""; }; + 52A6DC9D2C4E3AA600F63C51 /* ShopListingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopListingCell.swift; sourceTree = ""; }; + 52A6DC9E2C4E3AA600F63C51 /* ShopListingCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ShopListingCell.xib; sourceTree = ""; }; + 52A6DCA12C4E3B7500F63C51 /* ShopListingVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopListingVM.swift; sourceTree = ""; }; + 52A6DCA32C4E48AF00F63C51 /* ShopSuperCategoryDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopSuperCategoryDM.swift; sourceTree = ""; }; + 52A6DCA92C4E59BD00F63C51 /* ShopCategoryDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopCategoryDM.swift; sourceTree = ""; }; + 52A6DCAB2C4E5A1100F63C51 /* ShopCategoryVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopCategoryVC.swift; sourceTree = ""; }; + 52A6DCAD2C4E5A3900F63C51 /* ShopCategoryVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopCategoryVM.swift; sourceTree = ""; }; + 52A6DCAF2C4E621800F63C51 /* BadgedBarButtonItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BadgedBarButtonItem.swift; sourceTree = ""; }; + 52A6DCB12C4E73C800F63C51 /* ShopProductsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopProductsVC.swift; sourceTree = ""; }; + 52A6DCB32C4E73F100F63C51 /* ShopProductsVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopProductsVM.swift; sourceTree = ""; }; + 52A6DCB52C4E748100F63C51 /* ShopSubCategoryDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopSubCategoryDM.swift; sourceTree = ""; }; + 52A6DCB72C4E754800F63C51 /* ShopProductDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopProductDM.swift; sourceTree = ""; }; + 52A6DCB92C4EA46400F63C51 /* ShopProductsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopProductsCell.swift; sourceTree = ""; }; + 52A6DCBA2C4EA46400F63C51 /* ShopProductsCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ShopProductsCell.xib; sourceTree = ""; }; 52A981CD2C1AFE66000E0BEC /* FavouriteListingDM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavouriteListingDM.swift; sourceTree = ""; }; 52A981CF2C1AFEE8000E0BEC /* MyListVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyListVM.swift; sourceTree = ""; }; 52A981D52C1B0E27000E0BEC /* FavouriteCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavouriteCell.swift; sourceTree = ""; }; @@ -690,6 +722,8 @@ 523ED25C2BDA2BC700CFED02 /* WOKA */ = { isa = PBXGroup; children = ( + 52A6DCAF2C4E621800F63C51 /* BadgedBarButtonItem.swift */, + 52A6DC942C4E385500F63C51 /* Shop */, 9CB3D0832C37BA470062869D /* Karaoke */, 526A436D2C36A96A00AE148F /* Games */, 52BFB52B2C33DA9700BAAE15 /* Audio Books */, @@ -977,6 +1011,60 @@ path = Timer; sourceTree = ""; }; + 52A6DC942C4E385500F63C51 /* Shop */ = { + isa = PBXGroup; + children = ( + 52A6DC9A2C4E388C00F63C51 /* Model */, + 52A6DC992C4E388900F63C51 /* View */, + 52A6DC982C4E388600F63C51 /* ViewModel */, + 52A6DC972C4E388300F63C51 /* Controller */, + 52A6DC952C4E387F00F63C51 /* Shop.storyboard */, + ); + path = Shop; + sourceTree = ""; + }; + 52A6DC972C4E388300F63C51 /* Controller */ = { + isa = PBXGroup; + children = ( + 52A6DC9B2C4E38E000F63C51 /* ShopListingVC.swift */, + 52A6DCAB2C4E5A1100F63C51 /* ShopCategoryVC.swift */, + 52A6DCB12C4E73C800F63C51 /* ShopProductsVC.swift */, + ); + path = Controller; + sourceTree = ""; + }; + 52A6DC982C4E388600F63C51 /* ViewModel */ = { + isa = PBXGroup; + children = ( + 52A6DCA12C4E3B7500F63C51 /* ShopListingVM.swift */, + 52A6DCAD2C4E5A3900F63C51 /* ShopCategoryVM.swift */, + 52A6DCB32C4E73F100F63C51 /* ShopProductsVM.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; + 52A6DC992C4E388900F63C51 /* View */ = { + isa = PBXGroup; + children = ( + 52A6DC9D2C4E3AA600F63C51 /* ShopListingCell.swift */, + 52A6DC9E2C4E3AA600F63C51 /* ShopListingCell.xib */, + 52A6DCB92C4EA46400F63C51 /* ShopProductsCell.swift */, + 52A6DCBA2C4EA46400F63C51 /* ShopProductsCell.xib */, + ); + path = View; + sourceTree = ""; + }; + 52A6DC9A2C4E388C00F63C51 /* Model */ = { + isa = PBXGroup; + children = ( + 52A6DCA32C4E48AF00F63C51 /* ShopSuperCategoryDM.swift */, + 52A6DCA92C4E59BD00F63C51 /* ShopCategoryDM.swift */, + 52A6DCB52C4E748100F63C51 /* ShopSubCategoryDM.swift */, + 52A6DCB72C4E754800F63C51 /* ShopProductDM.swift */, + ); + path = Model; + sourceTree = ""; + }; 52BFB52B2C33DA9700BAAE15 /* Audio Books */ = { isa = PBXGroup; children = ( @@ -1624,6 +1712,7 @@ 52D6A24B2C21B43300145908 /* WebSeriesCell.xib in Resources */, 52DAC6482C21762900E2F85B /* WebSeries.storyboard in Resources */, 527AC6F82C171C8F00434FB7 /* BlogsCell.xib in Resources */, + 52A6DC962C4E387F00F63C51 /* Shop.storyboard in Resources */, 52A981D82C1B0E27000E0BEC /* FavouriteCell.xib in Resources */, 52C1A4E82C05C95D007BAA50 /* Theme.storyboard in Resources */, 526A436F2C36A97400AE148F /* Games.storyboard in Resources */, @@ -1639,10 +1728,12 @@ 9C834ED32C1C1F9200B29A9C /* Exo2-SemiBold.ttf in Resources */, 9C834ED42C1C1F9200B29A9C /* Exo2-Medium.ttf in Resources */, 52BFB52D2C33DAA500BAAE15 /* AudioBooks.storyboard in Resources */, + 52A6DC9F2C4E3AA600F63C51 /* ShopListingCell.xib in Resources */, 9C834ED52C1C1F9200B29A9C /* Exo2-Bold.ttf in Resources */, 9C834ED62C1C1F9200B29A9C /* Exo2-ExtraBold.ttf in Resources */, 9C834ED72C1C1F9200B29A9C /* Exo2-Regular.ttf in Resources */, 9C834ED82C1C1F9200B29A9C /* Exo2-Thin.ttf in Resources */, + 52A6DCBB2C4EA46400F63C51 /* ShopProductsCell.xib in Resources */, 9CB3D0852C37BA530062869D /* Karaoke.storyboard in Resources */, 52C6E0262BE3B46A00E22D59 /* SelectAvatarCell.xib in Resources */, 52C8B0712BDA7512003B51D0 /* PassingCloud.json in Resources */, @@ -1735,6 +1826,7 @@ 5202AAFE2BDF90590043B7BD /* TextFieldImage.swift in Sources */, 9C7939152C0F23AA00F5D6E6 /* NsNotificationExtension.swift in Sources */, 528E5F1B2C24531200E33E4E /* SeasonListingDM.swift in Sources */, + 52A6DCAA2C4E59BD00F63C51 /* ShopCategoryDM.swift in Sources */, 52FDDAB52BF34DC300E037C1 /* YesNoAlertVC.swift in Sources */, 52C6E0232BE3B3E300E22D59 /* SelectAvatarVC.swift in Sources */, 52F4E8662C3D123B00778FBC /* JWKaraokePlayerVC.swift in Sources */, @@ -1753,14 +1845,17 @@ 52D6A24C2C21B43300145908 /* WebSeriesCell.swift in Sources */, 5242FE5B2C24317A0086A86D /* WebSeriesSeasonVM.swift in Sources */, 524C422B2C04781B0016A11C /* ThemeTwoVM.swift in Sources */, + 52A6DCA22C4E3B7500F63C51 /* ShopListingVM.swift in Sources */, 52C8EC7A2C353653002DC35C /* ContinueAudioListDM.swift in Sources */, 52B8D4DF2C04A25E00ED65F3 /* StatusBar.swift in Sources */, 5259541D2BE8D94400191286 /* QueueHelper.swift in Sources */, 525954232BE8F00400191286 /* BaseResponseModel.swift in Sources */, + 52A6DCB42C4E73F100F63C51 /* ShopProductsVM.swift in Sources */, 9C27E1692BDB76F200EC1DA9 /* OnBoardVM.swift in Sources */, 9C7939172C0F23E900F5D6E6 /* LinkTypeEnum.swift in Sources */, 523ED2622BDA2BC700CFED02 /* SplashVC.swift in Sources */, 9CDC343C2BDBBC6B00093089 /* SelectAgeVC.swift in Sources */, + 52A6DCAC2C4E5A1100F63C51 /* ShopCategoryVC.swift in Sources */, 525327D02BFCBC4A00F64283 /* ExploreWokaVC.swift in Sources */, 52C8B0542BDA4BD1003B51D0 /* RoundCorner.swift in Sources */, 522242662BFC74380085C632 /* MyListVC.swift in Sources */, @@ -1775,6 +1870,7 @@ 52B8D4E12C04A25E00ED65F3 /* BasicTransitionAnimator.swift in Sources */, 52AF71F02C36B29A00BC5972 /* GamesListDM.swift in Sources */, 52BC3BF02C1701F8002FACA6 /* BlogDM.swift in Sources */, + 52A6DCA02C4E3AA600F63C51 /* ShopListingCell.swift in Sources */, 525954192BE8CC3400191286 /* ConstantString.swift in Sources */, 52D774EB2BDFC0BF001D87DE /* OTPVC.swift in Sources */, 9C8446872C40FC6E003E3E53 /* AVPlayerTesting.swift in Sources */, @@ -1811,6 +1907,7 @@ 9CBCB2A52BE50D49007D7934 /* NewPasswordVC.swift in Sources */, 52C8D8D42C2D9F3400CA72A6 /* LikeFavCommonFunc.swift in Sources */, 9CBCB29F2BE4E13A007D7934 /* ValidatorClass.swift in Sources */, + 52A6DCBC2C4EA46400F63C51 /* ShopProductsCell.swift in Sources */, 528BEF602C2C372900FFDAB8 /* ContinueWatchingVC.swift in Sources */, 9CBCB29B2BE4D614007D7934 /* LoginVC.swift in Sources */, 52BC3BE82C0E04A9002FACA6 /* FaqListDM.swift in Sources */, @@ -1832,6 +1929,7 @@ 52AF71EE2C36AD3100BC5972 /* GamesListVM.swift in Sources */, 52A981CE2C1AFE66000E0BEC /* FavouriteListingDM.swift in Sources */, 527AC6FD2C173A5100434FB7 /* SongListCell.swift in Sources */, + 52A6DCAE2C4E5A3900F63C51 /* ShopCategoryVM.swift in Sources */, 52D6A2542C22B93F00145908 /* CategoryListingDM.swift in Sources */, 9C27E1672BDB706700EC1DA9 /* StoryBoard.swift in Sources */, 52C8B0692BDA6E1E003B51D0 /* LocalizedEnum.swift in Sources */, @@ -1843,6 +1941,7 @@ 9C1C69FC2C106C240035B2C7 /* ContactSupportVM.swift in Sources */, 52AF71F22C36B77B00BC5972 /* GamesDetailVC.swift in Sources */, 52A3F6AF2BECC0690000BB0B /* LinkedChildVM.swift in Sources */, + 52A6DCB02C4E621800F63C51 /* BadgedBarButtonItem.swift in Sources */, 52C8EC7D2C3536E5002DC35C /* ContinueAudioCell.swift in Sources */, 525954252BE8F01600191286 /* ValueWrapper.swift in Sources */, 52A3F6A82BECBF2A0000BB0B /* LinkedChildCell.swift in Sources */, @@ -1852,6 +1951,7 @@ 52FDBA7D2BFF481A009D7AC7 /* ThemeOneVM.swift in Sources */, 9C7939192C0F345000F5D6E6 /* ContactSupportVC.swift in Sources */, 9CBE1B432C0F37B300CA6E61 /* DropDown.swift in Sources */, + 52A6DC9C2C4E38E000F63C51 /* ShopListingVC.swift in Sources */, 52C8B0742BDA7626003B51D0 /* OnBoardVC.swift in Sources */, 5219C2C22C086D9C00A1DF4D /* DataTypeConversion.swift in Sources */, 525953CF2BE8B28F00191286 /* Utilities.swift in Sources */, @@ -1880,6 +1980,7 @@ 5272FCE52BDFDC8C000ECB1D /* UserDetailsRegisterVM.swift in Sources */, 528E5F222C24660F00E33E4E /* SeasonCategoryCell.swift in Sources */, 525954272BE9178F00191286 /* UserDataDM.swift in Sources */, + 52A6DCB62C4E748100F63C51 /* ShopSubCategoryDM.swift in Sources */, 9C27E1652BDB6FBC00EC1DA9 /* StoryBoardID.swift in Sources */, 9CB3D08B2C37BBA50062869D /* KaraokeListingVC.swift in Sources */, 52FDBA782BFF23F4009D7AC7 /* TimePeriod.swift in Sources */, @@ -1903,8 +2004,10 @@ 52E214C72C2AD47F00BC2D29 /* EpisodeDetailsVC.swift in Sources */, 52D774F12BDFC53B001D87DE /* StringSubScript.swift in Sources */, 9CBE1B3F2C0F37B300CA6E61 /* DPDConstants.swift in Sources */, + 52A6DCA42C4E48AF00F63C51 /* ShopSuperCategoryDM.swift in Sources */, 52B8D4DA2C04A25E00ED65F3 /* Preferences.swift in Sources */, 52FB2D8F2BDF898F0009B0C7 /* TextFieldPadding.swift in Sources */, + 52A6DCB22C4E73C800F63C51 /* ShopProductsVC.swift in Sources */, 5257B2652BDFB6F50086D79B /* CheckPhoneHomeBtnOrNotch.swift in Sources */, 52663FF92BDFAF110001D8CE /* EmailVM.swift in Sources */, 52C1A4E52C05BC86007BAA50 /* MainNavController.swift in Sources */, @@ -1923,6 +2026,7 @@ 52C6E0212BE3ADE300E22D59 /* GenderEnum.swift in Sources */, 9CA7C6C02C1093E500D73742 /* ProfileVC.swift in Sources */, 525953D12BE8B2B200191286 /* LLSpinner.swift in Sources */, + 52A6DCB82C4E754800F63C51 /* ShopProductDM.swift in Sources */, 52C6E0272BE3B46A00E22D59 /* SelectAvatarCell.swift in Sources */, 9C535DB82C0089B400DA6DCD /* ViewButtonAnimation.swift in Sources */, ); diff --git a/WOKA/Assets/Assets.xcassets/Menu/SideMenu/CartIcon.imageset/Contents.json b/WOKA/Assets/Assets.xcassets/Menu/SideMenu/CartIcon.imageset/Contents.json index c648f1c..0a3dc32 100644 --- a/WOKA/Assets/Assets.xcassets/Menu/SideMenu/CartIcon.imageset/Contents.json +++ b/WOKA/Assets/Assets.xcassets/Menu/SideMenu/CartIcon.imageset/Contents.json @@ -1,7 +1,6 @@ { "images" : [ { - "filename" : "Group 183.png", "idiom" : "universal", "scale" : "1x" }, diff --git a/WOKA/Assets/Assets.xcassets/Menu/SideMenu/CartIcon.imageset/Group 183.png b/WOKA/Assets/Assets.xcassets/Menu/SideMenu/CartIcon.imageset/Group 183.png deleted file mode 100644 index 11d5eb1..0000000 Binary files a/WOKA/Assets/Assets.xcassets/Menu/SideMenu/CartIcon.imageset/Group 183.png and /dev/null differ diff --git a/WOKA/BadgedBarButtonItem.swift b/WOKA/BadgedBarButtonItem.swift new file mode 100644 index 0000000..b94bbb3 --- /dev/null +++ b/WOKA/BadgedBarButtonItem.swift @@ -0,0 +1,212 @@ +// +// BadgedBarButtonItem.swift +// BadgedBarButtonItem +// +// Created by Maksim Artemov on 17/07/2019. +// Copyright © 2019 Max. All rights reserved. +// + +import UIKit + +public enum BadgePosition { + case left + case right +} + +public enum BadgeSize { + case extraSmall + case small + case medium + case large +} + +public class BadgedButtonItem: UIBarButtonItem { + + public func setBadge(with value: Int?) { + self.badgeValue = value + } + + public var badgeTintColor: UIColor? { + didSet { + lblBadge.backgroundColor = badgeTintColor + } + } + + public var badgeTextColor: UIColor? { + didSet { + lblBadge.textColor = badgeTextColor + } + } + + public var position: BadgePosition? = .right { + didSet { + if position == .left { + self.lblBadge.frame = CGRect(x: 0, + y: 0, + width: badgeRadius * 2, + height: badgeRadius * 2) + } else { + self.lblBadge.frame = CGRect(x: filterBtn.frame.maxX - badgeRadius * 2 - 5, + y: 0, + width: badgeRadius * 2, + height: badgeRadius * 2) + } + } + } + + public var hasBorder: Bool? { + didSet { + if hasBorder == true { + lblBadge.layer.borderWidth = 1.0 + } + } + } + + public var borderColor: UIColor? = .black { + didSet { + lblBadge.layer.borderColor = borderColor?.cgColor + } + } + + public var badgeSize: BadgeSize = .medium { + didSet { + switch badgeSize { + case .extraSmall: + self.badgeRadius = 6.0 + case .small: + self.badgeRadius = 7.0 + case .medium: + self.badgeRadius = 8.0 + case .large: + self.badgeRadius = 9.0 + } + } + } + + public var badgeAnimation: Bool? = false { + didSet { + self.isAnimated = badgeAnimation + } + } + + public var tapAction: (() -> Void)? + + private var badgeValue: Int? { + didSet { + if let value = badgeValue, + value > 0 { + + // reducing font size if the value has two digits + if "\(value)".count > 1 { + lblBadge.font = UIFont.systemFont(ofSize: twoDigitsFontSize) + } else { + lblBadge.font = UIFont.systemFont(ofSize: oneDigitFontSize) + } + + lblBadge.isHidden = false + lblBadge.text = "\(value)" + animateBadge(isAnimated) + } else { + lblBadge.isHidden = true + } + } + } + + + private let filterBtn = UIButton() + private let lblBadge = UILabel() + private var isAnimated: Bool? = false + private var badgeRadius: CGFloat = 8.0 { + didSet { + self.lblBadge.layer.cornerRadius = badgeRadius + } + } + + private var oneDigitFontSize: CGFloat { + return badgeRadius + 1 + } + private var twoDigitsFontSize: CGFloat { + return badgeRadius + } + + override init() { + super.init() + setup() + } + + init(with image: UIImage?) { + super.init() + setup(image: image) + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + setup() + } + + private func setup(image: UIImage? = nil) { + + self.filterBtn.frame = CGRect(x: 0, y: 0, width: 55, height: 55) + self.filterBtn.adjustsImageWhenHighlighted = false + let scaledImage = UIImage.imageWithImage(image, scaledToSize: CGSize(width: 45, height: 50)) + self.filterBtn.setImage(scaledImage?.withRenderingMode(.alwaysOriginal), for: .normal) + self.filterBtn.addTarget(self, action: #selector(buttonPressed), for: .touchUpInside) + + self.lblBadge.frame = CGRect(x: filterBtn.frame.maxX - badgeRadius * 2, + y: 0, + width: badgeRadius * 2, + height: badgeRadius * 2) + self.lblBadge.backgroundColor = .red + self.lblBadge.clipsToBounds = true + self.lblBadge.layer.cornerRadius = badgeRadius + self.lblBadge.textColor = .white + self.lblBadge.font = UIFont.systemFont(ofSize: 10) + self.lblBadge.textAlignment = .center + self.lblBadge.isHidden = true + self.lblBadge.minimumScaleFactor = 0.5 + self.lblBadge.adjustsFontSizeToFitWidth = true + self.filterBtn.addSubview(lblBadge) + self.customView = filterBtn + } + + @objc private func buttonPressed() { + if let action = tapAction { + action() + } + } + + private func animateBadge(_ animate: Bool?) { + guard animate == true else { return } + lblBadge.transform = CGAffineTransform(scaleX: 1.2, y: 1.2) + UIView.animate(withDuration: 0.4, + delay: 0, + usingSpringWithDamping: 0.2, + initialSpringVelocity: 3, + options: [.curveLinear], + animations: { [weak self] in + + guard let strongSelf = self else { return } + strongSelf.lblBadge.transform = .identity + + }) { [weak self] (finished) in + + guard let strongSelf = self else { return } + if !finished { + strongSelf.lblBadge.transform = .identity + } + } + } + +} + +/// Takes an image and returns a new one identical but resized. +private extension UIImage { + static func imageWithImage(_ image: UIImage?, scaledToSize newSize: CGSize) -> UIImage? { + guard let image = image else { return nil } + UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0) + image.draw(in: CGRect(origin: CGPoint.zero, size: CGSize(width: newSize.width, height: newSize.height))) + let newImage: UIImage = UIGraphicsGetImageFromCurrentImageContext()! + UIGraphicsEndImageContext() + return newImage + } +} diff --git a/WOKA/Constants K/CellIdentifier.swift b/WOKA/Constants K/CellIdentifier.swift index 56349db..8fdfc83 100644 --- a/WOKA/Constants K/CellIdentifier.swift +++ b/WOKA/Constants K/CellIdentifier.swift @@ -48,5 +48,10 @@ extension K{ struct AudioBooks{ static let continueAudioCell = "ContinueAudioCell" } + + struct Shop{ + static let shopListingCell = "ShopListingCell" + static let shopProductsCell = "ShopProductsCell" + } } } diff --git a/WOKA/Constants K/StoryBoard.swift b/WOKA/Constants K/StoryBoard.swift index 1454770..73d7fc5 100644 --- a/WOKA/Constants K/StoryBoard.swift +++ b/WOKA/Constants K/StoryBoard.swift @@ -20,5 +20,6 @@ extension K{ static let audioBooks = "AudioBooks" static let Games = "Games" static let Karaoke = "Karaoke" + static let shop = "Shop" } } diff --git a/WOKA/Constants K/StoryBoardID.swift b/WOKA/Constants K/StoryBoardID.swift index 34bda44..e15cec2 100644 --- a/WOKA/Constants K/StoryBoardID.swift +++ b/WOKA/Constants K/StoryBoardID.swift @@ -91,5 +91,12 @@ extension K{ static let aVPlayerVC = "AVPlayerVC" } + // MARK: - Shop + + struct Shop{ + static let shopListingVC = "ShopListingVC" + static let shopCategoryVC = "ShopCategoryVC" + static let shopProductsVC = "ShopProductsVC" + } } } diff --git a/WOKA/Helpers/Animation/ShimmerEffectView.swift b/WOKA/Helpers/Animation/ShimmerEffectView.swift index 3465fe3..7487be6 100644 --- a/WOKA/Helpers/Animation/ShimmerEffectView.swift +++ b/WOKA/Helpers/Animation/ShimmerEffectView.swift @@ -9,9 +9,12 @@ import UIKit class ShimmerEffectView: UIView { - var gradientColorOne: CGColor = UIColor(red: 0.176, green: 0.012, blue: 0.561, alpha: 1.0).cgColor - var gradientColorTwo: CGColor = UIColor(white: 0.925, alpha: 1.0).cgColor +// var gradientColorOne: CGColor = UIColor(red: 0.176, green: 0.012, blue: 0.561, alpha: 1.0).cgColor + var gradientColorOne: CGColor = #colorLiteral(red: 0.2364082336, green: 0.1172600761, blue: 0.6259267926, alpha: 1).cgColor +// var gradientColorTwo: CGColor = UIColor(white: 0.925, alpha: 1.0).cgColor + var gradientColorTwo: CGColor = #colorLiteral(red: 0.9254901961, green: 0.9254901961, blue: 0.9254901961, alpha: 1).cgColor + private var gradientLayer: CAGradientLayer? override init(frame: CGRect) { diff --git a/WOKA/Network Adapter/APIEndPoints.swift b/WOKA/Network Adapter/APIEndPoints.swift index 6f7cb75..92ceeeb 100644 --- a/WOKA/Network Adapter/APIEndPoints.swift +++ b/WOKA/Network Adapter/APIEndPoints.swift @@ -103,6 +103,13 @@ struct APIEndPoints { static let sing_karaoke_listing = makeURL(path: "sing_karaoke_listing") } + struct Shop{ + static let super_category_listing = makeURL(path: "super_category_listing") + static let category_listing = makeURL(path: "category_listing") + static let sub_category_listing = makeURL(path: "sub_category_listing") + static let shop_product_listing = makeURL(path: "shop_product_listing") + } + // Other endpoint categories... struct Links { static let privacyPolicy = "https://www.wokaland.com/privacy-policy/" diff --git a/WOKA/Shop/Controller/ShopCategoryVC.swift b/WOKA/Shop/Controller/ShopCategoryVC.swift new file mode 100644 index 0000000..7a1383d --- /dev/null +++ b/WOKA/Shop/Controller/ShopCategoryVC.swift @@ -0,0 +1,107 @@ +// +// ShopCategoryVC.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import UIKit + +class ShopCategoryVC: UIViewController { + + @IBOutlet weak var tableView: UITableView! + + var vm = ShopCategoryVM() + + override func viewDidLoad() { + super.viewDidLoad() + vm.vc = self + vm.initView() + navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) + navigationController?.navigationBar.shadowImage = UIImage() + + // Create the button + let backbutton = UIButton(type: .custom) + backbutton.setImage(UIImage(named: "CartIcon"), for: .normal) // Image can be downloaded from the provided link + backbutton.setTitleColor(.black, for: .normal) // You can change the TitleColor + backbutton.addTarget(self, action: #selector(cartBtnTapped), for: .touchUpInside) + + // Set button height and width + let buttonHeight: CGFloat = 50 + let buttonWidth: CGFloat = 50 + backbutton.translatesAutoresizingMaskIntoConstraints = false + backbutton.widthAnchor.constraint(equalToConstant: buttonWidth).isActive = true + backbutton.heightAnchor.constraint(equalToConstant: buttonHeight).isActive = true + + // Create a container view for the button + let containerView = UIView(frame: CGRect(x: 0, y: 0, width: buttonWidth, height: buttonHeight)) + containerView.addSubview(backbutton) + + // Set constraints for the button inside the container view + NSLayoutConstraint.activate([ + backbutton.centerYAnchor.constraint(equalTo: containerView.centerYAnchor), + backbutton.centerXAnchor.constraint(equalTo: containerView.centerXAnchor) + ]) + + // Create a UIBarButtonItem with the custom view + let customBarButton = UIBarButtonItem(customView: containerView) + + // Create a flexible space item to push the custom view to the left + let flexibleSpace = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) + flexibleSpace.width = 10 + // Create a negative spacer to fine-tune the position + let negativeSpacer = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) + negativeSpacer.width = 10 // Adjust this value to move the button to the left + + // Add the custom bar button and the spacer to the navigation bar + self.navigationItem.rightBarButtonItems = [flexibleSpace,negativeSpacer, customBarButton] + } + + @objc func cartBtnTapped(){ + print("cart tapped") + } + + override func viewWillAppear(_ animated: Bool) { + self.navigationController?.setNavigationBarHidden(false, animated: animated) + } + + override func viewDidAppear(_ animated: Bool) { + self.navigationController?.setColor(color: .white) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.navigationController?.setNavigationBarHidden(true, animated: animated) + } + + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + + // Customize the navigation bar's appearance + self.navigationController?.setColor(color: .black) + } +} + +// MARK: - TableView DataSource , Delegates + +extension ShopCategoryVC : TableViewSRC{ + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return vm.categoryData.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: K.CellIdentifier.Shop.shopListingCell) as! ShopListingCell + let data = vm.categoryData[indexPath.row] + cell.setCategoryData(data: data) + return cell + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let data = vm.categoryData[indexPath.row] + let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil) + let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopProductsVC) as! ShopProductsVC + vcPush.vm.categoryID = data.id + vcPush.vm.pageTitle = data.categoryName + self.navigationController?.pushViewController(vcPush, animated: true) + } +} diff --git a/WOKA/Shop/Controller/ShopListingVC.swift b/WOKA/Shop/Controller/ShopListingVC.swift new file mode 100644 index 0000000..8fb637f --- /dev/null +++ b/WOKA/Shop/Controller/ShopListingVC.swift @@ -0,0 +1,107 @@ +// +// ShopListingVC.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import UIKit + +class ShopListingVC: UIViewController { + + @IBOutlet weak var tableView: UITableView! + + var vm = ShopListingVM() + + override func viewDidLoad() { + super.viewDidLoad() + vm.vc = self + vm.initView() + navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) + navigationController?.navigationBar.shadowImage = UIImage() + + // Create the button + let backbutton = UIButton(type: .custom) + backbutton.setImage(UIImage(named: "CartIcon"), for: .normal) // Image can be downloaded from the provided link + backbutton.setTitleColor(.black, for: .normal) // You can change the TitleColor + backbutton.addTarget(self, action: #selector(vm.cartBtnTapped), for: .touchUpInside) + + // Set button height and width + let buttonHeight: CGFloat = 50 + let buttonWidth: CGFloat = 50 + backbutton.translatesAutoresizingMaskIntoConstraints = false + backbutton.widthAnchor.constraint(equalToConstant: buttonWidth).isActive = true + backbutton.heightAnchor.constraint(equalToConstant: buttonHeight).isActive = true + + // Create a container view for the button + let containerView = UIView(frame: CGRect(x: 0, y: 0, width: buttonWidth, height: buttonHeight)) + containerView.addSubview(backbutton) + + // Set constraints for the button inside the container view + NSLayoutConstraint.activate([ + backbutton.centerYAnchor.constraint(equalTo: containerView.centerYAnchor), + backbutton.centerXAnchor.constraint(equalTo: containerView.centerXAnchor) + ]) + + // Create a UIBarButtonItem with the custom view + let customBarButton = UIBarButtonItem(customView: containerView) + + // Create a flexible space item to push the custom view to the left + let flexibleSpace = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) + flexibleSpace.width = 10 + // Create a negative spacer to fine-tune the position + let negativeSpacer = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) + negativeSpacer.width = 10 // Adjust this value to move the button to the left + + // Add the custom bar button and the spacer to the navigation bar + self.navigationItem.rightBarButtonItems = [flexibleSpace,negativeSpacer, customBarButton] + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationController?.setNavigationBarHidden(false, animated: animated) + self.navigationController?.setColor(color: .white) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.navigationController?.setNavigationBarHidden(true, animated: animated) + } + + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + + // Customize the navigation bar's appearance + self.navigationController?.setColor(color: .black) + } +} + +// MARK: - TableView DataSource , Delegates + +extension ShopListingVC : TableViewSRC{ + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return vm.superCatData.count == 0 ? 3 : vm.superCatData.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: K.CellIdentifier.Shop.shopListingCell) as! ShopListingCell + + if vm.superCatData.count == 0{ + cell.showShimmer() + }else{ + let data = vm.superCatData[indexPath.row] + cell.setData(data: data) + cell.stopShimmer() + } + return cell + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + if vm.superCatData.count == 0 {return} + let superCatID = vm.superCatData[indexPath.row].id + let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil) + let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopCategoryVC) as! ShopCategoryVC + vcPush.vm.superCatID = superCatID + self.navigationController?.pushViewController(vcPush, animated: true) + } +} diff --git a/WOKA/Shop/Controller/ShopProductsVC.swift b/WOKA/Shop/Controller/ShopProductsVC.swift new file mode 100644 index 0000000..be805c5 --- /dev/null +++ b/WOKA/Shop/Controller/ShopProductsVC.swift @@ -0,0 +1,138 @@ +// +// ShopProductsVC.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import UIKit + +class ShopProductsVC: UIViewController { + + @IBOutlet weak var collectionView: UICollectionView! + @IBOutlet weak var subCategoryCV: UICollectionView! + @IBOutlet weak var productCV: UICollectionView! + + var vm = ShopProductsVM() + + override func viewDidLoad() { + super.viewDidLoad() + vm.vc = self + vm.initView() + navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) + navigationController?.navigationBar.shadowImage = UIImage() + + // Create the button + let backbutton = UIButton(type: .custom) + backbutton.setImage(UIImage(named: "CartIcon"), for: .normal) // Image can be downloaded from the provided link + backbutton.setTitleColor(.black, for: .normal) // You can change the TitleColor + backbutton.addTarget(self, action: #selector(cartBtnTapped), for: .touchUpInside) + + // Set button height and width + let buttonHeight: CGFloat = 50 + let buttonWidth: CGFloat = 50 + backbutton.translatesAutoresizingMaskIntoConstraints = false + backbutton.widthAnchor.constraint(equalToConstant: buttonWidth).isActive = true + backbutton.heightAnchor.constraint(equalToConstant: buttonHeight).isActive = true + + // Create a container view for the button + let containerView = UIView(frame: CGRect(x: 0, y: 0, width: buttonWidth, height: buttonHeight)) + containerView.addSubview(backbutton) + + // Set constraints for the button inside the container view + NSLayoutConstraint.activate([ + backbutton.centerYAnchor.constraint(equalTo: containerView.centerYAnchor), + backbutton.centerXAnchor.constraint(equalTo: containerView.centerXAnchor) + ]) + + // Create a UIBarButtonItem with the custom view + let customBarButton = UIBarButtonItem(customView: containerView) + + // Create a flexible space item to push the custom view to the left + let flexibleSpace = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) + flexibleSpace.width = 10 + // Create a negative spacer to fine-tune the position + let negativeSpacer = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) + negativeSpacer.width = 10 // Adjust this value to move the button to the left + + // Add the custom bar button and the spacer to the navigation bar + self.navigationItem.rightBarButtonItems = [flexibleSpace,negativeSpacer, customBarButton] + } + + @objc func cartBtnTapped(){ + print("cart tapped") + } + + override func viewWillAppear(_ animated: Bool) { + self.navigationController?.setNavigationBarHidden(false, animated: animated) + } + + override func viewDidAppear(_ animated: Bool) { + self.navigationController?.setColor(color: .white) + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.navigationController?.setNavigationBarHidden(true, animated: animated) + } + + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + + // Customize the navigation bar's appearance + self.navigationController?.setColor(color: .black) + } + +} + +// MARK: - CollectionView Delegate + +extension ShopProductsVC : CollectionViewSRC{ + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return vm.subCategoryData.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: K.CellIdentifier.WebSeries.seasonCategoryCell, for: indexPath) as! SeasonCategoryCell + + let data = vm.subCategoryData[indexPath.row] +// cell.setData(title: data.seasonNumber ?? "Season", iselected: data.id == vm.episodeSelectedCateogory) + cell.setSubCategory(data: data, isSelected: data.id == vm.selectedSubCategory) + return cell + } + + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { +// vm.episodeSelectedCateogory = vm.seasonListingData[indexPath.row].id +// vm.setSeasonData() +// episodeTitle.isHidden = false +// episodeTitle.text = "" +// vm.getSeasonEpisode() +// vm.getTeaserListing() +// self.categoryCV.reloadData() + } +} + +// MARK: - Collection Flow Layout + +extension ShopProductsVC : UICollectionViewDelegateFlowLayout{ + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + // Generate a random string for testing purposes + let randomText = vm.subCategoryData[indexPath.row].subCategoryName! + + // Define the font for the text + let font = FontCustom.shareInstance.customFont(fontName: .Exo2_Bold, size: 18) // Adjust the font size as needed + + // Calculate the width of the text + let attributes = [NSAttributedString.Key.font: font] + let textWidth = (randomText as NSString).size(withAttributes: attributes).width + + // Set the cell width based on the text width and any additional padding + // 14 for container view + 10 for inside spacing. + let padding: CGFloat = 24 + 20 // Adjust padding as needed + let cellWidth = textWidth + padding + return CGSize(width: cellWidth , height: 50) + } + +} diff --git a/WOKA/Shop/Model/ShopCategoryDM.swift b/WOKA/Shop/Model/ShopCategoryDM.swift new file mode 100644 index 0000000..3294615 --- /dev/null +++ b/WOKA/Shop/Model/ShopCategoryDM.swift @@ -0,0 +1,33 @@ +// +// ShopCategoryDM.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import Foundation + +// MARK: - ShopCategoryDM +struct ShopCategoryDM: Codable { + let result: [ResultData]? + let totalRecords: Int? + + enum CodingKeys: String, CodingKey { + case result + case totalRecords = "total_records" + } + + // MARK: - ResultData + struct ResultData: Codable { + let id: Int? + let categoryName: String? + let categoryThumbnail: String? + + enum CodingKeys: String, CodingKey { + case id + case categoryName = "category_name" + case categoryThumbnail = "category_thumbnail" + } + } + +} diff --git a/WOKA/Shop/Model/ShopProductDM.swift b/WOKA/Shop/Model/ShopProductDM.swift new file mode 100644 index 0000000..b4c8229 --- /dev/null +++ b/WOKA/Shop/Model/ShopProductDM.swift @@ -0,0 +1,71 @@ +// +// ShopProductDM.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import Foundation + +// MARK: - ShopProductDM +struct ShopProductDM: Codable { + let result: ResultData? + + // MARK: - ResultData + struct ResultData: Codable { + let sabakDegiNaniSeries: [SabakDegiNaniSery]? + + enum CodingKeys: String, CodingKey { + case sabakDegiNaniSeries = "Sabak Degi Nani Series" + } + } + + // MARK: - SabakDegiNaniSery + struct SabakDegiNaniSery: Codable { + let id: Int? + let skuID, productName, productThumbnail: String? + let categoryMasterID, subCategoryMasterID: Int? + let productPrice: String? + let remainStockQuantity: Int? + let stockStatus: String? +// let taxCategory: JSONNull? + let taxValue: String? + let shopMasterDetail: ShopMasterDetail? + let shopImage: [String]? + let addedToCart: Bool? + + enum CodingKeys: String, CodingKey { + case id + case skuID = "sku_id" + case productName = "product_name" + case productThumbnail = "product_thumbnail" + case categoryMasterID = "category_master_id" + case subCategoryMasterID = "sub_category_master_id" + case productPrice = "product_price" + case remainStockQuantity = "remain_stock_quantity" + case stockStatus = "stock_status" +// case taxCategory = "tax_category" + case taxValue = "tax_value" + case shopMasterDetail = "shop_master_detail" + case shopImage = "shop_image" + case addedToCart = "added_to_cart" + } + } + + // MARK: - ShopMasterDetail + struct ShopMasterDetail: Codable { + let id, productID: Int? + let productNameEnglish, productNameHindi, descriptionEnglish, descriptionHindi: String? + + enum CodingKeys: String, CodingKey { + case id + case productID = "product_id" + case productNameEnglish = "product_name_english" + case productNameHindi = "product_name_hindi" + case descriptionEnglish = "description_english" + case descriptionHindi = "description_hindi" + } + } + +} + diff --git a/WOKA/Shop/Model/ShopSubCategoryDM.swift b/WOKA/Shop/Model/ShopSubCategoryDM.swift new file mode 100644 index 0000000..ac2744b --- /dev/null +++ b/WOKA/Shop/Model/ShopSubCategoryDM.swift @@ -0,0 +1,34 @@ +// +// ShopSubCategoryDM.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import Foundation + +// MARK: - ShopSubCategoryDM +struct ShopSubCategoryDM: Codable { + let result: [ResultData]? + let totalRecords: Int? + + enum CodingKeys: String, CodingKey { + case result + case totalRecords = "total_records" + } + + // MARK: - ResultData + struct ResultData: Codable { + let id, categoryMasterID: Int? + let subCategoryName: String? + let subCategoryThumbnail: String? + + enum CodingKeys: String, CodingKey { + case id + case categoryMasterID = "category_master_id" + case subCategoryName = "sub_category_name" + case subCategoryThumbnail = "sub_category_thumbnail" + } + } + +} diff --git a/WOKA/Shop/Model/ShopSuperCategoryDM.swift b/WOKA/Shop/Model/ShopSuperCategoryDM.swift new file mode 100644 index 0000000..d3aa840 --- /dev/null +++ b/WOKA/Shop/Model/ShopSuperCategoryDM.swift @@ -0,0 +1,33 @@ +// +// ShopSuperCategoryDM.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import Foundation + +// MARK: - ShopSuperCategoryDM +struct ShopSuperCategoryDM: Codable { + let result: [ResultData]? + let totalRecords: Int? + + enum CodingKeys: String, CodingKey { + case result + case totalRecords = "total_records" + } + + // MARK: - Result + struct ResultData: Codable { + let id: Int? + let superCategoryName: String? + let superCategoryThumbnail: String? + + enum CodingKeys: String, CodingKey { + case id + case superCategoryName = "super_category_name" + case superCategoryThumbnail = "super_category_thumbnail" + } + } + +} diff --git a/WOKA/Shop/Shop.storyboard b/WOKA/Shop/Shop.storyboard new file mode 100644 index 0000000..b0e9650 --- /dev/null +++ b/WOKA/Shop/Shop.storyboard @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/Shop/View/ShopListingCell.swift b/WOKA/Shop/View/ShopListingCell.swift new file mode 100644 index 0000000..0fbe2ba --- /dev/null +++ b/WOKA/Shop/View/ShopListingCell.swift @@ -0,0 +1,50 @@ +// +// ShopListingCell.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import UIKit + +class ShopListingCell: UITableViewCell { + + @IBOutlet weak var cellImage: UIImageView! + @IBOutlet weak var cellTitle: UILabel! + @IBOutlet weak var shimmerEffectView: ShimmerEffectView! + + override func awakeFromNib() { + super.awakeFromNib() + self.backgroundColor = .clear + // Initialization code + } + + func showShimmer(){ + shimmerEffectView.gradientColorOne = #colorLiteral(red: 0.4969186187, green: 0.8725844026, blue: 1, alpha: 1) + shimmerEffectView.gradientColorTwo = #colorLiteral(red: 0.9254901961, green: 0.9254901961, blue: 0.9254901961, alpha: 1) + shimmerEffectView.startShimmer() + } + + func stopShimmer(){ + shimmerEffectView.stopShimmer() + } + + override func setSelected(_ selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + + } + + func setData(data : ShopSuperCategoryDM.ResultData){ + if let url = data.superCategoryThumbnail{ + self.cellImage.imageURL(url, color: .black) + } + self.cellTitle.text = data.superCategoryName + } + + func setCategoryData(data : ShopCategoryDM.ResultData){ + if let url = data.categoryThumbnail{ + self.cellImage.imageURL(url, color: .black) + } + self.cellTitle.text = data.categoryName + } +} diff --git a/WOKA/Shop/View/ShopListingCell.xib b/WOKA/Shop/View/ShopListingCell.xib new file mode 100644 index 0000000..e632a83 --- /dev/null +++ b/WOKA/Shop/View/ShopListingCell.xib @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + Exo2-Bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/Shop/View/ShopProductsCell.swift b/WOKA/Shop/View/ShopProductsCell.swift new file mode 100644 index 0000000..ca550d3 --- /dev/null +++ b/WOKA/Shop/View/ShopProductsCell.swift @@ -0,0 +1,17 @@ +// +// ShopProductsCell.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import UIKit + +class ShopProductsCell: UICollectionViewCell { + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + } + +} diff --git a/WOKA/Shop/View/ShopProductsCell.xib b/WOKA/Shop/View/ShopProductsCell.xib new file mode 100644 index 0000000..0f71232 --- /dev/null +++ b/WOKA/Shop/View/ShopProductsCell.xib @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WOKA/Shop/ViewModel/ShopCategoryVM.swift b/WOKA/Shop/ViewModel/ShopCategoryVM.swift new file mode 100644 index 0000000..6627ffa --- /dev/null +++ b/WOKA/Shop/ViewModel/ShopCategoryVM.swift @@ -0,0 +1,90 @@ +// +// ShopCategoryVM.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import UIKit +import Alamofire + +class ShopCategoryVM{ + + weak var vc : ShopCategoryVC! + var superCatID : Int? + + var categoryData = [ShopCategoryDM.ResultData]() + + func initView(){ + setupCell() + addGradient() + getCategory() + } + + func setupCell(){ + vc.tableView.register(UINib(nibName: K.CellIdentifier.Shop.shopListingCell, bundle: nil), forCellReuseIdentifier: K.CellIdentifier.Shop.shopListingCell) + vc.tableView.delegate = vc.self + vc.tableView.dataSource = vc.self + } + + func addGradient(){ + self.vc.title = "Shop".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue) + let color1 = #colorLiteral(red: 0.6745098039, green: 0.6235294118, blue: 0.1725490196, alpha: 1) + let color2 = #colorLiteral(red: 0.5450980392, green: 0.6745098039, blue: 0.1725490196, alpha: 1) + + vc.view.applyGradient(colors: [color2, color1], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0.8, y: 0)) + } + + + + // MARK: - Get SuperCategory + + func getCategory(){ + guard let superCatID else{return} + Utilities.startProgressHUD() + let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()] + let params : Parameters = ["module_id" : "5", + "super_category_id" : superCatID] + + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Shop.category_listing, method: .post,parameters: params,headers: headers) { [weak self](result : Result, NetworkManager.APIError>) in + switch result{ + case .success(let data): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + switch data.success{ + case 0: + /* + Error + */ + Utilities.dismissProgressHUD() + Utilities.alertWithBtnCompletion(title: "Error", msgBody: data.message ?? K.ConstantString.unRecognised, okBtnStr: "Retry?", vc: self.vc) { isDone in + if isDone{ + self.getCategory() + } + } + case 1: + Utilities.dismissProgressHUD() + guard let data = data.data?.result else{return} + self.categoryData = data + self.vc.tableView.reloadData() + default: + Utilities.dismissProgressHUD() + break + } + case .failure(let error): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + Utilities.dismissProgressHUD() + Utilities.alertWithBtnCompletion(title: "Error", msgBody: error.localizedDescription, okBtnStr: "Retry?", vc: self.vc) { isDone in + if isDone{ + self.getCategory() + } + } + } + } + } +} diff --git a/WOKA/Shop/ViewModel/ShopListingVM.swift b/WOKA/Shop/ViewModel/ShopListingVM.swift new file mode 100644 index 0000000..4b86bd8 --- /dev/null +++ b/WOKA/Shop/ViewModel/ShopListingVM.swift @@ -0,0 +1,77 @@ +// +// ShopListingVM.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import UIKit +import Alamofire + +class ShopListingVM{ + + weak var vc : ShopListingVC! + var superCatData = [ShopSuperCategoryDM.ResultData]() + + func initView(){ + setupCell() + addGradient() + getSuperCategory() + } + + func setupCell(){ + vc.tableView.register(UINib(nibName: K.CellIdentifier.Shop.shopListingCell, bundle: nil), forCellReuseIdentifier: K.CellIdentifier.Shop.shopListingCell) + vc.tableView.delegate = vc.self + vc.tableView.dataSource = vc.self + } + + func addGradient(){ + self.vc.title = "Shop".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue) + let color1 = #colorLiteral(red: 0.6745098039, green: 0.6235294118, blue: 0.1725490196, alpha: 1) + let color2 = #colorLiteral(red: 0.5450980392, green: 0.6745098039, blue: 0.1725490196, alpha: 1) + + vc.view.applyGradient(colors: [color2, color1], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0.8, y: 0)) + } + + @objc func cartBtnTapped(){ + print("cart tapped") + } + + // MARK: - Get SuperCategory + + func getSuperCategory(){ + let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()] + let params : Parameters = ["module_id" : "5"] + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Shop.super_category_listing, method: .post,parameters: params,headers: headers) { [weak self](result : Result, NetworkManager.APIError>) in + switch result{ + case .success(let data): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + switch data.success{ + case 0: + /* + Error + */ + Utilities.dismissProgressHUD() + + case 1: + Utilities.dismissProgressHUD() + guard let data = data.data?.result else{return} + self.superCatData = data + self.vc.tableView.reloadData() + default: + break + } + case .failure(let error): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + Utilities.dismissProgressHUD() + vc.toast(msg: error.localizedDescription , time: 2) + } + } + } +} diff --git a/WOKA/Shop/ViewModel/ShopProductsVM.swift b/WOKA/Shop/ViewModel/ShopProductsVM.swift new file mode 100644 index 0000000..6d9fa17 --- /dev/null +++ b/WOKA/Shop/ViewModel/ShopProductsVM.swift @@ -0,0 +1,142 @@ +// +// ShopProductsVM.swift +// WOKA +// +// Created by MacBook Pro on 22/07/24. +// + +import Foundation +import Alamofire + +class ShopProductsVM{ + + weak var vc : ShopProductsVC! + var subCategoryData = [ShopSubCategoryDM.ResultData]() + var shopProducts = [ShopProductDM.ResultData]() + + var categoryID : Int? + var selectedSubCategory = 0 + var pageTitle : String? + + func initView(){ + getCategory() + addGradient() + setupCell() + } + + func addGradient(){ + let color1 = #colorLiteral(red: 0.6745098039, green: 0.6235294118, blue: 0.1725490196, alpha: 1) + let color2 = #colorLiteral(red: 0.5450980392, green: 0.6745098039, blue: 0.1725490196, alpha: 1) + self.vc.title = pageTitle ?? "Shop" + vc.view.applyGradient(colors: [color2, color1], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0.8, y: 0)) + } + + func setupCell(){ + vc.subCategoryCV.register(UINib(nibName: K.CellIdentifier.WebSeries.seasonCategoryCell, bundle: nil), forCellWithReuseIdentifier: K.CellIdentifier.WebSeries.seasonCategoryCell) + vc.subCategoryCV.delegate = vc.self + vc.subCategoryCV.dataSource = vc.self + } + + // MARK: - Get SuperCategory + + func getCategory(){ + guard let categoryID else{return} + Utilities.startProgressHUD() + let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()] + let params : Parameters = ["category_id" : categoryID] + + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Shop.sub_category_listing, method: .post,parameters: params,headers: headers) { [weak self](result : Result, NetworkManager.APIError>) in + switch result{ + case .success(let data): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + switch data.success{ + case 0: + /* + Error + */ + Utilities.dismissProgressHUD() + Utilities.alertWithBtnCompletion(title: "Error", msgBody: data.message ?? K.ConstantString.unRecognised, okBtnStr: "Retry?", vc: self.vc) { isDone in + if isDone{ + self.getCategory() + } + } + case 1: + Utilities.dismissProgressHUD() + guard let data = data.data?.result else{return} + self.subCategoryData.append(ShopSubCategoryDM.ResultData(id: 0, categoryMasterID: 0, subCategoryName: "All", subCategoryThumbnail: "")) + self.subCategoryData.append(contentsOf: data) + self.selectedSubCategory = data.first?.id ?? 0 + self.vc.subCategoryCV.reloadData() +// if let subCatID = data.first?.id{ +// self.getShopProducts(subCategoryID: nil) +// } + default: + Utilities.dismissProgressHUD() + break + } + case .failure(let error): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + Utilities.dismissProgressHUD() + Utilities.alertWithBtnCompletion(title: "Error", msgBody: error.localizedDescription, okBtnStr: "Retry?", vc: self.vc) { isDone in + if isDone{ + self.getCategory() + } + } + } + } + } + + func getShopProducts(subCategoryID : Int?){ + guard let categoryID else{return} + Utilities.startProgressHUD() + let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()] + let params : Parameters = ["category_id" : categoryID, + "sub_category_id" : subCategoryID ?? ""] + + NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Shop.shop_product_listing, method: .post,parameters: params,headers: headers) { [weak self](result : Result, NetworkManager.APIError>) in + switch result{ + case .success(let data): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + switch data.success{ + case 0: + /* + Error + */ + Utilities.dismissProgressHUD() + Utilities.alertWithBtnCompletion(title: "Error", msgBody: data.message ?? K.ConstantString.unRecognised, okBtnStr: "Retry?", vc: self.vc) { isDone in + if isDone{ + self.getShopProducts(subCategoryID: subCategoryID) + } + } + case 1: + Utilities.dismissProgressHUD() + guard let data = data.data?.result else{return} + print(data) + default: + Utilities.dismissProgressHUD() + break + } + case .failure(let error): + guard let self else{ + Utilities.dismissProgressHUD() + return + } + Utilities.dismissProgressHUD() + Utilities.alertWithBtnCompletion(title: "Error", msgBody: error.localizedDescription, okBtnStr: "Retry?", vc: self.vc) { isDone in +// if isDone{ +// self.getCategory() +// } + } + } + } + } +} diff --git a/WOKA/SideBarNav/Controller/MyOrdersVC.swift b/WOKA/SideBarNav/Controller/MyOrdersVC.swift index 0c4efa1..54630f6 100644 --- a/WOKA/SideBarNav/Controller/MyOrdersVC.swift +++ b/WOKA/SideBarNav/Controller/MyOrdersVC.swift @@ -12,42 +12,21 @@ class MyOrdersVC: UIViewController { override func viewDidLoad() { super.viewDidLoad() self.title = "MY ORDERS" - - // Create the button - let backbutton = UIButton(type: .custom) - backbutton.setImage(UIImage(named: "CartIcon"), for: .normal) // Image can be downloaded from the provided link - backbutton.setTitleColor(.black, for: .normal) // You can change the TitleColor - backbutton.addTarget(self, action: #selector(cartBtnTapped), for: .touchUpInside) - - // Set button height and width - let buttonHeight: CGFloat = 60 - let buttonWidth: CGFloat = 60 - backbutton.translatesAutoresizingMaskIntoConstraints = false - backbutton.widthAnchor.constraint(equalToConstant: buttonWidth).isActive = true - backbutton.heightAnchor.constraint(equalToConstant: buttonHeight).isActive = true - - // Create a container view for the button - let containerView = UIView(frame: CGRect(x: 0, y: 0, width: buttonWidth, height: buttonHeight)) - containerView.addSubview(backbutton) - - // Set constraints for the button inside the container view - NSLayoutConstraint.activate([ - backbutton.centerYAnchor.constraint(equalTo: containerView.centerYAnchor), - backbutton.centerXAnchor.constraint(equalTo: containerView.centerXAnchor) - ]) - - // Create a UIBarButtonItem with the custom view - let customBarButton = UIBarButtonItem(customView: containerView) - - // Create a flexible space item to push the custom view to the left - let flexibleSpace = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) - flexibleSpace.width = 20 - // Create a negative spacer to fine-tune the position - let negativeSpacer = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) - negativeSpacer.width = 10 // Adjust this value to move the button to the left - - // Add the custom bar button and the spacer to the navigation bar - self.navigationItem.rightBarButtonItems = [flexibleSpace,negativeSpacer, customBarButton] + + let btn = BadgedButtonItem(with: UIImage(named: "CartIcon")) + btn.badgeTintColor = .red + btn.badgeTextColor = .green + btn.position = .right + btn.hasBorder = true + btn.borderColor = .red + btn.badgeSize = .large + btn.badgeAnimation = true + btn.setBadge(with: 1) + btn.tapAction = { + // do something + print("tapped") + } + self.navigationItem.rightBarButtonItem = btn } @@ -65,8 +44,5 @@ class MyOrdersVC: UIViewController { override func viewDidDisappear(_ animated: Bool) { self.navigationController?.setColor(color: .black) } - - @objc func cartBtnTapped(){ - - } + } diff --git a/WOKA/Theme/Base.lproj/Theme.storyboard b/WOKA/Theme/Base.lproj/Theme.storyboard index b48c3e7..1a9cc21 100644 --- a/WOKA/Theme/Base.lproj/Theme.storyboard +++ b/WOKA/Theme/Base.lproj/Theme.storyboard @@ -214,34 +214,47 @@ - - + + - - - - + + - + + + + - + - + - + @@ -264,7 +277,7 @@ - + @@ -294,7 +307,7 @@ - + @@ -345,7 +358,7 @@ - + @@ -380,19 +393,18 @@ - + + - + - - + - @@ -419,13 +431,13 @@ - + @@ -477,6 +489,7 @@ + diff --git a/WOKA/Theme/Controller/ThemeOneVC.swift b/WOKA/Theme/Controller/ThemeOneVC.swift index e5883ea..9272bb1 100644 --- a/WOKA/Theme/Controller/ThemeOneVC.swift +++ b/WOKA/Theme/Controller/ThemeOneVC.swift @@ -30,6 +30,7 @@ class ThemeOneVC: UIViewController { @IBOutlet weak var bottomArrow: UIImageView! @IBOutlet weak var gamesView: UIView! @IBOutlet weak var karaokeView: UIView! + @IBOutlet weak var shopView: UIView! var timer: Timer? diff --git a/WOKA/Theme/ViewModel/ThemeOneVM.swift b/WOKA/Theme/ViewModel/ThemeOneVM.swift index a88e6f8..ba64463 100644 --- a/WOKA/Theme/ViewModel/ThemeOneVM.swift +++ b/WOKA/Theme/ViewModel/ThemeOneVM.swift @@ -152,6 +152,15 @@ class ThemeOneVM{ vc.navigationController?.pushViewController(vcPush, animated: true) } } + + vc.shopView.addTapGesture { + ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.shopView) { [weak self] in + guard let self else{return} + let sb = UIStoryboard(name: K.StoryBoard.shop, bundle: nil) + let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Shop.shopListingVC) as! ShopListingVC + vc.navigationController?.pushViewController(vcPush, animated: true) + } + } } // MARK: - Animate Clouds and LiveTV diff --git a/WOKA/WebSeries/View/SeasonCategoryCell.swift b/WOKA/WebSeries/View/SeasonCategoryCell.swift index a1f46a4..931cbc2 100644 --- a/WOKA/WebSeries/View/SeasonCategoryCell.swift +++ b/WOKA/WebSeries/View/SeasonCategoryCell.swift @@ -26,6 +26,11 @@ class SeasonCategoryCell: UICollectionViewCell { selectDeselect(isSelected: iselected) } + func setSubCategory(data : ShopSubCategoryDM.ResultData, isSelected : Bool){ + self.categoryTitle.text = data.subCategoryName + selectDeselectsubCategory(isSelected: isSelected) + } + func selectDeselect(isSelected : Bool){ if isSelected{ outerView.backgroundColor = #colorLiteral(red: 0.4495816827, green: 0.2344398499, blue: 0.8120074868, alpha: 1) @@ -35,4 +40,14 @@ class SeasonCategoryCell: UICollectionViewCell { categoryTitle.textColor = .black } } + + func selectDeselectsubCategory(isSelected : Bool){ + if isSelected{ + outerView.backgroundColor = #colorLiteral(red: 0.03529411765, green: 0, blue: 0.3647058824, alpha: 1) + categoryTitle.textColor = .white + }else{ + outerView.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1) + categoryTitle.textColor = .black + } + } }