diff --git a/Hortali-App/Hortali.xcodeproj/project.pbxproj b/Hortali-App/Hortali.xcodeproj/project.pbxproj index 9fe5383..f939eaf 100644 --- a/Hortali-App/Hortali.xcodeproj/project.pbxproj +++ b/Hortali-App/Hortali.xcodeproj/project.pbxproj @@ -12,7 +12,7 @@ 220A63E428D24C3800D9E2A9 /* InfoGardenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 220A63E328D24C3800D9E2A9 /* InfoGardenView.swift */; }; 220A63E928D24C7100D9E2A9 /* InfoGardenController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 220A63E828D24C7100D9E2A9 /* InfoGardenController.swift */; }; 220A63EC28D24CFA00D9E2A9 /* LabelExpansive.swift in Sources */ = {isa = PBXBuildFile; fileRef = 220A63EB28D24CFA00D9E2A9 /* LabelExpansive.swift */; }; - 220A63EE28D3BDF700D9E2A9 /* CustomScrooll.swift in Sources */ = {isa = PBXBuildFile; fileRef = 220A63ED28D3BDF700D9E2A9 /* CustomScrooll.swift */; }; + 220A63EE28D3BDF700D9E2A9 /* CustomScroll.swift in Sources */ = {isa = PBXBuildFile; fileRef = 220A63ED28D3BDF700D9E2A9 /* CustomScroll.swift */; }; 2210244628D5201500F412A5 /* InfoGardenInfosCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2210244528D5201500F412A5 /* InfoGardenInfosCell.swift */; }; 2210244828D5230C00F412A5 /* InfoGardenCellType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2210244728D5230C00F412A5 /* InfoGardenCellType.swift */; }; 2210244B28D5272C00F412A5 /* InfoGardenMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2210244A28D5272C00F412A5 /* InfoGardenMap.swift */; }; @@ -29,8 +29,6 @@ 2210246C28D9017700F412A5 /* UIImage+ContactIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2210246B28D9017700F412A5 /* UIImage+ContactIcon.swift */; }; 2212E82B28DB8734004CCBAA /* GardenDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2212E82A28DB8734004CCBAA /* GardenDelegate.swift */; }; 2212E82D28DB877B004CCBAA /* GardenProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2212E82C28DB877B004CCBAA /* GardenProtocol.swift */; }; - 2212E83128DB884E004CCBAA /* MenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2212E83028DB884E004CCBAA /* MenuController.swift */; }; - 2212E83328DB88D9004CCBAA /* TabBarProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2212E83228DB88D9004CCBAA /* TabBarProtocol.swift */; }; 2212E83B28DB9F60004CCBAA /* InfoFoodController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2212E83A28DB9F60004CCBAA /* InfoFoodController.swift */; }; 2212E83D28DB9F7B004CCBAA /* InfoFoodView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2212E83C28DB9F7B004CCBAA /* InfoFoodView.swift */; }; 2212E84228DCEC07004CCBAA /* CustomLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2212E84128DCEC07004CCBAA /* CustomLabel.swift */; }; @@ -94,6 +92,9 @@ 22A3918128F7862800A42DC1 /* ManagedVitamins.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22A3918028F7862800A42DC1 /* ManagedVitamins.swift */; }; 22A3918428F7AD5D00A42DC1 /* SearchProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22A3918328F7AD5D00A42DC1 /* SearchProtocol.swift */; }; 22A3918628F7AE3000A42DC1 /* SearchDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22A3918528F7AE3000A42DC1 /* SearchDelegate.swift */; }; + 22A3DB2A290CED4700B34CEC /* ViewLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22A3DB29290CED4700B34CEC /* ViewLabel.swift */; }; + 22A75A8C290CC681001CEA7E /* PopGestureDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22A75A8B290CC681001CEA7E /* PopGestureDelegate.swift */; }; + 22A75A8E290CC6DC001CEA7E /* CustomNavigationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22A75A8D290CC6DC001CEA7E /* CustomNavigationProtocol.swift */; }; 22E8C4E028D9188400CE6061 /* InfoGardenTime.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22E8C4DF28D9188400CE6061 /* InfoGardenTime.swift */; }; 22E8C4E428D918B500CE6061 /* TimeGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22E8C4E328D918B500CE6061 /* TimeGroup.swift */; }; 22EDD4AB28D95812001CE093 /* CustomStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22EDD4AA28D95812001CE093 /* CustomStack.swift */; }; @@ -103,6 +104,7 @@ 22EDD4B928DA313B001CE093 /* HourInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22EDD4B828DA313B001CE093 /* HourInfoView.swift */; }; 22EDD4BE28DA4A6A001CE093 /* AppImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22EDD4BD28DA4A6A001CE093 /* AppImages.swift */; }; 22EDD4C128DA4B33001CE093 /* UIImage+AppImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22EDD4C028DA4B33001CE093 /* UIImage+AppImages.swift */; }; + B227C5CB290B032C00B07918 /* CustomNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B227C5CA290B032C00B07918 /* CustomNavigationController.swift */; }; B241564728D26E4C009F011C /* FoodCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B241564628D26E4C009F011C /* FoodCell.swift */; }; B241564C28D2722B009F011C /* FoodDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = B241564B28D2722B009F011C /* FoodDataSource.swift */; }; B241564E28D27284009F011C /* FoodDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B241564D28D27284009F011C /* FoodDelegate.swift */; }; @@ -114,7 +116,7 @@ 220A63E328D24C3800D9E2A9 /* InfoGardenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoGardenView.swift; sourceTree = ""; }; 220A63E828D24C7100D9E2A9 /* InfoGardenController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoGardenController.swift; sourceTree = ""; }; 220A63EB28D24CFA00D9E2A9 /* LabelExpansive.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelExpansive.swift; sourceTree = ""; }; - 220A63ED28D3BDF700D9E2A9 /* CustomScrooll.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomScrooll.swift; sourceTree = ""; }; + 220A63ED28D3BDF700D9E2A9 /* CustomScroll.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomScroll.swift; sourceTree = ""; }; 2210244528D5201500F412A5 /* InfoGardenInfosCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoGardenInfosCell.swift; sourceTree = ""; }; 2210244728D5230C00F412A5 /* InfoGardenCellType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoGardenCellType.swift; sourceTree = ""; }; 2210244A28D5272C00F412A5 /* InfoGardenMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoGardenMap.swift; sourceTree = ""; }; @@ -131,8 +133,6 @@ 2210246B28D9017700F412A5 /* UIImage+ContactIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+ContactIcon.swift"; sourceTree = ""; }; 2212E82A28DB8734004CCBAA /* GardenDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GardenDelegate.swift; sourceTree = ""; }; 2212E82C28DB877B004CCBAA /* GardenProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GardenProtocol.swift; sourceTree = ""; }; - 2212E83028DB884E004CCBAA /* MenuController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuController.swift; sourceTree = ""; }; - 2212E83228DB88D9004CCBAA /* TabBarProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarProtocol.swift; sourceTree = ""; }; 2212E83A28DB9F60004CCBAA /* InfoFoodController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoFoodController.swift; sourceTree = ""; }; 2212E83C28DB9F7B004CCBAA /* InfoFoodView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoFoodView.swift; sourceTree = ""; }; 2212E84128DCEC07004CCBAA /* CustomLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomLabel.swift; sourceTree = ""; }; @@ -198,6 +198,9 @@ 22A3918028F7862800A42DC1 /* ManagedVitamins.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManagedVitamins.swift; sourceTree = ""; }; 22A3918328F7AD5D00A42DC1 /* SearchProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchProtocol.swift; sourceTree = ""; }; 22A3918528F7AE3000A42DC1 /* SearchDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchDelegate.swift; sourceTree = ""; }; + 22A3DB29290CED4700B34CEC /* ViewLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewLabel.swift; sourceTree = ""; }; + 22A75A8B290CC681001CEA7E /* PopGestureDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopGestureDelegate.swift; sourceTree = ""; }; + 22A75A8D290CC6DC001CEA7E /* CustomNavigationProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomNavigationProtocol.swift; sourceTree = ""; }; 22E8C4DF28D9188400CE6061 /* InfoGardenTime.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoGardenTime.swift; sourceTree = ""; }; 22E8C4E328D918B500CE6061 /* TimeGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimeGroup.swift; sourceTree = ""; }; 22EDD4AA28D95812001CE093 /* CustomStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomStack.swift; sourceTree = ""; }; @@ -207,6 +210,7 @@ 22EDD4B828DA313B001CE093 /* HourInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HourInfoView.swift; sourceTree = ""; }; 22EDD4BD28DA4A6A001CE093 /* AppImages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppImages.swift; sourceTree = ""; }; 22EDD4C028DA4B33001CE093 /* UIImage+AppImages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+AppImages.swift"; sourceTree = ""; }; + B227C5CA290B032C00B07918 /* CustomNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomNavigationController.swift; sourceTree = ""; }; B241564628D26E4C009F011C /* FoodCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FoodCell.swift; sourceTree = ""; }; B241564B28D2722B009F011C /* FoodDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FoodDataSource.swift; sourceTree = ""; }; B241564D28D27284009F011C /* FoodDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FoodDelegate.swift; sourceTree = ""; }; @@ -375,15 +379,6 @@ path = Protocol; sourceTree = ""; }; - 2212E83428DB894A004CCBAA /* Menu */ = { - isa = PBXGroup; - children = ( - 2212E83028DB884E004CCBAA /* MenuController.swift */, - 2212E83228DB88D9004CCBAA /* TabBarProtocol.swift */, - ); - path = Menu; - sourceTree = ""; - }; 2212E83528DB9F2E004CCBAA /* InfoFood */ = { isa = PBXGroup; children = ( @@ -502,6 +497,7 @@ children = ( 222937DB28C66B9E00515095 /* System */, 22A3918528F7AE3000A42DC1 /* SearchDelegate.swift */, + 22A75A8B290CC681001CEA7E /* PopGestureDelegate.swift */, ); path = Delegates; sourceTree = ""; @@ -557,9 +553,9 @@ 2229381E28C7C3DD00515095 /* Main */ = { isa = PBXGroup; children = ( - 2212E83428DB894A004CCBAA /* Menu */, 2229385128C89ABB00515095 /* Launch */, 2229381F28C7C3FC00515095 /* MainController.swift */, + B227C5CA290B032C00B07918 /* CustomNavigationController.swift */, ); path = Main; sourceTree = ""; @@ -631,6 +627,7 @@ 222937F428C6846700515095 /* ContainerView.swift */, 220A63EB28D24CFA00D9E2A9 /* LabelExpansive.swift */, 2229384E28C8964200515095 /* MainView.swift */, + 22A3DB29290CED4700B34CEC /* ViewLabel.swift */, ); path = Components; sourceTree = ""; @@ -810,7 +807,7 @@ children = ( 2212E84128DCEC07004CCBAA /* CustomLabel.swift */, 22EDD4AA28D95812001CE093 /* CustomStack.swift */, - 220A63ED28D3BDF700D9E2A9 /* CustomScrooll.swift */, + 220A63ED28D3BDF700D9E2A9 /* CustomScroll.swift */, 2229382528C852D200515095 /* CustomButton.swift */, ); path = Conponents; @@ -850,6 +847,7 @@ isa = PBXGroup; children = ( 22A3918328F7AD5D00A42DC1 /* SearchProtocol.swift */, + 22A75A8D290CC6DC001CEA7E /* CustomNavigationProtocol.swift */, ); path = Protocol; sourceTree = ""; @@ -1046,14 +1044,13 @@ 222937EB28C6828500515095 /* UILabel+FontInfo.swift in Sources */, 223B75DB28F0DC840034B2C4 /* ManagedImage.swift in Sources */, 223B75D928F0DBA60034B2C4 /* DataType.swift in Sources */, + 22A75A8E290CC6DC001CEA7E /* CustomNavigationProtocol.swift in Sources */, 2210246228D84C6800F412A5 /* InfoGardenProtocol.swift in Sources */, 22A3917A28F7858100A42DC1 /* ManagedHourInfo.swift in Sources */, 2229385B28C9D3AC00515095 /* ScreenInfo.swift in Sources */, B241564E28D27284009F011C /* FoodDelegate.swift in Sources */, 2229382028C7C3FC00515095 /* MainController.swift in Sources */, 2210245428D52B2B00F412A5 /* InfoGardenInfosDataSource.swift in Sources */, - 2212E83328DB88D9004CCBAA /* TabBarProtocol.swift in Sources */, - 2212E83128DB884E004CCBAA /* MenuController.swift in Sources */, 222937E528C6779500515095 /* UIColors+AppColors.swift in Sources */, 2210246A28D9013E00F412A5 /* ContactIcon.swift in Sources */, 2212E84228DCEC07004CCBAA /* CustomLabel.swift in Sources */, @@ -1061,6 +1058,7 @@ 220A63E428D24C3800D9E2A9 /* InfoGardenView.swift in Sources */, 2210246828D8F9BC00F412A5 /* ContactGroup.swift in Sources */, 222937C828C66B5600515095 /* DataBase.xcdatamodeld in Sources */, + 22A3DB2A290CED4700B34CEC /* ViewLabel.swift in Sources */, 22A3916E28F6E62700A42DC1 /* InfoGardenCellProtocol.swift in Sources */, 22EDD4BE28DA4A6A001CE093 /* AppImages.swift in Sources */, 222937F928C68B9B00515095 /* CollectionGroup.swift in Sources */, @@ -1076,7 +1074,7 @@ 22A3918428F7AD5D00A42DC1 /* SearchProtocol.swift in Sources */, 2212E83B28DB9F60004CCBAA /* InfoFoodController.swift in Sources */, 2229384A28C8934100515095 /* FoodView.swift in Sources */, - 220A63EE28D3BDF700D9E2A9 /* CustomScrooll.swift in Sources */, + 220A63EE28D3BDF700D9E2A9 /* CustomScroll.swift in Sources */, 222937FC28C68C8200515095 /* CollectionGroupStyle.swift in Sources */, 223B75E028F146920034B2C4 /* GardenDataManager.swift in Sources */, 2210245728D53F3300F412A5 /* InfoGardenInfosDelegate.swift in Sources */, @@ -1111,12 +1109,14 @@ 2210244628D5201500F412A5 /* InfoGardenInfosCell.swift in Sources */, 223B75CB28F0D99B0034B2C4 /* UDHandler+DataType.swift in Sources */, 2212E84528DD0DA9004CCBAA /* FoodProtocol.swift in Sources */, + 22A75A8C290CC681001CEA7E /* PopGestureDelegate.swift in Sources */, 22EDD4B728DA2E00001CE093 /* HourInfoCell.swift in Sources */, 222937F528C6846700515095 /* ContainerView.swift in Sources */, 22E8C4E428D918B500CE6061 /* TimeGroup.swift in Sources */, 2229384F28C8964200515095 /* MainView.swift in Sources */, 2229380128C68EF500515095 /* FavoriteView.swift in Sources */, 22EDD4B328DA2D4F001CE093 /* HourInfoController.swift in Sources */, + B227C5CB290B032C00B07918 /* CustomNavigationController.swift in Sources */, 2229386628C9DA1600515095 /* UITextField+setupIconsColor.swift in Sources */, 222937F328C6844E00515095 /* CustomViews.swift in Sources */, ); @@ -1256,7 +1256,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = 534V229RMK; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "iOS-App/Info.plist"; @@ -1285,7 +1285,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = 534V229RMK; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "iOS-App/Info.plist"; diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/AppIcon.appiconset/logo.jpg b/Hortali-App/Shared/Assets/Assets.xcassets/AppIcon.appiconset/logo.jpg index ebfaeef..f9c1460 100644 Binary files a/Hortali-App/Shared/Assets/Assets.xcassets/AppIcon.appiconset/logo.jpg and b/Hortali-App/Shared/Assets/Assets.xcassets/AppIcon.appiconset/logo.jpg differ diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Email-contact.imageset/Contents.json b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Email-contact.imageset/Contents.json new file mode 100644 index 0000000..454ac3b --- /dev/null +++ b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Email-contact.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "email-contact.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Email-contact.imageset/email-contact.png b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Email-contact.imageset/email-contact.png new file mode 100644 index 0000000..5e2156a Binary files /dev/null and b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Email-contact.imageset/email-contact.png differ diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Facebook-contact.imageset/Contents.json b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Facebook-contact.imageset/Contents.json new file mode 100644 index 0000000..d5be856 --- /dev/null +++ b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Facebook-contact.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "face-contact.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Facebook-contact.imageset/face-contact.png b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Facebook-contact.imageset/face-contact.png new file mode 100644 index 0000000..e1d32cf Binary files /dev/null and b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Facebook-contact.imageset/face-contact.png differ diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/General-contact.imageset/Contents.json b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/General-contact.imageset/Contents.json new file mode 100644 index 0000000..9c1318a --- /dev/null +++ b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/General-contact.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Link-General.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/General-contact.imageset/Link-General.png b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/General-contact.imageset/Link-General.png new file mode 100644 index 0000000..317b0a5 Binary files /dev/null and b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/General-contact.imageset/Link-General.png differ diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Instagram-contact.imageset/Contents.json b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Instagram-contact.imageset/Contents.json new file mode 100644 index 0000000..1a1c44d --- /dev/null +++ b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Instagram-contact.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "insta-contact.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Instagram-contact.imageset/insta-contact.png b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Instagram-contact.imageset/insta-contact.png new file mode 100644 index 0000000..898fb8d Binary files /dev/null and b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Instagram-contact.imageset/insta-contact.png differ diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Ligar-contact.imageset/Contents.json b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Ligar-contact.imageset/Contents.json new file mode 100644 index 0000000..c7fc047 --- /dev/null +++ b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Ligar-contact.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "fone-contact.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Ligar-contact.imageset/fone-contact.png b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Ligar-contact.imageset/fone-contact.png new file mode 100644 index 0000000..83ea964 Binary files /dev/null and b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Ligar-contact.imageset/fone-contact.png differ diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Whatsapp-contact.imageset/Contents.json b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Whatsapp-contact.imageset/Contents.json new file mode 100644 index 0000000..5285793 --- /dev/null +++ b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Whatsapp-contact.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "whatts-contact.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Whatsapp-contact.imageset/whatts-contact.png b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Whatsapp-contact.imageset/whatts-contact.png new file mode 100644 index 0000000..655add9 Binary files /dev/null and b/Hortali-App/Shared/Assets/Assets.xcassets/Contact Icons/Whatsapp-contact.imageset/whatts-contact.png differ diff --git a/Hortali-App/Shared/Design System/Views/Components/CollectionGroup/CollectionGroup.swift b/Hortali-App/Shared/Design System/Views/Components/CollectionGroup/CollectionGroup.swift index 1954d83..c85121f 100644 --- a/Hortali-App/Shared/Design System/Views/Components/CollectionGroup/CollectionGroup.swift +++ b/Hortali-App/Shared/Design System/Views/Components/CollectionGroup/CollectionGroup.swift @@ -32,6 +32,7 @@ public class CollectionGroup: UIView { col.showsHorizontalScrollIndicator = false col.showsVerticalScrollIndicator = false + return col }() @@ -56,6 +57,9 @@ public class CollectionGroup: UIView { /// Constraints dinâmicas que mudam de acordo com o tamanho da tela private var dynamicConstraints: [NSLayoutConstraint] = [] + + /// Espaço de diferença que a label vai ter + private var labelSpace: CGFloat = 0 @@ -75,6 +79,22 @@ public class CollectionGroup: UIView { required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + /* MARK: - Encapsulamento */ + + /// Configura o espaço lateral da primeira e última célula + /// - Parameter space: espaço que vai ser adicionado + public func setPadding(for space: CGFloat) { + self.collection.contentInset = .init(top: 0, left: space, bottom: 0, right: space) + } + + + /// Configura o espaço lateral da label + /// - Parameter space: espaço que vai ser adicionado + public func setLabelSpace(for space: CGFloat) { + self.labelSpace = space + } + + /* MARK: - Ciclo de Vida */ @@ -106,7 +126,7 @@ public class CollectionGroup: UIView { case .complete: self.dynamicConstraints = [ self.titleLabel.topAnchor.constraint(equalTo: self.topAnchor), - self.titleLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor), + self.titleLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: self.labelSpace), self.titleLabel.trailingAnchor.constraint(equalTo: self.trailingAnchor), self.titleLabel.heightAnchor.constraint(equalToConstant: titleLabelHeight), diff --git a/Hortali-App/Shared/Design System/Views/Components/ContainerView.swift b/Hortali-App/Shared/Design System/Views/Components/ContainerView.swift index 8408abf..77abf0f 100644 --- a/Hortali-App/Shared/Design System/Views/Components/ContainerView.swift +++ b/Hortali-App/Shared/Design System/Views/Components/ContainerView.swift @@ -92,7 +92,7 @@ class ContainerView: UIView { let titleSize: CGFloat = self.getEquivalent(35) self.titleLabel.setupText(with: FontInfo( - fontSize: titleSize, weight: .bold + fontSize: titleSize, weight: .heavy )) } @@ -115,7 +115,7 @@ class ContainerView: UIView { self.contentView.topAnchor.constraint(equalTo: self.titleLabel.bottomAnchor, constant: lateral), - self.contentView.leadingAnchor.constraint(equalTo: self.safeAreaLayoutGuide.leadingAnchor, constant: lateral), + self.contentView.leadingAnchor.constraint(equalTo: self.safeAreaLayoutGuide.leadingAnchor), self.contentView.trailingAnchor.constraint(equalTo: self.safeAreaLayoutGuide.trailingAnchor), self.contentView.bottomAnchor.constraint(equalTo: self.safeAreaLayoutGuide.bottomAnchor), ] diff --git a/Hortali-App/Shared/Design System/Views/Components/LabelExpansive.swift b/Hortali-App/Shared/Design System/Views/Components/LabelExpansive.swift index 0411f0c..24cdd4f 100644 --- a/Hortali-App/Shared/Design System/Views/Components/LabelExpansive.swift +++ b/Hortali-App/Shared/Design System/Views/Components/LabelExpansive.swift @@ -10,22 +10,11 @@ class ExpansiveLabel: UIView { /* MARK: - Atributos */ // Views - - /// Label de referencia para pegar o tamanho quando tiver texto grande - private let invisibleLabel: UILabel = { - let lbl = CustomViews.newLabel() - lbl.numberOfLines = 0 - lbl.lineBreakMode = .byWordWrapping - lbl.sizeToFit() - lbl.isHidden = true - return lbl - }() - + /// Label para colocar o texto expandivel private let paragraphLabel: UILabel = { let lbl = CustomViews.newLabel() lbl.textColor = UIColor(.paragraph) - lbl.numberOfLines = 0 lbl.lineBreakMode = .byWordWrapping return lbl }() @@ -50,20 +39,11 @@ class ExpansiveLabel: UIView { // Tamanhos - /// Tamanho do botão - private let btNormalSize: CGFloat = 30 - - /// Tamanho da label quando não está expandida - private let lblNormalSize: CGFloat = 65 - - /// Tamanho da expansão da label - private var expandedSize: CGFloat = 0 - /// Tamanho do texto que fica aparecendo sem expandir - private let textCountFit: Int = 75 + private let textCountFit: Int = 120 /// Estado se está expandida - private var status = false + private var isExtended = false @@ -82,64 +62,56 @@ class ExpansiveLabel: UIView { /* MARK: - Encapsulamento */ - - /* Variáveis Computáveis */ - - /// Tamanho atual da label - public var actualLabelSize: CGFloat { - return self.lblNormalSize + self.expandedSize - } - - /// Tamanho da expansão da label - public var expandedLabelSize: CGFloat { - return self.expandedSize - } - - /// Estado se está ou não expandida - public var isExtended: Bool { - return self.status - } - - - /* Gerais */ - + /// Define o texto que a label vai receber /// - Parameter text: texto que vai ser definido public func setInfoText(for text: String) { self.paragraphLabel.text = text - self.invisibleLabel.text = text if text.count < self.textCountFit { - self.expansiveButton.isHidden = true + self.hideButton() } } - + /// Configurações para expandir ou reduzir o tamanho da label /// - Parameter isExtended: se está ou não expandida - public func setupExtension(extended: Bool) { - self.status = extended + public func setupExtension(extended: Bool? = nil) { + if let extended { + self.isExtended = extended + } else { + self.isExtended.toggle() + } - var size = self.btNormalSize + self.lblNormalSize if self.isExtended { - size += round(self.invisibleLabel.bounds.height) + self.paragraphLabel.sizeToFit() + self.paragraphLabel.numberOfLines = 0 + self.paragraphLabel.adjustsFontSizeToFitWidth = false + } else { + self.paragraphLabel.numberOfLines = 3 + self.paragraphLabel.adjustsFontSizeToFitWidth = true } - self.setLabelSize(for: size) + self.setupHeight() } /// Configura a constraint de altura public func setupHeight() { - let expLabelHeight = self.superview?.self.getEquivalent(self.actualLabelSize) ?? 0 - - NSLayoutConstraint.deactivate(self.heightConstraints) - - self.heightConstraints = [ - self.heightAnchor.constraint(equalToConstant: expLabelHeight), - ] + if !self.heightConstraints.isEmpty { + NSLayoutConstraint.deactivate(self.heightConstraints) + self.heightConstraints.removeAll() + } - NSLayoutConstraint.activate(self.heightConstraints) + if !self.expansiveButton.isHidden && !self.isExtended { + let minimunLabelSize: CGFloat = self.superview?.getEquivalent(110) ?? 00 + + self.heightConstraints = [ + self.heightAnchor.constraint(equalToConstant: minimunLabelSize), + ] + + NSLayoutConstraint.activate(self.heightConstraints) + } } @@ -181,19 +153,10 @@ class ExpansiveLabel: UIView { /* Geral */ - /// Define o tamanho da label - /// - Parameter size: tamanho que a label vai ter - private func setLabelSize(for size: CGFloat) { - if size > self.lblNormalSize { - self.expandedSize = size - self.lblNormalSize - } - } - - - /// Retorna a quantidade de caracteres do texto - /// - Returns: quantidade de caracteres do texto - private func getTextCount() -> Int { - return self.paragraphLabel.text?.count ?? 0 + /// Esconde o botão de expandir + private func hideButton() { + self.expansiveButton.isHidden = true + self.paragraphLabel.sizeToFit() } @@ -201,7 +164,6 @@ class ExpansiveLabel: UIView { /// Adiciona os elementos (Views) na tela private func setupViews() { - self.addSubview(self.invisibleLabel) self.addSubview(self.paragraphLabel) self.addSubview(self.expansiveButton) } @@ -210,10 +172,9 @@ class ExpansiveLabel: UIView { /// Define os textos que são estáticos (os textos em si que vão sempre ser o mesmo) private func setupStaticTexts() { /* Labels */ - let fontInfo = FontInfo(fontSize: 20, weight: .regular) - - self.paragraphLabel.setupText(with: fontInfo) - self.invisibleLabel.setupText(with: fontInfo) + self.paragraphLabel.setupText(with: FontInfo( + fontSize: 20, weight: .regular + )) /* Botões */ self.setupButtonIcon() @@ -222,7 +183,8 @@ class ExpansiveLabel: UIView { /// Define as constraints que dependem do tamanho da tela private func setupDynamicConstraints() { - self.expansiveButton.circleSize = self.getEquivalent(self.btNormalSize) + let btSize: CGFloat = self.getEquivalent(30) + self.expansiveButton.circleSize = btSize NSLayoutConstraint.deactivate(self.dynamicConstraints) @@ -230,14 +192,9 @@ class ExpansiveLabel: UIView { self.paragraphLabel.topAnchor.constraint(equalTo: self.topAnchor), self.paragraphLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor), self.paragraphLabel.trailingAnchor.constraint(equalTo: self.trailingAnchor), - self.paragraphLabel.bottomAnchor.constraint(equalTo: self.expansiveButton.topAnchor), - self.invisibleLabel.topAnchor.constraint(equalTo: self.paragraphLabel.topAnchor), - self.invisibleLabel.leadingAnchor.constraint(equalTo: self.paragraphLabel.leadingAnchor), - self.invisibleLabel.trailingAnchor.constraint(equalTo: self.paragraphLabel.trailingAnchor), - - + self.expansiveButton.topAnchor.constraint(equalTo: self.paragraphLabel.bottomAnchor), self.expansiveButton.bottomAnchor.constraint(equalTo: self.bottomAnchor), self.expansiveButton.centerXAnchor.constraint(equalTo: self.centerXAnchor) ] diff --git a/Hortali-App/Shared/Design System/Views/Components/ViewLabel.swift b/Hortali-App/Shared/Design System/Views/Components/ViewLabel.swift new file mode 100644 index 0000000..43e0785 --- /dev/null +++ b/Hortali-App/Shared/Design System/Views/Components/ViewLabel.swift @@ -0,0 +1,82 @@ +/* Macro - Grupo 05 */ + +/* Bibliotecas necessárias: */ +import class Foundation.NSCoder + +import class UIKit.NSLayoutConstraint +import class UIKit.UIView +import class UIKit.UILabel + +import struct CoreGraphics.CGFloat + + +/// Uma view que possui uma label dentro +/// +/// Esse componente é usado principalemente pra cliar uma label que não fique grudada na borda dela +class ViewLabel: UIView { + + /* MARK: - Atributos */ + + // Views + + private lazy var label: UILabel = { + let lbl = CustomViews.newLabel() + lbl.textAlignment = .center + lbl.adjustsFontSizeToFitWidth = true + return lbl + }() + + + + /* MARK: - Construtor */ + + init() { + super.init(frame: .zero) + self.translatesAutoresizingMaskIntoConstraints = false + + self.setupViews() + self.setupConstraints() + } + + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + + + /* MARK: - Encapsulamento */ + + /// Texto da label + public var text: String = "" { + didSet { + self.label.text = text + } + } + + + /// Configrua a fonte da label + /// - Parameter font: informações da fonte + public func setupText(with font: FontInfo) { + self.label.setupText(with: font) + } + + + + /* MARK: - Configurações */ + + /// Adiciona os elementos (Views) na tela + private func setupViews() { + self.addSubview(self.label) + } + + + /// Define as constraints que dependem do tamanho da tela + private func setupConstraints() { + let space: CGFloat = 5 + + NSLayoutConstraint.activate([ + self.label.topAnchor.constraint(equalTo: self.topAnchor, constant: space), + self.label.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: space), + self.label.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -space), + self.label.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -space) + ]) + } +} diff --git a/Hortali-App/Shared/Design System/Views/Custom/Conponents/CustomScrooll.swift b/Hortali-App/Shared/Design System/Views/Custom/Conponents/CustomScroll.swift similarity index 66% rename from Hortali-App/Shared/Design System/Views/Custom/Conponents/CustomScrooll.swift rename to Hortali-App/Shared/Design System/Views/Custom/Conponents/CustomScroll.swift index cea1cf9..b067003 100644 --- a/Hortali-App/Shared/Design System/Views/Custom/Conponents/CustomScrooll.swift +++ b/Hortali-App/Shared/Design System/Views/Custom/Conponents/CustomScroll.swift @@ -13,10 +13,10 @@ class CustomScroll: UIView { /// Scrool view padrão do UIKit public let scroll: UIScrollView = { - let scrool = UIScrollView() - scrool.translatesAutoresizingMaskIntoConstraints = false - scrool.backgroundColor = UIColor(.viewBack) - return scrool + let scroll = UIScrollView() + scroll.translatesAutoresizingMaskIntoConstraints = false + scroll.backgroundColor = UIColor(.viewBack) + return scroll }() /// Espaço para colocar os elementos na scroll @@ -26,19 +26,25 @@ class CustomScroll: UIView { }() + // Constraints + + /// Constraints dinâmicas que mudam de acordo com o tamanho da tela + private var dynamicConstraints: [NSLayoutConstraint] = [] + + // Outros /// Tamanho da scrollView - public var scrollContentSize = CGSize() { + private var scrollContentSize = CGSize() { didSet { self.setupScroollSize() } } - /// Constraints dinâmicas que mudam de acordo com o tamanho da tela - private var dynamicConstraints: [NSLayoutConstraint] = [] - - + /// Último elemento adicionado na scroll + private var lastViewAdded: UIView? + + /* MARK: - Construtor */ @@ -51,7 +57,18 @@ class CustomScroll: UIView { required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } - + + + /* MARK: - Encapsulamento */ + + /// Adiciona uma view na scroll + /// - Parameter view: view que vai ser adicionada + public func addViewInScroll(_ view: UIView) { + self.contentView.addSubview(view) + self.lastViewAdded = view + } + + /* MARK: - Ciclo de Vida */ @@ -66,12 +83,39 @@ class CustomScroll: UIView { /* MARK: - Configurações */ + /// Atualiza o tamanho da scroll a partir da posição do último elemento adicionado + public func updateScrollSize() { + guard + let lastViewAdded = self.lastViewAdded, + let superview = self.superview + else { return } + + var height = lastViewAdded.frame.origin.y + lastViewAdded.frame.height + + if height > self.frame.height { + let removeSpace = superview.safeAreaInsets.bottom + + if (height - removeSpace) > superview.bounds.height { + height -= removeSpace + } + } + + if height != self.frame.height { + self.scrollContentSize = CGSize( + width: superview.bounds.width, + height: height + ) + } + } + + /// Configura o tamanho da scroll e a contentView dela private func setupScroollSize() { self.scroll.frame = self.bounds - self.scroll.contentSize = self.scrollContentSize - self.contentView.frame.size = self.scrollContentSize + + self.scroll.contentSize = self.scrollContentSize + self.scroll.contentSize.width = 0 } diff --git a/Hortali-App/Shared/Storage/Data/DataManager.swift b/Hortali-App/Shared/Storage/Data/DataManager.swift index 08c6c40..133fada 100644 --- a/Hortali-App/Shared/Storage/Data/DataManager.swift +++ b/Hortali-App/Shared/Storage/Data/DataManager.swift @@ -90,7 +90,13 @@ class DataManager { case .add: list.append(config.id) case .remove: - list.remove(at: config.cellId) + for index in 0.. Bool { + if let navProtocol = self.navControllerProtocol { + return navProtocol.getControllersCount() > 1 + } + return false + } +} diff --git a/Hortali-App/iOS-App/General/Protocol/CustomNavigationProtocol.swift b/Hortali-App/iOS-App/General/Protocol/CustomNavigationProtocol.swift new file mode 100644 index 0000000..0a6512c --- /dev/null +++ b/Hortali-App/iOS-App/General/Protocol/CustomNavigationProtocol.swift @@ -0,0 +1,15 @@ +/* Macro - Grupo 05 */ + +/* Bibliotecas necessárias: */ +import class UIKit.NSObject + + +/// Os tipos que estão de acordo esse protocolo são navigation controllers que +/// precisam de configuração a partir da quantidade de view controllers que ela +/// possui +protocol CustomNavigationProtocol: NSObject { + + /// Diz a quantidade de controllers que a navigation possuei + /// - Returns: quantidade de view controlllers + func getControllersCount() -> Int +} diff --git a/Hortali-App/iOS-App/Screens/Favorite/FavoriteViewController.swift b/Hortali-App/iOS-App/Screens/Favorite/FavoriteViewController.swift index b1e9f08..300655f 100644 --- a/Hortali-App/iOS-App/Screens/Favorite/FavoriteViewController.swift +++ b/Hortali-App/iOS-App/Screens/Favorite/FavoriteViewController.swift @@ -5,7 +5,7 @@ import UIKit /// Controller responsável pela tela de favoritos -class FavoriteViewController: MenuController, GardenProtocol, FoodProtocol { +class FavoriteViewController: UIViewController, GardenProtocol, FoodProtocol { /* MARK: - Atributos */ @@ -40,7 +40,7 @@ class FavoriteViewController: MenuController, GardenProtocol, FoodProtocol { override func viewDidLoad() { super.viewDidLoad() - + self.setupDelegates() } @@ -50,32 +50,28 @@ class FavoriteViewController: MenuController, GardenProtocol, FoodProtocol { self.setupDataSourcesData() } - - + + /* MARK: - Protocolo */ internal func openGardenInfo(for index: Int) { let selectedCell = self.gardenDataSource.data[index] + + let controller = InfoGardenController(with: selectedCell) + controller.hidesBottomBarWhenPushed = true - let controller = InfoGardenController(with: selectedCell, in: index) - controller.modalTransitionStyle = .crossDissolve - controller.modalPresentationStyle = .fullScreen - - self.tabBarProtocol?.showTabBar(is: false) - self.present(controller, animated: true) + self.navigationController?.pushViewController(controller, animated: true) } internal func openFoodInfo(for index: Int) { let selectedCell = self.foodDataSource.data[index] - let controller = InfoFoodController(with: selectedCell, in: index) - controller.modalTransitionStyle = .crossDissolve - controller.modalPresentationStyle = .fullScreen + let controller = InfoFoodController(with: selectedCell) + controller.hidesBottomBarWhenPushed = true - self.tabBarProtocol?.showTabBar(is: false) - self.present(controller, animated: true) + self.navigationController?.pushViewController(controller, animated: true) } diff --git a/Hortali-App/iOS-App/Screens/Favorite/View/FavoriteView.swift b/Hortali-App/iOS-App/Screens/Favorite/View/FavoriteView.swift index 250255f..c189667 100644 --- a/Hortali-App/iOS-App/Screens/Favorite/View/FavoriteView.swift +++ b/Hortali-App/iOS-App/Screens/Favorite/View/FavoriteView.swift @@ -189,6 +189,12 @@ class FavoriteView: MainView { let foodGpHeight = self.getEquivalent(187, dimension: .height) // 150+12+25 + self.foodGroup.setPadding(for: lateral) + self.gardenGroup.setPadding(for: lateral) + + self.foodGroup.setLabelSpace(for: lateral) + self.gardenGroup.setLabelSpace(for: lateral) + NSLayoutConstraint.deactivate(self.dynamicConstraints) self.dynamicConstraints = [ diff --git a/Hortali-App/iOS-App/Screens/Food/FoodController.swift b/Hortali-App/iOS-App/Screens/Food/FoodController.swift index 6542374..f1e662d 100644 --- a/Hortali-App/iOS-App/Screens/Food/FoodController.swift +++ b/Hortali-App/iOS-App/Screens/Food/FoodController.swift @@ -5,14 +5,14 @@ import UIKit /// Controller responsável pela tela de alimentos -class FoodController: MenuController, FoodProtocol { +class FoodController: UIViewController, FoodProtocol { /* MARK: - Atributos */ /// View principal que a classe vai controlar private let myView = FoodView() - + /* Delegate & Data Sources */ /// Data source da collection de alimentos @@ -46,12 +46,10 @@ class FoodController: MenuController, FoodProtocol { internal func openFoodInfo(for index: Int) { let selectedCell = self.foodDataSource.data[index] - let controller = InfoFoodController(with: selectedCell, in: index) - controller.modalTransitionStyle = .crossDissolve - controller.modalPresentationStyle = .fullScreen + let controller = InfoFoodController(with: selectedCell) + controller.hidesBottomBarWhenPushed = true - self.tabBarProtocol?.showTabBar(is: false) - self.present(controller, animated: true) + self.navigationController?.pushViewController(controller, animated: true) } @@ -64,6 +62,7 @@ class FoodController: MenuController, FoodProtocol { func segmentationAction(sender: UISegmentedControl) { let index = sender.selectedSegmentIndex self.updateFoodData(for: index) + self.myView.resetCollectionScroll() } diff --git a/Hortali-App/iOS-App/Screens/Food/View/FoodView.swift b/Hortali-App/iOS-App/Screens/Food/View/FoodView.swift index d575172..91ff4a1 100644 --- a/Hortali-App/iOS-App/Screens/Food/View/FoodView.swift +++ b/Hortali-App/iOS-App/Screens/Food/View/FoodView.swift @@ -87,6 +87,12 @@ class FoodView: MainView { self.foodGroup.collection.reloadInputViews() } + + /// Deixa a scroll no início da tela + public func resetCollectionScroll() { + self.foodGroup.collection.setContentOffset(.zero, animated: true) + } + /* MARK: - Ciclo de Vida */ @@ -147,17 +153,17 @@ class FoodView: MainView { private func setupDynamicConstraints() { let lateral: CGFloat = self.getEquivalent(15) let between: CGFloat = self.getEquivalent(20) - + NSLayoutConstraint.deactivate(self.dynamicConstraints) self.dynamicConstraints = [ self.foodSegmented.topAnchor.constraint(equalTo: self.contentView.topAnchor, constant: lateral), - self.foodSegmented.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor), + self.foodSegmented.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor, constant: lateral), self.foodSegmented.trailingAnchor.constraint(equalTo: self.contentView.trailingAnchor, constant: -lateral), self.foodGroup.topAnchor.constraint(equalTo: self.foodSegmented.bottomAnchor, constant: between), - self.foodGroup.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor), + self.foodGroup.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor, constant: lateral), self.foodGroup.trailingAnchor.constraint(equalTo: self.contentView.trailingAnchor, constant: -lateral), self.foodGroup.bottomAnchor.constraint(equalTo: self.contentView.bottomAnchor) ] diff --git a/Hortali-App/iOS-App/Screens/Garden/GardenController.swift b/Hortali-App/iOS-App/Screens/Garden/GardenController.swift index 0eef52b..9ef6bc5 100644 --- a/Hortali-App/iOS-App/Screens/Garden/GardenController.swift +++ b/Hortali-App/iOS-App/Screens/Garden/GardenController.swift @@ -5,7 +5,7 @@ import UIKit /// Controller responsável pela principal de ver todas as hortas -class GardenController: MenuController, GardenProtocol, SearchProtocol { +class GardenController: UIViewController, GardenProtocol, SearchProtocol { /* MARK: - Atributos */ @@ -56,13 +56,11 @@ class GardenController: MenuController, GardenProtocol, SearchProtocol { internal func openGardenInfo(for index: Int) { let selectedCell = self.gardenDataSource.data[index] + + let controller = InfoGardenController(with: selectedCell) + controller.hidesBottomBarWhenPushed = true - let controller = InfoGardenController(with: selectedCell, in: index) - controller.modalTransitionStyle = .crossDissolve - controller.modalPresentationStyle = .fullScreen - - self.tabBarProtocol?.showTabBar(is: false) - self.present(controller, animated: true) + self.navigationController?.pushViewController(controller, animated: true) } diff --git a/Hortali-App/iOS-App/Screens/Garden/Views/GardenView.swift b/Hortali-App/iOS-App/Screens/Garden/Views/GardenView.swift index b3380d5..c3021fd 100644 --- a/Hortali-App/iOS-App/Screens/Garden/Views/GardenView.swift +++ b/Hortali-App/iOS-App/Screens/Garden/Views/GardenView.swift @@ -12,21 +12,17 @@ class GardenView: MainView { // Views /// Bara de busca das hortas - private let search: UISearchBar = CustomViews.newSearch() + private let search = CustomViews.newSearch() /// Collection das hortas private let gardenGroup = CollectionGroup(style: .justCollection) - /// View de referência para centralizar as células da Collection - private let referenceView: UIView = CustomViews.newView() - // Outros /// Constraints dinâmicas que mudam de acordo com o tamanho da tela private var dynamicConstraints: [NSLayoutConstraint] = [] - /// Configurações do layout da collection private let collectionFlow: UICollectionViewFlowLayout = { let cvFlow = UICollectionViewFlowLayout() @@ -35,7 +31,7 @@ class GardenView: MainView { return cvFlow }() - + /* MARK: - Construtor */ @@ -116,10 +112,28 @@ class GardenView: MainView { /* Geral */ + /// Espaço entre a collection das hortas + /// - Returns: distância entre os elemento + /// + /// Essa função calcula o espaço disponível que tem para a collection das hortas ser colocada + /// no centro. + /// + /// O valor retornado deve ser usado como espaço (`constant`) na hora de definir as constraints + /// de _top_ e _bottom_. + private func getEmptySpace() -> CGFloat { + let top = search.frame.origin.y + search.frame.height + let collectionHeight = self.getEquivalent(400) + let bottom = self.safeAreaInsets.bottom + + let totalEmptySpace = (self.frame.height - top - collectionHeight - bottom) / 2 + + return totalEmptySpace + } + + /// Adiciona os elementos (Views) na tela private func setupViews() { self.addSubview(self.search) - self.contentView.addSubview(self.referenceView) self.contentView.addSubview(self.gardenGroup) } @@ -144,7 +158,10 @@ class GardenView: MainView { /// Define as constraints que dependem do tamanho da tela private func setupDynamicConstraints() { - let collectionHeight = self.getEquivalent(400, dimension: .height) + let emptySpace = self.getEmptySpace() + + let lateral = self.getEquivalent(15) + self.gardenGroup.setPadding(for: lateral) NSLayoutConstraint.deactivate(self.dynamicConstraints) @@ -154,14 +171,8 @@ class GardenView: MainView { self.search.leadingAnchor.constraint(equalTo: self.leadingAnchor), - self.referenceView.topAnchor.constraint(equalTo: self.search.bottomAnchor), - self.referenceView.trailingAnchor.constraint(equalTo: self.contentView.trailingAnchor), - self.referenceView.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor), - self.referenceView.bottomAnchor.constraint(equalTo: self.contentView.bottomAnchor), - - - self.gardenGroup.heightAnchor.constraint(equalToConstant: getEquivalent(collectionHeight)), - self.gardenGroup.centerYAnchor.constraint(equalTo: self.referenceView.centerYAnchor), + self.gardenGroup.topAnchor.constraint(equalTo: self.search.bottomAnchor, constant: emptySpace), + self.gardenGroup.bottomAnchor.constraint(equalTo: self.contentView.bottomAnchor, constant: -emptySpace), self.gardenGroup.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor), self.gardenGroup.trailingAnchor.constraint(equalTo: self.contentView.trailingAnchor) ] diff --git a/Hortali-App/iOS-App/Screens/HourInfo/View/HourInfoView.swift b/Hortali-App/iOS-App/Screens/HourInfo/View/HourInfoView.swift index ee367c8..9f0ccda 100644 --- a/Hortali-App/iOS-App/Screens/HourInfo/View/HourInfoView.swift +++ b/Hortali-App/iOS-App/Screens/HourInfo/View/HourInfoView.swift @@ -115,7 +115,7 @@ class HourInfoView: ContainerView { self.dynamicConstraints = [ self.hourInfoGp.topAnchor.constraint(equalTo: self.contentView.topAnchor, constant: lateral), - self.hourInfoGp.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor), + self.hourInfoGp.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor, constant: lateral), self.hourInfoGp.trailingAnchor.constraint(equalTo: self.contentView.trailingAnchor, constant: -lateral), self.hourInfoGp.bottomAnchor.constraint(equalTo: self.contentView.bottomAnchor), ] diff --git a/Hortali-App/iOS-App/Screens/InfoFood/InfoFoodController.swift b/Hortali-App/iOS-App/Screens/InfoFood/InfoFoodController.swift index 079a9e0..0c8b044 100644 --- a/Hortali-App/iOS-App/Screens/InfoFood/InfoFoodController.swift +++ b/Hortali-App/iOS-App/Screens/InfoFood/InfoFoodController.swift @@ -13,7 +13,7 @@ class InfoFoodController: UIViewController { /// View principal que a classe vai controlar private var myView: InfoFoodView - + /* Outros */ @@ -24,12 +24,12 @@ class InfoFoodController: UIViewController { /* MARK: - Construtor */ - init(with data: ManagedFood, in index: Int) { + init(with data: ManagedFood) { self.myView = InfoFoodView(data: data) self.favUpdate = FavoriteUpdate( favoriteType: .food, - id: data.id, cellId: index, + id: data.id, action: .add ) @@ -51,7 +51,7 @@ class InfoFoodController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - + self.setupButtonsAction() } @@ -62,7 +62,7 @@ class InfoFoodController: UIViewController { /// Ação de voltar para a tela anterior @objc private func backAction() { - self.dismiss(animated: true) + self.navigationController?.popViewController(animated: true) } @@ -109,3 +109,4 @@ class InfoFoodController: UIViewController { } } } + diff --git a/Hortali-App/iOS-App/Screens/InfoFood/View/InfoFoodView.swift b/Hortali-App/iOS-App/Screens/InfoFood/View/InfoFoodView.swift index 3a705d3..48ba62a 100644 --- a/Hortali-App/iOS-App/Screens/InfoFood/View/InfoFoodView.swift +++ b/Hortali-App/iOS-App/Screens/InfoFood/View/InfoFoodView.swift @@ -53,6 +53,7 @@ class InfoFoodView: UIView { lbl.adjustsFontSizeToFitWidth = true lbl.textColor = UIColor(AppColors.paragraph) lbl.lineBreakMode = .byWordWrapping + lbl.sizeToFit() return lbl }() @@ -125,13 +126,8 @@ class InfoFoodView: UIView { /// Configurações para expandir a label public func expandLabel() { - var status = self.expansiveLabel.isExtended - status.toggle() - - self.expansiveLabel.setupExtension(extended: status) - self.expansiveLabel.setupButtonIcon() - self.setupExpansiveLabelHeight() - self.updateScrollSize() + self.expansiveLabel.setupExtension() + self.scrollView.updateScrollSize() } @@ -199,23 +195,8 @@ class InfoFoodView: UIView { self.setupVitaminsStackViews(for: data.vitamins) self.vitaminsInfoLabel.text = data.minerals } - - - /// Define o tamanho que a scroll vai ter - private func updateScrollSize() { - var scrollHeight: CGFloat = 1350 - (465) // Collection escondida - - if self.expansiveLabel.isExtended { - scrollHeight += self.expansiveLabel.expandedLabelSize - } + - self.scrollView.scrollContentSize = CGSize( - width: self.getEquivalent(self.bounds.width), - height: scrollHeight - ) - } - - /// Cria e adiciona as views que vão ser colocadas na stack private func setupVitaminsStackViews(for vitamins: [ManagedVitamins]) { for vitamin in vitamins { @@ -248,23 +229,26 @@ class InfoFoodView: UIView { private func setupViews() { self.addSubview(self.scrollView) - self.scrollView.contentView.addSubview(self.coverImage) - self.scrollView.contentView.addSubview(self.backButton) - self.scrollView.contentView.addSubview(self.favoriteButton) - self.scrollView.contentView.addSubview(self.container) + self.addSubview(self.backButton) + self.addSubview(self.favoriteButton) + + self.scrollView.addViewInScroll(self.coverImage) + self.scrollView.addViewInScroll(self.container) self.container.contentView.addSubview(self.benefitsLabel) self.container.contentView.addSubview(self.expansiveLabel) self.container.contentView.addSubview(self.vitaminsLabel) - self.container.addSubview(self.vitaminsStack) + self.container.contentView.addSubview(self.vitaminsStack) self.container.contentView.addSubview(self.vitaminsInfoLabel) + + self.scrollView.addViewInScroll(self.vitaminsInfoLabel) self.container.contentView.addSubview(self.howToCollection) } /// Personalização da UI private func setupUI() { - self.updateScrollSize() + self.scrollView.updateScrollSize() // Collection self.collectionFlow.minimumInteritemSpacing = self.getEquivalent(10) @@ -317,8 +301,6 @@ class InfoFoodView: UIView { let gap = self.getEquivalent(25) - let safeAreaGap = self.scrollView.scroll.safeAreaInsets.top - // Altura dos botões self.backButton.circleSize = self.getEquivalent(45) self.favoriteButton.circleSize = self.getEquivalent(45) @@ -344,7 +326,7 @@ class InfoFoodView: UIView { self.scrollView.topAnchor.constraint(equalTo: self.topAnchor), self.scrollView.leftAnchor.constraint(equalTo: self.leftAnchor), self.scrollView.rightAnchor.constraint(equalTo: self.rightAnchor), - self.scrollView.bottomAnchor.constraint(equalTo: self.safeAreaLayoutGuide.bottomAnchor), + self.scrollView.bottomAnchor.constraint(equalTo: self.bottomAnchor), self.scrollView.widthAnchor.constraint(equalTo: self.widthAnchor), @@ -354,12 +336,12 @@ class InfoFoodView: UIView { self.coverImage.heightAnchor.constraint(equalToConstant: imageHeight), - self.backButton.topAnchor.constraint(equalTo: self.scrollView.contentView.topAnchor, constant: safeAreaGap), - self.backButton.leadingAnchor.constraint(equalTo: self.scrollView.contentView.leadingAnchor, constant: lateral), + self.backButton.topAnchor.constraint(equalTo: self.safeAreaLayoutGuide.topAnchor), + self.backButton.leadingAnchor.constraint(equalTo: self.safeAreaLayoutGuide.leadingAnchor, constant: lateral), self.favoriteButton.centerYAnchor.constraint(equalTo: self.backButton.centerYAnchor), - self.favoriteButton.trailingAnchor.constraint(equalTo: self.scrollView.contentView.trailingAnchor, constant: -lateral), + self.favoriteButton.trailingAnchor.constraint(equalTo: self.safeAreaLayoutGuide.trailingAnchor, constant: -lateral), /* Container */ @@ -367,22 +349,21 @@ class InfoFoodView: UIView { self.container.topAnchor.constraint(equalTo: self.coverImage.bottomAnchor, constant: -gap), self.container.leadingAnchor.constraint(equalTo: self.scrollView.contentView.leadingAnchor), self.container.trailingAnchor.constraint(equalTo: self.scrollView.contentView.trailingAnchor), - self.container.bottomAnchor.constraint(equalTo: self.scrollView.contentView.bottomAnchor), - + self.container.bottomAnchor.constraint(equalTo: self.scrollView.bottomAnchor), self.benefitsLabel.topAnchor.constraint(equalTo: self.container.contentView.topAnchor), - self.benefitsLabel.leadingAnchor.constraint(equalTo: self.container.contentView.leadingAnchor), + self.benefitsLabel.leadingAnchor.constraint(equalTo: self.container.contentView.leadingAnchor, constant: lateral), self.benefitsLabel.trailingAnchor.constraint(equalTo: self.container.contentView.trailingAnchor, constant: -lateral), self.benefitsLabel.heightAnchor.constraint(equalToConstant: titlesLabelHeight), self.expansiveLabel.topAnchor.constraint(equalTo: self.benefitsLabel.bottomAnchor, constant: lateral), - self.expansiveLabel.leadingAnchor.constraint(equalTo: self.container.contentView.leadingAnchor), - self.expansiveLabel.trailingAnchor.constraint(equalTo: self.container.contentView.trailingAnchor, constant: -lateral), + self.expansiveLabel.leadingAnchor.constraint(equalTo: self.benefitsLabel.leadingAnchor), + self.expansiveLabel.trailingAnchor.constraint(equalTo: self.benefitsLabel.trailingAnchor), self.vitaminsLabel.topAnchor.constraint(equalTo: self.expansiveLabel.bottomAnchor, constant: between), - self.vitaminsLabel.leadingAnchor.constraint(equalTo: self.container.contentView.leadingAnchor), + self.vitaminsLabel.leadingAnchor.constraint(equalTo: self.benefitsLabel.leadingAnchor), self.vitaminsLabel.trailingAnchor.constraint(equalTo: self.container.trailingAnchor), self.vitaminsLabel.heightAnchor.constraint(equalToConstant: titlesLabelHeight), @@ -394,9 +375,8 @@ class InfoFoodView: UIView { self.vitaminsInfoLabel.topAnchor.constraint(equalTo: self.vitaminsStack.bottomAnchor, constant: lateral), - self.vitaminsInfoLabel.leadingAnchor.constraint(equalTo: self.container.contentView.leadingAnchor), - self.vitaminsInfoLabel.trailingAnchor.constraint(equalTo: self.container.contentView.trailingAnchor, constant: -lateral), - self.vitaminsInfoLabel.heightAnchor.constraint(equalToConstant: self.getEquivalent(65)), + self.vitaminsInfoLabel.leadingAnchor.constraint(equalTo: self.benefitsLabel.leadingAnchor), + self.vitaminsInfoLabel.trailingAnchor.constraint(equalTo: self.benefitsLabel.trailingAnchor), self.howToCollection.topAnchor.constraint(equalTo: self.vitaminsInfoLabel.bottomAnchor, constant: between), diff --git a/Hortali-App/iOS-App/Screens/InfoGarden/InfoGardenController.swift b/Hortali-App/iOS-App/Screens/InfoGarden/InfoGardenController.swift index 6612493..30d5ed0 100644 --- a/Hortali-App/iOS-App/Screens/InfoGarden/InfoGardenController.swift +++ b/Hortali-App/iOS-App/Screens/InfoGarden/InfoGardenController.swift @@ -40,12 +40,12 @@ class InfoGardenController: UIViewController, InfoGardenProtocol { /* MARK: - Construtor */ - init(with data: ManagedGarden, in index: Int) { + init(with data: ManagedGarden) { self.myView = InfoGardenView(data: data) self.favUpdate = FavoriteUpdate( favoriteType: .garden, - id: data.id, cellId: index, + id: data.id, action: .add ) @@ -117,7 +117,7 @@ class InfoGardenController: UIViewController, InfoGardenProtocol { /// Ação de voltar para a tela anterior @objc private func backAction() { - self.dismiss(animated: true) + self.navigationController?.popViewController(animated: true) } @@ -239,6 +239,14 @@ class InfoGardenController: UIViewController, InfoGardenProtocol { } + /// Ação de quando altera a page control + /// - Parameter sender: page control que foi alterada + @objc + private func pageControlAction(sender: UIPageControl) { + self.myView.updateCurrentCell(for: sender.currentPage) + } + + /* MARK: - Configurações */ @@ -247,6 +255,7 @@ class InfoGardenController: UIViewController, InfoGardenProtocol { self.myView.setBackButtonAction(target: self, action: #selector(self.backAction)) self.myView.setFavoriteButtonAction(target: self, action: #selector(self.favoriteAction)) self.myView.setExpLabelButtonAction(target: self, action: #selector(self.expandLabelAction)) + self.myView.setPageControlAction(target: self, action: #selector(self.pageControlAction(sender:))) } diff --git a/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenContact/ContactGroup.swift b/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenContact/ContactGroup.swift index a257b90..e5cbda6 100644 --- a/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenContact/ContactGroup.swift +++ b/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenContact/ContactGroup.swift @@ -15,18 +15,10 @@ class ContactGroup: UIView { private let imageView = CustomViews.newImage() /// O contato em si - private let contactLabel: UILabel = { - let lbl = CustomViews.newLabel() - lbl.backgroundColor = UIColor(.contactCellBack) - return lbl - }() + private let contactLabel: UILabel = CustomViews.newLabel() /// Descrição do tipo do contato - private let descriptionLabel: UILabel = { - let lbl = CustomViews.newLabel() - lbl.backgroundColor = UIColor(.contactCellBack) - return lbl - }() + private let descriptionLabel: UILabel = CustomViews.newLabel() // Outros @@ -56,7 +48,7 @@ class ContactGroup: UIView { public func setupContactInfo(with info: ManagedContact) { let prefix = "-contact" - var image = UIImage(named: "general\(prefix)") + var image = UIImage(named: "General\(prefix)") if let contactImage = UIImage(named: "\(info.type)\(prefix)") { image = contactImage } diff --git a/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenContact/InfoGardenContact.swift b/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenContact/InfoGardenContact.swift index 55518e4..b08c31a 100644 --- a/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenContact/InfoGardenContact.swift +++ b/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenContact/InfoGardenContact.swift @@ -22,7 +22,9 @@ class InfoGardenContact: UIView, InfoGardenCellProtocol { /// Constraints dinâmicas que mudam de acordo com o tamanho da tela private var dynamicConstraints: [NSLayoutConstraint] = [] - + + /// Quantiade de contato que estão na stack view + private var contactInStack: Int = 0 /* MARK: - Construtor */ @@ -71,6 +73,7 @@ class InfoGardenContact: UIView, InfoGardenCellProtocol { self.contactViews[0].setupContactInfo(with: infos[0]) self.contactViews[1].setupContactInfo(with: infos[1]) } + self.contactInStack = infos.count } @@ -105,14 +108,25 @@ class InfoGardenContact: UIView, InfoGardenCellProtocol { self.dynamicConstraints = [ self.contactStack.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: lateral), self.contactStack.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -lateral), - self.contactStack.topAnchor.constraint(equalTo: self.topAnchor, constant: spaceStack), - self.contactStack.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -spaceStack), - - + self.contactViews[0].heightAnchor.constraint(equalToConstant: groupHeight), self.contactViews[1].heightAnchor.constraint(equalToConstant: groupHeight), ] + + if self.contactInStack == 1 { + self.dynamicConstraints += [ + self.contactStack.heightAnchor.constraint(equalToConstant: groupHeight), + self.contactStack.centerYAnchor.constraint(equalTo: self.centerYAnchor), + self.contactStack.centerXAnchor.constraint(equalTo: self.centerXAnchor) + ] + } else { + self.dynamicConstraints += [ + self.contactStack.topAnchor.constraint(equalTo: self.topAnchor, constant: spaceStack), + self.contactStack.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -spaceStack) + ] + } + NSLayoutConstraint.activate(self.dynamicConstraints) } diff --git a/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenMap/InfoGardenMap.swift b/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenMap/InfoGardenMap.swift index d01cef8..029a218 100644 --- a/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenMap/InfoGardenMap.swift +++ b/Hortali-App/iOS-App/Screens/InfoGarden/View/Cells/InfosCell/Types/InfoGardenMap/InfoGardenMap.swift @@ -15,11 +15,8 @@ class InfoGardenMap: UIView, InfoGardenCellProtocol { private let mapView: UIImageView = CustomViews.newImage() /// Endereço da rua - private let addressLabel: UILabel = { - let lbl = CustomViews.newLabel() - lbl.layer.masksToBounds = true - lbl.textAlignment = .center - lbl.adjustsFontSizeToFitWidth = true + private let addressLabel: ViewLabel = { + let lbl = ViewLabel() lbl.backgroundColor = UIColor(.viewBack)?.withAlphaComponent(0.6) return lbl }() @@ -159,7 +156,7 @@ class InfoGardenMap: UIView, InfoGardenCellProtocol { /// Define os textos que são estáticos (os textos em si que vão sempre ser o mesmo) - private func setupStaticTexts() { + private func setupStaticTexts() { self.addressLabel.setupText(with: FontInfo( fontSize: self.getConstant(for: 20), weight: .regular )) diff --git a/Hortali-App/iOS-App/Screens/InfoGarden/View/InfoGardenView.swift b/Hortali-App/iOS-App/Screens/InfoGarden/View/InfoGardenView.swift index 0cd6a6f..6792102 100644 --- a/Hortali-App/iOS-App/Screens/InfoGarden/View/InfoGardenView.swift +++ b/Hortali-App/iOS-App/Screens/InfoGarden/View/InfoGardenView.swift @@ -61,6 +61,7 @@ class InfoGardenView: UIView { private let infosCollectionFlow: UICollectionViewFlowLayout = { let cvFlow = UICollectionViewFlowLayout() cvFlow.scrollDirection = .horizontal + return cvFlow }() @@ -69,6 +70,7 @@ class InfoGardenView: UIView { let cvFlow = UICollectionViewFlowLayout() cvFlow.scrollDirection = .horizontal cvFlow.minimumLineSpacing = 0 + return cvFlow }() @@ -120,15 +122,21 @@ class InfoGardenView: UIView { } + /// Atualiza a célula que é mostrada a partir do item do page control selecionado + /// - Parameter index: index selecionado + public func updateCurrentCell(for index: Int) { + self.imagesCollectionGp.collection.scrollToItem( + at: IndexPath(row: index, section: 0), + at: .centeredHorizontally, + animated: true + ) + } + + /// Configurações para expandir a label public func expandLabel() { - var status = self.expansiveLabel.isExtended - status.toggle() - - self.expansiveLabel.setupExtension(extended: status) - self.expansiveLabel.setupButtonIcon() - self.setupExpansiveLabelHeight() - self.updateScrollSize() + self.expansiveLabel.setupExtension() + self.scrollView.updateScrollSize() } @@ -152,6 +160,12 @@ class InfoGardenView: UIView { } + /// Define a ação do botão de expandir a label + public func setPageControlAction(target: Any?, action: Selector) -> Void { + self.imagesPageControl.addTarget(target, action: action, for: .valueChanged) + } + + /* Collection */ /// Atualiza os dados das collections @@ -217,21 +231,7 @@ class InfoGardenView: UIView { self.expansiveLabel.setInfoText(for: data.biograph) } - - /// Define o tamanho que a scroll vai ter - private func updateScrollSize() { - var scrollHeight: CGFloat = 880 - - if self.expansiveLabel.isExtended { - scrollHeight += self.expansiveLabel.expandedLabelSize - } - - self.scrollView.scrollContentSize = CGSize( - width: self.getEquivalent(self.bounds.width), - height: scrollHeight - ) - } - + /* Collection */ @@ -255,15 +255,16 @@ class InfoGardenView: UIView { /// Adiciona os elementos (Views) na tela private func setupViews() { self.addSubview(self.scrollView) - - self.scrollView.contentView.addSubview(self.imagesCollectionGp) - self.scrollView.contentView.addSubview(self.imagesPageControl) - self.scrollView.contentView.addSubview(self.backButton) - self.scrollView.contentView.addSubview(self.favoriteButton) - self.scrollView.contentView.addSubview(self.container) + + self.scrollView.addViewInScroll(self.imagesCollectionGp) + self.scrollView.addViewInScroll(self.imagesPageControl) + self.scrollView.addViewInScroll(self.container) self.container.contentView.addSubview(self.expansiveLabel) - self.scrollView.contentView.addSubview(self.infosCollectionGp) + self.scrollView.addViewInScroll(self.infosCollectionGp) + + self.addSubview(self.backButton) + self.addSubview(self.favoriteButton) } @@ -271,8 +272,6 @@ class InfoGardenView: UIView { private func setupUI() { self.imagesPageControl.layer.cornerRadius = self.imagesPageControl.bounds.height / 2 - self.updateScrollSize() - // Collections self.infosCollectionFlow.itemSize = CGSize( @@ -286,6 +285,8 @@ class InfoGardenView: UIView { width: self.getEquivalent(390), height: self.getEquivalent(510) ) + + self.scrollView.updateScrollSize() } @@ -310,25 +311,25 @@ class InfoGardenView: UIView { let between = self.getEquivalent(20) let gap = self.getEquivalent(25) - let safeAreaGap = self.scrollView.scroll.safeAreaInsets.top - // Altura dos botões self.backButton.circleSize = self.getEquivalent(45) self.favoriteButton.circleSize = self.getEquivalent(45) // Altura dos elementos let segHeight = self.getEquivalent(510) - let containerHeight = self.getEquivalent(435) let collectionHeight = self.getEquivalent(200) + self.infosCollectionGp.setPadding(for: lateral) + + NSLayoutConstraint.deactivate(self.dynamicConstraints) self.dynamicConstraints = [ self.scrollView.topAnchor.constraint(equalTo: self.topAnchor), self.scrollView.leftAnchor.constraint(equalTo: self.leftAnchor), self.scrollView.rightAnchor.constraint(equalTo: self.rightAnchor), - self.scrollView.bottomAnchor.constraint(equalTo: self.safeAreaLayoutGuide.bottomAnchor), + self.scrollView.bottomAnchor.constraint(equalTo: self.bottomAnchor), self.scrollView.widthAnchor.constraint(equalTo: self.widthAnchor), @@ -342,12 +343,12 @@ class InfoGardenView: UIView { self.imagesPageControl.centerXAnchor.constraint(equalTo: self.imagesCollectionGp.centerXAnchor), - self.backButton.topAnchor.constraint(equalTo: self.scrollView.contentView.topAnchor, constant: safeAreaGap), - self.backButton.leadingAnchor.constraint(equalTo: self.scrollView.contentView.leadingAnchor, constant: lateral), + self.backButton.topAnchor.constraint(equalTo: self.safeAreaLayoutGuide.topAnchor), + self.backButton.leadingAnchor.constraint(equalTo: self.safeAreaLayoutGuide.leadingAnchor, constant: lateral), self.favoriteButton.centerYAnchor.constraint(equalTo: self.backButton.centerYAnchor), - self.favoriteButton.trailingAnchor.constraint(equalTo: self.scrollView.contentView.trailingAnchor, constant: -lateral), + self.favoriteButton.trailingAnchor.constraint(equalTo: self.safeAreaLayoutGuide.trailingAnchor, constant: -lateral), /* Container */ @@ -355,11 +356,11 @@ class InfoGardenView: UIView { self.container.topAnchor.constraint(equalTo: self.imagesCollectionGp.bottomAnchor, constant: -gap), self.container.leadingAnchor.constraint(equalTo: self.scrollView.contentView.leadingAnchor), self.container.trailingAnchor.constraint(equalTo: self.scrollView.contentView.trailingAnchor), - self.container.heightAnchor.constraint(equalToConstant: containerHeight), + self.container.bottomAnchor.constraint(equalTo: self.scrollView.contentView.bottomAnchor), self.expansiveLabel.topAnchor.constraint(equalTo: self.container.contentView.topAnchor), - self.expansiveLabel.leadingAnchor.constraint(equalTo: self.container.contentView.leadingAnchor), + self.expansiveLabel.leadingAnchor.constraint(equalTo: self.container.contentView.leadingAnchor, constant: lateral), self.expansiveLabel.trailingAnchor.constraint(equalTo: self.container.contentView.trailingAnchor, constant: -lateral), diff --git a/Hortali-App/iOS-App/Screens/Main/CustomNavigationController.swift b/Hortali-App/iOS-App/Screens/Main/CustomNavigationController.swift new file mode 100644 index 0000000..c6994bb --- /dev/null +++ b/Hortali-App/iOS-App/Screens/Main/CustomNavigationController.swift @@ -0,0 +1,47 @@ +/* Macro - Grupo 05 */ + +/* Bibliotecas necessárias: */ +import class UIKit.UINavigationController + + +/// Navigation controller costumizada que lida com o gesto de pop para as telas que não usa a navigation bar +class CustomNavigationController: UINavigationController, CustomNavigationProtocol { + + /* MARK: - Atributos */ + + /// Delegate que lida com gesto de pop + private var popGestureDelegate: PopGestureDelegate? + + /// Esconde a navigation bar + override var isNavigationBarHidden: Bool { + didSet { + self.gestureHandler() + } + } + + + + /* MARK: - Protocol */ + + internal func getControllersCount() -> Int { + return self.viewControllers.count + } + + + + /* MARK: - Configurações */ + + /// Lida com o gesto de pop + private func gestureHandler() { + if self.isNavigationBarHidden { + if self.popGestureDelegate == nil { + self.popGestureDelegate = PopGestureDelegate() + self.popGestureDelegate?.setNavProtocol(for: self) + + self.interactivePopGestureRecognizer?.delegate = self.popGestureDelegate + } + } else { + self.popGestureDelegate = nil + } + } +} diff --git a/Hortali-App/iOS-App/Screens/Main/MainController.swift b/Hortali-App/iOS-App/Screens/Main/MainController.swift index b3f943d..5668b35 100644 --- a/Hortali-App/iOS-App/Screens/Main/MainController.swift +++ b/Hortali-App/iOS-App/Screens/Main/MainController.swift @@ -34,6 +34,15 @@ class MainController: UITabBarController { /* MARK: - Configurações */ + /// Configurações iniciais da Navigation Controller + private func getNavigation(for vc: UIViewController) -> CustomNavigationController { + let nav = CustomNavigationController() + nav.pushViewController(vc, animated: true) + nav.isNavigationBarHidden = true + + return nav + } + /// Configurações iniciais da Tab Bar private func setupTab() { self.tabBar.backgroundColor = UIColor(.viewBack) @@ -45,9 +54,9 @@ class MainController: UITabBarController { /// Define as controllers que vão aparecer na Tab Bar private func setupControllers() { self.viewControllers = [ - self.gardenController, - self.foodController, - self.favoriteController, + self.getNavigation(for: self.gardenController), + self.getNavigation(for: self.foodController), + self.getNavigation(for: self.favoriteController), ] } diff --git a/Hortali-App/iOS-App/Screens/Main/Menu/MenuController.swift b/Hortali-App/iOS-App/Screens/Main/Menu/MenuController.swift deleted file mode 100644 index 56c2a8c..0000000 --- a/Hortali-App/iOS-App/Screens/Main/Menu/MenuController.swift +++ /dev/null @@ -1,34 +0,0 @@ -/* Macro - Grupo 05 */ - -/* Bibliotecas necessárias: */ -import UIKit - - -/// Padrão de controller para as telas iniciais -class MenuController: UIViewController { - - /* MARK: - Atributos */ - - /// Comunicação com a controller que tem a tab bar - internal var tabBarProtocol: TabBarProtocol? - - - - /* MARK: - Encapsulamento */ - - /// Define o protocolo de comunicaão com a controller que tem a tab bar - /// - Parameter delegate: tipo que possui o protocolo - public func setTabProtocol(with delegate: TabBarProtocol) { - self.tabBarProtocol = delegate - } - - - - /* MARK: - Ciclo de Vida */ - - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - - self.tabBarProtocol?.showTabBar(is: true) - } -} diff --git a/Hortali-App/iOS-App/Screens/Main/Menu/TabBarProtocol.swift b/Hortali-App/iOS-App/Screens/Main/Menu/TabBarProtocol.swift deleted file mode 100644 index 30909f7..0000000 --- a/Hortali-App/iOS-App/Screens/Main/Menu/TabBarProtocol.swift +++ /dev/null @@ -1,13 +0,0 @@ -/* Macro - Grupo 05 */ - -/* Bibliotecas necessárias: */ -import UIKit - - -/// Os tipos que ficam de acordo com esse protocolo possuem uma tab bar -protocol TabBarProtocol: NSObject { - - /// Mostra/esconde a tab bar - /// - Parameter visibility: se vai mostrar ou não - func showTabBar(is visibility: Bool) -}