Advertisement
ChandanAppdesk

ArtistDetailsVC.swift

Mar 6th, 2024
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 42.06 KB | Source Code | 0 0
  1. //
  2. // ArtistDetailsVC.swift
  3. // hubble-ios
  4. //
  5. // Created by Appdesk Services PVT. LTD. on 21/06/23.
  6. // Copyright (c) 2023 Hubble. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10. import GoogleMaps
  11. import TagListView
  12. import DropDown
  13.  
  14. class ArtistDetailsVC: UIViewController {
  15.  
  16.     let viewModal = ArtistDetailsViewModel()
  17.     var artistDetails: ArtistDetails?
  18.     var artistID: String?
  19.     var willingToNegotiate: Bool?
  20.     var allServiceDetails: [Service] = []
  21.     var reviewDetails: [Review] = [] {
  22.         didSet {
  23.             ratingCollection.reloadData()
  24.         }
  25.     }
  26.     var seeAboutDetails: String?
  27.  
  28.     var contentViewHeight = 2400.0
  29.     lazy var contentView: UIView = {
  30.         let view = UIView()
  31.         view.isAccessibilityElement = false
  32.         view.backgroundColor = .primaryDarkColor
  33.         return view
  34.     }()
  35.  
  36.     lazy var requestBooking: (buttonBgView: UIView, container: UIView) = {
  37.         var button = Common.createContinueButton(buttonName: "artist_detail_request_booking".myLocalizedString)
  38.         button.buttonBgView.accessibilityElement(id: AccessIdentifier.requestDetailsBookingButton, label: AccessLabel.requestDetailsBookingButton)
  39.         button.container.isAccessibilityElement = false
  40.         let tapGr = UITapGestureRecognizer(target: self, action: #selector(requestBookingButtonTapped))
  41.         button.buttonBgView.addGestureRecognizer(tapGr)
  42.         return button
  43.     }()
  44.  
  45.     lazy var scrollView: UIScrollView = {
  46.         let scroll = UIScrollView()
  47.         scroll.translatesAutoresizingMaskIntoConstraints = false
  48.         scroll.showsVerticalScrollIndicator = true
  49.         scroll.isScrollEnabled = true
  50.         scroll.isAccessibilityElement = false
  51.         scroll.addSubview(contentView)
  52.         contentView.snp.makeConstraints { make in
  53.             make.height.equalTo(contentViewHeight)
  54.             make.top.bottom.left.right.width.equalTo(scroll)
  55.         }
  56.         return scroll
  57.     }()
  58.  
  59.     // navigation bar
  60.     lazy var backButton: UIButton = {
  61.         let button = UIButton()
  62.         button.accessibilityElement(id: AccessIdentifier.backButton, label: AccessLabel.backButton)
  63.         button.backgroundColor = .colorWhiteAlpha3
  64.         button.tintColor = .white
  65.         button.corner(cornerRadius: 10)
  66.         button.setImage(.backButton, for: .normal)
  67.         button.isUserInteractionEnabled = true
  68.         button.addTarget(self, action: #selector(backHomeTapped), for: .touchUpInside)
  69.         return button
  70.     }()
  71.    
  72.     lazy var threeDotMenuButton: UIButton = {
  73.         let button = UIButton()
  74.         button.setImage(.ellipsisVertical, for: .normal)
  75.         button.tintColor = .white
  76.         button.corner(cornerRadius: 10)
  77.         button.backgroundColor = .colorWhiteAlpha3
  78.         button.addTarget(self, action: #selector(threeDotMenuButtonTapped), for: .touchUpInside)
  79.         return button
  80.     }()
  81.  
  82.     let threeDotMenu: DropDown = {
  83.         let menu = DropDown()
  84.         menu.cornerRadius = 12
  85.         menu.dataSource = ["artist_about_share_profile".myLocalizedString, "artist_about_report_this_profile".myLocalizedString]
  86.         menu.cellNib = UINib(nibName: CustomDDC.customReuseId, bundle: .none)
  87.         DropDown.appearance().textFont = .fontRegular16
  88.         menu.separatorColor = .black
  89.         menu.customCellConfiguration = { index, title, cell in
  90.             guard let cell = cell as? CustomDDC else { return }
  91.             if index == 1 {
  92.                 cell.cellImage.image = .reportProfile
  93.                 cell.optionLabel.textColor = .red
  94.             } else {
  95.                 cell.cellImage.image = .shareProfile
  96.                 cell.optionLabel.textColor = .black
  97.             }
  98.         }
  99.         return menu
  100.     }()
  101.  
  102.     lazy var profileBackgroundImageView: UIImageView = {
  103.         let image = UIImageView(isImageViewerEnable: true)
  104.         image.accessibilityElement(id: AccessIdentifier.profileImage, label: AccessLabel.profileImage)
  105.         image.contentMode = .scaleAspectFill
  106.         image.clipsToBounds = true
  107.         image.isUserInteractionEnabled = true
  108.         return image
  109.     }()
  110.  
  111.     lazy var userTypeNameLabel: UILabel = {
  112.         let label = UILabel()
  113.         label.accessibilityElement(id: AccessIdentifier.userTypeNameLabel, label: AccessLabel.userTypeNameLabel)
  114.         label.text = "artist_user_type_text".myLocalizedString
  115.         label.textAlignment = .center
  116.         label.isUserInteractionEnabled = true
  117.         label.textColor = .white
  118.         label.backgroundColor = .color111111Alpha6
  119.         label.corner(cornerRadius: 8.0)
  120.         label.font = .fontRegular16
  121.         return label
  122.     }()
  123.  
  124.     lazy var artistName: UILabel = {
  125.         let label = UILabel()
  126.         label.accessibilityElement(id: AccessIdentifier.artistName, label: AccessLabel.artistName)
  127.         label.isUserInteractionEnabled = true
  128.         label.font = .fontBold42
  129.         label.text = "artist_Name_text".myLocalizedString
  130.         return label
  131.     }()
  132.  
  133.     lazy var artistUserName: UILabel = {
  134.         let label = UILabel()
  135.         label.accessibilityElement(id: AccessIdentifier.artistUserName, label: AccessLabel.artistUserName)
  136.         label.isUserInteractionEnabled = true
  137.         label.font = .fontRegular22
  138.         label.text = "artist_User_Name_text".myLocalizedString
  139.         return label
  140.     }()
  141.  
  142.     lazy var reatingsTextlabel: UILabel = {
  143.         let label = UILabel()
  144.         label.accessibilityElement(id: AccessIdentifier.reatingsTextlabel, label: AccessLabel.reatingsTextlabel)
  145.         label.textColor = .white
  146.         label.isUserInteractionEnabled = true
  147.         label.font = .fontLight14
  148.         label.text = "artist_reatings_text".myLocalizedString
  149.         return label
  150.     }()
  151.  
  152.     lazy var reatingStarImageView: UIImageView = {
  153.         let imageView = UIImageView()
  154.         imageView.accessibilityElement(id: AccessIdentifier.reatingStarImageView, label: AccessLabel.reatingStarImageView)
  155.         imageView.image = .saveStarFill
  156.         imageView.isUserInteractionEnabled = true
  157.         imageView.tintColor = .yellow
  158.         return imageView
  159.     }()
  160.  
  161.     lazy var memberSinceTextLabel: UILabel = {
  162.         let label = UILabel()
  163.         label.accessibilityElement(id: AccessIdentifier.memberSinceTextLabel, label: AccessLabel.memberSinceTextLabel)
  164.         label.isUserInteractionEnabled = true
  165.         label.font = .fontRegular16
  166.         label.text = "artist_memberSince_text_label".myLocalizedString
  167.         return label
  168.     }()
  169.  
  170.     lazy var memberSinceLabel: UILabel = {
  171.         let label = UILabel()
  172.         label.accessibilityElement(id: AccessIdentifier.memberSinceLabel, label: AccessLabel.memberSinceLabel)
  173.         label.isUserInteractionEnabled = true
  174.         label.font = .fontBold14
  175.         label.text = "artist_memberSince_text".myLocalizedString
  176.         return label
  177.     }()
  178.  
  179.     lazy var priceTextLabel: UILabel = {
  180.         let label = UILabel()
  181.         label.text = "artist_pricing_range_text_Label".myLocalizedString
  182.         label.accessibilityElement(id: AccessIdentifier.priceTextLabel, label: AccessLabel.priceTextLabel)
  183.         label.font = .fontRegular16
  184.         label.textColor = .white
  185.         return label
  186.     }()
  187.  
  188.     lazy var priceLabel: UILabel = {
  189.         let label = UILabel()
  190.         label.text = "artist_pricing_range_text".myLocalizedString
  191.         label.accessibilityElement(id: AccessIdentifier.priceDetailLabel, label: AccessLabel.priceDetailLabel)
  192.         label.font = .fontBold14
  193.         label.textColor = .white
  194.         return label
  195.     }()
  196.  
  197.     lazy var noOfBookingTextLabel: UILabel = {
  198.         let label = UILabel()
  199.         label.text = "artist_noOfBooking_Text_Label".myLocalizedString
  200.         label.accessibilityElement(id: AccessIdentifier.noOfBookingTextLabel, label: AccessLabel.noOfBookingTextLabel)
  201.         label.font = .fontRegular16
  202.         label.textColor = .white
  203.         return label
  204.     }()
  205.  
  206.     lazy var noOfBookingLabel: UILabel = {
  207.         let label = UILabel()
  208.         label.text = "artist_noOfBooking_text".myLocalizedString
  209.         label.accessibilityElement(id: AccessIdentifier.noOfBookingLabel, label: AccessLabel.noOfBookingLabel)
  210.         label.font = .fontBold14
  211.         label.textColor = .white
  212.         return label
  213.     }()
  214.  
  215.     lazy var servicesTextLabel: UILabel = {
  216.         let label = UILabel()
  217.         label.text = "artist_services_text_label".myLocalizedString
  218.         label.accessibilityElement(id: AccessIdentifier.servicesTextLabel, label: AccessLabel.servicesTextLabel)
  219.         label.font = .fontBold20
  220.         label.textColor = .white
  221.         return label
  222.     }()
  223.  
  224.     lazy var termAndConditionButton: UIButton = {
  225.         let button = UIButton()
  226.         button.accessibilityElement(id: AccessIdentifier.termAndConditionButton, label: AccessLabel.termAndConditionButton)
  227.         button.backgroundColor = .clear
  228.         button.tintColor = .white
  229.         button.setTitle("service_detail_term_and_condition_text".myLocalizedString, for: .normal)
  230.         button.titleLabel?.font = .fontRegular14
  231.         button.addTarget(self, action: #selector(termAndConditionButtonTapped), for: .touchUpInside)
  232.         return button
  233.     }()
  234.  
  235.     lazy var sepraterLabel: UILabel = {
  236.         let label = UILabel()
  237.         label.backgroundColor = .white
  238.         return label
  239.     }()
  240.  
  241.     lazy var memberBgView: UIView = {
  242.         let view = UIView()
  243.         view.backgroundColor = .colorWhiteAlpha1
  244.         view.corner(cornerRadius: 12.0)
  245.         return view
  246.     }()
  247.  
  248.     lazy var priceBgView: UIView = {
  249.         let view = UIView()
  250.         view.backgroundColor = .colorWhiteAlpha1
  251.         view.corner(cornerRadius: 12.0)
  252.         return view
  253.     }()
  254.  
  255.     lazy var termConditionBgView: UIView = {
  256.         let view = UIView()
  257.         view.backgroundColor = .colorWhiteAlpha1
  258.         view.corner(cornerRadius: 4.0)
  259.         return view
  260.     }()
  261.  
  262.     lazy var noOfBookingBgView: UIView = {
  263.         let view = UIView()
  264.         view.backgroundColor = .colorWhiteAlpha1
  265.         view.corner(cornerRadius: 8.0)
  266.         return view
  267.     }()
  268.  
  269.     var allServices: [String] = [] {
  270.         didSet {
  271.             for (index, services) in allServices.enumerated() {
  272.                 if index == 3 { return }
  273.                 let label = UILabel()
  274.                 label.text = services
  275.                 label.textColor = .white
  276.                 label.font = .fontRegular16
  277.                 servicesLabels.append(label)
  278.                 servicesStack.addArrangedSubview(label)
  279.             }
  280.         }
  281.     }
  282.     lazy var serviceBgView: UIView = {
  283.         let view = UIView()
  284.         view.backgroundColor = .colorWhiteAlpha1
  285.         view.corner(cornerRadius: 12.0)
  286.         let tapGr = UITapGestureRecognizer(target: self, action: #selector(seeMoreAllServicesButtonTapped))
  287.         view.addGestureRecognizer(tapGr)
  288.         return view
  289.     }()
  290.  
  291.     func calculateSizeOfServicesStack() -> CGFloat {
  292.         var height = CGFloat()
  293.         let size = allServices.first?.SizeOf(.fontRegular14) ?? .zero
  294.         allServices.forEach { _ in
  295.             height = size.height + height
  296.             height += 4
  297.         }
  298.         if allServices.count >= 3 { height += 32}
  299.         return height
  300.     }
  301.  
  302.     lazy var servicesLabels: [UILabel] = {
  303.         var servicesLabels: [UILabel] = []
  304.         return servicesLabels
  305.     }()
  306.  
  307.     lazy var servicesStack: UIStackView = {
  308.         let stack = UIStackView(arrangedSubviews: servicesLabels)
  309.         stack.axis = .vertical
  310.         stack.alignment = .fill
  311.         stack.distribution = .fillEqually
  312.         stack.spacing = 4
  313.         return stack
  314.     }()
  315.  
  316.     lazy var seeMoreServicesButton: UIButton = {
  317.         let button = UIButton()
  318.         button.accessibilityElement(id: AccessIdentifier.seeMoreAboutButton, label: AccessLabel.seeMoreAboutButton)
  319.         button.backgroundColor = .clear
  320.         button.tintColor = .white
  321.         button.corner(cornerRadius: 4)
  322.         button.backgroundColor = .colorWhiteAlpha1
  323.         button.setTitle("artist_seeMore_text".myLocalizedString, for: .normal)
  324.         button.titleLabel?.font = .fontBold14
  325.         button.addTarget(self, action: #selector(seeMoreAllServicesButtonTapped), for: .touchUpInside)
  326.         return button
  327.     }()
  328.  
  329.     lazy var memberPriceStackView: UIStackView = {
  330.         let stackView = UIStackView(arrangedSubviews: [memberBgView, priceBgView])
  331.         stackView.axis = .horizontal
  332.         stackView.spacing = 8
  333.         stackView.isAccessibilityElement = false
  334.         stackView.distribution = .fill
  335.         memberBgView.snp.makeConstraints { make in
  336.             make.width.equalTo(136)
  337.         }
  338.         return stackView
  339.     }()
  340.  
  341.     lazy var portfolioTextLabel: UILabel = {
  342.         let label = UILabel()
  343.         label.accessibilityElement(id: AccessIdentifier.portfolioTextLabel, label: AccessLabel.portfolioTextLabel)
  344.         label.text = "artist_portfolio_text_label".myLocalizedString
  345.         label.font = .fontBold18
  346.         return label
  347.     }()
  348.  
  349.     lazy var photosTextLabel: UILabel = {
  350.         let label = UILabel()
  351.         label.accessibilityElement(id: AccessIdentifier.photosTextLabel, label: AccessLabel.photosTextLabel)
  352.         label.text = "artist_photo's_text".myLocalizedString
  353.         label.font = .fontRegular16
  354.         return label
  355.     }()
  356.  
  357.     lazy var videosTextLabel: UILabel = {
  358.         let label = UILabel()
  359.         label.accessibilityElement(id: AccessIdentifier.videosTextLabel, label: AccessLabel.videosTextLabel)
  360.         label.text = "artist_videos_text".myLocalizedString
  361.         label.font = .fontRegular16
  362.         return label
  363.     }()
  364.  
  365.     lazy var photoCollection: UICollectionView = {
  366.         let collection = UICollectionView(frame: .zero, collectionViewLayout: createLayoutPhotos())
  367.         collection.backgroundColor = .clear
  368.         collection.translatesAutoresizingMaskIntoConstraints = false
  369.         collection.dataSource = self
  370.         collection.accessibilityElement(id: AccessIdentifier.photoCollectionView, label: AccessLabel.photoCollectionView)
  371.         collection.delegate = self
  372.         collection.tag = 0
  373.         collection.register(StaggeredGridCVC.self, forCellWithReuseIdentifier: StaggeredGridCVC.reuseId)
  374.         return collection
  375.     }()
  376.  
  377.     lazy var videoCollection: UICollectionView = {
  378.         let collection = UICollectionView(frame: .zero, collectionViewLayout: createLayoutVideos())
  379.         collection.backgroundColor = .clear
  380.         collection.translatesAutoresizingMaskIntoConstraints = false
  381.         collection.dataSource = self
  382.         collection.delegate = self
  383.         collection.accessibilityElement(id: AccessIdentifier.videoCollectionView, label: AccessLabel.videoCollectionView)
  384.         collection.tag = 1
  385.         collection.register(StaggeredGridCVC.self, forCellWithReuseIdentifier: StaggeredGridCVC.reuseId)
  386.         return collection
  387.     }()
  388.  
  389.     lazy var ratingCollection: UICollectionView = {
  390.         let layout = UICollectionViewFlowLayout()
  391.         layout.scrollDirection = .horizontal
  392.         let collection = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
  393.         collection.corner(cornerRadius: 12.0)
  394.         collection.backgroundColor = .clear
  395.         collection.dataSource = self
  396.         collection.delegate = self
  397.         collection.showsHorizontalScrollIndicator = false
  398.         collection.tag = 2
  399.         collection.register(ReviewCVC.self, forCellWithReuseIdentifier: ReviewCVC.reuseId)
  400.         return collection
  401.     }()
  402.  
  403.     lazy var portfolioBgView: UIView = {
  404.         let view = UIView()
  405.         view.backgroundColor = .colorWhiteAlpha1
  406.         view.isAccessibilityElement = false
  407.         view.corner(cornerRadius: 12)
  408.         view.addSubview(portfolioTextLabel)
  409.         view.addSubview(photosTextLabel)
  410.         view.addSubview(photoCollection)
  411.         portfolioTextLabel.snp.makeConstraints { make in
  412.             make.top.equalTo(view).offset(24)
  413.             make.left.equalTo(view).offset(20)
  414.         }
  415.         photosTextLabel.snp.makeConstraints { make in
  416.             make.top.equalTo(portfolioTextLabel.snp.bottom).offset(16)
  417.             make.left.equalTo(view).offset(20)
  418.         }
  419.         photoCollection.snp.makeConstraints { make in
  420.             make.top.equalTo(photosTextLabel.snp.bottom).offset(16)
  421.             make.left.equalTo(view).offset(16)
  422.             make.right.equalTo(view).inset(16)
  423.             make.height.equalTo(200)
  424.         }
  425.         view.addSubview(videosTextLabel)
  426.         videosTextLabel.snp.makeConstraints { make in
  427.             make.top.equalTo(photoCollection.snp.bottom).offset(31)
  428.             make.left.equalTo(view).offset(20)
  429.         }
  430.         view.addSubview(videoCollection)
  431.         videoCollection.snp.makeConstraints { make in
  432.             make.top.equalTo(videosTextLabel.snp.bottom).offset(16)
  433.             make.left.equalTo(view).offset(16)
  434.             make.right.equalTo(view).inset(16)
  435.             make.height.equalTo(230)
  436.         }
  437.         return view
  438.     }()
  439.  
  440.     lazy var serviceAboutPricingView: UIView = {
  441.         let view = UIView()
  442.         view.backgroundColor = .colorWhiteAlpha1
  443.         view.corner(cornerRadius: 12.0)
  444.         return view
  445.     }()
  446.  
  447.     lazy var servicePricingView: UIView = {
  448.         let view = UIView()
  449.         view.backgroundColor = .colorWhiteAlpha2
  450.         view.corner(cornerRadius: 12.0)
  451.         return view
  452.     }()
  453.  
  454.     lazy var aboutView: UIView = {
  455.         let view = UIView()
  456.         view.backgroundColor = .colorWhiteAlpha1
  457.         view.corner(cornerRadius: 12.0)
  458.         return view
  459.     }()
  460.  
  461.     lazy var aboutTextLabel: UILabel = {
  462.         let label = UILabel()
  463.         label.text = "service_detail_about_text_label".myLocalizedString
  464.         label.accessibilityElement(id: AccessIdentifier.aboutDetailLabel, label: AccessLabel.aboutDetailLabel)
  465.         label.font = .fontBold16
  466.         label.textColor = .white
  467.         return label
  468.     }()
  469.  
  470.     let aboutTextFromLanguage: String = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard"
  471.  
  472.     lazy var aboutLabel: UILabel = {
  473.         let label = UILabel()
  474.         label.text = aboutTextFromLanguage
  475.         label.accessibilityElement(id: AccessIdentifier.detailsDetailLabel, label: AccessLabel.detailsDetailLabel)
  476.         label.font = .fontRegular18
  477.         label.textColor = .white
  478.         label.lineBreakMode = .byWordWrapping
  479.         label.numberOfLines = 4
  480.         return label
  481.     }()
  482.  
  483.     lazy var dummyAboutTextLabel: UILabel = {
  484.         let label = UILabel()
  485.         label.numberOfLines = 0
  486.         label.text = aboutTextFromLanguage
  487.         label.font = .fontRegular18
  488.         label.textAlignment = .left
  489.         label.textColor = .white
  490.         label.backgroundColor = .black
  491.         label.isHidden = true
  492.         return label
  493.     }()
  494.  
  495.     lazy var seeMoreAboutButton: UIButton = {
  496.         let button = UIButton()
  497.         button.accessibilityElement(id: AccessIdentifier.seeMoreDetailsButton, label: AccessLabel.seeMoreDetailsButton)
  498.         button.backgroundColor = .clear
  499.         button.tintColor = .white
  500.         button.setTitle("artist_seeMore_text".myLocalizedString, for: .normal)
  501.         button.titleLabel?.font = .fontBold16
  502.         button.addTarget(self, action: #selector(seeAboutButtonTapped), for: .touchUpInside)
  503.         return button
  504.     }()
  505.  
  506.     lazy var fromCountryChips: [String] = []
  507.     lazy var fromtTextLabel: UILabel = {
  508.         let label = UILabel()
  509.         label.text = "From"
  510.         label.font = .fontBold18
  511.         label.textColor = .white
  512.         return label
  513.     }()
  514.  
  515.     lazy var fromCountryChipsView: TagListView = {
  516.         let listView = setUpTagView(on: self.aboutView, titleLabel: fromtTextLabel, tags: fromCountryChips)
  517.         return listView
  518.     }()
  519.  
  520.     lazy var spokenLanguageChips: [String] = []
  521.     lazy var spokenLanguageTextLabel: UILabel = {
  522.         let label = UILabel()
  523.         label.text = "Spoken Language"
  524.         label.font = .fontBold18
  525.         label.textColor = .white
  526.         return label
  527.     }()
  528.  
  529.     lazy var spokenLanguageChipsView: TagListView = {
  530.         let listView = setUpTagView(on: self.aboutView, titleLabel: spokenLanguageTextLabel, tags: spokenLanguageChips)
  531.         return listView
  532.     }()
  533.  
  534.     lazy var servicePricingTextLabel: UILabel = {
  535.         let label = UILabel()
  536.         label.text = "service_detail_pricing_text_label".myLocalizedString
  537.         label.accessibilityElement(id: AccessIdentifier.priceTextLabel, label: AccessLabel.priceTextLabel)
  538.         label.font = .fontRegular16
  539.         label.textColor = .white
  540.         return label
  541.     }()
  542.  
  543.     lazy var servicePricingLabel: UILabel = {
  544.         let label = UILabel()
  545.         label.text = "service_detail_pricing_text".myLocalizedString
  546.         label.accessibilityElement(id: AccessIdentifier.priceDetailLabel, label: AccessLabel.priceDetailLabel)
  547.         label.font = .fontBold14
  548.         label.textColor = .white
  549.         return label
  550.     }()
  551.  
  552.     lazy var aboutServicePricingTextLabel: UILabel = {
  553.         let label = UILabel()
  554.         label.text = "service_detail_about_text_label".myLocalizedString
  555.         label.accessibilityElement(id: AccessIdentifier.aboutTextLabel, label: AccessLabel.aboutTextLabel)
  556.         label.font = .fontBold18
  557.         label.textColor = .white
  558.         return label
  559.     }()
  560.  
  561.     let aboutTextPriceLabel: String = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard"
  562.  
  563.     lazy var aboutServicePricingLabel: UILabel = {
  564.         let label = UILabel()
  565.         label.text = aboutTextPriceLabel
  566.         label.accessibilityElement(id: AccessIdentifier.aboutDetailLabel, label: AccessLabel.aboutDetailLabel)
  567.         label.font = .fontRegular18
  568.         label.textColor = .white
  569.         label.lineBreakMode = .byWordWrapping
  570.         label.numberOfLines = 4
  571.         return label
  572.     }()
  573.  
  574.     lazy var dummyAboutTextPriceLabel: UILabel = {
  575.         let label = UILabel()
  576.         label.numberOfLines = 0
  577.         label.text = aboutTextPriceLabel
  578.         label.font = .fontRegular18
  579.         label.textAlignment = .left
  580.         label.textColor = .white
  581.         label.backgroundColor = .black
  582.         label.isHidden = true
  583.         return label
  584.     }()
  585.  
  586.     lazy var detailsServicePricingTextLabel: UILabel = {
  587.         let label = UILabel()
  588.         label.text = "service_detail_text_label".myLocalizedString
  589.         label.accessibilityElement(id: AccessIdentifier.detailsTextLabel, label: AccessLabel.detailsTextLabel)
  590.         label.font = .fontBold18
  591.         label.textColor = .white
  592.         return label
  593.     }()
  594.  
  595.     let detailsTextPriceLabel: String = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard"
  596.  
  597.     lazy var detailsServicePricingLabel: UILabel = {
  598.         let label = UILabel()
  599.         label.text = detailsTextPriceLabel
  600.         label.accessibilityElement(id: AccessIdentifier.detailsDetailLabel, label: AccessLabel.detailsDetailLabel)
  601.         label.font = .fontRegular18
  602.         label.textColor = .white
  603.         label.lineBreakMode = .byWordWrapping
  604.         label.numberOfLines = 4
  605.         return label
  606.     }()
  607.  
  608.     lazy var dummyDetailsTextPriceLabel: UILabel = {
  609.         let label = UILabel()
  610.         label.numberOfLines = 0
  611.         label.text = detailsTextPriceLabel
  612.         label.font = .fontRegular18
  613.         label.textAlignment = .left
  614.         label.textColor = .white
  615.         label.backgroundColor = .black
  616.         label.isHidden = true
  617.         return label
  618.     }()
  619.  
  620.     lazy var termAndConditionServicePricingButton: UIButton = {
  621.         let button = UIButton()
  622.         button.accessibilityElement(id: AccessIdentifier.termAndConditionButton, label: AccessLabel.termAndConditionButton)
  623.         button.backgroundColor = .clear
  624.         button.tintColor = .white
  625.         button.setTitle("service_detail_term_and_condition_text".myLocalizedString, for: .normal)
  626.         button.titleLabel?.font = .fontBook14
  627.         button.addTarget(self, action: #selector(termAndConditionButtonTapped), for: .touchUpInside)
  628.         return button
  629.     }()
  630.  
  631.     lazy var seeMoreAboutServicePricingButton: UIButton = {
  632.         let button = UIButton()
  633.         button.accessibilityElement(id: AccessIdentifier.seeMoreAboutButton, label: AccessLabel.seeMoreAboutButton)
  634.         button.backgroundColor = .clear
  635.         button.tintColor = .white
  636.         button.setTitle("artist_seeMore_text".myLocalizedString, for: .normal)
  637.         button.titleLabel?.font = .fontBold14
  638.         button.addTarget(self, action: #selector(termAndConditionButtonTapped), for: .touchUpInside)
  639.         return button
  640.     }()
  641.  
  642.     lazy var seeMoreDetailsServicePricingButton: UIButton = {
  643.         let button = UIButton()
  644.         button.accessibilityElement(id: AccessIdentifier.seeMoreDetailsButton, label: AccessLabel.seeMoreDetailsButton)
  645.         button.backgroundColor = .clear
  646.         button.tintColor = .white
  647.         button.setTitle("artist_seeMore_text".myLocalizedString, for: .normal)
  648.         button.titleLabel?.font = .fontBold14
  649.         button.addTarget(self, action: #selector(termAndConditionButtonTapped), for: .touchUpInside)
  650.         return button
  651.     }()
  652.  
  653.     lazy var termConditionServicePricingBgView: UIView = {
  654.         let view = UIView()
  655.         view.backgroundColor = .colorWhiteAlpha2
  656.         return view
  657.     }()
  658.  
  659.     lazy var sepraterServicePricingLabel: UILabel = {
  660.         let label = UILabel()
  661.         label.backgroundColor = .white
  662.         return label
  663.     }()
  664.  
  665.     lazy var mapView: GMSMapView = {
  666.         let view = GMSMapView()
  667.         view.corner(cornerRadius: 16.0)
  668.         return view
  669.     }()
  670.  
  671.     lazy var reviewTextLabel: UILabel = {
  672.         let label = UILabel()
  673.         label.text = "artist_review_text_label".myLocalizedString
  674.         label.accessibilityElement(id: AccessIdentifier.reviewTextLabel, label: AccessLabel.reviewTextLabel)
  675.         label.font = .fontBold18
  676.         label.textColor = .white
  677.         return label
  678.     }()
  679.  
  680.     lazy var reviewRatingLabel: UILabel = {
  681.         let label = UILabel()
  682.         label.text = "artist_reviewRating_text".myLocalizedString
  683.         label.font = .fontLight14
  684.         label.textColor = .white
  685.         return label
  686.     }()
  687.  
  688.     lazy var ReviewRatingStarImageView: UIImageView = {
  689.         let imageView = UIImageView()
  690.         imageView.accessibilityElement(id: AccessIdentifier.ReviewRatingStarImageView, label: AccessLabel.ReviewRatingStarImageView)
  691.         imageView.image = .saveStarFill
  692.         imageView.isUserInteractionEnabled = true
  693.         imageView.tintColor = .yellow
  694.         return imageView
  695.     }()
  696.  
  697.     lazy var reviewSeeAllButton: UIButton = {
  698.         let button = UIButton()
  699.         button.accessibilityElement(id: AccessIdentifier.reviewSeeAllButton, label: AccessLabel.reviewSeeAllButton)
  700.         button.backgroundColor = .clear
  701.         button.tintColor = .white
  702.         button.setTitle("artist_seeAll_text_label".myLocalizedString, for: .normal)
  703.         button.titleLabel?.font = .fontBold14
  704.         return button
  705.     }()
  706.  
  707.     lazy var ratingStackView: UIStackView = {
  708.         let stack = UIStackView(arrangedSubviews: [reviewTextLabel, reviewRatingLabel, ReviewRatingStarImageView])
  709.         stack.spacing = 4.0
  710.         stack.axis = .horizontal
  711.         stack.distribution = .fill
  712.         reviewTextLabel.snp.makeConstraints { make in
  713.             make.width.equalTo(77)
  714.             make.height.equalTo(26)
  715.         }
  716.         reviewRatingLabel.snp.makeConstraints { make in
  717.             make.height.equalTo(17)
  718.         }
  719.         ReviewRatingStarImageView.snp.makeConstraints { make in
  720.             make.width.equalTo(12)
  721.             make.height.equalTo(11)
  722.         }
  723.         return stack
  724.     }()
  725.  
  726.     // AVilibility section
  727.     lazy var avilivilityBgView: UIView = {
  728.         let view = UIView()
  729.         view.corner(cornerRadius: 12)
  730.         view.backgroundColor = .colorWhiteAlpha1
  731.         return view
  732.     }()
  733.     lazy var abilibilityTitleText: UILabel = {
  734.         let label = UILabel()
  735.         label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
  736.         label.text = "artist_personal_info_availability".myLocalizedString
  737.         label.font = .fontBold18
  738.         label.textColor = .white
  739.         return label
  740.     }()
  741.  
  742.     // AVilibility To Monday Day Slot
  743.     lazy var arrayOfAbilibilitysChipView = [
  744.         self.abilibilityMondayChipsView,
  745.         self.abilibilityTuesdayChipsView,
  746.         self.abilibilityWednesdayChipsView,
  747.         self.abilibilityThusdayChipsView,
  748.         self.abilibilityFridayChipsView,
  749.         self.abilibilitySaturdayChipsView,
  750.         self.abilibilitySundayChipsView
  751.     ]
  752.     lazy var arrayOfAbilibilitysChipTitleView = [
  753.         self.abilibilityMondayTitleText,
  754.         self.abilibilityTuesdayTitleText,
  755.         self.abilibilityWednesdayTitleText,
  756.         self.abilibilityThusdayTitleText,
  757.         self.abilibilityFridayTitleText,
  758.         self.abilibilitySaturdayTitleText,
  759.         self.abilibilitySundayTitleText
  760.     ]
  761.     var lastDisplayedArrayIndexOfAbilibilitysChipView: Int = .zero
  762.     lazy var allAbilibilityMondayChipText: [String] = []
  763.     lazy var abilibilityMondayTitleText: UILabel = {
  764.         let label = UILabel()
  765.         label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
  766.         label.text = "artist_day_monday_slot_label".myLocalizedString
  767.         label.font = .fontBold14
  768.         label.textColor = .white
  769.         label.tag = 1
  770.         return label
  771.     }()
  772.  
  773.     lazy var abilibilityMondayChipsView: TagListView = {
  774.         let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilityMondayTitleText, tags: allAbilibilityMondayChipText)
  775.         listView.tag = 1
  776.         return listView
  777.     }()
  778.  
  779.     // AVilibility To Tuesday Day Slot
  780.     lazy var allAbilibilityTuesdayChipText: [String] = []
  781.     lazy var abilibilityTuesdayTitleText: UILabel = {
  782.         let label = UILabel()
  783.         label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
  784.         label.text = "artist_day_tuesday_slot_label".myLocalizedString
  785.         label.font = .fontBold14
  786.         label.textColor = .white
  787.         label.tag = 2
  788.         return label
  789.     }()
  790.  
  791.     lazy var abilibilityTuesdayChipsView: TagListView = {
  792.         let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilityTuesdayTitleText, tags: allAbilibilityTuesdayChipText)
  793.         listView.tag = 2
  794.         return listView
  795.     }()
  796.  
  797.     // AVilibility To Wednesday Day Slot
  798.     lazy var allAbilibilityWednesdayChipText: [String] = []
  799.     lazy var abilibilityWednesdayTitleText: UILabel = {
  800.         let label = UILabel()
  801.         label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
  802.         label.text = "artist_day_wednesday_slot_label".myLocalizedString
  803.         label.font = .fontBold14
  804.         label.textColor = .white
  805.         label.tag = 3
  806.         return label
  807.     }()
  808.  
  809.     lazy var abilibilityWednesdayChipsView: TagListView = {
  810.         let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilityWednesdayTitleText, tags: allAbilibilityWednesdayChipText)
  811.         listView.tag = 3
  812.         return listView
  813.     }()
  814.  
  815.     // AVilibility To Thusday Day Slot
  816.     lazy var allAbilibilityThusdayChipText: [String] = []
  817.     lazy var abilibilityThusdayTitleText: UILabel = {
  818.         let label = UILabel()
  819.        label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
  820.         label.text = "artist_day_thusday_slot_label".myLocalizedString
  821.         label.font = .fontBold14
  822.         label.textColor = .white
  823.         label.tag = 4
  824.         return label
  825.     }()
  826.  
  827.     lazy var abilibilityThusdayChipsView: TagListView = {
  828.         let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilityThusdayTitleText, tags: allAbilibilityThusdayChipText)
  829.         listView.tag = 4
  830.         return listView
  831.     }()
  832.  
  833.     // AVilibility To Friday Day Slot
  834.     lazy var allAbilibilityFridayChipText: [String] = []
  835.     lazy var abilibilityFridayTitleText: UILabel = {
  836.         let label = UILabel()
  837.         label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
  838.         label.text = "artist_day_friday_slot_label".myLocalizedString
  839.         label.font = .fontBold14
  840.         label.textColor = .white
  841.         label.tag = 5
  842.         return label
  843.     }()
  844.  
  845.     lazy var abilibilityFridayChipsView: TagListView = {
  846.         let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilityFridayTitleText, tags: allAbilibilityFridayChipText)
  847.         listView.tag = 5
  848.         return listView
  849.     }()
  850.  
  851.     // AVilibility To Saturday Day Slot
  852.     lazy var allAbilibilitySaturdayChipText: [String] = []
  853.     lazy var abilibilitySaturdayTitleText: UILabel = {
  854.         let label = UILabel()
  855.         label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
  856.         label.text = "artist_day_saturday_slot_label".myLocalizedString
  857.         label.font = .fontBold14
  858.         label.tag = 6
  859.         label.textColor = .white
  860.         return label
  861.     }()
  862.  
  863.     lazy var abilibilitySaturdayChipsView: TagListView = {
  864.         let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilitySaturdayTitleText, tags: allAbilibilitySaturdayChipText)
  865.         listView.tag = 6
  866.         return listView
  867.     }()
  868.  
  869.     // AVilibility To Sunday Day Slot
  870.     lazy var allAbilibilitySundayChipText: [String] = []
  871.     lazy var abilibilitySundayTitleText: UILabel = {
  872.         let label = UILabel()
  873.         label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
  874.         label.text = "artist_day_sunday_slot_label".myLocalizedString
  875.         label.font = .fontBold14
  876.         label.tag = 7
  877.         label.textColor = .white
  878.         return label
  879.     }()
  880.  
  881.     lazy var abilibilitySundayChipsView: TagListView = {
  882.         let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilitySundayTitleText, tags: allAbilibilitySundayChipText)
  883.         listView.tag = 7
  884.         return listView
  885.     }()
  886.  
  887.     // Willingness To Travel
  888.     lazy var allWillingnessToTravelChips: [String] = []
  889.     lazy var willingnessToTravelTitelText: UILabel = {
  890.         let label = UILabel()
  891.         label.text = "Willingness to Travel"
  892.         label.font = .fontBold18
  893.         label.tag = 8
  894.         label.textColor = .white
  895.         return label
  896.     }()
  897.  
  898.     lazy var willingnessToTravelChipsView: TagListView = {
  899.         let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: willingnessToTravelTitelText, tags: allWillingnessToTravelChips)
  900.         listView.tag = 8
  901.         return listView
  902.     }()
  903.  
  904.     // Willingness To Negotiate
  905.     lazy var allWillingnessToNegotiateChips: [String] = []
  906.     lazy var willingnessToNegotiateTitleText: UILabel = {
  907.         let label = UILabel()
  908.         label.text = "Willingness to Negotiate"
  909.         label.font = .fontBold18
  910.         label.textColor = .white
  911.         return label
  912.     }()
  913.  
  914.     lazy var willingnessToNegotiateChipsView: TagListView = {
  915.         let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: willingnessToNegotiateTitleText, tags: allWillingnessToNegotiateChips)
  916.         return listView
  917.     }()
  918.  
  919.     // Willingness To Negotiate
  920.     lazy var allEquipmentOnHandChips: [String] = []
  921.     lazy var equipmentOnHandTitleText: UILabel = {
  922.         let label = UILabel()
  923.         label.text = "Equipment on Hand"
  924.         label.font = .fontBold18
  925.         label.textColor = .white
  926.         return label
  927.     }()
  928.  
  929.     lazy var equipmentOnHandChipsView: TagListView = {
  930.         let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: equipmentOnHandTitleText, tags: allEquipmentOnHandChips)
  931.         return listView
  932.     }()
  933.  
  934.     // Technical Rider
  935.     lazy var allTechnicalRiderChips: [String] = []
  936.     lazy var technicalRiderTitleText: UILabel = {
  937.         let label = UILabel()
  938.         label.text = "Technical Rider"
  939.         label.font = .fontBold18
  940.         label.textColor = .white
  941.         return label
  942.     }()
  943.  
  944.     lazy var technicalRiderChipsView: TagListView = {
  945.         let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: technicalRiderTitleText, tags: allTechnicalRiderChips)
  946.         return listView
  947.     }()
  948.  
  949.     lazy var allImagesArtistDetails: [UIImage?] = [] {
  950.         didSet {
  951.             photoCollection.collectionViewLayout = createLayoutPhotos()
  952.             photoCollection.reloadData()
  953.         }
  954.     }
  955.  
  956.     lazy var allVideosArtistDetails: [Video] = [] {
  957.         didSet {
  958.             videoCollection.collectionViewLayout = createLayoutVideos()
  959.             videoCollection.reloadData()
  960.         }
  961.     }
  962.     // create empty view
  963.     lazy var emptyView: EmptyView = {
  964.         let emptyView = EmptyView()
  965.         emptyView.setupView(.init(imageNameOrURL: K.appIconName, title: K.emptyString, subTitle: K.errorMessage))
  966.         emptyView.errorButtonHandler = {
  967.             emptyView.removeFromSuperview()
  968.             self.userArtistDetailsNetObserver(artistId: self.artistID)
  969.         }
  970.         emptyView.backButtonHandler = {
  971.             self.navigationController?.popViewController(animated: true)
  972.         }
  973.         return emptyView
  974.     }()
  975.  
  976.     func calculateSizeOfLanguagesStack() -> CGFloat {
  977.         let languagesHeight = spokenLanguageChipsView.intrinsicContentSize.height
  978.         return languagesHeight
  979.     }
  980.  
  981.     func calculateTagViewHeight() -> CGFloat {
  982.         let abiblityMondayHeight = allAbilibilityMondayChipText.isEmpty ? -48 :  abilibilityMondayChipsView.intrinsicContentSize.height
  983.         let abiblityTuesdayHeight = allAbilibilityTuesdayChipText.isEmpty ? -48 :abilibilityTuesdayChipsView.intrinsicContentSize.height
  984.         let abiblityWednesdayHeight = allAbilibilityWednesdayChipText.isEmpty ? -48 :abilibilityWednesdayChipsView.intrinsicContentSize.height
  985.         let abiblityThusdayHeight = allAbilibilityThusdayChipText.isEmpty ? -48 :abilibilityThusdayChipsView.intrinsicContentSize.height
  986.         let abiblityFridayHeight = allAbilibilityFridayChipText.isEmpty ? -48 :abilibilityFridayChipsView.intrinsicContentSize.height
  987.         let abiblitySaturdayHeight = allAbilibilitySaturdayChipText.isEmpty ? -48 :abilibilitySaturdayChipsView.intrinsicContentSize.height
  988.         let abiblitySundayHeight = allAbilibilitySundayChipText.isEmpty ? -48 :abilibilitySundayChipsView.intrinsicContentSize.height
  989.         let travelHeight = willingnessToTravelChipsView.intrinsicContentSize.height
  990.         let negotiateHeight = willingnessToNegotiateChipsView.intrinsicContentSize.height
  991.         let equipmentHeight = equipmentOnHandChipsView.intrinsicContentSize.height
  992.         let technicalHeight = technicalRiderChipsView.intrinsicContentSize.height
  993.         return (abiblityMondayHeight + abiblityTuesdayHeight + abiblityWednesdayHeight + abiblityThusdayHeight + abiblityFridayHeight + abiblitySaturdayHeight + abiblitySundayHeight + travelHeight + negotiateHeight + equipmentHeight + technicalHeight)
  994.     }
  995.  
  996.     func setUpTagView(on contentView: UIView, titleLabel: UILabel, tags: [String]) -> TagListView {
  997.         let tagView = TagListView.init()
  998.         tagView.paddingX = 10
  999.         tagView.paddingY = 10
  1000.         tagView.marginX = 8
  1001.         tagView.marginY = 8
  1002.         tagView.tagBackgroundColor = .colorWhiteAlpha2
  1003.         tagView.textColor = .white
  1004.         tagView.alignment = .left
  1005.         tagView.addTags(tags)
  1006.         contentView.addSubview(tagView)
  1007.         tagView.snp.makeConstraints { (make) in
  1008.             make.left.equalTo(titleLabel).offset(0)
  1009.             make.top.equalTo(titleLabel.snp.bottom).offset(15)
  1010.             make.right.equalTo(titleLabel)
  1011.         }
  1012.         tagView.tagViews.forEach { tag in
  1013.             tag.corner(cornerRadius: 8)
  1014.         }
  1015.         tagView.textFont = .fontRegular14
  1016.         tagView.setNeedsLayout()
  1017.         tagView.layoutIfNeeded()
  1018.         return tagView
  1019.     }
  1020.  
  1021.     override func viewDidLoad() {
  1022.         super.viewDidLoad()
  1023.         self.view.backgroundColor = .primaryDarkColor
  1024.         userArtistDetailsNetObserver(artistId: artistID)
  1025.         ratingCollection.reloadData()
  1026.     }
  1027.  
  1028.     func userArtistDetailsNetObserver(artistId: String?) {
  1029.         viewModal.userArtistDetailsProgressHandler = { [weak self] progress in
  1030.             switch progress {
  1031.             case .loading:
  1032.                 ActivityHUD.shared.showActivityIndicator()
  1033.             case .stopLoading:
  1034.                 ActivityHUD.shared.hideActivityIndicator()
  1035.             case .dataLoaded(let data):
  1036.                 self?.userArtistDetailsFetchSuccess(data: data)
  1037.             case .error(_):
  1038.                 self?.showEmptyView("alert_somthing_went_wrong_error_message".myLocalizedString)
  1039.                 self?.showAlert(message: "alert_somthing_went_wrong_error_message".myLocalizedString, selfDismiss: true)
  1040.             }
  1041.         }
  1042.         guard let artistId = artistId else { return }
  1043.         self.viewModal.userArtistDetails(artistId: artistId)
  1044.     }
  1045.  
  1046.     func showEmptyView(_ errorMessage: String?) {
  1047.         emptyView.setupView(.init(imageNameOrURL: K.emptyString, title: K.emptyString, subTitle: errorMessage ?? K.errorMessageSomethingWrong))
  1048.         self.view.addSubview(emptyView)
  1049.         emptyView.snp.makeConstraints { make in
  1050.             make.height.equalTo(450)
  1051.             make.width.equalTo(K.width - 16)
  1052.             make.centerX.equalTo(view)
  1053.             make.centerY.equalTo(view)
  1054.         }
  1055.     }
  1056.  
  1057.     func userArtistDetailsFetchSuccess(data: ArtistDetailsResponseModel) {
  1058.         guard let dataBody = data.body else {
  1059.             self.showAlert(message: data.message, selfDismiss: false)
  1060.             showEmptyView(data.message)
  1061.             return
  1062.         }
  1063.         getUserArtistDetails(data: dataBody)
  1064.     }
  1065. }
  1066.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement