Bladeren bron

fix: 修复 UI 验收问题

陈文艺 2 maanden geleden
bovenliggende
commit
444ad9157e

+ 22 - 0
Lanu/Assets.xcassets/common/Voice/ic_voice_edit_pause.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "ic_voice_edit_pause@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "ic_voice_edit_pause@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
Lanu/Assets.xcassets/common/Voice/ic_voice_edit_pause.imageset/ic_voice_edit_pause@2x.png


BIN
Lanu/Assets.xcassets/common/Voice/ic_voice_edit_pause.imageset/ic_voice_edit_pause@3x.png


+ 14 - 4
Lanu/Common/Views/Base/LNViewController.swift

@@ -8,6 +8,7 @@
 import Foundation
 import UIKit
 import SnapKit
+import Combine
 
 
 class LNViewController: UIViewController {
@@ -16,7 +17,7 @@ class LNViewController: UIViewController {
     var navigationBarColor: UIColor = .white
     var customBack: (() -> Void)?
     
-    private let fakeView = UIView()
+    let fakeNaviBgView = UIView()
     
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -43,12 +44,21 @@ class LNViewController: UIViewController {
         }
         navigationItem.leftBarButtonItem = UIBarButtonItem(customView: button)
         
-        view.addSubview(fakeView)
-        fakeView.snp.makeConstraints { make in
+        view.addSubview(fakeNaviBgView)
+        fakeNaviBgView.snp.makeConstraints { make in
             make.horizontalEdges.equalToSuperview()
             make.bottom.equalTo(view.snp.top)
             make.height.equalTo(UIView.navigationBarHeight + UIView.statusBarHeight)
         }
+        view.publisher(for: \.frame).removeDuplicates().sink
+        { [weak self] newValue in
+            guard let self else { return }
+            if newValue.origin.y > fakeNaviBgView.bounds.height {
+                fakeNaviBgView.snp.updateConstraints { make in
+                    make.height.equalTo(newValue.origin.y)
+                }
+            }
+        }.store(in: &bag)
     }
     
     func setRightButton(_ view: UIView?) {
@@ -81,6 +91,6 @@ class LNViewController: UIViewController {
             navBar.compactAppearance = appearance
         }
         
-        fakeView.backgroundColor = view.backgroundColor
+        fakeNaviBgView.backgroundColor = view.backgroundColor
     }
 }

+ 46 - 0
Lanu/Localizable.xcstrings

@@ -9062,6 +9062,52 @@
           }
         }
       }
+    },
+    "B00107" : {
+      "extractionState" : "manual",
+      "localizations" : {
+        "en" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "Delete and re-record"
+          }
+        },
+        "id" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "Hapus dan rekam ulang"
+          }
+        },
+        "zh-Hans" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "删除并重新录制"
+          }
+        }
+      }
+    },
+    "B00108" : {
+      "extractionState" : "manual",
+      "localizations" : {
+        "en" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "Order earnings are held for 1 day before settlement to available balance."
+          }
+        },
+        "id" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "Pendapatan pesanan ditahan 1 hari sebelum diselesaikan ke saldo tersedia."
+          }
+        },
+        "zh-Hans" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "订单收入暂存1天,结算后转入可用余额。"
+          }
+        }
+      }
     }
   },
   "version" : "1.1"

+ 17 - 1
Lanu/Manager/Profile/LNProfileManager.swift

@@ -87,7 +87,23 @@ extension LNProfileManager {
             queue.asyncIfNotGlobal {
                 handler(err == nil)
             }
-            if err == nil {
+            if let err {
+                showToast(err.errorDesc)
+            } else {
+                guard let self else { return }
+                reloadMyProfile()
+            }
+        }
+    }
+    
+    func cleanVoiceBar(queue: DispatchQueue = .main, handler: @escaping (Bool) -> Void) {
+        LNHttpManager.shared.cleanVoiceBar { [weak self] err in
+            queue.asyncIfNotGlobal {
+                handler(err == nil)
+            }
+            if let err {
+                showToast(err.errorDesc)
+            } else {
                 guard let self else { return }
                 reloadMyProfile()
             }

+ 5 - 0
Lanu/Manager/Profile/Network/LNHttpManager+Profile.swift

@@ -11,6 +11,7 @@ import Foundation
 private let kNetPath_Profile_MyInfo = "/user/my/info"
 private let kNetPath_Profile_EditMyInfo = "/user/my/info/edit"
 private let kNetPath_Profile_EditVoice = "/user/my/voiceBarApply"
+private let kNetPath_Profile_ResetVoice = "/user/clean/myVoiceBar"
 
 private let kNetPath_Profile_UsersInfo = "/user/get/infos"
 
@@ -75,6 +76,10 @@ extension LNHttpManager {
             "voiceBarDuration": duration
         ], completion: completion)
     }
