Browse Source

Tab bar hidden

pull/1/head
Dibya Malla 4 years ago
parent
commit
3741027572
  1. 24
      GME Remit/Modules/Home/User Interface/Wireframe/HomeWireframe.swift
  2. 3
      GME Remit/Modules/LauncherScreen/User Interface/Wireframe/LauncherScreenWireframe.swift
  3. 3
      GME Remit/Modules/Login/User Interface/Wireframe/LoginWireframe.swift
  4. 280
      GME Remit/Modules/Main/User Interface/View/MainViewController.swift
  5. 3
      GME Remit/Modules/RegisterModules/UserAuthentication/NewRegister/User Interface/Wireframe/NewRegisterWireframe.swift
  6. 3
      GME Remit/Modules/RemittanceModules/TransactionHistoryModules/TransactionHistoryGroup/User Interface/Wireframe/TransactionHistoryGroupWireframe.swift
  7. 20
      GME Remit/Protocols/WireframeInput.swift

24
GME Remit/Modules/Home/User Interface/Wireframe/HomeWireframe.swift

@ -46,39 +46,27 @@ extension HomeWireframe: HomeWireframeInput {
}
func openSendMoney() {
if let navigation = self.view.navigationController {
self.sendMoneyWireframe.pushMainView(in: navigation)
}
self.sendMoneyWireframe.pushMainView(on: self.view)
}
func openNotice() {
if let navigation = self.view.navigationController {
self.noticeWireframe.pushMainView(in: navigation)
}
self.noticeWireframe.pushMainView(on: self.view)
}
func openTrackYourTransfer() {
if let navigation = self.view.navigationController {
self.walletStatementWireframe.openWalletStatement(source: navigation)
}
self.walletStatementWireframe.pushMainView(on: self.view)
}
func openTodaysRate() {
if let navigation = self.view.navigationController {
self.todaysRateWireframe.pushMainView(in: navigation)
}
self.todaysRateWireframe.pushMainView(on: self.view)
}
func openRedeemCashPayment(){
if let navigation = self.view.navigationController {
RedeemCashPickUpWireframe().pushMainView(in: navigation)
}
RedeemCashPickUpWireframe().pushMainView(on: self.view)
}
func openWithdraw(){
if let navigation = self.view.navigationController {
WithdrawFromWalletWireframe().pushMainView(in: navigation)
}
WithdrawFromWalletWireframe().pushMainView(on: self.view)
}
func openAgreement() {

3
GME Remit/Modules/LauncherScreen/User Interface/Wireframe/LauncherScreenWireframe.swift

@ -129,9 +129,10 @@ extension LauncherScreenWireframe {
) as? SideMenuViewController else {
return
}
let navWithTab = UINavigationController(rootViewController: tabBarViewController!)
let sideMenuController = LGSideMenuController(
rootViewController: tabBarViewController,
rootViewController: navWithTab,
leftViewController: sidemenuVc,
rightViewController: nil
)

3
GME Remit/Modules/Login/User Interface/Wireframe/LoginWireframe.swift

@ -48,8 +48,9 @@ extension LoginWireframe: LoginWireframeInput {
let mainWireFrame = MainWireframe.shared
let tabBarViewController = mainWireFrame?.getMainView()
let navWithTab = UINavigationController(rootViewController: tabBarViewController!)
let sideMenuController = LGSideMenuController(
rootViewController: tabBarViewController,
rootViewController: navWithTab,
leftViewController: sidemenuVc,
rightViewController: nil
)

280
GME Remit/Modules/Main/User Interface/View/MainViewController.swift

@ -9,163 +9,173 @@ import Foundation
import UIKit
class MainViewController: UITabBarController {
// MARK: Properties
// MARK: ENUMS:
private enum Items: Int {
case home = 0
case sendMoney
case branch
case profile
}
var presenter: MainModuleInterface?
// MARK: VC's Life cycle
override func viewDidLoad() {
super.viewDidLoad()
self.delegate = self
self.setupAppearance()
}
func setup(viewControllers: [UIViewController]) {
self.viewControllers = viewControllers
self.setupTab()
setupTabItem()
}
// MARK: Other functions
func setupAppearance() {
UINavigationBar.setInsideAppearance()
}
private func setupTab() {
self.tabBar.tintColor = Colors.defaultRed
self.tabBar.isTranslucent = false
self.tabBar.shadowImage = Colors.TabBar.shadow.image()
self.tabBar.backgroundImage = UIImage()
// self.tabBar.barTintColor = .themeMainBackground
}
override func setupTabItem() {
}
// MARK: Properties
// MARK: ENUMS:
private enum Items: Int {
case home = 0
case sendMoney
case branch
case profile
}
var presenter: MainModuleInterface?
// MARK: VC's Life cycle
override func viewDidLoad() {
super.viewDidLoad()
self.delegate = self
self.setupAppearance()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: animated)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}
func setup(viewControllers: [UIViewController]) {
self.viewControllers = viewControllers
self.setupTab()
setupTabItem()
}
// MARK: Other functions
func setupAppearance() {
UINavigationBar.setInsideAppearance()
}
private func setupTab() {
self.tabBar.tintColor = Colors.defaultRed
self.tabBar.isTranslucent = false
self.tabBar.shadowImage = Colors.TabBar.shadow.image()
self.tabBar.backgroundImage = UIImage()
// self.tabBar.barTintColor = .themeMainBackground
}
override func setupTabItem() {
}
}
extension MainViewController: MainViewInterface {
}
extension MainViewController: UITabBarControllerDelegate {
func tabBarController(
_ tabBarController: UITabBarController,
shouldSelect viewController: UIViewController
) -> Bool {
if let nav = viewController as? UINavigationController {
if nav.viewControllers.first as? RecipientsViewController != nil {
NotificationCenter.default.post(
name: Notification.Name.init(AppConstants.MainWireFrameNotificationName),
object: nil,
userInfo: nil
)
return Utility.isVerifiedUser()
}
func tabBarController(
_ tabBarController: UITabBarController,
shouldSelect viewController: UIViewController
) -> Bool {
if let nav = viewController as? UINavigationController {
if nav.viewControllers.first as? RecipientsViewController != nil {
NotificationCenter.default.post(
name: Notification.Name.init(AppConstants.MainWireFrameNotificationName),
object: nil,
userInfo: nil
)
return Utility.isVerifiedUser()
}
}
print(tabBarController.selectedIndex)
return true
}
print(tabBarController.selectedIndex)
return true
}
}
extension UINavigationBar {
static func setInsideAppearance() {
let navBarAppearance = UINavigationBar.appearance()
navBarAppearance.isTranslucent = false
navBarAppearance.barTintColor = UIColor.white
}
static func setOutsideAppearance() {
self.setInsideAppearance()
let navBarAppearance = UINavigationBar.appearance()
navBarAppearance.barTintColor = Colors.defaultRed
let font = Fonts.NavBar.titleFont
navBarAppearance.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: UIColor.black,
NSAttributedString.Key.font: font]
navBarAppearance.tintColor = UIColor.black
}
static func setupImageAppearance() {
let navBarAppearance = UINavigationBar.appearance()
navBarAppearance.barTintColor = Colors.defaultRed
let font = Fonts.NavBar.titleFont
navBarAppearance.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: UIColor.black,
NSAttributedString.Key.font: font]
navBarAppearance.tintColor = UIColor.black
}
static func setInsideAppearance() {
let navBarAppearance = UINavigationBar.appearance()
navBarAppearance.isTranslucent = false
navBarAppearance.barTintColor = UIColor.white
}
static func setOutsideAppearance() {
self.setInsideAppearance()
let navBarAppearance = UINavigationBar.appearance()
navBarAppearance.barTintColor = Colors.defaultRed
let font = Fonts.NavBar.titleFont
navBarAppearance.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: UIColor.black,
NSAttributedString.Key.font: font]
navBarAppearance.tintColor = UIColor.black
}
static func setupImageAppearance() {
let navBarAppearance = UINavigationBar.appearance()
navBarAppearance.barTintColor = Colors.defaultRed
let font = Fonts.NavBar.titleFont
navBarAppearance.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: UIColor.black,
NSAttributedString.Key.font: font]
navBarAppearance.tintColor = UIColor.black
}
}
@objc protocol Setup {
@objc optional func setupTabItem()
@objc optional func setupTabItem()
}
extension UIViewController: Setup {
func setupTabItem() {
}
func setupTabItem() {
}
}
struct Colors {
static let separator = UIColor(hex: "#eeeeee")
static let defaultRed = UIColor(hex: "#0xec1c24")
static let cartBadge = UIColor(hex: "#F5951D")
struct TabBar {
static let textItemSelected = Colors.defaultRed
static let textItemNotSelected = UIColor(hex: "#959595")
static let shadow = Colors.separator
}
struct NavBar {
// static let barTint =
static let tint = UIColor.white
static let shadow = Colors.separator
}
struct XLTabBar {
static let titleUnselected = UIColor(hex: "#555555")
static let titleSelected = Colors.defaultRed
static let selectedBackground = Colors.defaultRed
}
static let separator = UIColor(hex: "#eeeeee")
static let defaultRed = UIColor(hex: "#0xec1c24")
static let cartBadge = UIColor(hex: "#F5951D")
struct TabBar {
static let textItemSelected = Colors.defaultRed
static let textItemNotSelected = UIColor(hex: "#959595")
static let shadow = Colors.separator
}
struct NavBar {
// static let barTint =
static let tint = UIColor.white
static let shadow = Colors.separator
}
struct XLTabBar {
static let titleUnselected = UIColor(hex: "#555555")
static let titleSelected = Colors.defaultRed
static let selectedBackground = Colors.defaultRed
}
}
struct Fonts {
struct TabBar {
static let itemFont = UIFont.sanfrancisco(.light, size: 10)
}
struct NavBar {
static let titleFont = UIFont.sanfrancisco(.regular, size: 17)
}
struct XLTabBar {
static let itemFont = UIFont.sanfrancisco(.regular, size: 12)
}
struct Error {
static let font = UIFont.sanfrancisco(.semibold, size: 11)
}
struct TabBar {
static let itemFont = UIFont.sanfrancisco(.light, size: 10)
}
struct NavBar {
static let titleFont = UIFont.sanfrancisco(.regular, size: 17)
}
struct XLTabBar {
static let itemFont = UIFont.sanfrancisco(.regular, size: 12)
}
struct Error {
static let font = UIFont.sanfrancisco(.semibold, size: 11)
}
}
extension UIColor {
func image(of size: CGSize = CGSize(width: 1, height: 1)) -> UIImage {
let rect = CGRect(origin: .zero, size: size)
UIGraphicsBeginImageContextWithOptions(size, false, 0)
self.setFill()
UIRectFill(rect)
let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
return image
}
func image(of size: CGSize = CGSize(width: 1, height: 1)) -> UIImage {
let rect = CGRect(origin: .zero, size: size)
UIGraphicsBeginImageContextWithOptions(size, false, 0)
self.setFill()
UIRectFill(rect)
let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
return image
}
}

