Просмотр исходного кода

feat: 移除个人页评分逻辑,增加点赞功能

陈文艺 2 дней назад
Родитель
Сommit
219061f20e

+ 2 - 10
Lanu.xcodeproj/project.pbxproj

@@ -346,8 +346,6 @@
 				Views/Profile/Profile/LNProfileInfosView.swift,
 				Views/Profile/Profile/LNProfileInRoomView.swift,
 				Views/Profile/Profile/LNProfilePhotoWall.swift,
-				Views/Profile/Profile/LNProfileScoreFloatingView.swift,
-				Views/Profile/Profile/LNProfileStaringPanel.swift,
 				Views/Profile/Profile/LNProfileTabView.swift,
 				Views/Profile/Profile/LNProfileUserInfoView.swift,
 				Views/Profile/Profile/LNProfileViewController.swift,
@@ -445,6 +443,8 @@
 		};
 		FBB67E232EC48B440070E686 /* ThirdParty */ = {
 			isa = PBXFileSystemSynchronizedRootGroup;
+			exceptions = (
+			);
 			path = ThirdParty;
 			sourceTree = "<group>";
 		};
@@ -597,14 +597,10 @@
 			inputFileListPaths = (
 				"${PODS_ROOT}/Target Support Files/Pods-Gami/Pods-Gami-resources-${CONFIGURATION}-input-files.xcfilelist",
 			);
-			inputPaths = (
-			);
 			name = "[CP] Copy Pods Resources";
 			outputFileListPaths = (
 				"${PODS_ROOT}/Target Support Files/Pods-Gami/Pods-Gami-resources-${CONFIGURATION}-output-files.xcfilelist",
 			);
-			outputPaths = (
-			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
 			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Gami/Pods-Gami-resources.sh\"\n";
@@ -640,14 +636,10 @@
 			inputFileListPaths = (
 				"${PODS_ROOT}/Target Support Files/Pods-Gami/Pods-Gami-frameworks-${CONFIGURATION}-input-files.xcfilelist",
 			);
-			inputPaths = (
-			);
 			name = "[CP] Embed Pods Frameworks";
 			outputFileListPaths = (
 				"${PODS_ROOT}/Target Support Files/Pods-Gami/Pods-Gami-frameworks-${CONFIGURATION}-output-files.xcfilelist",
 			);
-			outputPaths = (
-			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
 			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Gami/Pods-Gami-frameworks.sh\"\n";

+ 3 - 3
Lanu/Localizable.xcstrings

@@ -5343,19 +5343,19 @@
         "en" : {
           "stringUnit" : {
             "state" : "translated",
-            "value" : "%d Fans"
+            "value" : "%@ Fans"
           }
         },
         "id" : {
           "stringUnit" : {
             "state" : "translated",
-            "value" : "%d Penggemar"
+            "value" : "%@ Penggemar"
           }
         },
         "zh-Hans" : {
           "stringUnit" : {
             "state" : "translated",
-            "value" : "%d 粉丝"
+            "value" : "%@ 粉丝"
           }
         }
       }

+ 0 - 161
Lanu/Views/Profile/Profile/LNProfileScoreFloatingView.swift

@@ -1,161 +0,0 @@
-//
-//  LNProfileScoreFloatingView.swift
-//  Lanu
-//
-//  Created by OneeChan on 2025/12/16.
-//
-
-import Foundation
-import UIKit
-import SnapKit
-
-
-class LNProfileScoreFloatingView: UIView {
-    private var curDetail: LNUserProfileVO?
-    private let background = UIImageView()
-    
-    override init(frame: CGRect) {
-        super.init(frame: frame)
-        
-        setupViews()
-        setupGesture()
-    }
-    
-    func update(_ detail: LNUserProfileVO) {
-        curDetail = detail
-        isHidden = !detail.playmate || detail.rated || detail.userNo.isMyUid
-    }
-    
-    override func layoutSubviews() {
-        super.layoutSubviews()
-        background.layer.cornerRadius = background.bounds.height * 0.5
-    }
-    
-    required init?(coder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-}
-
-extension LNProfileScoreFloatingView {
-    @objc
-    private func handlePan(_ ges: UIPanGestureRecognizer) {
-        let location = ges.location(in: superview)
-        
-        switch ges.state {
-        case .began:
-            break
-        case .changed:
-            center = location
-            break
-        default:
-            updatePosition(animated: true)
-            break
-        }
-    }
-}
-
-extension LNProfileScoreFloatingView {
-    private func updatePosition(animated: Bool) {
-        guard let superview else { return }
-        let movement = { [weak self] in
-            guard let self else { return }
-            
-            let y = center.y.bounded(min: 160, max: superview.bounds.height - 160)
-//            if center.x > superview.bounds.width * 0.5 {
-                center = .init(x: superview.bounds.width - bounds.width * 0.5 - 8, y: y)
-//            } else {
-//                center = .init(x: bounds.width * 0.5 + 8, y: y)
-//            }
-        }
-        if animated {
-            UIView.animate(withDuration: 0.25, animations: movement)
-        } else {
-            movement()
-        }
-    }
-    
-    private func setupViews() {
-        let ic = UIImageView()
-        ic.image = .icProfileFillScore
-        addSubview(ic)
-        ic.snp.makeConstraints { make in
-            make.centerX.equalToSuperview()
-            make.top.equalToSuperview()
-            make.leading.greaterThanOrEqualToSuperview()
-        }
-        
-        background.image = .primary_7
-        background.layer.cornerRadius = 9.5
-        background.clipsToBounds = true
-        addSubview(background)
-        background.snp.makeConstraints { make in
-            make.horizontalEdges.equalToSuperview()
-            make.bottom.equalToSuperview()
-            make.top.equalTo(ic.snp.bottom).offset(-12)
-            make.width.lessThanOrEqualTo(74)
-        }
-        
-        let label = UILabel()
-        label.text = .init(key: "A00227")
-        label.font = .init(name: UIFont.boldFontName, size: 11)
-        label.textColor = .text_1
-        label.textAlignment = .center
-        label.numberOfLines = 2
-        background.addSubview(label)
-        label.snp.makeConstraints { make in
-            make.verticalEdges.equalToSuperview().inset(2)
-            make.horizontalEdges.equalToSuperview().inset(5.5)
-        }
-    }
-    
-    private func setupGesture() {
-        let pan = UIPanGestureRecognizer(target: self, action: #selector(handlePan(_:)))
-        addGestureRecognizer(pan)
-        
-        onTap { [weak self] in
-            guard let self else { return }
-            guard let curDetail else { return }
-            
-            let panel = LNProfileStaringPanel()
-            panel.updateAvatar(url: curDetail.avatar)
-            panel.handler = { [weak self] score in
-                guard let self else { return }
-                LNGameMateManager.shared.scoreGameMate(uid: curDetail.userNo, score: Int(score))
-                { [weak self] success in
-                    guard let self else { return }
-                    if success {
-                        showToast(.init(key: "A00228"))
-                        isHidden = true
-                    }
-                }
-            }
-            panel.popup()
-        }
-    }
-}
-
-#if DEBUG
-
-import SwiftUI
-
-struct LNProfileScoreFloatingViewPreview: UIViewRepresentable {
-    func makeUIView(context: Context) -> some UIView {
-        let container = UIView()
-        container.backgroundColor = .lightGray
-        
-        let view = LNProfileScoreFloatingView()
-        container.addSubview(view)
-        view.snp.makeConstraints { make in
-            make.center.equalToSuperview()
-        }
-        
-        return container
-    }
-    
-    func updateUIView(_ uiView: UIViewType, context: Context) { }
-}
-
-#Preview(body: {
-    LNProfileScoreFloatingViewPreview()
-})
-#endif

+ 0 - 120
Lanu/Views/Profile/Profile/LNProfileStaringPanel.swift

@@ -1,120 +0,0 @@
-//
-//  LNProfileStaringPanel.swift
-//  Lanu
-//
-//  Created by OneeChan on 2025/12/2.
-//
-
-import Foundation
-import UIKit
-import SnapKit
-
-
-class LNProfileStaringPanel: LNPopupView {
-    var handler: ((Double) -> Void)? = nil
-    
-    private let avatar = UIImageView()
-    private let titleLabel = UILabel()
-    private let scoreView = LNFiveStarScoreView()
-    private let confirmButton = UIButton()
-    
-    override init(frame: CGRect) {
-        super.init(frame: frame)
-        
-        setupViews()
-    }
-    
-    func updateAvatar(url: String) {
-        avatar.sd_setImage(with: URL(string: url))
-    }
-    
-    required init?(coder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-}
-
-extension LNProfileStaringPanel: LNFiveStarScoreViewDelegate {
-    func onFiveStarScoreView(view: LNFiveStarScoreView, scoreChanged newScore: Double) {
-        let bg = newScore == 0 ? nil : UIImage.primary_8
-        confirmButton.setBackgroundImage(bg, for: .normal)
-    }
-}
-
-extension LNProfileStaringPanel {
-    private func setupViews() {
-        avatar.backgroundColor = .fill
-        avatar.layer.cornerRadius = 30
-        avatar.layer.borderColor = UIColor.fill.cgColor
-        avatar.layer.borderWidth = 2
-        avatar.clipsToBounds = true
-        container.addSubview(avatar)
-        avatar.snp.makeConstraints { make in
-            make.centerX.equalToSuperview()
-            make.top.equalToSuperview().offset(-16)
-            make.width.height.equalTo(60)
-        }
-        
-        titleLabel.font = .heading_h3
-        titleLabel.textColor = .text_5
-        titleLabel.text = .init(key: "A00194")
-        titleLabel.textAlignment = .center
-        container.addSubview(titleLabel)
-        titleLabel.snp.makeConstraints { make in
-            make.horizontalEdges.equalToSuperview().inset(16)
-            make.top.equalTo(avatar.snp.bottom).offset(11)
-        }
-        
-        scoreView.startType = .whiteBorder
-        scoreView.icSize = 30
-        scoreView.editable = true
-        scoreView.spacing = 12
-        scoreView.delegate = self
-        container.addSubview(scoreView)
-        scoreView.snp.makeConstraints { make in
-            make.centerX.equalToSuperview()
-            make.top.equalTo(titleLabel.snp.bottom).offset(17)
-        }
-        
-        confirmButton.setTitle(.init(key: "A00183"), for: .normal)
-        confirmButton.backgroundColor = .text_2
-        confirmButton.setTitleColor(.text_1, for: .normal)
-        confirmButton.titleLabel?.font = .heading_h3
-        confirmButton.layer.cornerRadius = 23.5
-        confirmButton.clipsToBounds = true
-        confirmButton.addAction(UIAction(handler: { [weak self] _ in
-            guard let self else { return }
-            dismiss()
-            handler?(scoreView.score)
-        }), for: .touchUpInside)
-        container.addSubview(confirmButton)
-        confirmButton.snp.makeConstraints { make in
-            make.horizontalEdges.equalToSuperview().inset(12)
-            make.top.equalTo(scoreView.snp.bottom).offset(25)
-            make.bottom.equalToSuperview().offset(commonBottomInset)
-            make.height.equalTo(47)
-        }
-    }
-}
-
-#if DEBUG
-
-import SwiftUI
-
-struct LNProfileStaringPanelPreview: UIViewRepresentable {
-    func makeUIView(context: Context) -> some UIView {
-        let container = UIView()
-        container.backgroundColor = .lightGray
-        
-        let view = LNProfileStaringPanel()
-        view.popup(container)
-        
-        return container
-    }
-    
-    func updateUIView(_ uiView: UIViewType, context: Context) { }
-}
-
-#Preview(body: {
-    LNProfileStaringPanelPreview()
-})
-#endif

+ 34 - 16
Lanu/Views/Profile/Profile/LNProfileUserInfoView.swift

@@ -16,6 +16,7 @@ class LNProfileUserInfoView: UIView {
     
     private let idLabel = UILabel()
     private let followCountLabel = UILabel()
+    private let likeCountLabel = UILabel()
     
     private let scoreLabel = UILabel()
     
@@ -31,9 +32,11 @@ class LNProfileUserInfoView: UIView {
         userNameLabel.text = detail.nickname
         genderView.update(detail.gender, detail.age)
         idLabel.text = "ID \(detail.userNo)"
-        followCountLabel.text = .init(key: "A00234", detail.fansCount)
         
-        scoreLabel.text = "\(detail.star)"
+        followCountLabel.text = .init(key: "A00234", detail.fansCount.formattedAsShortNumber())
+//        likeCountLabel.text = detail.fansCount.formattedAsShortNumber() + .init(key: "A00301")
+        
+//        scoreLabel.text = detail.star.formattedAsShortNumber()
         scoreLabel.superview?.isHidden = !detail.playmate
         
         curDetail = detail
@@ -49,7 +52,7 @@ extension LNProfileUserInfoView {
         let star = buildStarView()
         addSubview(star)
         star.snp.makeConstraints { make in
-            make.trailing.equalToSuperview().offset(-16)
+            make.trailing.equalToSuperview().offset(-18)
             make.bottom.equalToSuperview().offset(-10)
         }
         
@@ -117,29 +120,44 @@ extension LNProfileUserInfoView {
         followCountLabel.textColor = .text_2
         fansView.addSubview(followCountLabel)
         followCountLabel.snp.makeConstraints { make in
-            make.edges.equalToSuperview()
+            make.leading.equalToSuperview()
+            make.verticalEdges.equalToSuperview()
+        }
+        
+        likeCountLabel.font = .body_s
+        likeCountLabel.textColor = .text_2
+        fansView.addSubview(likeCountLabel)
+        likeCountLabel.snp.makeConstraints { make in
+            make.leading.equalTo(followCountLabel.snp.trailing).offset(4)
+            make.centerY.equalToSuperview()
+            make.trailing.lessThanOrEqualToSuperview()
         }
     }
     
     private func buildStarView() -> UIView {
         let container = UIView()
+        container.onTap { [weak self] in
+            guard let self else { return }
+            
+        }
         
-        let star = LNStarScoreView()
-        star.icSize = 18
-        star.score = 1.0
-        container.addSubview(star)
-        star.snp.makeConstraints { make in
-            make.leading.equalToSuperview()
-            make.verticalEdges.equalToSuperview()
+        let likeIc = UIImageView()
+        likeIc.image = .icLikeEmpty.withTintColor(.text_1, renderingMode: .alwaysOriginal)
+        container.addSubview(likeIc)
+        likeIc.snp.makeConstraints { make in
+            make.horizontalEdges.equalToSuperview()
+            make.top.equalToSuperview()
+            make.width.height.equalTo(36)
         }
         
-        scoreLabel.font = .heading_h2
-        scoreLabel.textColor = .text_1
+        scoreLabel.text = "0"
+        scoreLabel.font = .body_s
+        scoreLabel.textColor = .text_2
         container.addSubview(scoreLabel)
         scoreLabel.snp.makeConstraints { make in
-            make.centerY.equalToSuperview()
-            make.leading.equalTo(star.snp.trailing).offset(4)
-            make.trailing.equalToSuperview()
+            make.centerX.equalToSuperview()
+            make.top.equalTo(likeIc.snp.bottom).offset(2)
+            make.bottom.equalToSuperview()
         }
         
         return container

+ 0 - 9
Lanu/Views/Profile/Profile/LNProfileViewController.swift

@@ -42,7 +42,6 @@ class LNProfileViewController: LNViewController {
     private let userInfoView = LNProfileUserInfoView()
     private let infoView = LNProfileInfosView()
     private let bottomMenu = LNProfileBottomMenu()
-    private let scoreView = LNProfileScoreFloatingView()
     
     private var detail: LNUserProfileVO?
     private var stayTimer: String?
@@ -155,7 +154,6 @@ private extension LNProfileViewController {
         voiceBar.update(detail.voiceBar)
         infoView.update(detail)
         bottomMenu.update(detail, scene: scene)
-        scoreView.update(detail)
     }
     
     func updateProgress(_ progress: Double) {
@@ -286,13 +284,6 @@ private extension LNProfileViewController {
             make.bottom.equalToSuperview()
         }
         
-        scoreView.isHidden = true
-        view.addSubview(scoreView)
-        scoreView.snp.makeConstraints { make in
-            make.centerY.equalToSuperview()
-            make.trailing.equalToSuperview().offset(-8)
-        }
-        
         infoView.outerScrollView = scrollView
     }