+    
+    func cleanVoiceBar(completion: @escaping (LNHttpError?) -> Void) {
+        post(path: kNetPath_Profile_ResetVoice, completion: completion)
+    }
 }
 
 extension LNHttpManager {

+ 2 - 0
Lanu/Manager/Profile/Network/LNProfileResponse.swift

@@ -81,6 +81,8 @@ enum LNUserVoiceBarState: Int, Decodable {
 @AutoCodable
 class LNUserVoiceStateVO: Decodable {
     var status: LNUserVoiceBarState = .none
+    var voiceBar: String = ""
+    var voiceBarDuration: Int = 0
     
     init() { }
 }

+ 1 - 1
Lanu/Views/Game/Join/Input/LNJoinUsViewController.swift

@@ -176,7 +176,7 @@ extension LNJoinUsViewController {
         view.addSubview(headerView)
         headerView.snp.makeConstraints { make in
             make.horizontalEdges.equalToSuperview()
-            make.top.equalToSuperview().offset(-(UIView.navigationBarHeight + UIView.statusBarHeight))
+            make.top.equalTo(fakeNaviBgView)
         }
         
         let container = UIView()

+ 1 - 1
Lanu/Views/Game/OrderCenter/LNGameMateCenterViewController.swift

@@ -89,7 +89,7 @@ extension LNGameMateCenterViewController {
         view.addSubview(topCover)
         topCover.snp.makeConstraints { make in
             make.horizontalEdges.equalToSuperview()
-            make.top.equalToSuperview().offset(-(UIView.navigationBarHeight + UIView.statusBarHeight))
+            make.top.equalTo(fakeNaviBgView)
         }
         
         let scrollView = UIScrollView()

+ 1 - 1
Lanu/Views/Game/OrderCenter/Skill/LNSkillReviewViewController.swift

@@ -46,7 +46,7 @@ extension LNSkillReviewViewController {
         view.addSubview(bg)
         bg.snp.makeConstraints { make in
             make.horizontalEdges.equalToSuperview()
-            make.top.equalToSuperview().offset(-(UIView.navigationBarHeight + UIView.statusBarHeight))
+            make.top.equalTo(fakeNaviBgView)
         }
         
         let infoView = buildInfoView()

+ 1 - 1
Lanu/Views/Login/Phone/LNLoginCaptchaInputViewController.swift

@@ -106,7 +106,7 @@ extension LNLoginCaptchaInputViewController {
         view.addSubview(cover)
         cover.snp.makeConstraints { make in
             make.horizontalEdges.equalToSuperview()
-            make.top.equalToSuperview().offset(-UIView.navigationBarHeight - UIView.statusBarHeight)
+            make.top.equalTo(fakeNaviBgView)
         }
         
         let textView = buildTextView()

+ 1 - 1
Lanu/Views/Login/Phone/LNLoginPhoneInputViewController.swift

@@ -105,7 +105,7 @@ extension LNLoginPhoneInputViewController {
         view.addSubview(cover)
         cover.snp.makeConstraints { make in
             make.horizontalEdges.equalToSuperview()
-            make.top.equalToSuperview().offset(-UIView.navigationBarHeight - UIView.statusBarHeight)
+            make.top.equalTo(fakeNaviBgView)
         }
         
         let paragraphStyle = NSMutableParagraphStyle()

+ 1 - 1
Lanu/Views/Login/Setup/LNBaseInfoSetupViewController.swift

@@ -191,7 +191,7 @@ extension LNBaseInfoSetupViewController {
         container.addSubview(bg)
         bg.snp.makeConstraints { make in
             make.horizontalEdges.equalToSuperview()
-            make.top.equalToSuperview().offset(-UIView.navigationBarHeight - UIView.statusBarHeight)
+            make.top.equalTo(fakeNaviBgView)
         }
         
         let titleView = buildTitles()

+ 1 - 1
Lanu/Views/Login/Setup/LNGenderSetupViewController.swift

@@ -73,7 +73,7 @@ extension LNGenderSetupViewController {
         view.addSubview(bg)
         bg.snp.makeConstraints { make in
             make.horizontalEdges.equalToSuperview()
-            make.top.equalToSuperview().offset(-UIView.navigationBarHeight - UIView.statusBarHeight)
+            make.top.equalTo(fakeNaviBgView)
         }
         
         setupNavigationBar()

+ 1 - 1
Lanu/Views/Login/Setup/LNInterestSetupViewController.swift

@@ -133,7 +133,7 @@ extension LNInterestSetupViewController {
         view.addSubview(bg)
         bg.snp.makeConstraints { make in
             make.horizontalEdges.equalToSuperview()
-            make.top.equalToSuperview().offset(-UIView.navigationBarHeight - UIView.statusBarHeight)
+            make.top.equalTo(fakeNaviBgView)
         }
         
         let titleView = buildTitles()

+ 41 - 16
Lanu/Views/Profile/Edit/LNEditVoicePanel.swift

@@ -28,6 +28,7 @@ class LNEditVoicePanel: LNPopupView {
     private var recordTaskId: String?
     
     private let editView = UIView()
+    private let editPlayButton = UIButton()
     private let editDurationLabel = UILabel()
     private var curUrl: URL?
     private var curDuration: Double?
@@ -89,6 +90,7 @@ extension LNEditVoicePanel {
         } else if myVoiceBarInfo.status == .done,
                   !myUserInfo.voiceBar.isEmpty {
             curState = .play
+            playDurationLabel.text = Double(myVoiceBarInfo.voiceBarDuration).durationDisplay
         } else {
             curState = .record
         }
@@ -130,6 +132,7 @@ extension LNEditVoicePanel: LNVoicePlayerNotify {
         if !editView.isHidden {
             let intDuration = Int(curDuration)
             editDurationLabel.text = String(format: "%02d:%02d", intDuration / 60, intDuration % 60)
+            editPlayButton.setImage(.icVoiceEditPlay, for: .normal)
         } else if !displayView.isHidden {
             playDurationLabel.text = curDuration.durationDisplay
             playIcon.image = .icVoicePlay
@@ -141,6 +144,8 @@ extension LNEditVoicePanel: LNVoicePlayerNotify {
         
         if !displayView.isHidden {
             playIcon.image = .icVoicePause
+        } else if !editView.isHidden {
+            editPlayButton.setImage(.icVoiceEditPause, for: .normal)
         }
     }
 }
@@ -185,7 +190,13 @@ extension LNEditVoicePanel {
     }
     
     private func setupViews() {
-        containerHeight = .height(326)
+        let fakeView = UIView()
+        fakeView.isUserInteractionEnabled = false
+        container.addSubview(fakeView)
+        fakeView.snp.makeConstraints { make in
+            make.edges.equalToSuperview()
+            make.height.equalTo(326)
+        }
         
         let titleView = buildTitle()
         container.addSubview(titleView)
@@ -347,15 +358,18 @@ extension LNEditVoicePanel {
         let playView = UIView()
         stackView.addArrangedSubview(playView)
         
-        let playButton = UIButton()
-        playButton.setImage(.icVoiceEditPlay, for: .normal)
-        playButton.addAction(UIAction(handler: { [weak self] _ in
+        editPlayButton.setImage(.icVoiceEditPlay, for: .normal)
+        editPlayButton.addAction(UIAction(handler: { [weak self] _ in
             guard let self else { return }
             guard let curUrl else { return }
-            LNVoicePlayer.shared.play(path: curUrl.path)
+            if LNVoicePlayer.shared.isPlaying {
+                LNVoicePlayer.shared.stop()
+            } else {
+                LNVoicePlayer.shared.play(path: curUrl.path)
+            }
         }), for: .touchUpInside)
-        playView.addSubview(playButton)
-        playButton.snp.makeConstraints { make in
+        playView.addSubview(editPlayButton)
+        editPlayButton.snp.makeConstraints { make in
             make.centerX.equalToSuperview()
             make.leading.greaterThanOrEqualToSuperview()
             make.top.equalToSuperview()
@@ -370,7 +384,7 @@ extension LNEditVoicePanel {
         playLabel.snp.makeConstraints { make in
             make.horizontalEdges.equalToSuperview()
             make.bottom.equalToSuperview()
-            make.top.equalTo(playButton.snp.bottom).offset(12)
+            make.top.equalTo(editPlayButton.snp.bottom).offset(12)
         }
         
         let confirmButton = UIButton()
@@ -446,6 +460,8 @@ extension LNEditVoicePanel {
     private func buildDisplayView() -> UIView {
         let button = UIButton()
         button.setBackgroundImage(.primary_7, for: .normal)
+        button.layer.cornerRadius = 16
+        button.clipsToBounds = true
         displayView.addSubview(button)
         button.snp.makeConstraints { make in
             make.centerX.equalToSuperview()
@@ -463,6 +479,7 @@ extension LNEditVoicePanel {
         }
         
         voiceWaveView.isUserInteractionEnabled = false
+        voiceWaveView.build()
         button.addSubview(voiceWaveView)
         voiceWaveView.snp.makeConstraints { make in
             make.centerY.equalToSuperview()
@@ -480,27 +497,26 @@ extension LNEditVoicePanel {
         }
         
         button.addAction(UIAction(handler: { [weak self] _ in
-            guard let self else { return }
+            guard self != nil else { return }
             if LNVoicePlayer.shared.isPlaying {
                 LNVoicePlayer.shared.stop()
-            } else if let url = curUrl?.absoluteString {
-                LNVoicePlayer.shared.play(url)
+            } else if !myUserInfo.voiceBar.isEmpty {
+                LNVoicePlayer.shared.play(myUserInfo.voiceBar)
             }
         }), for: .touchUpInside)
         
         let confirmButton = UIButton()
-        confirmButton.setTitle(.init(key: "A00240"), for: .normal)
-        confirmButton.setTitleColor(.text_1, for: .normal)
+        confirmButton.setTitle(.init(key: "B00107"), for: .normal)
+        confirmButton.setTitleColor(.text_6, for: .normal)
         confirmButton.titleLabel?.font = .heading_h3
         confirmButton.layer.cornerRadius = 23.5
-        confirmButton.setBackgroundImage(.primary_8, for: .normal)
+        confirmButton.setBackgroundImage(.primary_7, for: .normal)
         confirmButton.clipsToBounds = true
         confirmButton.addAction(UIAction(handler: { [weak self] _ in
             guard let self else { return }
             LNVoicePlayer.shared.stop()
             
-            LNProfileManager.shared.setMyVoiceBar(url: "", duration: 0)
-            { [weak self] success in
+            LNProfileManager.shared.cleanVoiceBar { [weak self] success in
                 guard let self else { return }
                 guard success else { return }
                 resetRecord()
@@ -514,6 +530,15 @@ extension LNEditVoicePanel {
             make.height.equalTo(47)
         }
         
+        let cover = UIView()
+        cover.layer.cornerRadius = 22
+        cover.backgroundColor = .fill
+        cover.isUserInteractionEnabled = false
+        confirmButton.insertSubview(cover, at: 0)
+        cover.snp.makeConstraints { make in
+            make.edges.equalToSuperview().inset(1)
+        }
+        
         return displayView
     }
 }

+ 2 - 3
Lanu/Views/Profile/Profile/LNProfileViewController.swift

@@ -209,9 +209,8 @@ extension LNProfileViewController {
         cover.onTap { [weak self] in
             guard let self else { return }
             guard let detail else { return }
-            let cover = detail.cover.isEmpty ? detail.avatar : detail.cover
-            guard !cover.isEmpty else { return }
-            view.presentImagePreview([cover], 0)
+            guard !detail.avatar.isEmpty else { return }
+            view.presentImagePreview([detail.avatar], 0)
         }
         cover.snp.makeConstraints { make in
             make.height.equalTo(cover.snp.width).multipliedBy(363.0/375.0)

+ 20 - 3
Lanu/Views/Wallet/Bean/LNBeanViewController.swift

@@ -147,7 +147,24 @@ extension LNBeanViewController {
         container.addSubview(titleLabel)
         titleLabel.snp.makeConstraints { make in
             make.top.equalToSuperview()
-            make.horizontalEdges.equalToSuperview()
+            make.leading.equalToSuperview()
+        }
+        
+        let about = UIButton()
+        about.setImage(.icAbout.withRenderingMode(.alwaysTemplate), for: .normal)
+        about.tintColor = .text_4
+        about.addAction(UIAction(handler: { [weak self] _ in
+            guard self != nil else { return }
+            let alert = LNCommonAlertView()
+            alert.messageLabel.text = .init(key: "B00108")
+            alert.setConfirm { }
+            alert.popup()
+        }), for: .touchUpInside)
+        container.addSubview(about)
+        about.snp.makeConstraints { make in
+            make.top.equalTo(titleLabel).offset(1)
+            make.trailing.lessThanOrEqualToSuperview()
+            make.width.height.equalTo(16)
         }
         
         unsettleLabel.text = "0"
@@ -225,7 +242,7 @@ extension LNBeanViewController {
         
         let toCoin = buildExchangeItemView(title: .init(key: "A00273"), color: .init(hex: "#FFF8E1"), icon: .icCoin42)
         toCoin.onTap { [weak self] in
-            guard let self else { return }
+            guard self != nil else { return }
             let panel = LNExchangePanel(exchangeType: .beanToCoin)
             panel.popup()
         }
@@ -233,7 +250,7 @@ extension LNBeanViewController {
         
         let toDiamond = buildExchangeItemView(title: .init(key: "A00264"), color: .init(hex: "#E3F2FF"), icon: .icDiamond42)
         toDiamond.onTap { [weak self] in
-            guard let self else { return }
+            guard self != nil else { return }
             let panel = LNExchangePanel(exchangeType: .beanToDiamond)
             panel.popup()
         }

+ 1 - 1
Lanu/Views/Wallet/LNWalletViewController.swift

@@ -55,7 +55,7 @@ extension LNWalletViewController {
         view.addSubview(topCover)
         topCover.snp.makeConstraints { make in
             make.leading.trailing.equalToSuperview()
-            make.top.equalToSuperview().offset(-UIView.navigationBarHeight - UIView.statusBarHeight)
+            make.top.equalTo(fakeNaviBgView)
         }
         
         setupNavBar()