Commit 0e9b10f3 authored by pete谢兆麟's avatar pete谢兆麟

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

parents 2036c94c fbd2324b
......@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
0406C7112D2FBB0300193E7D /* YHConversationGuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0406C7102D2FBB0300193E7D /* YHConversationGuideView.swift */; };
0411CEDE2D14006C00644D35 /* YHGCMainApplicantInformationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0411CEDD2D14006C00644D35 /* YHGCMainApplicantInformationViewController.swift */; };
0411CEE02D1400C200644D35 /* YHGCMainApplicantInformationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0411CEDF2D1400C200644D35 /* YHGCMainApplicantInformationViewModel.swift */; };
0411CEE22D14014000644D35 /* YHGCMainInformationCardTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0411CEE12D14014000644D35 /* YHGCMainInformationCardTableViewCell.swift */; };
......@@ -1226,6 +1227,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0406C7102D2FBB0300193E7D /* YHConversationGuideView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHConversationGuideView.swift; sourceTree = "<group>"; };
0411CEDD2D14006C00644D35 /* YHGCMainApplicantInformationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCMainApplicantInformationViewController.swift; sourceTree = "<group>"; };
0411CEDF2D1400C200644D35 /* YHGCMainApplicantInformationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCMainApplicantInformationViewModel.swift; sourceTree = "<group>"; };
0411CEE12D14014000644D35 /* YHGCMainInformationCardTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCMainInformationCardTableViewCell.swift; sourceTree = "<group>"; };
......@@ -3159,6 +3161,7 @@
045C0AF42D12CA5E00BD2DC0 /* YHHomeWebViewBottomForSavePicView.swift */,
045C0AF52D12CA5E00BD2DC0 /* YHIdentityTabBar.swift */,
045C0AF62D12CA5E00BD2DC0 /* YHManagerFuncGuildeCheckView.swift */,
0406C7102D2FBB0300193E7D /* YHConversationGuideView.swift */,
045C0AF72D12CA5E00BD2DC0 /* YHMessageBellView.swift */,
045C0AF82D12CA5E00BD2DC0 /* YHOrderTipsItemView.swift */,
045C0AF92D12CA5E00BD2DC0 /* YHOrderTipsView.swift */,
......@@ -7752,6 +7755,7 @@
045C13122D12CA5F00BD2DC0 /* YHAdopterCardExampleView.swift in Sources */,
045C13132D12CA5F00BD2DC0 /* YHMySettingViewController.swift in Sources */,
045C13142D12CA5F00BD2DC0 /* YHHKImmigrationRecordsVC.swift in Sources */,
0406C7112D2FBB0300193E7D /* YHConversationGuideView.swift in Sources */,
045C13152D12CA5F00BD2DC0 /* YHMineCertificateEntryViewController.swift in Sources */,
045C13162D12CA5F00BD2DC0 /* YHInformationAuthorizationStepOneViewController.swift in Sources */,
045C13172D12CA5F00BD2DC0 /* YHInformationFillTipsAlertView.swift in Sources */,
......
......@@ -369,6 +369,10 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
let message = messages[indexPath.row]
let msgType = message.getType()
if msgType == .unknown {
return 0.0
}
if msgType == .productList {
var height = 16+70.0
if let listModel = message.body.cardsInfo {
......
......@@ -395,9 +395,11 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var msgType = YHAIMessageType.unknown
var msg = YHAIChatMessage()
if 0 <= indexPath.row, indexPath.row < messages.count {
let msg = messages[indexPath.row]
let msgType = msg.getType()
msg = messages[indexPath.row]
msgType = msg.getType()
if msgType == .text {
let cell = tableView.dequeueReusableCell(withIdentifier: YHAITextMessageCell.cellReuseIdentifier, for: indexPath) as! YHAITextMessageCell
cell.message = msg
......@@ -496,6 +498,9 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
if 0 <= indexPath.row, indexPath.row < messages.count {
let message = messages[indexPath.row]
let msgType = message.getType()
if msgType == .unknown {
return 0.0
}
if msgType == .productList {
var height = 16+70.0
......
......@@ -36,6 +36,15 @@ class YHButlerServiceManager: NSObject {
var unreadCount: Int {
allUnreadCount()
}
var guideWindowShowedKey: String? {
guard let userId = YHLoginManager.shared.userModel?.id, userId.count > 0 else {
return nil
}
return "guideWindowShowedKey" + "_\(userId)"
}
var didShowWindowDict: [String: Bool] = [:]
private override init() {
super.init()
......
......@@ -16,6 +16,11 @@ class YHCommunityViewController: YHBaseViewController {
var arrItemVCs : [YHBaseViewController] = []
private lazy var princleVM : YHPrincleViewModel = {
let vm = YHPrincleViewModel()
return vm
}()
lazy var segmentedView : JXSegmentedView = {
let view = JXSegmentedView(frame: CGRect(x: 0, y: k_Height_safeAreaInsetsTop(), width: KScreenWidth, height: 48))
view.backgroundColor = .clear
......@@ -223,6 +228,7 @@ class YHCommunityViewController: YHBaseViewController {
requestFriendRequest()
//处于第一个item的时候,才允许屏幕边缘手势返回
navigationController?.interactivePopGestureRecognizer?.isEnabled = (segmentedView.selectedIndex == 0)
showAlert()
}
override func viewWillDisappear(_ animated: Bool) {
......@@ -232,6 +238,26 @@ class YHCommunityViewController: YHBaseViewController {
navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}
private func showAlert() {
guard YHLoginManager.shared.isLogin() else {
return
}
princleVM.getPrincleStatus { [weak self] success, error in
if success {
guard let self = self else {
return
}
guard let model = self.princleVM.alertStatusModel else {
return
}
if model.type == 20 {
self.showYHManagerGuideView(self.navigationController)
}
}
}
}
func requestFriendRequest() {
if YHLoginManager.shared.isLogin() {
self.friendViewModel.getMyFriendList { success, error in
......@@ -311,3 +337,40 @@ extension YHCommunityViewController: JXSegmentedListContainerViewDataSource {
}
}
extension YHCommunityViewController {
//MARK: - 跳银河管家
private func showYHManagerGuideView(_ navigationController: UINavigationController?) {
if YHUatHelper.shared.getUatModuleStatusBy(module: .QiYu_Service) != 1 {
printLog("非目标用户")
return
}
if let key = YHButlerServiceManager.shared.guideWindowShowedKey, YHButlerServiceManager.shared.didShowWindowDict[key] == true {
return
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
if let key = YHButlerServiceManager.shared.guideWindowShowedKey {
YHButlerServiceManager.shared.didShowWindowDict[key] = true
}
let view = YHConversationGuideView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.checkButtonEvent = { [weak self] in
guard let self = self else {
return
}
self.princleVM.postAlertStatus(20) { success, error in
}
self.gotoYinHeManager(navigationController)
}
view.show()
}
}
private func gotoYinHeManager(_ navigationController: UINavigationController?) {
guard let userId = YHLoginManager.shared.userModel?.id, userId.count > 0 else {
return
}
//YHAnalytics.track("APP_HomeTab_IntelligentAssistant")
YHButlerServiceManager.shared.gotoButlerServiceSessionVC(navigationController: navigationController, completion: { _ in
})
}
}
......@@ -650,7 +650,9 @@ private extension YHHomeHoldViewPageViewController {
printLog("非目标用户")
return
}
if let key = YHButlerServiceManager.shared.guideWindowShowedKey, YHButlerServiceManager.shared.didShowWindowDict[key] == true {
return
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
//判断是否在 首页tab
if let vc = UIApplication.shared.keyWindow?.rootViewController as? YHTabBarViewController {
......@@ -663,6 +665,9 @@ private extension YHHomeHoldViewPageViewController {
if self.segmentedView.selectedIndex != 0 {
return
}
if let key = YHButlerServiceManager.shared.guideWindowShowedKey {
YHButlerServiceManager.shared.didShowWindowDict[key] = true
}
// self.princleVM.postAlertStatus(20) { success, error in
// }
......
//
// YHConversationGuideView.swift
// galaxy
//
// Created by alexzzw on 2025/1/9.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHConversationGuideView: UIView {
var checkButtonEvent: (() -> Void)?
private lazy var centerView: UIView = {
let view = UIView()
view.backgroundColor = .clear
return view
}()
private lazy var bottomContainerView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.clipsToBounds = true
view.layer.cornerRadius = kCornerRadius6
return view
}()
private lazy var topImageView: UIImageView = {
let imageV = UIImageView()
imageV.image = UIImage(named: "conversation_guide_icon")
imageV.contentMode = .scaleToFill
imageV.clipsToBounds = true
imageV.isUserInteractionEnabled = true
return imageV
}()
lazy var checkButton: UIButton = {
let button = UIButton(type: .custom)
button.addTarget(self, action: #selector(clickCheckButton), for: .touchUpInside)
button.setTitle("立即查看", for: .normal)
button.setTitleColor(.white, for: .normal)
button.backgroundColor = .brandMainColor
button.layer.cornerRadius = 3
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
return button
}()
private lazy var infoTitleLabel: UILabel = {
let label : UILabel = UILabel()
label.text = "您好!银河用户"
label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
return label
}()
private lazy var infoContentLabel: UILabel = {
let label : UILabel = UILabel()
label.text = "我是您的专属文案管家,为您提供最贴心的帮助与引导,请随时告诉我您的需求"
label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = UIColor(hexString: "#4D5665")
label.numberOfLines = 0
label.lineBreakMode = .byCharWrapping
label.textAlignment = .center
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupUI() {
backgroundColor = UIColor(hex: 0x0000, alpha: 0.5)
addSubview(centerView)
centerView.addSubview(bottomContainerView)
centerView.addSubview(topImageView)
bottomContainerView.addSubview(checkButton)
bottomContainerView.addSubview(infoTitleLabel)
bottomContainerView.addSubview(infoContentLabel)
centerView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(38)
make.right.equalToSuperview().offset(-38)
make.centerY.equalToSuperview()
}
let ratio = 299.0 / 152.0
topImageView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.width.equalTo(topImageView.snp.height).multipliedBy(ratio)
}
bottomContainerView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(topImageView.snp.centerY)
}
infoTitleLabel.snp.makeConstraints { make in
make.top.equalTo(topImageView.snp.bottom).offset(24)
make.left.greaterThanOrEqualToSuperview()
make.right.lessThanOrEqualToSuperview()
make.centerX.equalToSuperview()
}
infoContentLabel.snp.makeConstraints { make in
make.top.equalTo(infoTitleLabel.snp.bottom).offset(6)
make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20)
}
checkButton.snp.makeConstraints { make in
make.top.equalTo(infoContentLabel.snp.bottom).offset(32)
make.left.right.equalTo(infoContentLabel)
make.height.equalTo(45)
make.bottom.equalToSuperview().offset(-16)
}
}
@objc private func clickCheckButton() {
checkButtonEvent?()
dismiss()
}
func show() {
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(self)
}
func dismiss() {
removeFromSuperview()
}
}
extension YHConversationGuideView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer:UIGestureRecognizer, shouldReceive touch:UITouch) -> Bool {
if touch.view == self {
return true
}
return false
}
}
......@@ -10,6 +10,11 @@ import UIKit
import JXSegmentedView
class YHServerCenterHoldViewController: UIViewController {
private lazy var princleVM : YHPrincleViewModel = {
let vm = YHPrincleViewModel()
return vm
}()
private let serviceCenterMainReqVM : YHServiceCenterViewModel = YHServiceCenterViewModel()
var stepID: Int = 0
var mobile: String = ""
......@@ -90,6 +95,10 @@ class YHServerCenterHoldViewController: UIViewController {
// Do any additional setup after loading the view.
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
showAlert()
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
......@@ -106,6 +115,25 @@ class YHServerCenterHoldViewController: UIViewController {
}
}
private func showAlert() {
guard YHLoginManager.shared.isLogin() else {
return
}
princleVM.getPrincleStatus { [weak self] success, error in
if success {
guard let self = self else {
return
}
guard let model = self.princleVM.alertStatusModel else {
return
}
if model.type == 20 {
self.showYHManagerGuideView(self.navigationController)
}
}
}
}
func setupView() {
view.backgroundColor = .clear
......@@ -237,3 +265,41 @@ extension YHServerCenterHoldViewController: JXSegmentedListContainerViewDataSour
return arrItemVCs[index]
}
}
extension YHServerCenterHoldViewController {
//MARK: - 跳银河管家
private func showYHManagerGuideView(_ navigationController: UINavigationController?) {
if YHUatHelper.shared.getUatModuleStatusBy(module: .QiYu_Service) != 1 {
printLog("非目标用户")
return
}
if let key = YHButlerServiceManager.shared.guideWindowShowedKey, YHButlerServiceManager.shared.didShowWindowDict[key] == true {
return
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
if let key = YHButlerServiceManager.shared.guideWindowShowedKey {
YHButlerServiceManager.shared.didShowWindowDict[key] = true
}
let view = YHConversationGuideView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.checkButtonEvent = { [weak self] in
guard let self = self else {
return
}
self.princleVM.postAlertStatus(20) { success, error in
}
self.gotoYinHeManager(navigationController)
}
view.show()
}
}
private func gotoYinHeManager(_ navigationController: UINavigationController?) {
guard let userId = YHLoginManager.shared.userModel?.id, userId.count > 0 else {
return
}
//YHAnalytics.track("APP_HomeTab_IntelligentAssistant")
YHButlerServiceManager.shared.gotoButlerServiceSessionVC(navigationController: navigationController, completion: { _ in
})
}
}
......@@ -433,7 +433,7 @@ class YHPrincipleUploadStatusCell: UITableViewCell {
if let remark = self.itemModel?.remark, !remark.isEmpty {
text = "\n"+remark
}
return "新公司在职证明(在申请期间更换了工作时必传)"+text
return "1、新公司在职证明(在申请期间更换了工作时必传)\n2、海外学历认证证书:如您曾申报过由非中国内地学院颁发的学位,则必传(比如:留服认证)\n"+text
}
return ""
}
......
......@@ -73,19 +73,19 @@ class YHComprehensiveEvaluationCell: UITableViewCell {
}()
lazy var partPassText: ASAttributedString = {
let aa: ASAttributedString = .init("经初步评估,", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
let bb: ASAttributedString = .init("您目前已符合【优秀人才入境计划 - 综合计分制】的部分重要甄选条件", .font(UIFont.PFSC_B(ofSize: 14)),.foreground(UIColor.init(hex: 0xD48638)))
let cc: ASAttributedString = .init(",在如下方面具备优势,足以证明您的优秀之处!考虑到优才计划的的多维度要求,以及您目前已经具备的良好基础,如果您能进一步去孵化其他条件,后续的申请将会更具竞争力", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
// let aa: ASAttributedString = .init("经初步评估,", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
// let bb: ASAttributedString = .init("您目前已符合【优秀人才入境计划 - 综合计分制】的部分重要甄选条件", .font(UIFont.PFSC_B(ofSize: 14)),.foreground(UIColor.init(hex: 0xD48638)))
// let cc: ASAttributedString = .init(",在如下方面具备优势,足以证明您的优秀之处!考虑到优才计划的的多维度要求,以及您目前已经具备的良好基础,如果您能进一步去孵化其他条件,后续的申请将会更具竞争力", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
// let aa: ASAttributedString = .init(" 综合计分制设有资格门槛,只有达到申请资格门槛的申请人才能经网上递交申请。", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
// let bb: ASAttributedString = .init("最新适用的申请资格门槛:符合12项评核准备的其中6个。\n", .font(UIFont.PFSC_B(ofSize: 14)),.foreground(UIColor.init(hex: 0xD48638)))
//
// let dd: ASAttributedString = .init(" 经初步评估,", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
// let ee: ASAttributedString = .init("您目前符合【优秀人才入境计划 - 综合计分制】的以下甄选条件!", .font(UIFont.PFSC_B(ofSize: 14)),.foreground(UIColor.init(hex: 0xD48638)))
// let ff: ASAttributedString = .init("考虑到您目前已经具备的良好基础,建议您进一步孵化其他条件。", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
let aa: ASAttributedString = .init(" 综合计分制设有资格门槛,只有达到申请资格门槛的申请人才能经网上递交申请。", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
let bb: ASAttributedString = .init("最新适用的申请资格门槛:符合12项评核准备的其中6个。\n", .font(UIFont.PFSC_B(ofSize: 14)),.foreground(UIColor.init(hex: 0xD48638)))
return aa+bb+cc
let cc: ASAttributedString = .init(" 经初步评估,", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
let dd: ASAttributedString = .init("您目前符合【优秀人才入境计划 - 综合计分制】的以下甄选条件!", .font(UIFont.PFSC_B(ofSize: 14)),.foreground(UIColor.init(hex: 0xD48638)))
let ee: ASAttributedString = .init("考虑到您目前已经具备的良好基础,建议您进一步孵化其他条件。", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
return aa+bb+cc+dd+ee
}()
lazy var neverPassText: ASAttributedString = {
......
......@@ -49,6 +49,7 @@ class YHEducationInfoListVC: YHBaseViewController {
var bottomView: YHSaveAndSubmitView = {
let view = YHSaveAndSubmitView.createView()
view.isHiddenSave = true
return view
}()
......@@ -198,14 +199,15 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
let isNeedWrap = (formItem.type == .mainApplicantProfessionalQualification)
cell.setTitleAndSubTitle(title:formItem.getTitle(), subTitle:formItem.getSubTitle(), isNeedWrap:isNeedWrap)
// 决定右边按钮显示样式
cell.showEditType(type: .none)
if formItem.type == .mainApplicantEducation { // 学历
cell.setTitleAndSubTitle(title:formItem.getTitle(), subTitle:formItem.getSubTitle(), isNeedWrap:isNeedWrap)
cell.showEditType(type: isDegreeEditMode)
} else if formItem.type == .mainApplicantProfessionalQualification { // 专业
cell.setTitleAndSubTitle(title:formItem.getTitle(), subTitle:formItem.getSubTitle(), subTitleColor: .failColor, isNeedWrap:isNeedWrap)
cell.showEditType(type: isQualificationEditMode)
}
......
......@@ -19,7 +19,7 @@ class YHFormItemTitleCell: UITableViewCell {
var rightClickBlock:((YHFormTitleItemEditType)->Void)?
// isNeedWrap 副标题是否需要换行
func setTitleAndSubTitle(title: String? = "", subTitle: String? = "", isNeedWrap:Bool = false) {
func setTitleAndSubTitle(title: String? = "", subTitle: String? = "", subTitleColor: UIColor = .labelTextColor2, isNeedWrap:Bool = false) {
let titleAttributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_M(ofSize: 17),
......@@ -27,7 +27,7 @@ class YHFormItemTitleCell: UITableViewCell {
]
let subTitleAttributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 12),
.foregroundColor: UIColor.labelTextColor2
.foregroundColor: subTitleColor
]
let attrStr = NSMutableAttributedString(string:"", attributes: titleAttributes)
......
......@@ -16,6 +16,10 @@ import Photos
*/
class YHH5WebViewVC: YHBaseViewController, WKUIDelegate, WKNavigationDelegate {
lazy var manager : YHAIRequestManager = {
return YHAIRequestManager()
}()
// 测评结果回调
var evaluationResultCallback:((Dictionary<String, Any>)->())?
......@@ -514,6 +518,34 @@ extension YHH5WebViewVC {
// MARK: - h5实现的接口
extension YHH5WebViewVC {
func goAgentChatPage(dic:[String:Any]) {
let id = dic["id"] as? String ?? ""
let title = dic["title"] as? String ?? ""
let businessType = dic["businessType"] as? String ?? ""
let botld = dic["botld"] as? String ?? ""
YHHUD.show(.progress(message: "加载中..."))
self.manager.getSubRobotChatConversationId(listItemId: "\(id)") {
sesseionId in
YHHUD.hide()
var isShow = false
if businessType == YHAIRobotType.education.rawValue || businessType == YHAIRobotType.sale.rawValue || businessType == YHAIRobotType.business.rawValue {
isShow = true
}
let vc = YHAIRobotChatViewController()
vc.isNeedShowBannerHeader = isShow
vc.myTitle = title
vc.robotId = botld
vc.listItemId = Int(id) ?? 0
vc.conversationId = sesseionId
vc.robotType = businessType
self.navigationController?.pushViewController(vc, animated: true)
}
}
//25 关闭AI聊天的测评弹窗并获取测评结果
// type 1 直接关闭。 2 测评出结果关闭
// result 测评结果json 待定
......
......@@ -19,6 +19,27 @@ class YHJsApi: NSObject {
extension YHJsApi {
//32、 H5跳转App智能体会话页面
@objc func goAgentChatPage(_ dicData: String) {
DispatchQueue.main.async {
if let data = dicData.data(using: .utf8) {
do {
if let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
if let delegate = self.delegate as? YHH5WebViewVC {
delegate.goAgentChatPage(dic:jsonObject)
}
} else {
printLog("JSON字符串不是有效的字典格式")
}
} catch {
printLog("JSON解析错误: \(error)")
}
}
}
}
// 30、跳转到APP底部的服务Tab-再推出服务进度页面
@objc func goServiceProgressPage(_ tag : Any) {
......
......@@ -904,6 +904,9 @@ extension YHLivePlayerViewController {
@objc private func handleAppWillEnterForeground() {
if YHLoginManager.shared.isLogin() {
joinLiveRoom(id: liveId, callback: { _, _ in })
if let roomId = roomId {
setupChatRoom(roomId: roomId)
}
}
}
/*
......@@ -976,7 +979,9 @@ extension YHLivePlayerViewController {
if #available(iOS 16.0, *) {
windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: orientationMask))
} else {
// let orientation: UIInterfaceOrientation = orientationMask == .portrait ? .portrait : .landscapeRight
// UIDevice.current.setValue(orientation.rawValue, forKey: "orientation")
// UIViewController.attemptRotationToDeviceOrientation()
}
}
......@@ -987,6 +992,9 @@ extension YHLivePlayerViewController {
if #available(iOS 16.0, *) {
windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: orientationMask))
} else {
// let orientation: UIInterfaceOrientation = .portrait
// UIDevice.current.setValue(orientation.rawValue, forKey: "orientation")
// UIViewController.attemptRotationToDeviceOrientation()
}
bottomInputBar.isHidden = false
messageListView.isHidden = false
......@@ -1002,6 +1010,9 @@ extension YHLivePlayerViewController {
if #available(iOS 16.0, *) {
windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: orientationMask))
} else {
// let orientation: UIInterfaceOrientation = .landscapeRight
// UIDevice.current.setValue(orientation.rawValue, forKey: "orientation")
// UIViewController.attemptRotationToDeviceOrientation()
}
bottomInputBar.isHidden = true
messageListView.isHidden = true
......
......@@ -305,7 +305,7 @@ extension YHIMHelper: EMChatroomManagerDelegate {
if let jsonString = ext {
let dic = jsonString.toDictionary()
if let fromNickName = dic["fromNickName"] {
print(fromNickName)
printLog(fromNickName)
NotificationCenter.default.post(name: YHIMHelper.didUserEnterRoomMessages, object: fromNickName)
return
......
......@@ -47,6 +47,9 @@ class YHLiveMessageListView: UIView {
make.top.equalToSuperview()
make.left.bottom.right.equalToSuperview()
}
// 添加 KVO
tableView.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil)
}
// MARK: - Public Methods
......@@ -63,12 +66,20 @@ class YHLiveMessageListView: UIView {
messages.removeAll()
tableView.reloadData()
}
}
// MARK: - UITableViewDelegate & UITableViewDataSource
extension YHLiveMessageListView: UITableViewDelegate, UITableViewDataSource {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
deinit {
// 移除 KVO
tableView.removeObserver(self, forKeyPath: "contentSize")
}
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == "contentSize" {
fadeCells()
}
}
private func fadeCells() {
// 内容大小变化
let fadeRange: CGFloat = 50
tableView.visibleCells.forEach { cell in
......@@ -76,7 +87,7 @@ extension YHLiveMessageListView: UITableViewDelegate, UITableViewDataSource {
let cellRect = tableView.rectForRow(at: indexPath)
// 因为视图是倒置的,所以我们需要用 tableView 的高度来计算正确的位置
let cellPositionFromBottom = tableView.bounds.height - (cellRect.origin.y - scrollView.contentOffset.y) - cellRect.height
let cellPositionFromBottom = tableView.bounds.height - (cellRect.origin.y - tableView.contentOffset.y) - cellRect.height
if cellPositionFromBottom >= 0 && cellPositionFromBottom <= fadeRange {
let progress = cellPositionFromBottom / fadeRange
......@@ -88,6 +99,14 @@ extension YHLiveMessageListView: UITableViewDelegate, UITableViewDataSource {
}
}
}
}
// MARK: - UITableViewDelegate & UITableViewDataSource
extension YHLiveMessageListView: UITableViewDelegate, UITableViewDataSource {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
fadeCells()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
......
......@@ -59,6 +59,11 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
let msgViewModel: YHMsgViewModel = YHMsgViewModel()
let loginViewModel = YHLoginViewModel()
let userViewModel = YHMatchUserViewModel()
private lazy var princleVM : YHPrincleViewModel = {
let vm = YHPrincleViewModel()
return vm
}()
lazy var tableView: UITableView = {
let tableView = UITableView(frame: CGRect.zero, style:.grouped)
......@@ -165,6 +170,32 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
checkSettingRedPoint()
headerView.updateAvatar()
requstUserBasicInfo()
showAlert()
}
// override func viewDidAppear(_ animated: Bool) {
// super.viewDidAppear(animated)
// showYHManagerGuideView(self.navigationController)
// }
private func showAlert() {
guard YHLoginManager.shared.isLogin() else {
return
}
princleVM.getPrincleStatus { [weak self] success, error in
if success {
guard let self = self else {
return
}
guard let model = self.princleVM.alertStatusModel else {
return
}
if model.type == 20 {
self.showYHManagerGuideView(self.navigationController)
}
}
}
}
@objc func clickBtn() {
......@@ -542,3 +573,41 @@ extension YHMyViewController {
}
}
extension YHMyViewController {
//MARK: - 跳银河管家
private func showYHManagerGuideView(_ navigationController: UINavigationController?) {
if YHUatHelper.shared.getUatModuleStatusBy(module: .QiYu_Service) != 1 {
printLog("非目标用户")
return
}
if let key = YHButlerServiceManager.shared.guideWindowShowedKey, YHButlerServiceManager.shared.didShowWindowDict[key] == true {
return
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
if let key = YHButlerServiceManager.shared.guideWindowShowedKey {
YHButlerServiceManager.shared.didShowWindowDict[key] = true
}
let view = YHConversationGuideView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.checkButtonEvent = { [weak self] in
guard let self = self else {
return
}
self.princleVM.postAlertStatus(20) { success, error in
}
self.gotoYinHeManager(navigationController)
}
view.show()
}
}
private func gotoYinHeManager(_ navigationController: UINavigationController?) {
guard let userId = YHLoginManager.shared.userModel?.id, userId.count > 0 else {
return
}
//YHAnalytics.track("APP_HomeTab_IntelligentAssistant")
YHButlerServiceManager.shared.gotoButlerServiceSessionVC(navigationController: navigationController, completion: { _ in
})
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "conversation_guide_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "conversation_guide_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "启动页@2x.png",
"filename" : "startPage@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "启动页@3x.png",
"filename" : "startPage@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment