Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // ArtistDetailsVC+Methods.swift
- // hubble-ios
- //
- // Created by Appdesk Services PVT. LTD. on 03/07/23.
- // Copyright (c) 2023 Hubble. All rights reserved.
- //
- import Foundation
- import GoogleMaps
- import AVFoundation
- import SDWebImage
- import SnapshotKit
- import TagListView
- // MARK: - Targets Methods
- extension ArtistDetailsVC {
- @objc func backHomeTapped() {
- navigationController?.popViewController(animated: true)
- }
- @objc func threeDotMenuButtonTapped() {
- threeDotMenu.anchorView = self.threeDotMenuButton
- threeDotMenu.bottomOffset = CGPoint(x: .zero, y: (threeDotMenu.anchorView?.plainView.bounds.height) ?? .zero)
- threeDotMenu.show()
- threeDotMenu.selectionAction = { [weak self] index, title in
- self?.threeDotMenu.deselectRow(at: index)
- switch index {
- case .zero:
- self?.takeScreenShortAndShareImage()
- case 1:
- self?.reportArtistProfile()
- default: break
- }
- self?.threeDotMenu.removeFromSuperview()
- }
- }
- func reportArtistProfile() {
- let reportType: [String] = [
- "Inappropriate Content",
- "Inappropriate Behavior",
- "Misrepresentation",
- "Spam",
- "Suspicious Activity",
- "Unsafe or Unsanitary environment",
- "Unprofessional Communication",
- "Other"
- ]
- let reportSheet = ReportOptionSheetVC()
- reportSheet.options = reportType
- reportSheet.artistId = self.artistID ?? K.emptyString
- if let sheet = reportSheet.sheetPresentationController {
- sheet.detents = [.custom(resolver: { context in
- context.maximumDetentValue * 0.65
- })]
- sheet.preferredCornerRadius = 12.0
- }
- reportSheet.reportSuccessCallback = { [weak self] message in
- reportSheet.dismiss(animated: true)
- DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: {
- self?.showMessage(message: message)
- })
- }
- self.present(reportSheet, animated: true)
- }
- func showMessage(message: String) {
- self.showSnackbar(message: "snakebar_message_profile_detail_Reported_successfully".myLocalizedString)
- }
- func takeScreenShortAndShareImage() {
- backButton.isHidden = true
- threeDotMenu.hide()
- self.contentView.asyncTakeSnapshotOfFullContent { [weak self] screenshot in
- guard let self = self else { return }
- let waterMarked = addWatermark(to: screenshot ?? UIImage(), with: .waterMark ?? UIImage(), at: .init(x: contentView.x + 30, y: self.contentView.centerY))
- let sharesheet = UIActivityViewController(activityItems: [waterMarked], applicationActivities: .none)
- self.present(sharesheet, animated: true) {
- self.backButton.isHidden = false
- }
- }
- }
- @objc func seeMoreAllServicesButtonTapped() {
- let allServicesVC = AllServicesVC()
- allServicesVC.allservicelist = allServiceDetails
- allServicesVC.artistId = self.artistID
- navigationController?.pushViewController(allServicesVC, animated: true)
- }
- @objc func seeAboutButtonTapped() {
- let seeMoreDetailsVC = SeeMoreDetailsVC()
- seeMoreDetailsVC.seeMoreTitle = "service_detail_see_more_about_text".myLocalizedString
- seeMoreDetailsVC.seeMoreDetials = seeAboutDetails
- if let sheet = seeMoreDetailsVC.sheetPresentationController {
- sheet.detents = [.medium()]
- sheet.largestUndimmedDetentIdentifier = .medium
- sheet.prefersScrollingExpandsWhenScrolledToEdge = false
- sheet.prefersEdgeAttachedInCompactHeight = true
- sheet.widthFollowsPreferredContentSizeWhenEdgeAttached = true
- }
- self.present(seeMoreDetailsVC, animated: true)
- }
- @objc func termAndConditionButtonTapped() {
- // let seeMoreDetailsVC = SeeMoreDetailsVC()
- // seeMoreDetailsVC.seeMoreTitle = "service_detail_see_more_termCondition_text".myLocalizedString
- // seeMoreDetailsVC.seeMoreDetials = K.emptyString
- // if let sheet = seeMoreDetailsVC.sheetPresentationController {
- // sheet.detents = [.medium()]
- // sheet.largestUndimmedDetentIdentifier = .medium
- // sheet.prefersScrollingExpandsWhenScrolledToEdge = false
- // sheet.prefersEdgeAttachedInCompactHeight = true
- // sheet.widthFollowsPreferredContentSizeWhenEdgeAttached = true
- // }
- // self.present(seeMoreDetailsVC, animated: true)
- self.pushToWebScreen(title: K.termsConditionsTitle, urlString: K.termsConditionsUrl)
- }
- @objc func requestBookingButtonTapped() {
- if allServices.isEmpty {
- self.showSnackbar(message: "artist_about_no_services_snackbar_message".myLocalizedString)
- } else {
- let selectServiceVC = SelectServiceVC()
- selectServiceVC.allservicelist = allServiceDetails
- selectServiceVC.artistId = self.artistID
- selectServiceVC.willingToNegotiate = self.willingToNegotiate
- navigationController?.pushViewController(selectServiceVC, animated: true)
- }
- }
- func pushToWebScreen(title: String, urlString: String) {
- let webContentVC = WebContentVC()
- webContentVC.webTitle = title
- webContentVC.webUrl = urlString
- self.navigationController?.pushViewController(webContentVC, animated: true)
- }
- }
- // MARK: - Private Methods
- extension ArtistDetailsVC {
- private func getVideoPhotoURLFromFileKey(_ data: ArtistDetails) {
- // Profile Picture
- if let profileImageURL = URL(string: data.profilePictureKey) {
- self.profileBackgroundImageView.sd_setImage(with: profileImageURL)
- }
- // Photos
- let photoUrls = data.portfolioPhotos.map { $0.mediaURL }
- for photoKey in photoUrls {
- let url = URL(string: photoKey) ?? K.compnyUrl
- SDWebImageManager.shared.loadImage(with: url, progress: .none) { image, _, _, _, _, _ in
- if let image = image {
- self.allImagesArtistDetails.append(image)
- }
- }
- }
- // Videos
- for videoKey in data.portfolioVideos {
- Task {
- let videoURL = URL(string: videoKey.mediaURL) ?? K.compnyUrl
- let thumbnail = await AVAsset(url: videoURL).generateThumbnailAsync(seconds: 1)
- self.allVideosArtistDetails.append(.init(videoUrl: videoURL, videoKey: videoKey.fileName, thumbnail: thumbnail, status: .uploaded))
- self.videoCollection.collectionViewLayout = self.createLayoutVideos()
- self.videoCollection.reloadData()
- }
- }
- }
- func loadMapUI(latitude: Double, logitude: Double) {
- let camera = GMSCameraPosition.camera(withLatitude: latitude, longitude: logitude, zoom: 19.0)
- self.mapView.camera = camera
- self.mapView.isMyLocationEnabled = true
- mapView.isUserInteractionEnabled = false
- DispatchQueue.main.async {
- let maker = GMSMarker()
- maker.tracksViewChanges = false
- let markerImage = UIImage(named: "locationPin")
- let markerView = UIImageView(image: markerImage)
- markerView.frame = CGRect(x: 0, y: 0, width: 25, height: 30)
- maker.iconView = markerView
- maker.position = CLLocationCoordinate2D(latitude: latitude, longitude: logitude)
- maker.map = self.mapView
- }
- }
- func getUserArtistDetails(data: ArtistDetails) {
- allServiceDetails = data.services
- loadMapUI(latitude: data.primaryLocation.coordinates[1], logitude: data.primaryLocation.coordinates[0])
- userTypeNameLabel.text = data.userType
- let name = data.showLastName ? "\(data.firstName) \(data.lastName)" : data.firstName
- artistName.text = data.userType == UserType.artist ? name : data.organizationName
- artistUserName.text = "@\(data.userName)"
- let reviews = data.rating ?? .zero
- let roundedValue = (reviews * 10).rounded() / 10
- reatingsTextlabel.text = String(roundedValue)
- memberSinceLabel.text = convertTimestampToMonthAndYear(timestamp: data.createdAt)
- priceLabel.text = String("$\(data.price ?? 0)") + "/\(data.rate ?? "0.0")"
- noOfBookingLabel.text = String(data.numberOfBooking ?? 0)
- aboutLabel.text = data.about
- var serviceName: [String] = []
- data.services.forEach { service in
- if serviceName.count > 3 { return }
- serviceName.append(service.serviceName)
- }
- self.allServices = serviceName
- self.reviewDetails = data.reviews
- self.setUpUI()
- let ratingStar = data.rating ?? .zero
- if ratingStar < 0.5 {
- reatingsTextlabel.isHidden = true
- reatingStarImageView.isHidden = true
- } else {
- reatingsTextlabel.text = String(roundedValue)
- reviewRatingLabel.text = String(roundedValue)
- self.reatingStarImageView.isHidden = false
- }
- fromCountryChipsView.addTag(data.primaryLocation.address)
- fromCountryChipsView.cornerRadius = 8.0
- spokenLanguageChipsView.addTags(data.languages)
- spokenLanguageChipsView.cornerRadius = 8.0
- if let availability = data.availability {
- self.allAbilibilityMondayChipText = availability.monday
- handleHeightOfAbilibility(
- tagView: abilibilityMondayChipsView,
- tagData: allAbilibilityMondayChipText,
- titleLabel: abilibilityMondayTitleText,
- upperLabel: abilibilityTitleText
- )
- self.allAbilibilityTuesdayChipText = availability.tuesday
- handleHeightOfAbilibility(
- tagView: abilibilityTuesdayChipsView,
- tagData: allAbilibilityTuesdayChipText,
- titleLabel: abilibilityTuesdayTitleText,
- upperLabel: abilibilityMondayTitleText
- )
- self.allAbilibilityWednesdayChipText = availability.wednesday
- handleHeightOfAbilibility(
- tagView: abilibilityWednesdayChipsView,
- tagData: allAbilibilityWednesdayChipText,
- titleLabel: abilibilityWednesdayTitleText,
- upperLabel: abilibilityTuesdayTitleText
- )
- self.allAbilibilityThusdayChipText = availability.thursday
- handleHeightOfAbilibility(
- tagView: abilibilityThusdayChipsView,
- tagData: allAbilibilityThusdayChipText,
- titleLabel: abilibilityThusdayTitleText,
- upperLabel: abilibilityWednesdayTitleText
- )
- self.allAbilibilityFridayChipText = availability.friday
- handleHeightOfAbilibility(
- tagView: abilibilityFridayChipsView,
- tagData: allAbilibilityFridayChipText,
- titleLabel: abilibilityFridayTitleText,
- upperLabel: abilibilityThusdayTitleText
- )
- self.allAbilibilitySaturdayChipText = availability.saturday
- handleHeightOfAbilibility(
- tagView: abilibilitySaturdayChipsView,
- tagData: allAbilibilitySaturdayChipText,
- titleLabel: abilibilitySaturdayTitleText,
- upperLabel: abilibilityFridayTitleText
- )
- self.allAbilibilitySundayChipText = availability.sunday
- handleHeightOfAbilibility(
- tagView: abilibilitySundayChipsView,
- tagData: allAbilibilitySundayChipText,
- titleLabel: abilibilitySundayTitleText,
- upperLabel: abilibilitySaturdayTitleText
- )
- }
- willingnessToTravelTitelText.snp.remakeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- if allAbilibilitySundayChipText.isEmpty {
- make.top.equalTo(arrayOfAbilibilitysChipView[lastDisplayedArrayIndexOfAbilibilitysChipView - 1].bottom).offset(topOffset)
- } else {
- make.top.equalTo(abilibilitySundayChipsView.snp.bottom).offset(topOffset)
- }
- }
- willingnessToTravelChipsView.addTag(data.willingToTravel ? "Yes" : "No")
- willingnessToTravelChipsView.cornerRadius = 8.0
- willingnessToNegotiateChipsView.addTag(data.willingToNegotiate ? "Yes": "No")
- willingnessToNegotiateChipsView.cornerRadius = 8.0
- equipmentOnHandChipsView.addTags(data.equipmentsOnHand)
- equipmentOnHandChipsView.cornerRadius = 8.0
- technicalRiderChipsView.addTags(data.technicalRider)
- technicalRiderChipsView.cornerRadius = 8.0
- seeAboutDetails = data.about
- willingToNegotiate = data.willingToNegotiate
- updateConstraints(data: data)
- getVideoPhotoURLFromFileKey(data)
- }
- func handleHeightOfAbilibility(tagView: TagListView, tagData: [String], titleLabel: UILabel, upperLabel: UILabel) {
- if tagData.isEmpty {
- titleLabel.snp.remakeConstraints { make in
- make.bottom.equalTo(upperLabel)
- }
- tagView.snp.remakeConstraints { make in
- make.bottom.equalTo(upperLabel)
- }
- titleLabel.isHidden = true
- tagView.isHidden = true
- } else {
- titleLabel.snp.remakeConstraints { make in
- make.top.equalTo(
- self.lastDisplayedArrayIndexOfAbilibilitysChipView == .zero ?
- abilibilityTitleText.bottom :
- arrayOfAbilibilitysChipView[
- self.lastDisplayedArrayIndexOfAbilibilitysChipView - 1
- ].bottom
- ).offset(topOffset)
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- }
- tagView.cornerRadius = 8.0
- tagView.addTags(tagData)
- self.lastDisplayedArrayIndexOfAbilibilitysChipView = tagView.tag
- }
- }
- func updateConstraints(data: ArtistDetails) {
- let maxWidth = UIScreen.main.bounds.size.width - 40
- let dummyAboutTextLabelHeight = self.dummyAboutTextLabel.sizeThatFits(CGSize(width: maxWidth, height: CGFloat.greatestFiniteMagnitude))
- let aboutLabelHeight = self.aboutLabel.sizeThatFits(CGSize(width: maxWidth, height: CGFloat.greatestFiniteMagnitude))
- if dummyAboutTextLabelHeight.height > aboutLabelHeight.height {
- seeMoreAboutButton.snp.removeConstraints()
- seeMoreAboutButton.isHidden = true
- } else {
- seeMoreAboutButton.isHidden = false
- }
- if reviewDetails.isEmpty {
- ratingStackView.isHidden = true
- contentView.snp.updateConstraints { make in
- make.height.equalTo(contentViewHeight - 170)
- }
- }
- let height = calculateSizeOfServicesStack()
- contentView.snp.updateConstraints { make in
- make.height.equalTo(contentViewHeight + height)
- }
- let languageHeight = calculateSizeOfLanguagesStack()
- aboutView.snp.updateConstraints { make in
- make.height.equalTo(aboutView.height + languageHeight + aboutLabel.intrinsicContentSize.height)
- }
- self.contentView.snp.updateConstraints { make in
- make.height.equalTo(contentViewHeight + languageHeight + aboutLabel.intrinsicContentSize.height + seeMoreAboutButton.height)
- }
- avilivilityBgView.snp.updateConstraints { make in
- make.height.equalTo(calculateTagViewHeight() + 600)
- }
- let finalContentViewHeight = self.contentViewHeight + avilivilityBgView.height + calculateTagViewHeight() + 100 + (reviewDetails.isEmpty ? 0 : 250)
- contentView.snp.updateConstraints { make in
- make.height.equalTo(finalContentViewHeight)
- }
- contentView.setNeedsLayout()
- contentView.updateConstraints()
- if data.portfolioPhotos.isEmpty && data.portfolioVideos.isEmpty {
- portfolioBgView.isHidden = true
- servicesTextLabel.snp.remakeConstraints { make in
- make.top.equalTo(aboutView.bottom).offset(12)
- make.left.equalTo(contentView).offset(16)
- make.height.equalTo(24)
- }
- contentView.snp.updateConstraints { make in
- make.height.equalTo(finalContentViewHeight - 600)
- }
- return
- }
- if data.portfolioPhotos.isEmpty {
- photosTextLabel.isHidden = true
- photoCollection.isHidden = true
- videosTextLabel.snp.remakeConstraints { make in
- make.top.equalTo(portfolioTextLabel.bottom).offset(topOffset)
- make.left.equalTo(portfolioTextLabel.left)
- }
- videoCollection.snp.remakeConstraints { make in
- make.top.equalTo(videosTextLabel.snp.bottom).offset(topOffset)
- make.left.equalTo(portfolioBgView).offset(leftOffset)
- make.right.equalTo(portfolioBgView).inset(rightInset)
- make.height.equalTo(230)
- }
- portfolioBgView.snp.updateConstraints { make in
- let portfolioTextMargin = 50.0
- make.height.equalTo((portfolioBgView.height/2) + portfolioTextMargin)
- }
- contentView.snp.updateConstraints { make in
- make.height.equalTo(finalContentViewHeight - 250)
- }
- }
- if data.portfolioVideos.isEmpty {
- videosTextLabel.isHidden = true
- videoCollection.isHidden = true
- portfolioBgView.snp.updateConstraints { make in
- let portfolioTextMargin = 50.0
- make.height.equalTo((portfolioBgView.height/2) + portfolioTextMargin)
- }
- contentView.snp.updateConstraints { make in
- make.height.equalTo(finalContentViewHeight - 250)
- }
- }
- contentView.setNeedsLayout()
- contentView.updateConstraints()
- }
- func setUpUI() {
- self.view.addSubview(scrollView)
- scrollView.snp.makeConstraints { make in
- make.top.equalTo(self.view.safeAreaLayoutGuide)
- make.bottom.left.right.equalTo(self.view)
- make.width.equalTo(self.view)
- make.bottom.equalTo(self.view.safeAreaLayoutGuide).inset(96)
- }
- self.view.addSubview(requestBooking.container)
- requestBooking.container.snp.makeConstraints { make in
- make.left.right.equalTo(self.view)
- make.top.equalTo(scrollView.snp.bottom)
- make.bottom.equalTo(self.view.safeAreaLayoutGuide)
- make.height.equalTo(Common.containerHeight96)
- }
- contentView.addSubview(profileBackgroundImageView)
- profileBackgroundImageView.snp.makeConstraints { make in
- make.top.equalTo(0)
- make.left.right.equalTo(contentView)
- make.height.width.equalTo(300)
- }
- profileBackgroundImageView.addSubview(backButton)
- backButton.snp.makeConstraints { make in
- make.top.equalTo(profileBackgroundImageView.snp.top).offset(24)
- make.left.equalTo(profileBackgroundImageView.snp.left).offset(24)
- make.width.height.equalTo(32)
- }
- profileBackgroundImageView.addSubview(threeDotMenuButton)
- threeDotMenuButton.snp.makeConstraints { make in
- make.top.equalTo(profileBackgroundImageView).offset(24)
- make.right.equalTo(profileBackgroundImageView.right).inset(24)
- make.width.height.equalTo(32)
- }
- profileBackgroundImageView.addSubview(userTypeNameLabel)
- userTypeNameLabel.snp.makeConstraints { make in
- make.top.equalTo(backButton.snp.top).offset(104)
- make.left.equalTo(profileBackgroundImageView.snp.left).offset(12)
- make.width.equalTo(80)
- make.height.equalTo(28)
- }
- profileBackgroundImageView.addSubview(artistName)
- artistName.snp.makeConstraints { make in
- make.top.equalTo(userTypeNameLabel.snp.bottom).offset(1)
- make.left.equalTo(profileBackgroundImageView.snp.left).offset(12)
- make.right.equalTo(profileBackgroundImageView)
- make.height.equalTo(51)
- }
- profileBackgroundImageView.addSubview(artistUserName)
- artistUserName.snp.makeConstraints { make in
- make.top.equalTo(artistName.snp.bottom).offset(0)
- make.left.equalTo(profileBackgroundImageView.snp.left).offset(12)
- make.height.equalTo(27)
- }
- profileBackgroundImageView.addSubview(reatingsTextlabel)
- reatingsTextlabel.snp.makeConstraints { make in
- make.top.equalTo(artistUserName.snp.bottom).offset(2)
- make.left.equalTo(profileBackgroundImageView.snp.left).offset(12)
- make.height.equalTo(16)
- }
- profileBackgroundImageView.addSubview(reatingStarImageView)
- reatingStarImageView.snp.makeConstraints { make in
- make.top.equalTo(artistUserName.snp.bottom).offset(4)
- make.left.equalTo(reatingsTextlabel.snp.right).offset(2)
- make.width.height.equalTo(12)
- }
- profileBackgroundImageView.addSubview(sepraterLabel)
- sepraterLabel.snp.makeConstraints { make in
- make.bottom.equalTo(profileBackgroundImageView.snp.bottom).inset(0)
- make.left.equalTo(profileBackgroundImageView.snp.left).offset(10)
- make.right.equalTo(profileBackgroundImageView.snp.right).inset(10)
- make.height.equalTo(1)
- }
- contentView.addSubview(memberPriceStackView)
- memberPriceStackView.snp.makeConstraints { make in
- make.top.equalTo(profileBackgroundImageView.snp.bottom).offset(16)
- make.left.equalTo(contentView).offset(16)
- make.right.equalTo(contentView).inset(16)
- make.height.equalTo(64)
- }
- memberBgView.addSubview(memberSinceTextLabel)
- memberSinceTextLabel.snp.makeConstraints { make in
- make.top.equalTo(memberBgView.snp.top).offset(8)
- make.left.equalTo(memberBgView).offset(8)
- make.height.equalTo(18)
- }
- memberBgView.addSubview(memberSinceLabel)
- memberSinceLabel.snp.makeConstraints { make in
- make.top.equalTo(memberSinceTextLabel.snp.bottom).offset(8)
- make.left.equalTo(memberBgView).offset(8)
- make.height.equalTo(18)
- }
- priceBgView.addSubview(priceTextLabel)
- priceTextLabel.snp.makeConstraints { make in
- make.top.equalTo(priceBgView.snp.top).offset(14)
- make.left.equalTo(priceBgView).offset(16)
- make.height.equalTo(18)
- }
- priceBgView.addSubview(priceLabel)
- priceLabel.snp.makeConstraints { make in
- make.top.equalTo(priceTextLabel.snp.bottom).offset(2)
- make.left.equalTo(priceTextLabel)
- make.height.equalTo(18)
- }
- priceBgView.addSubview(termConditionBgView)
- termConditionBgView.snp.makeConstraints { make in
- make.top.equalTo(priceBgView.snp.top).offset(20)
- make.right.equalTo(priceBgView).inset(10)
- make.width.equalTo(75)
- make.height.equalTo(24)
- }
- termConditionBgView.addSubview(termAndConditionButton)
- termAndConditionButton.snp.makeConstraints { make in
- make.top.equalTo(termConditionBgView.snp.top).offset(4)
- make.right.equalTo(termConditionBgView).inset(1)
- make.width.equalTo(72)
- make.height.equalTo(18)
- }
- contentView.addSubview(noOfBookingBgView)
- noOfBookingBgView.snp.makeConstraints { make in
- make.top.equalTo(memberBgView.snp.bottom).offset(16)
- make.left.equalTo(contentView).offset(16)
- make.right.equalTo(contentView).inset(16)
- make.height.equalTo(64)
- }
- noOfBookingBgView.addSubview(noOfBookingTextLabel)
- noOfBookingTextLabel.snp.makeConstraints { make in
- make.top.equalTo(noOfBookingBgView.snp.top).offset(10)
- make.centerX.equalTo(noOfBookingBgView)
- make.height.equalTo(18)
- }
- noOfBookingBgView.addSubview(noOfBookingLabel)
- noOfBookingLabel.snp.makeConstraints { make in
- make.top.equalTo(noOfBookingTextLabel.snp.bottom).offset(8)
- make.centerX.equalTo(noOfBookingBgView)
- make.height.equalTo(18)
- }
- contentView.addSubview(aboutView)
- aboutView.snp.makeConstraints { make in
- make.top.equalTo(noOfBookingBgView.snp.bottom).offset(16)
- make.left.equalTo(contentView).offset(16)
- make.right.equalTo(contentView).inset(16)
- make.height.equalTo(220)
- }
- aboutView.addSubview(aboutTextLabel)
- aboutTextLabel.snp.makeConstraints { make in
- make.top.equalTo(aboutView.snp.top).offset(16)
- make.left.equalTo(aboutView).offset(16)
- make.height.equalTo(21)
- }
- aboutView.addSubview(aboutLabel)
- aboutLabel.snp.makeConstraints { make in
- make.top.equalTo(aboutTextLabel.snp.bottom).offset(8)
- make.left.equalTo(aboutView).offset(16)
- make.right.equalTo(aboutView).inset(16)
- }
- aboutView.addSubview(dummyAboutTextLabel)
- dummyAboutTextLabel.snp.makeConstraints { make in
- make.top.equalTo(aboutLabel.snp.bottom).offset(16)
- make.left.equalTo(aboutView).offset(16)
- make.right.equalTo(aboutView).inset(16)
- }
- aboutView.addSubview(seeMoreAboutButton)
- seeMoreAboutButton.snp.makeConstraints { make in
- make.top.equalTo(aboutLabel.snp.bottom)
- make.left.equalTo(aboutView).offset(16)
- }
- aboutView.addSubview(fromtTextLabel)
- fromtTextLabel.snp.makeConstraints { make in
- make.left.equalTo(aboutView).offset(16)
- make.right.equalTo(aboutView).inset(16)
- make.top.equalTo(aboutLabel.snp.bottom).offset(36)
- }
- aboutView.addSubview(fromCountryChipsView)
- fromCountryChipsView.snp.makeConstraints { make in
- make.top.equalTo(fromtTextLabel.snp.bottom).offset(16)
- }
- aboutView.addSubview(spokenLanguageTextLabel)
- spokenLanguageTextLabel.snp.makeConstraints { make in
- make.left.equalTo(aboutView).offset(16)
- make.right.equalTo(aboutView).inset(16)
- make.top.equalTo(fromCountryChipsView.snp.bottom).offset(24)
- }
- aboutView.addSubview(spokenLanguageChipsView)
- spokenLanguageChipsView.snp.makeConstraints { make in
- make.top.equalTo(spokenLanguageTextLabel.snp.bottom).offset(16)
- }
- let languageHeight = calculateSizeOfLanguagesStack()
- self.contentView.snp.updateConstraints { make in
- make.height.equalTo(contentViewHeight + languageHeight)
- }
- contentView.addSubview(portfolioBgView)
- portfolioBgView.snp.makeConstraints { make in
- make.top.equalTo(aboutView.snp.bottom).offset(16)
- make.left.equalTo(contentView).offset(16)
- make.right.equalTo(contentView).inset(16)
- make.height.equalTo(600)
- }
- contentView.addSubview(servicesTextLabel)
- servicesTextLabel.snp.makeConstraints { make in
- make.top.equalTo(portfolioBgView.snp.bottom).offset(12)
- make.left.equalTo(contentView).offset(16)
- make.height.equalTo(24)
- }
- serviceBgView.addSubview(seeMoreServicesButton)
- if allServices.count <= 3 {
- seeMoreServicesButton.snp.removeConstraints()
- } else {
- seeMoreServicesButton.snp.makeConstraints { make in
- make.left.equalTo(serviceBgView.snp.left).offset(24)
- make.bottom.equalTo(serviceBgView.snp.bottom).inset(8)
- make.width.equalTo(82)
- make.height.equalTo(20)
- }
- }
- let height = calculateSizeOfServicesStack()
- contentView.addSubview(serviceBgView)
- serviceBgView.snp.makeConstraints { make in
- make.top.equalTo(servicesTextLabel.snp.bottom).offset(16)
- make.left.equalTo(contentView).offset(16)
- make.right.equalTo(contentView).inset(16)
- make.height.equalTo(32 + height)
- }
- contentView.snp.updateConstraints { make in
- make.height.equalTo(contentViewHeight + height)
- }
- serviceBgView.addSubview(servicesStack)
- servicesStack.snp.makeConstraints { make in
- make.top.equalTo(serviceBgView.snp.top).offset(12)
- make.left.equalTo(serviceBgView).offset(24)
- make.right.equalTo(serviceBgView).inset(16)
- if allServices.count <= 3 {
- make.bottom.equalTo(serviceBgView.snp.bottom).inset(16)
- } else {
- make.bottom.equalTo(seeMoreServicesButton.snp.top).inset(-12)
- }
- }
- contentView.addSubview(avilivilityBgView)
- avilivilityBgView.snp.makeConstraints { make in
- make.top.equalTo(serviceBgView.snp.bottom).offset(16.0 * 2)
- make.left.equalTo(contentView.snp.left).offset(16.0)
- make.right.equalTo(contentView.snp.right).inset(16.0)
- make.height.equalTo(600)
- }
- avilivilityBgView.addSubview(abilibilityTitleText)
- abilibilityTitleText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(avilivilityBgView).offset(16)
- }
- // Monday
- avilivilityBgView.addSubview(abilibilityMondayTitleText)
- avilivilityBgView.addSubview(abilibilityMondayChipsView)
- abilibilityMondayTitleText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(abilibilityTitleText.bottom).offset(16)
- }
- abilibilityMondayChipsView.snp.makeConstraints { make in
- make.top.equalTo(abilibilityMondayTitleText.bottom).offset(16)
- }
- // Tuesday
- avilivilityBgView.addSubview(abilibilityTuesdayTitleText)
- abilibilityTuesdayTitleText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(abilibilityMondayChipsView.bottom).offset(16)
- }
- avilivilityBgView.addSubview(abilibilityTuesdayChipsView)
- abilibilityTuesdayChipsView.snp.makeConstraints { make in
- make.top.equalTo(abilibilityTuesdayTitleText.bottom).offset(16)
- }
- // Wednesday
- avilivilityBgView.addSubview(abilibilityWednesdayTitleText)
- abilibilityWednesdayTitleText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(abilibilityTuesdayChipsView.bottom).offset(16)
- }
- avilivilityBgView.addSubview(abilibilityWednesdayChipsView)
- abilibilityWednesdayChipsView.snp.makeConstraints { make in
- make.top.equalTo(abilibilityWednesdayTitleText.bottom).offset(16)
- }
- // Thusday
- avilivilityBgView.addSubview(abilibilityThusdayTitleText)
- abilibilityThusdayTitleText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(abilibilityWednesdayChipsView.bottom).offset(16)
- }
- avilivilityBgView.addSubview(abilibilityThusdayChipsView)
- abilibilityThusdayChipsView.snp.makeConstraints { make in
- make.top.equalTo(abilibilityThusdayTitleText.bottom).offset(16)
- }
- // Friday
- avilivilityBgView.addSubview(abilibilityFridayTitleText)
- abilibilityFridayTitleText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(abilibilityThusdayChipsView.bottom).offset(16)
- }
- avilivilityBgView.addSubview(abilibilityFridayChipsView)
- abilibilityFridayChipsView.snp.makeConstraints { make in
- make.top.equalTo(abilibilityFridayTitleText.bottom).offset(16)
- }
- // Saturday
- avilivilityBgView.addSubview(abilibilitySaturdayTitleText)
- abilibilitySaturdayTitleText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(abilibilityFridayChipsView.bottom).offset(16)
- }
- avilivilityBgView.addSubview(abilibilitySaturdayChipsView)
- abilibilitySaturdayChipsView.snp.makeConstraints { make in
- make.top.equalTo(abilibilitySaturdayTitleText.bottom).offset(16)
- }
- // Sunday
- avilivilityBgView.addSubview(abilibilitySundayTitleText)
- abilibilitySundayTitleText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(abilibilitySaturdayChipsView.bottom).offset(16)
- }
- avilivilityBgView.addSubview(abilibilitySundayChipsView)
- abilibilitySundayChipsView.snp.makeConstraints { make in
- make.top.equalTo(abilibilitySundayTitleText.bottom).offset(16)
- }
- // Willingness to Travel
- avilivilityBgView.addSubview(willingnessToTravelTitelText)
- willingnessToTravelTitelText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(abilibilitySundayChipsView.snp.bottom).offset(16)
- }
- avilivilityBgView.addSubview(willingnessToTravelChipsView)
- willingnessToTravelChipsView.snp.makeConstraints { make in
- make.top.equalTo(willingnessToTravelTitelText.snp.bottom).offset(16)
- }
- // Willingness to Negotiate
- avilivilityBgView.addSubview(willingnessToNegotiateTitleText)
- willingnessToNegotiateTitleText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(willingnessToTravelChipsView.snp.bottom).offset(16)
- }
- avilivilityBgView.addSubview(willingnessToNegotiateChipsView)
- willingnessToNegotiateChipsView.snp.makeConstraints { make in
- make.top.equalTo(willingnessToNegotiateTitleText.snp.bottom).offset(16)
- }
- // Equipment
- avilivilityBgView.addSubview(equipmentOnHandTitleText)
- equipmentOnHandTitleText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(willingnessToNegotiateChipsView.snp.bottom).offset(16)
- }
- avilivilityBgView.addSubview(equipmentOnHandChipsView)
- equipmentOnHandChipsView.snp.makeConstraints { make in
- make.top.equalTo(equipmentOnHandTitleText.snp.bottom).offset(16)
- }
- // Technical Rider
- avilivilityBgView.addSubview(technicalRiderTitleText)
- technicalRiderTitleText.snp.makeConstraints { make in
- make.left.equalTo(avilivilityBgView).offset(12)
- make.right.equalTo(avilivilityBgView).inset(12)
- make.top.equalTo(equipmentOnHandChipsView.snp.bottom).offset(16)
- }
- avilivilityBgView.addSubview(technicalRiderChipsView)
- technicalRiderChipsView.snp.makeConstraints { make in
- make.top.equalTo(technicalRiderTitleText.snp.bottom).offset(16)
- }
- avilivilityBgView.snp.updateConstraints { make in
- make.height.equalTo(calculateTagViewHeight() + 286)
- }
- contentView.snp.updateConstraints { make in
- make.height.equalTo(contentViewHeight + calculateTagViewHeight())
- }
- self.contentView.setNeedsLayout()
- self.contentView.layoutIfNeeded()
- contentView.addSubview(mapView)
- mapView.snp.makeConstraints { make in
- make.top.equalTo(avilivilityBgView.snp.bottom).offset(16)
- make.left.equalTo(contentView).offset(16)
- make.right.equalTo(contentView).inset(16)
- make.height.equalTo(274)
- }
- contentView.addSubview(ratingStackView)
- ratingStackView.snp.makeConstraints { make in
- make.top.equalTo(mapView.snp.bottom).offset(16)
- make.left.equalTo(contentView).offset(16)
- make.height.equalTo(15)
- }
- contentView.addSubview(ratingCollection)
- ratingCollection.snp.makeConstraints { make in
- make.top.equalTo(ratingStackView.snp.bottom).offset(16)
- make.left.equalTo(contentView).offset(16)
- make.right.equalTo(contentView).inset(16)
- make.height.equalTo(170)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment