Explorar el Código

feat: 调整房间公屏点击逻辑

陈文艺 hace 1 semana
padre
commit
b553c41a82

+ 1 - 0
Lanu/Common/Extension/UIView+Extension.swift

@@ -93,6 +93,7 @@ extension UIView {
     func onTap(_ block: @escaping () -> Void) {
         let tap = BlockTapGestureRecognizer(action: block)
         addGestureRecognizer(tap)
+        isUserInteractionEnabled = true
     }
     
     private class BlockLongPressGestureRecognizer: UILongPressGestureRecognizer {

+ 0 - 1
Lanu/Common/Views/ImageUpload/LNImageUploadView.swift

@@ -181,7 +181,6 @@ extension LNImageUploadView {
         
         failedIc.isHidden = true
         failedIc.image = .init(named: "ic_im_chat_send_failed")
-        failedIc.isUserInteractionEnabled = true
         failedIc.onTap { [weak self] in
             guard let self else { return }
             guard let image = self.image else { return }

+ 0 - 1
Lanu/Views/Game/Join/Input/Example/LNJoinUsPhotoExamplePanel.swift

@@ -58,7 +58,6 @@ extension LNJoinUsPhotoExamplePanel {
         imageView.layer.cornerRadius = 12
         imageView.clipsToBounds = true
         imageView.contentMode = .scaleAspectFit
-        imageView.isUserInteractionEnabled = true
         imageView.onTap { [weak self] in
             guard let self else { return }
             guard let curItem else { return }

+ 0 - 1
Lanu/Views/Game/Skill/LNSkillDetailViewController.swift

@@ -344,7 +344,6 @@ extension LNSkillDetailViewController {
         }.store(in: &cancellables)
         
         cover.contentMode = .scaleAspectFill
-        cover.isUserInteractionEnabled = true
         cover.clipsToBounds = true
         cover.onTap { [weak self] in
             guard let self else { return }

+ 0 - 1
Lanu/Views/Game/Skill/LNSkillPhotosView.swift

@@ -35,7 +35,6 @@ class LNSkillPhotosView: UIView {
             imageView.layer.cornerRadius = 12
             imageView.clipsToBounds = true
             imageView.contentMode = .scaleAspectFill
-            imageView.isUserInteractionEnabled = true
             imageView.onTap { [weak self] in
                 guard let self else { return }
                 presentImagePreview(urls, index)

+ 1 - 1
Lanu/Views/Home/LNHomeTopMenuView.swift

@@ -18,6 +18,7 @@ class LNHomeTopMenuView: UIView {
             
         setupViews()
         LNEventDeliver.addObserver(self)
+        onUserRoomAbilityChanged()
     }
     
     required init?(coder: NSCoder) {
@@ -40,7 +41,6 @@ extension LNHomeTopMenuView {
         let logo = UIImageView()
         logo.image = .icHomeLogo
 #if DEBUG
-        logo.isUserInteractionEnabled = true
         logo.onTap {
             LNBottomSheetMenu.showEnvMenu()
         }

+ 0 - 1
Lanu/Views/IM/Chat/Cells/LNIMChatBaseMessageCell.swift

@@ -109,7 +109,6 @@ class LNIMChatBaseMessageCell: UITableViewCell {
             make.trailing.equalToSuperview().offset(-16)
         }
         
-        sendStateIc.isUserInteractionEnabled = true
         sendStateIc.image = .icImChatSendFailed
         bubbleView.addSubview(sendStateIc)
         sendStateIc.snp.makeConstraints { make in

+ 0 - 1
Lanu/Views/IM/Chat/Cells/LNIMChatImageMessageCell.swift

@@ -37,7 +37,6 @@ class LNIMChatImageMessageCell: LNIMChatBaseMessageCell {
         imageIc.contentMode = .scaleAspectFill
         imageIc.layer.cornerRadius = 12
         imageIc.clipsToBounds = true
-        imageIc.isUserInteractionEnabled = true
         container.addSubview(imageIc)
         imageIc.snp.makeConstraints { make in
             make.edges.equalToSuperview()

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

@@ -290,7 +290,6 @@ extension LNBaseInfoSetupViewController {
         avatar.layer.cornerRadius = 60
         avatar.clipsToBounds = true
         avatar.delegate = self
-        avatar.isUserInteractionEnabled = true
         avatar.onTap { [weak self] in
             guard let self else { return }
             changeAvatar()

+ 0 - 1
Lanu/Views/Order/Detail/LNOrderRefundInfoView.swift

@@ -26,7 +26,6 @@ class LNOrderRefundInfoView: UIView {
         var photos: [UIImageView] = []
         for (index, attachment) in detail.attachments.enumerated() {
             let imageView = UIImageView()
-            imageView.isUserInteractionEnabled = true
             imageView.sd_setImage(with: URL(string: attachment.attachmentUrl))
             photos.append(imageView)
             imageView.snp.makeConstraints { make in

+ 0 - 1
Lanu/Views/Profile/Feed/LNImageFeedDetailViewController.swift

@@ -561,7 +561,6 @@ extension LNImageFeedHeaderCell {
     private func buildImageView() -> UIImageView {
         let imageView = UIImageView()
         imageView.contentMode = .scaleAspectFit
-        imageView.isUserInteractionEnabled = true
         
         return imageView
     }

+ 0 - 2
Lanu/Views/Profile/Feed/LNProfileFeedItemCell.swift

@@ -120,7 +120,6 @@ class LNProfileFeedItemCell: UITableViewCell {
                     for (index, media) in item.medias.enumerated() {
                         let imageView = buildImageView()
                         imageView.sd_setImage(with: URL(string: media.url))
-                        imageView.isUserInteractionEnabled = true
                         imageView.onTap { [weak self] in
                             guard let self else { return }
                             presentImagePreview(item.medias.map({ $0.url }), index)
@@ -323,7 +322,6 @@ extension LNProfileFeedItemCell {
         singlePhotoView.layer.cornerRadius = 12
         singlePhotoView.clipsToBounds = true
         singlePhotoView.contentMode = .scaleAspectFill
-        singlePhotoView.isUserInteractionEnabled = true
         singlePhotoView.onTap { [weak self] in
             guard let self else { return }
             guard let curItem else { return }

+ 0 - 2
Lanu/Views/Profile/Mine/LNMineUserInfoView.swift

@@ -62,7 +62,6 @@ extension LNMineUserInfoView {
         
         let home = UIImageView()
         home.image = .icMineHome
-        home.isUserInteractionEnabled = true
         home.onTap { [weak self] in
             guard let self else { return }
             pushToProfile(uid: myUid)
@@ -104,7 +103,6 @@ extension LNMineUserInfoView {
         avatar.backgroundColor = .fill
         avatar.clipsToBounds = true
         avatar.contentMode = .scaleAspectFill
-        avatar.isUserInteractionEnabled = true
         avatar.onTap { [weak self] in
             guard let self else { return }
             pushToProfile(uid: myUid)

+ 0 - 1
Lanu/Views/Profile/Profile/LNProfilePhotoWall.swift

@@ -225,7 +225,6 @@ private class LNProfilePhotoWallCell: UITableViewCell {
         photo.contentMode = .scaleAspectFill
         photo.layer.cornerRadius = 12
         photo.clipsToBounds = true
-        photo.isUserInteractionEnabled = true
         contentView.addSubview(photo)
         photo.onTap { [weak self] in
             guard let self else { return }

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

@@ -314,7 +314,6 @@ private extension LNProfileViewController {
         }.store(in: &cancellables)
         
         cover.contentMode = .scaleAspectFill
-        cover.isUserInteractionEnabled = true
         cover.onTap { [weak self] in
             guard let self else { return }
             guard let detail else { return }

+ 17 - 9
Lanu/Views/Room/Message/LNRoomChatMessageCell.swift

@@ -36,22 +36,27 @@ class LNRoomChatMessageCell: UITableViewCell {
     }
 }
 
+extension LNRoomChatMessageCell {
+    private func showProfileCard() {
+        guard let curItem else { return }
+        let panel = LNRoomProfileCardPanel()
+        panel.load(curItem.sender)
+        panel.popup()
+    }
+}
+
 extension LNRoomChatMessageCell {
     private func setupViews() {
         backgroundColor = .clear
         
-        onTap { [weak self] in
-            guard let self else { return }
-            guard let curItem else { return }
-            let panel = LNRoomProfileCardPanel()
-            panel.load(curItem.sender)
-            panel.popup()
-        }
-        
         avatarView.layer.cornerRadius = 13
         avatarView.layer.borderColor = .fill
         avatarView.layer.borderWidth = 0.5
         avatarView.clipsToBounds = true
+        avatarView.onTap { [weak self] in
+            guard let self else { return }
+            showProfileCard()
+        }
         contentView.addSubview(avatarView)
         avatarView.snp.makeConstraints { make in
             make.leading.equalToSuperview()
@@ -61,7 +66,6 @@ extension LNRoomChatMessageCell {
         }
         
         let bodyView = UIView()
-        bodyView.isUserInteractionEnabled = false
         contentView.addSubview(bodyView)
         bodyView.snp.makeConstraints { make in
             make.leading.equalTo(avatarView.snp.trailing).offset(10)
@@ -73,6 +77,10 @@ extension LNRoomChatMessageCell {
         nameLabel.font = .body_xs
         nameLabel.textColor = .text_2
         nameLabel.setContentHuggingPriority(.required, for: .vertical)
+        nameLabel.onTap { [weak self] in
+            guard let self else { return }
+            showProfileCard()
+        }
         bodyView.addSubview(nameLabel)
         nameLabel.snp.makeConstraints { make in
             make.horizontalEdges.equalToSuperview()

+ 5 - 5
Lanu/Views/Room/Message/LNRoomWelcomeMessageCell.swift

@@ -41,17 +41,17 @@ class LNRoomWelcomeMessageCell: UITableViewCell {
 extension LNRoomWelcomeMessageCell {
     private func setupViews() {
         backgroundColor = .clear
-        onTap { [weak self] in
+        
+        let container = UIView()
+        container.backgroundColor = .fill.withAlphaComponent(0.12)
+        container.layer.cornerRadius = 12
+        container.onTap { [weak self] in
             guard let self else { return }
             guard let curItem else { return }
             let panel = LNRoomProfileCardPanel()
             panel.load(curItem.sender)
             panel.popup()
         }
-        
-        let container = UIView()
-        container.backgroundColor = .fill.withAlphaComponent(0.12)
-        container.layer.cornerRadius = 12
         contentView.addSubview(container)
         container.snp.makeConstraints { make in
             make.verticalEdges.equalToSuperview()

+ 0 - 1
Lanu/Views/Room/Profile/LNRoomProfileCardPanel.swift

@@ -109,7 +109,6 @@ private extension LNRoomProfileCardPanel {
         avatarView.backgroundColor = .fill_7
         avatarView.clipsToBounds = true
         avatarView.contentMode = .scaleAspectFill
-        avatarView.isUserInteractionEnabled = true
         avatarView.onTap { [weak self] in
             guard let self else { return }
             guard let curDetail else { return }

+ 0 - 1
Lanu/Views/Wallet/Bean/LNBeanViewController.swift

@@ -89,7 +89,6 @@ extension LNBeanViewController {
             case .english: .icBeanValueBgEn
             case .indonesian: .icBeanValueBgId
             }
-            tag.isUserInteractionEnabled = true
             tag.onTap { [weak self] in
                 guard let self else { return }
                 view.pushToWebView(.init(url: .beanUrl))