3
GME Remit/Modules/RegisterModules/UserAuthentication/NewRegister/User Interface/Wireframe/NewRegisterWireframe.swift

@ -160,6 +160,7 @@ extension NewRegisterWireframe: NewRegisterWireframeInput {
let mainWireFrame = MainWireframe.shared
let tabBarViewController = mainWireFrame?.getMainView()
let navWithTab = UINavigationController(rootViewController: tabBarViewController!)
guard let sidemenuVc = UIStoryboard(name: "SideMenu", bundle: nil).instantiateViewController(
withIdentifier: "SideMenuViewController"
) as? SideMenuViewController else {
@ -167,7 +168,7 @@ extension NewRegisterWireframe: NewRegisterWireframeInput {
}
let sideMenuController = LGSideMenuController(
rootViewController: tabBarViewController,
rootViewController: navWithTab,
leftViewController: sidemenuVc,
rightViewController: nil
)

3
GME Remit/Modules/RemittanceModules/TransactionHistoryModules/TransactionHistoryGroup/User Interface/Wireframe/TransactionHistoryGroupWireframe.swift

@ -43,8 +43,7 @@ extension TransactionHistoryGroupWireframe: TransactionHistoryGroupWireframeInpu
func push(overseasType: OverseasType = .outbound, in source: UINavigationController) {
self.overseasType = overseasType
let mainView = self.getMainView()
source.pushViewController(mainView, animated: true)
self.pushMainView(in: source)
}
func open(overseasType: OverseasType = .outbound, on source: UIViewController?) {

20
GME Remit/Protocols/WireframeInput.swift

@ -49,12 +49,12 @@ extension WireframeInput {
func pushMainView(on source: UIViewController) {
let mainView = self.getMainView()
source.navigationController?.pushViewController(mainView, animated: true)
source.push(mainView, animated: true)
}
func pushMainView(in source: UINavigationController) {
let mainView = self.getMainView()
source.pushViewController(mainView, animated: true)
source.push(mainView, animated: true)
}
func openViewControllerWithNavigation(viewController: UIViewController, source: UIViewController) {
@ -64,3 +64,19 @@ extension WireframeInput {
}
}
extension UIViewController{
func push(_ viewController: UIViewController, animated: Bool){
if let tabBarController = self.tabBarController{
tabBarController.navigationController?.pushViewController(viewController, animated: animated)
return
}
if let navigationController = self.navigationController{
navigationController.pushViewController(viewController, animated: animated)
return
}
if let navigation = self as? UINavigationController{
navigation.pushViewController(viewController, animated: animated)
}
}
}
Loading…
Cancel
Save