Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // ArtistDetailsVC.swift
- // hubble-ios
- //
- // Created by Appdesk Services PVT. LTD. on 21/06/23.
- // Copyright (c) 2023 Hubble. All rights reserved.
- //
- import UIKit
- import GoogleMaps
- import TagListView
- import DropDown
- class ArtistDetailsVC: UIViewController {
- let viewModal = ArtistDetailsViewModel()
- var artistDetails: ArtistDetails?
- var artistID: String?
- var willingToNegotiate: Bool?
- var allServiceDetails: [Service] = []
- var reviewDetails: [Review] = [] {
- didSet {
- ratingCollection.reloadData()
- }
- }
- var seeAboutDetails: String?
- var contentViewHeight = 2400.0
- lazy var contentView: UIView = {
- let view = UIView()
- view.isAccessibilityElement = false
- view.backgroundColor = .primaryDarkColor
- return view
- }()
- lazy var requestBooking: (buttonBgView: UIView, container: UIView) = {
- var button = Common.createContinueButton(buttonName: "artist_detail_request_booking".myLocalizedString)
- button.buttonBgView.accessibilityElement(id: AccessIdentifier.requestDetailsBookingButton, label: AccessLabel.requestDetailsBookingButton)
- button.container.isAccessibilityElement = false
- let tapGr = UITapGestureRecognizer(target: self, action: #selector(requestBookingButtonTapped))
- button.buttonBgView.addGestureRecognizer(tapGr)
- return button
- }()
- lazy var scrollView: UIScrollView = {
- let scroll = UIScrollView()
- scroll.translatesAutoresizingMaskIntoConstraints = false
- scroll.showsVerticalScrollIndicator = true
- scroll.isScrollEnabled = true
- scroll.isAccessibilityElement = false
- scroll.addSubview(contentView)
- contentView.snp.makeConstraints { make in
- make.height.equalTo(contentViewHeight)
- make.top.bottom.left.right.width.equalTo(scroll)
- }
- return scroll
- }()
- // navigation bar
- lazy var backButton: UIButton = {
- let button = UIButton()
- button.accessibilityElement(id: AccessIdentifier.backButton, label: AccessLabel.backButton)
- button.backgroundColor = .colorWhiteAlpha3
- button.tintColor = .white
- button.corner(cornerRadius: 10)
- button.setImage(.backButton, for: .normal)
- button.isUserInteractionEnabled = true
- button.addTarget(self, action: #selector(backHomeTapped), for: .touchUpInside)
- return button
- }()
- lazy var threeDotMenuButton: UIButton = {
- let button = UIButton()
- button.setImage(.ellipsisVertical, for: .normal)
- button.tintColor = .white
- button.corner(cornerRadius: 10)
- button.backgroundColor = .colorWhiteAlpha3
- button.addTarget(self, action: #selector(threeDotMenuButtonTapped), for: .touchUpInside)
- return button
- }()
- let threeDotMenu: DropDown = {
- let menu = DropDown()
- menu.cornerRadius = 12
- menu.dataSource = ["artist_about_share_profile".myLocalizedString, "artist_about_report_this_profile".myLocalizedString]
- menu.cellNib = UINib(nibName: CustomDDC.customReuseId, bundle: .none)
- DropDown.appearance().textFont = .fontRegular16
- menu.separatorColor = .black
- menu.customCellConfiguration = { index, title, cell in
- guard let cell = cell as? CustomDDC else { return }
- if index == 1 {
- cell.cellImage.image = .reportProfile
- cell.optionLabel.textColor = .red
- } else {
- cell.cellImage.image = .shareProfile
- cell.optionLabel.textColor = .black
- }
- }
- return menu
- }()
- lazy var profileBackgroundImageView: UIImageView = {
- let image = UIImageView(isImageViewerEnable: true)
- image.accessibilityElement(id: AccessIdentifier.profileImage, label: AccessLabel.profileImage)
- image.contentMode = .scaleAspectFill
- image.clipsToBounds = true
- image.isUserInteractionEnabled = true
- return image
- }()
- lazy var userTypeNameLabel: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.userTypeNameLabel, label: AccessLabel.userTypeNameLabel)
- label.text = "artist_user_type_text".myLocalizedString
- label.textAlignment = .center
- label.isUserInteractionEnabled = true
- label.textColor = .white
- label.backgroundColor = .color111111Alpha6
- label.corner(cornerRadius: 8.0)
- label.font = .fontRegular16
- return label
- }()
- lazy var artistName: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.artistName, label: AccessLabel.artistName)
- label.isUserInteractionEnabled = true
- label.font = .fontBold42
- label.text = "artist_Name_text".myLocalizedString
- return label
- }()
- lazy var artistUserName: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.artistUserName, label: AccessLabel.artistUserName)
- label.isUserInteractionEnabled = true
- label.font = .fontRegular22
- label.text = "artist_User_Name_text".myLocalizedString
- return label
- }()
- lazy var reatingsTextlabel: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.reatingsTextlabel, label: AccessLabel.reatingsTextlabel)
- label.textColor = .white
- label.isUserInteractionEnabled = true
- label.font = .fontLight14
- label.text = "artist_reatings_text".myLocalizedString
- return label
- }()
- lazy var reatingStarImageView: UIImageView = {
- let imageView = UIImageView()
- imageView.accessibilityElement(id: AccessIdentifier.reatingStarImageView, label: AccessLabel.reatingStarImageView)
- imageView.image = .saveStarFill
- imageView.isUserInteractionEnabled = true
- imageView.tintColor = .yellow
- return imageView
- }()
- lazy var memberSinceTextLabel: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.memberSinceTextLabel, label: AccessLabel.memberSinceTextLabel)
- label.isUserInteractionEnabled = true
- label.font = .fontRegular16
- label.text = "artist_memberSince_text_label".myLocalizedString
- return label
- }()
- lazy var memberSinceLabel: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.memberSinceLabel, label: AccessLabel.memberSinceLabel)
- label.isUserInteractionEnabled = true
- label.font = .fontBold14
- label.text = "artist_memberSince_text".myLocalizedString
- return label
- }()
- lazy var priceTextLabel: UILabel = {
- let label = UILabel()
- label.text = "artist_pricing_range_text_Label".myLocalizedString
- label.accessibilityElement(id: AccessIdentifier.priceTextLabel, label: AccessLabel.priceTextLabel)
- label.font = .fontRegular16
- label.textColor = .white
- return label
- }()
- lazy var priceLabel: UILabel = {
- let label = UILabel()
- label.text = "artist_pricing_range_text".myLocalizedString
- label.accessibilityElement(id: AccessIdentifier.priceDetailLabel, label: AccessLabel.priceDetailLabel)
- label.font = .fontBold14
- label.textColor = .white
- return label
- }()
- lazy var noOfBookingTextLabel: UILabel = {
- let label = UILabel()
- label.text = "artist_noOfBooking_Text_Label".myLocalizedString
- label.accessibilityElement(id: AccessIdentifier.noOfBookingTextLabel, label: AccessLabel.noOfBookingTextLabel)
- label.font = .fontRegular16
- label.textColor = .white
- return label
- }()
- lazy var noOfBookingLabel: UILabel = {
- let label = UILabel()
- label.text = "artist_noOfBooking_text".myLocalizedString
- label.accessibilityElement(id: AccessIdentifier.noOfBookingLabel, label: AccessLabel.noOfBookingLabel)
- label.font = .fontBold14
- label.textColor = .white
- return label
- }()
- lazy var servicesTextLabel: UILabel = {
- let label = UILabel()
- label.text = "artist_services_text_label".myLocalizedString
- label.accessibilityElement(id: AccessIdentifier.servicesTextLabel, label: AccessLabel.servicesTextLabel)
- label.font = .fontBold20
- label.textColor = .white
- return label
- }()
- lazy var termAndConditionButton: UIButton = {
- let button = UIButton()
- button.accessibilityElement(id: AccessIdentifier.termAndConditionButton, label: AccessLabel.termAndConditionButton)
- button.backgroundColor = .clear
- button.tintColor = .white
- button.setTitle("service_detail_term_and_condition_text".myLocalizedString, for: .normal)
- button.titleLabel?.font = .fontRegular14
- button.addTarget(self, action: #selector(termAndConditionButtonTapped), for: .touchUpInside)
- return button
- }()
- lazy var sepraterLabel: UILabel = {
- let label = UILabel()
- label.backgroundColor = .white
- return label
- }()
- lazy var memberBgView: UIView = {
- let view = UIView()
- view.backgroundColor = .colorWhiteAlpha1
- view.corner(cornerRadius: 12.0)
- return view
- }()
- lazy var priceBgView: UIView = {
- let view = UIView()
- view.backgroundColor = .colorWhiteAlpha1
- view.corner(cornerRadius: 12.0)
- return view
- }()
- lazy var termConditionBgView: UIView = {
- let view = UIView()
- view.backgroundColor = .colorWhiteAlpha1
- view.corner(cornerRadius: 4.0)
- return view
- }()
- lazy var noOfBookingBgView: UIView = {
- let view = UIView()
- view.backgroundColor = .colorWhiteAlpha1
- view.corner(cornerRadius: 8.0)
- return view
- }()
- var allServices: [String] = [] {
- didSet {
- for (index, services) in allServices.enumerated() {
- if index == 3 { return }
- let label = UILabel()
- label.text = services
- label.textColor = .white
- label.font = .fontRegular16
- servicesLabels.append(label)
- servicesStack.addArrangedSubview(label)
- }
- }
- }
- lazy var serviceBgView: UIView = {
- let view = UIView()
- view.backgroundColor = .colorWhiteAlpha1
- view.corner(cornerRadius: 12.0)
- let tapGr = UITapGestureRecognizer(target: self, action: #selector(seeMoreAllServicesButtonTapped))
- view.addGestureRecognizer(tapGr)
- return view
- }()
- func calculateSizeOfServicesStack() -> CGFloat {
- var height = CGFloat()
- let size = allServices.first?.SizeOf(.fontRegular14) ?? .zero
- allServices.forEach { _ in
- height = size.height + height
- height += 4
- }
- if allServices.count >= 3 { height += 32}
- return height
- }
- lazy var servicesLabels: [UILabel] = {
- var servicesLabels: [UILabel] = []
- return servicesLabels
- }()
- lazy var servicesStack: UIStackView = {
- let stack = UIStackView(arrangedSubviews: servicesLabels)
- stack.axis = .vertical
- stack.alignment = .fill
- stack.distribution = .fillEqually
- stack.spacing = 4
- return stack
- }()
- lazy var seeMoreServicesButton: UIButton = {
- let button = UIButton()
- button.accessibilityElement(id: AccessIdentifier.seeMoreAboutButton, label: AccessLabel.seeMoreAboutButton)
- button.backgroundColor = .clear
- button.tintColor = .white
- button.corner(cornerRadius: 4)
- button.backgroundColor = .colorWhiteAlpha1
- button.setTitle("artist_seeMore_text".myLocalizedString, for: .normal)
- button.titleLabel?.font = .fontBold14
- button.addTarget(self, action: #selector(seeMoreAllServicesButtonTapped), for: .touchUpInside)
- return button
- }()
- lazy var memberPriceStackView: UIStackView = {
- let stackView = UIStackView(arrangedSubviews: [memberBgView, priceBgView])
- stackView.axis = .horizontal
- stackView.spacing = 8
- stackView.isAccessibilityElement = false
- stackView.distribution = .fill
- memberBgView.snp.makeConstraints { make in
- make.width.equalTo(136)
- }
- return stackView
- }()
- lazy var portfolioTextLabel: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.portfolioTextLabel, label: AccessLabel.portfolioTextLabel)
- label.text = "artist_portfolio_text_label".myLocalizedString
- label.font = .fontBold18
- return label
- }()
- lazy var photosTextLabel: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.photosTextLabel, label: AccessLabel.photosTextLabel)
- label.text = "artist_photo's_text".myLocalizedString
- label.font = .fontRegular16
- return label
- }()
- lazy var videosTextLabel: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.videosTextLabel, label: AccessLabel.videosTextLabel)
- label.text = "artist_videos_text".myLocalizedString
- label.font = .fontRegular16
- return label
- }()
- lazy var photoCollection: UICollectionView = {
- let collection = UICollectionView(frame: .zero, collectionViewLayout: createLayoutPhotos())
- collection.backgroundColor = .clear
- collection.translatesAutoresizingMaskIntoConstraints = false
- collection.dataSource = self
- collection.accessibilityElement(id: AccessIdentifier.photoCollectionView, label: AccessLabel.photoCollectionView)
- collection.delegate = self
- collection.tag = 0
- collection.register(StaggeredGridCVC.self, forCellWithReuseIdentifier: StaggeredGridCVC.reuseId)
- return collection
- }()
- lazy var videoCollection: UICollectionView = {
- let collection = UICollectionView(frame: .zero, collectionViewLayout: createLayoutVideos())
- collection.backgroundColor = .clear
- collection.translatesAutoresizingMaskIntoConstraints = false
- collection.dataSource = self
- collection.delegate = self
- collection.accessibilityElement(id: AccessIdentifier.videoCollectionView, label: AccessLabel.videoCollectionView)
- collection.tag = 1
- collection.register(StaggeredGridCVC.self, forCellWithReuseIdentifier: StaggeredGridCVC.reuseId)
- return collection
- }()
- lazy var ratingCollection: UICollectionView = {
- let layout = UICollectionViewFlowLayout()
- layout.scrollDirection = .horizontal
- let collection = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
- collection.corner(cornerRadius: 12.0)
- collection.backgroundColor = .clear
- collection.dataSource = self
- collection.delegate = self
- collection.showsHorizontalScrollIndicator = false
- collection.tag = 2
- collection.register(ReviewCVC.self, forCellWithReuseIdentifier: ReviewCVC.reuseId)
- return collection
- }()
- lazy var portfolioBgView: UIView = {
- let view = UIView()
- view.backgroundColor = .colorWhiteAlpha1
- view.isAccessibilityElement = false
- view.corner(cornerRadius: 12)
- view.addSubview(portfolioTextLabel)
- view.addSubview(photosTextLabel)
- view.addSubview(photoCollection)
- portfolioTextLabel.snp.makeConstraints { make in
- make.top.equalTo(view).offset(24)
- make.left.equalTo(view).offset(20)
- }
- photosTextLabel.snp.makeConstraints { make in
- make.top.equalTo(portfolioTextLabel.snp.bottom).offset(16)
- make.left.equalTo(view).offset(20)
- }
- photoCollection.snp.makeConstraints { make in
- make.top.equalTo(photosTextLabel.snp.bottom).offset(16)
- make.left.equalTo(view).offset(16)
- make.right.equalTo(view).inset(16)
- make.height.equalTo(200)
- }
- view.addSubview(videosTextLabel)
- videosTextLabel.snp.makeConstraints { make in
- make.top.equalTo(photoCollection.snp.bottom).offset(31)
- make.left.equalTo(view).offset(20)
- }
- view.addSubview(videoCollection)
- videoCollection.snp.makeConstraints { make in
- make.top.equalTo(videosTextLabel.snp.bottom).offset(16)
- make.left.equalTo(view).offset(16)
- make.right.equalTo(view).inset(16)
- make.height.equalTo(230)
- }
- return view
- }()
- lazy var serviceAboutPricingView: UIView = {
- let view = UIView()
- view.backgroundColor = .colorWhiteAlpha1
- view.corner(cornerRadius: 12.0)
- return view
- }()
- lazy var servicePricingView: UIView = {
- let view = UIView()
- view.backgroundColor = .colorWhiteAlpha2
- view.corner(cornerRadius: 12.0)
- return view
- }()
- lazy var aboutView: UIView = {
- let view = UIView()
- view.backgroundColor = .colorWhiteAlpha1
- view.corner(cornerRadius: 12.0)
- return view
- }()
- lazy var aboutTextLabel: UILabel = {
- let label = UILabel()
- label.text = "service_detail_about_text_label".myLocalizedString
- label.accessibilityElement(id: AccessIdentifier.aboutDetailLabel, label: AccessLabel.aboutDetailLabel)
- label.font = .fontBold16
- label.textColor = .white
- return label
- }()
- let aboutTextFromLanguage: String = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard"
- lazy var aboutLabel: UILabel = {
- let label = UILabel()
- label.text = aboutTextFromLanguage
- label.accessibilityElement(id: AccessIdentifier.detailsDetailLabel, label: AccessLabel.detailsDetailLabel)
- label.font = .fontRegular18
- label.textColor = .white
- label.lineBreakMode = .byWordWrapping
- label.numberOfLines = 4
- return label
- }()
- lazy var dummyAboutTextLabel: UILabel = {
- let label = UILabel()
- label.numberOfLines = 0
- label.text = aboutTextFromLanguage
- label.font = .fontRegular18
- label.textAlignment = .left
- label.textColor = .white
- label.backgroundColor = .black
- label.isHidden = true
- return label
- }()
- lazy var seeMoreAboutButton: UIButton = {
- let button = UIButton()
- button.accessibilityElement(id: AccessIdentifier.seeMoreDetailsButton, label: AccessLabel.seeMoreDetailsButton)
- button.backgroundColor = .clear
- button.tintColor = .white
- button.setTitle("artist_seeMore_text".myLocalizedString, for: .normal)
- button.titleLabel?.font = .fontBold16
- button.addTarget(self, action: #selector(seeAboutButtonTapped), for: .touchUpInside)
- return button
- }()
- lazy var fromCountryChips: [String] = []
- lazy var fromtTextLabel: UILabel = {
- let label = UILabel()
- label.text = "From"
- label.font = .fontBold18
- label.textColor = .white
- return label
- }()
- lazy var fromCountryChipsView: TagListView = {
- let listView = setUpTagView(on: self.aboutView, titleLabel: fromtTextLabel, tags: fromCountryChips)
- return listView
- }()
- lazy var spokenLanguageChips: [String] = []
- lazy var spokenLanguageTextLabel: UILabel = {
- let label = UILabel()
- label.text = "Spoken Language"
- label.font = .fontBold18
- label.textColor = .white
- return label
- }()
- lazy var spokenLanguageChipsView: TagListView = {
- let listView = setUpTagView(on: self.aboutView, titleLabel: spokenLanguageTextLabel, tags: spokenLanguageChips)
- return listView
- }()
- lazy var servicePricingTextLabel: UILabel = {
- let label = UILabel()
- label.text = "service_detail_pricing_text_label".myLocalizedString
- label.accessibilityElement(id: AccessIdentifier.priceTextLabel, label: AccessLabel.priceTextLabel)
- label.font = .fontRegular16
- label.textColor = .white
- return label
- }()
- lazy var servicePricingLabel: UILabel = {
- let label = UILabel()
- label.text = "service_detail_pricing_text".myLocalizedString
- label.accessibilityElement(id: AccessIdentifier.priceDetailLabel, label: AccessLabel.priceDetailLabel)
- label.font = .fontBold14
- label.textColor = .white
- return label
- }()
- lazy var aboutServicePricingTextLabel: UILabel = {
- let label = UILabel()
- label.text = "service_detail_about_text_label".myLocalizedString
- label.accessibilityElement(id: AccessIdentifier.aboutTextLabel, label: AccessLabel.aboutTextLabel)
- label.font = .fontBold18
- label.textColor = .white
- return label
- }()
- let aboutTextPriceLabel: String = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard"
- lazy var aboutServicePricingLabel: UILabel = {
- let label = UILabel()
- label.text = aboutTextPriceLabel
- label.accessibilityElement(id: AccessIdentifier.aboutDetailLabel, label: AccessLabel.aboutDetailLabel)
- label.font = .fontRegular18
- label.textColor = .white
- label.lineBreakMode = .byWordWrapping
- label.numberOfLines = 4
- return label
- }()
- lazy var dummyAboutTextPriceLabel: UILabel = {
- let label = UILabel()
- label.numberOfLines = 0
- label.text = aboutTextPriceLabel
- label.font = .fontRegular18
- label.textAlignment = .left
- label.textColor = .white
- label.backgroundColor = .black
- label.isHidden = true
- return label
- }()
- lazy var detailsServicePricingTextLabel: UILabel = {
- let label = UILabel()
- label.text = "service_detail_text_label".myLocalizedString
- label.accessibilityElement(id: AccessIdentifier.detailsTextLabel, label: AccessLabel.detailsTextLabel)
- label.font = .fontBold18
- label.textColor = .white
- return label
- }()
- let detailsTextPriceLabel: String = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard"
- lazy var detailsServicePricingLabel: UILabel = {
- let label = UILabel()
- label.text = detailsTextPriceLabel
- label.accessibilityElement(id: AccessIdentifier.detailsDetailLabel, label: AccessLabel.detailsDetailLabel)
- label.font = .fontRegular18
- label.textColor = .white
- label.lineBreakMode = .byWordWrapping
- label.numberOfLines = 4
- return label
- }()
- lazy var dummyDetailsTextPriceLabel: UILabel = {
- let label = UILabel()
- label.numberOfLines = 0
- label.text = detailsTextPriceLabel
- label.font = .fontRegular18
- label.textAlignment = .left
- label.textColor = .white
- label.backgroundColor = .black
- label.isHidden = true
- return label
- }()
- lazy var termAndConditionServicePricingButton: UIButton = {
- let button = UIButton()
- button.accessibilityElement(id: AccessIdentifier.termAndConditionButton, label: AccessLabel.termAndConditionButton)
- button.backgroundColor = .clear
- button.tintColor = .white
- button.setTitle("service_detail_term_and_condition_text".myLocalizedString, for: .normal)
- button.titleLabel?.font = .fontBook14
- button.addTarget(self, action: #selector(termAndConditionButtonTapped), for: .touchUpInside)
- return button
- }()
- lazy var seeMoreAboutServicePricingButton: UIButton = {
- let button = UIButton()
- button.accessibilityElement(id: AccessIdentifier.seeMoreAboutButton, label: AccessLabel.seeMoreAboutButton)
- button.backgroundColor = .clear
- button.tintColor = .white
- button.setTitle("artist_seeMore_text".myLocalizedString, for: .normal)
- button.titleLabel?.font = .fontBold14
- button.addTarget(self, action: #selector(termAndConditionButtonTapped), for: .touchUpInside)
- return button
- }()
- lazy var seeMoreDetailsServicePricingButton: UIButton = {
- let button = UIButton()
- button.accessibilityElement(id: AccessIdentifier.seeMoreDetailsButton, label: AccessLabel.seeMoreDetailsButton)
- button.backgroundColor = .clear
- button.tintColor = .white
- button.setTitle("artist_seeMore_text".myLocalizedString, for: .normal)
- button.titleLabel?.font = .fontBold14
- button.addTarget(self, action: #selector(termAndConditionButtonTapped), for: .touchUpInside)
- return button
- }()
- lazy var termConditionServicePricingBgView: UIView = {
- let view = UIView()
- view.backgroundColor = .colorWhiteAlpha2
- return view
- }()
- lazy var sepraterServicePricingLabel: UILabel = {
- let label = UILabel()
- label.backgroundColor = .white
- return label
- }()
- lazy var mapView: GMSMapView = {
- let view = GMSMapView()
- view.corner(cornerRadius: 16.0)
- return view
- }()
- lazy var reviewTextLabel: UILabel = {
- let label = UILabel()
- label.text = "artist_review_text_label".myLocalizedString
- label.accessibilityElement(id: AccessIdentifier.reviewTextLabel, label: AccessLabel.reviewTextLabel)
- label.font = .fontBold18
- label.textColor = .white
- return label
- }()
- lazy var reviewRatingLabel: UILabel = {
- let label = UILabel()
- label.text = "artist_reviewRating_text".myLocalizedString
- label.font = .fontLight14
- label.textColor = .white
- return label
- }()
- lazy var ReviewRatingStarImageView: UIImageView = {
- let imageView = UIImageView()
- imageView.accessibilityElement(id: AccessIdentifier.ReviewRatingStarImageView, label: AccessLabel.ReviewRatingStarImageView)
- imageView.image = .saveStarFill
- imageView.isUserInteractionEnabled = true
- imageView.tintColor = .yellow
- return imageView
- }()
- lazy var reviewSeeAllButton: UIButton = {
- let button = UIButton()
- button.accessibilityElement(id: AccessIdentifier.reviewSeeAllButton, label: AccessLabel.reviewSeeAllButton)
- button.backgroundColor = .clear
- button.tintColor = .white
- button.setTitle("artist_seeAll_text_label".myLocalizedString, for: .normal)
- button.titleLabel?.font = .fontBold14
- return button
- }()
- lazy var ratingStackView: UIStackView = {
- let stack = UIStackView(arrangedSubviews: [reviewTextLabel, reviewRatingLabel, ReviewRatingStarImageView])
- stack.spacing = 4.0
- stack.axis = .horizontal
- stack.distribution = .fill
- reviewTextLabel.snp.makeConstraints { make in
- make.width.equalTo(77)
- make.height.equalTo(26)
- }
- reviewRatingLabel.snp.makeConstraints { make in
- make.height.equalTo(17)
- }
- ReviewRatingStarImageView.snp.makeConstraints { make in
- make.width.equalTo(12)
- make.height.equalTo(11)
- }
- return stack
- }()
- // AVilibility section
- lazy var avilivilityBgView: UIView = {
- let view = UIView()
- view.corner(cornerRadius: 12)
- view.backgroundColor = .colorWhiteAlpha1
- return view
- }()
- lazy var abilibilityTitleText: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
- label.text = "artist_personal_info_availability".myLocalizedString
- label.font = .fontBold18
- label.textColor = .white
- return label
- }()
- // AVilibility To Monday Day Slot
- lazy var arrayOfAbilibilitysChipView = [
- self.abilibilityMondayChipsView,
- self.abilibilityTuesdayChipsView,
- self.abilibilityWednesdayChipsView,
- self.abilibilityThusdayChipsView,
- self.abilibilityFridayChipsView,
- self.abilibilitySaturdayChipsView,
- self.abilibilitySundayChipsView
- ]
- lazy var arrayOfAbilibilitysChipTitleView = [
- self.abilibilityMondayTitleText,
- self.abilibilityTuesdayTitleText,
- self.abilibilityWednesdayTitleText,
- self.abilibilityThusdayTitleText,
- self.abilibilityFridayTitleText,
- self.abilibilitySaturdayTitleText,
- self.abilibilitySundayTitleText
- ]
- var lastDisplayedArrayIndexOfAbilibilitysChipView: Int = .zero
- lazy var allAbilibilityMondayChipText: [String] = []
- lazy var abilibilityMondayTitleText: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
- label.text = "artist_day_monday_slot_label".myLocalizedString
- label.font = .fontBold14
- label.textColor = .white
- label.tag = 1
- return label
- }()
- lazy var abilibilityMondayChipsView: TagListView = {
- let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilityMondayTitleText, tags: allAbilibilityMondayChipText)
- listView.tag = 1
- return listView
- }()
- // AVilibility To Tuesday Day Slot
- lazy var allAbilibilityTuesdayChipText: [String] = []
- lazy var abilibilityTuesdayTitleText: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
- label.text = "artist_day_tuesday_slot_label".myLocalizedString
- label.font = .fontBold14
- label.textColor = .white
- label.tag = 2
- return label
- }()
- lazy var abilibilityTuesdayChipsView: TagListView = {
- let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilityTuesdayTitleText, tags: allAbilibilityTuesdayChipText)
- listView.tag = 2
- return listView
- }()
- // AVilibility To Wednesday Day Slot
- lazy var allAbilibilityWednesdayChipText: [String] = []
- lazy var abilibilityWednesdayTitleText: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
- label.text = "artist_day_wednesday_slot_label".myLocalizedString
- label.font = .fontBold14
- label.textColor = .white
- label.tag = 3
- return label
- }()
- lazy var abilibilityWednesdayChipsView: TagListView = {
- let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilityWednesdayTitleText, tags: allAbilibilityWednesdayChipText)
- listView.tag = 3
- return listView
- }()
- // AVilibility To Thusday Day Slot
- lazy var allAbilibilityThusdayChipText: [String] = []
- lazy var abilibilityThusdayTitleText: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
- label.text = "artist_day_thusday_slot_label".myLocalizedString
- label.font = .fontBold14
- label.textColor = .white
- label.tag = 4
- return label
- }()
- lazy var abilibilityThusdayChipsView: TagListView = {
- let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilityThusdayTitleText, tags: allAbilibilityThusdayChipText)
- listView.tag = 4
- return listView
- }()
- // AVilibility To Friday Day Slot
- lazy var allAbilibilityFridayChipText: [String] = []
- lazy var abilibilityFridayTitleText: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
- label.text = "artist_day_friday_slot_label".myLocalizedString
- label.font = .fontBold14
- label.textColor = .white
- label.tag = 5
- return label
- }()
- lazy var abilibilityFridayChipsView: TagListView = {
- let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilityFridayTitleText, tags: allAbilibilityFridayChipText)
- listView.tag = 5
- return listView
- }()
- // AVilibility To Saturday Day Slot
- lazy var allAbilibilitySaturdayChipText: [String] = []
- lazy var abilibilitySaturdayTitleText: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
- label.text = "artist_day_saturday_slot_label".myLocalizedString
- label.font = .fontBold14
- label.tag = 6
- label.textColor = .white
- return label
- }()
- lazy var abilibilitySaturdayChipsView: TagListView = {
- let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilitySaturdayTitleText, tags: allAbilibilitySaturdayChipText)
- listView.tag = 6
- return listView
- }()
- // AVilibility To Sunday Day Slot
- lazy var allAbilibilitySundayChipText: [String] = []
- lazy var abilibilitySundayTitleText: UILabel = {
- let label = UILabel()
- label.accessibilityElement(id: AccessIdentifier.artistPersonalInfoAbilibilitySection, label: AccessLabel.artistPersonalInfoAbilibilitySection)
- label.text = "artist_day_sunday_slot_label".myLocalizedString
- label.font = .fontBold14
- label.tag = 7
- label.textColor = .white
- return label
- }()
- lazy var abilibilitySundayChipsView: TagListView = {
- let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: abilibilitySundayTitleText, tags: allAbilibilitySundayChipText)
- listView.tag = 7
- return listView
- }()
- // Willingness To Travel
- lazy var allWillingnessToTravelChips: [String] = []
- lazy var willingnessToTravelTitelText: UILabel = {
- let label = UILabel()
- label.text = "Willingness to Travel"
- label.font = .fontBold18
- label.tag = 8
- label.textColor = .white
- return label
- }()
- lazy var willingnessToTravelChipsView: TagListView = {
- let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: willingnessToTravelTitelText, tags: allWillingnessToTravelChips)
- listView.tag = 8
- return listView
- }()
- // Willingness To Negotiate
- lazy var allWillingnessToNegotiateChips: [String] = []
- lazy var willingnessToNegotiateTitleText: UILabel = {
- let label = UILabel()
- label.text = "Willingness to Negotiate"
- label.font = .fontBold18
- label.textColor = .white
- return label
- }()
- lazy var willingnessToNegotiateChipsView: TagListView = {
- let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: willingnessToNegotiateTitleText, tags: allWillingnessToNegotiateChips)
- return listView
- }()
- // Willingness To Negotiate
- lazy var allEquipmentOnHandChips: [String] = []
- lazy var equipmentOnHandTitleText: UILabel = {
- let label = UILabel()
- label.text = "Equipment on Hand"
- label.font = .fontBold18
- label.textColor = .white
- return label
- }()
- lazy var equipmentOnHandChipsView: TagListView = {
- let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: equipmentOnHandTitleText, tags: allEquipmentOnHandChips)
- return listView
- }()
- // Technical Rider
- lazy var allTechnicalRiderChips: [String] = []
- lazy var technicalRiderTitleText: UILabel = {
- let label = UILabel()
- label.text = "Technical Rider"
- label.font = .fontBold18
- label.textColor = .white
- return label
- }()
- lazy var technicalRiderChipsView: TagListView = {
- let listView = setUpTagView(on: self.avilivilityBgView, titleLabel: technicalRiderTitleText, tags: allTechnicalRiderChips)
- return listView
- }()
- lazy var allImagesArtistDetails: [UIImage?] = [] {
- didSet {
- photoCollection.collectionViewLayout = createLayoutPhotos()
- photoCollection.reloadData()
- }
- }
- lazy var allVideosArtistDetails: [Video] = [] {
- didSet {
- videoCollection.collectionViewLayout = createLayoutVideos()
- videoCollection.reloadData()
- }
- }
- // create empty view
- lazy var emptyView: EmptyView = {
- let emptyView = EmptyView()
- emptyView.setupView(.init(imageNameOrURL: K.appIconName, title: K.emptyString, subTitle: K.errorMessage))
- emptyView.errorButtonHandler = {
- emptyView.removeFromSuperview()
- self.userArtistDetailsNetObserver(artistId: self.artistID)
- }
- emptyView.backButtonHandler = {
- self.navigationController?.popViewController(animated: true)
- }
- return emptyView
- }()
- func calculateSizeOfLanguagesStack() -> CGFloat {
- let languagesHeight = spokenLanguageChipsView.intrinsicContentSize.height
- return languagesHeight
- }
- func calculateTagViewHeight() -> CGFloat {
- let abiblityMondayHeight = allAbilibilityMondayChipText.isEmpty ? -48 : abilibilityMondayChipsView.intrinsicContentSize.height
- let abiblityTuesdayHeight = allAbilibilityTuesdayChipText.isEmpty ? -48 :abilibilityTuesdayChipsView.intrinsicContentSize.height
- let abiblityWednesdayHeight = allAbilibilityWednesdayChipText.isEmpty ? -48 :abilibilityWednesdayChipsView.intrinsicContentSize.height
- let abiblityThusdayHeight = allAbilibilityThusdayChipText.isEmpty ? -48 :abilibilityThusdayChipsView.intrinsicContentSize.height
- let abiblityFridayHeight = allAbilibilityFridayChipText.isEmpty ? -48 :abilibilityFridayChipsView.intrinsicContentSize.height
- let abiblitySaturdayHeight = allAbilibilitySaturdayChipText.isEmpty ? -48 :abilibilitySaturdayChipsView.intrinsicContentSize.height
- let abiblitySundayHeight = allAbilibilitySundayChipText.isEmpty ? -48 :abilibilitySundayChipsView.intrinsicContentSize.height
- let travelHeight = willingnessToTravelChipsView.intrinsicContentSize.height
- let negotiateHeight = willingnessToNegotiateChipsView.intrinsicContentSize.height
- let equipmentHeight = equipmentOnHandChipsView.intrinsicContentSize.height
- let technicalHeight = technicalRiderChipsView.intrinsicContentSize.height
- return (abiblityMondayHeight + abiblityTuesdayHeight + abiblityWednesdayHeight + abiblityThusdayHeight + abiblityFridayHeight + abiblitySaturdayHeight + abiblitySundayHeight + travelHeight + negotiateHeight + equipmentHeight + technicalHeight)
- }
- func setUpTagView(on contentView: UIView, titleLabel: UILabel, tags: [String]) -> TagListView {
- let tagView = TagListView.init()
- tagView.paddingX = 10
- tagView.paddingY = 10
- tagView.marginX = 8
- tagView.marginY = 8
- tagView.tagBackgroundColor = .colorWhiteAlpha2
- tagView.textColor = .white
- tagView.alignment = .left
- tagView.addTags(tags)
- contentView.addSubview(tagView)
- tagView.snp.makeConstraints { (make) in
- make.left.equalTo(titleLabel).offset(0)
- make.top.equalTo(titleLabel.snp.bottom).offset(15)
- make.right.equalTo(titleLabel)
- }
- tagView.tagViews.forEach { tag in
- tag.corner(cornerRadius: 8)
- }
- tagView.textFont = .fontRegular14
- tagView.setNeedsLayout()
- tagView.layoutIfNeeded()
- return tagView
- }
- override func viewDidLoad() {
- super.viewDidLoad()
- self.view.backgroundColor = .primaryDarkColor
- userArtistDetailsNetObserver(artistId: artistID)
- ratingCollection.reloadData()
- }
- func userArtistDetailsNetObserver(artistId: String?) {
- viewModal.userArtistDetailsProgressHandler = { [weak self] progress in
- switch progress {
- case .loading:
- ActivityHUD.shared.showActivityIndicator()
- case .stopLoading:
- ActivityHUD.shared.hideActivityIndicator()
- case .dataLoaded(let data):
- self?.userArtistDetailsFetchSuccess(data: data)
- case .error(_):
- self?.showEmptyView("alert_somthing_went_wrong_error_message".myLocalizedString)
- self?.showAlert(message: "alert_somthing_went_wrong_error_message".myLocalizedString, selfDismiss: true)
- }
- }
- guard let artistId = artistId else { return }
- self.viewModal.userArtistDetails(artistId: artistId)
- }
- func showEmptyView(_ errorMessage: String?) {
- emptyView.setupView(.init(imageNameOrURL: K.emptyString, title: K.emptyString, subTitle: errorMessage ?? K.errorMessageSomethingWrong))
- self.view.addSubview(emptyView)
- emptyView.snp.makeConstraints { make in
- make.height.equalTo(450)
- make.width.equalTo(K.width - 16)
- make.centerX.equalTo(view)
- make.centerY.equalTo(view)
- }
- }
- func userArtistDetailsFetchSuccess(data: ArtistDetailsResponseModel) {
- guard let dataBody = data.body else {
- self.showAlert(message: data.message, selfDismiss: false)
- showEmptyView(data.message)
- return
- }
- getUserArtistDetails(data: dataBody)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement