Browse Source

1.修改输入框 可以输入空内容发送的问题
2.替换 vip 图标

100Years 1 month ago
parent
commit
9143dc1db6

+ 6 - 6
AIEmoji.xcodeproj/project.pbxproj

@@ -38,7 +38,6 @@
 		A80E73E12D533E5800C64288 /* TSPurchaseVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A80E73D82D533E5800C64288 /* TSPurchaseVC.swift */; };
 		A80E73E42D533EB000C64288 /* TSPurchaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A80E73E22D533EB000C64288 /* TSPurchaseManager.swift */; };
 		A80E73E62D5348D000C64288 /* SettingPurchaseTopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A80E73E52D5348CF00C64288 /* SettingPurchaseTopView.swift */; };
-		A89EA6982D5B1A01000EB181 /* Butterfly🦋.json in Resources */ = {isa = PBXBuildFile; fileRef = A89EA6972D5B19F0000EB181 /* Butterfly🦋.json */; };
 		A89EA64B2D59A588000EB181 /* MessageKit in Frameworks */ = {isa = PBXBuildFile; productRef = A89EA64A2D59A588000EB181 /* MessageKit */; };
 		A89EA6542D59A9F4000EB181 /* TSTextLayoutSizeCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = A89EA64F2D59A9F4000EB181 /* TSTextLayoutSizeCalculator.swift */; };
 		A89EA6552D59A9F4000EB181 /* MockMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = A89EA6502D59A9F4000EB181 /* MockMessage.swift */; };
@@ -53,6 +52,7 @@
 		A89EA67A2D59D25F000EB181 /* TSAIChatVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = A89EA6792D59D248000EB181 /* TSAIChatVM.swift */; };
 		A89EA67D2D59F1AF000EB181 /* StreamPostRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = A89EA67C2D59F1AC000EB181 /* StreamPostRequest.swift */; };
 		A89EA6832D59F4F9000EB181 /* TSChatViewController+ChatDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A89EA6822D59F4F1000EB181 /* TSChatViewController+ChatDelegate.swift */; };
+		A89EA6982D5B1A01000EB181 /* Butterfly🦋.json in Resources */ = {isa = PBXBuildFile; fileRef = A89EA6972D5B19F0000EB181 /* Butterfly🦋.json */; };
 		A89EA6A32D5B26E3000EB181 /* TSDBAIChatList.swift in Sources */ = {isa = PBXBuildFile; fileRef = A89EA6A22D5B26E3000EB181 /* TSDBAIChatList.swift */; };
 		A89EA6AC2D5B3EFB000EB181 /* TSRealmManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A89EA6AB2D5B3EFA000EB181 /* TSRealmManager.swift */; };
 		A89EA6B12D5C9D0C000EB181 /* TSAIChatHistoryVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A89EA6B02D5C9D0B000EB181 /* TSAIChatHistoryVC.swift */; };
@@ -159,7 +159,6 @@
 		A80E73D82D533E5800C64288 /* TSPurchaseVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSPurchaseVC.swift; sourceTree = "<group>"; };
 		A80E73E22D533EB000C64288 /* TSPurchaseManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSPurchaseManager.swift; sourceTree = "<group>"; };
 		A80E73E52D5348CF00C64288 /* SettingPurchaseTopView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingPurchaseTopView.swift; sourceTree = "<group>"; };
-		A89EA6972D5B19F0000EB181 /* Butterfly🦋.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "Butterfly🦋.json"; sourceTree = "<group>"; };
 		A89EA64C2D59A9F4000EB181 /* CustomMessageFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomMessageFlowLayout.swift; sourceTree = "<group>"; };
 		A89EA64E2D59A9F4000EB181 /* TSLayoutSizeCalculator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSLayoutSizeCalculator.swift; sourceTree = "<group>"; };
 		A89EA64F2D59A9F4000EB181 /* TSTextLayoutSizeCalculator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSTextLayoutSizeCalculator.swift; sourceTree = "<group>"; };
@@ -173,6 +172,7 @@
 		A89EA6792D59D248000EB181 /* TSAIChatVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSAIChatVM.swift; sourceTree = "<group>"; };
 		A89EA67C2D59F1AC000EB181 /* StreamPostRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamPostRequest.swift; sourceTree = "<group>"; };
 		A89EA6822D59F4F1000EB181 /* TSChatViewController+ChatDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TSChatViewController+ChatDelegate.swift"; sourceTree = "<group>"; };
+		A89EA6972D5B19F0000EB181 /* Butterfly🦋.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "Butterfly🦋.json"; sourceTree = "<group>"; };
 		A89EA6A22D5B26E3000EB181 /* TSDBAIChatList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSDBAIChatList.swift; sourceTree = "<group>"; };
 		A89EA6AB2D5B3EFA000EB181 /* TSRealmManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSRealmManager.swift; sourceTree = "<group>"; };
 		A89EA6B02D5C9D0B000EB181 /* TSAIChatHistoryVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSAIChatHistoryVC.swift; sourceTree = "<group>"; };
@@ -1197,7 +1197,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1;
+				CURRENT_PROJECT_VERSION = 4;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -1213,7 +1213,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 1.4;
+				MARKETING_VERSION = 1.3;
 				PRODUCT_BUNDLE_IDENTIFIER = com.girl.music.wallpaper;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -1236,7 +1236,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1;
+				CURRENT_PROJECT_VERSION = 4;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -1252,7 +1252,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 1.4;
+				MARKETING_VERSION = 1.3;
 				PRODUCT_BUNDLE_IDENTIFIER = com.girl.music.wallpaper;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";

+ 2 - 2
AIEmoji/Assets.xcassets/VIP/vip_side_icon.imageset/Contents.json

@@ -5,12 +5,12 @@
       "scale" : "1x"
     },
     {
-      "filename" : "vip_big_icon@2x.png",
+      "filename" : "vip_side_icon@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },
     {
-      "filename" : "vip_big_icon@3x.png",
+      "filename" : "vip_side_icon@3x.png",
       "idiom" : "universal",
       "scale" : "3x"
     }

BIN
AIEmoji/Assets.xcassets/VIP/vip_side_icon.imageset/vip_big_icon@2x.png


BIN
AIEmoji/Assets.xcassets/VIP/vip_side_icon.imageset/vip_big_icon@3x.png


BIN
AIEmoji/Assets.xcassets/VIP/vip_side_icon.imageset/vip_side_icon@2x.png


BIN
AIEmoji/Assets.xcassets/VIP/vip_side_icon.imageset/vip_side_icon@3x.png


+ 21 - 14
AIEmoji/Business/AIChat/TSChatViewController/TSChatInputBarVC/TSChatInputBarVC.swift

@@ -21,10 +21,7 @@ class TSChatInputBarVC: TSBaseVC, UITextViewDelegate {
     lazy var sendBtn: UIButton = {
         let sendBtn = UIButton.createButton(image: UIImage(named: "chat_send")) { [weak self]  in
             guard let self = self else { return }
-            if let string = textView.text {
-                sendComplete?([string])
-            }
-            emptyInput()
+            sendMsg()
         }
         sendBtn.isEnabled = false
         return sendBtn
@@ -37,13 +34,19 @@ class TSChatInputBarVC: TSBaseVC, UITextViewDelegate {
             vc.text = textView.text
             vc.sendComplete = { [weak self] date in
                 guard let self = self else { return }
-                sendComplete?(date)
-                emptyInput()
+                if let text = date.first as? String {
+                    textView.text = text
+                    textView.resignFirstResponder()
+                    textDidChange()
+                    scrollTextViewToBottom()
+                    sendComplete?(date)
+                }
             }
             
             vc.closeComplete = { [weak self] text in
                 guard let self = self else { return }
                 textView.text = text
+                textView.resignFirstResponder()
                 textDidChange()
                 scrollTextViewToBottom()
             }
@@ -121,11 +124,19 @@ class TSChatInputBarVC: TSBaseVC, UITextViewDelegate {
         NotificationCenter.default.addObserver(self, selector: #selector(textDidChange), name: UITextView.textDidChangeNotification, object: textView)
     }
 
+    func sendMsg(){
+        if textView.text.replacingOccurrences(of: " ", with: "").count <= 0 {
+            return
+        }
+        if let string = textView.text {
+            sendComplete?([string])
+            textView.resignFirstResponder()
+        }
+    }
     
     func sendEnabled(enabled:Bool){
-    
         if enabled == true ,textView.text.replacingOccurrences(of: " ", with: "").count > 0 {
-            sendBtn.isEnabled = false
+            sendBtn.isEnabled = true
         }else{
             sendBtn.isEnabled = false
         }
@@ -168,7 +179,7 @@ extension TSChatInputBarVC {
         }
          
         
-        sendEnabled(enabled: true)
+        sendEnabled(enabled: textView.text.count > 0)
 
         // 更新输入框的高度
         textView.snp.updateConstraints { make in
@@ -190,11 +201,7 @@ extension TSChatInputBarVC {
     func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
         if text == "\n" {
             // 当输入为换行符(即按下 return 键)时,执行相应操作
-            if let string = textView.text {
-                sendComplete?([string])
-            }
-            emptyInput()
-            textView.resignFirstResponder()
+            sendMsg()
             return false
         }
         return true

+ 21 - 13
AIEmoji/Business/AIChat/TSChatViewController/TSChatInputBarVC/TSChatInputFullScreenVC.swift

@@ -23,11 +23,7 @@ class TSChatInputFullScreenVC: TSBaseVC, UITextViewDelegate {
     lazy var sendBtn: UIButton = {
         let sendBtn = UIButton.createButton(image: UIImage(named: "chat_send")) { [weak self]  in
             guard let self = self else { return }
-            if let string = textView.text {
-                sendComplete?([string])
-            }
-            textView.text = ""
-            dismiss(animated: true)
+            sendMsg()
         }
         return sendBtn
     }()
@@ -122,9 +118,26 @@ class TSChatInputFullScreenVC: TSBaseVC, UITextViewDelegate {
     @objc private func textDidChange() {
         sendEnabled(enabled: textView.text.count > 0)
     }
-
+    
+    
+    func sendMsg(){
+        if textView.text.replacingOccurrences(of: " ", with: "").count <= 0 {
+            return
+        }
+        
+        if let string = textView.text {
+            sendComplete?([string])
+            textView.resignFirstResponder()
+            dismiss(animated: true)
+        }
+    }
+    
     func sendEnabled(enabled:Bool){
-        sendBtn.isEnabled = enabled
+        if enabled == true ,textView.text.replacingOccurrences(of: " ", with: "").count > 0 {
+            sendBtn.isEnabled = true
+        }else{
+            sendBtn.isEnabled = false
+        }
     }
     
     @objc func keyboardWillShow(_ notification: Notification) {
@@ -177,12 +190,7 @@ extension TSChatInputFullScreenVC {
     func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
         if text == "\n" {
             // 当输入为换行符(即按下 return 键)时,执行相应操作
-            if let string = textView.text {
-                sendComplete?([string])
-            }
-            dismiss(animated: true)
-            textView.text = ""
-            textView.resignFirstResponder()
+            sendMsg()
             return false
         }
         return true

+ 2 - 0
AIEmoji/Business/AIChat/TSChatViewController/TSChatViewController/TSChatViewController+SendMsg.swift

@@ -14,6 +14,8 @@ extension TSChatViewController {
             guard let self = self else { return }
         }){ return }
         
+        inputBarVC.emptyInput()
+        
         sendMessages(data)
         messagesCollectionView.scrollToLastItem(animated: true)
         view.endEditing(true)

+ 3 - 3
AIEmoji/Business/General/TSSmallIconBrowseVC/View/TSSmallIconBrowseCell.swift

@@ -29,9 +29,9 @@ class TSSmallIconBrowseCell : TSBaseCollectionCell{
         
         netWorkImageView.addSubview(vipImageView)
         vipImageView.snp.makeConstraints { make in
-            make.width.height.equalTo(40)
-            make.top.equalTo(-5)
-            make.trailing.equalTo(5)
+            make.width.height.equalTo(20)
+            make.top.equalTo(4)
+            make.trailing.equalTo(-4)
         }
         
     }

+ 3 - 3
AIEmoji/Business/TSEmojisVC/TSEmojisChildVC/VIew/TSEmojisCoLItemCell.swift

@@ -31,9 +31,9 @@ class TSEmojisCoLItemCell: TSBaseCollectionCell {
         
         bgContentView.addSubview(vipImageView)
         vipImageView.snp.makeConstraints { make in
-            make.width.height.equalTo(40)
-            make.top.equalTo(-8)
-            make.trailing.equalTo(8)
+            make.width.height.equalTo(20)
+            make.top.equalTo(4)
+            make.trailing.equalTo(-4)
         }
     }
     

+ 6 - 4
AIEmoji/Business/TSGenmojiVC/TSGenmojiVC/View/TSGenmojiGennerateCell.swift

@@ -80,16 +80,18 @@ class TSGenmojiGennerateCell : TSBaseCollectionCell{
 
 extension TSGenmojiGennerateCell: UITextViewDelegate{
     func textViewDidChange(_ textView: UITextView) {
-        submitBtn.isEnabled = textView.text.count > 0
+        submitBtn.isEnabled = textView.text.replacingOccurrences(of: " ", with: "") .count > 0
     }
     
     // 实现 UITextViewDelegate 协议方法,控制 return 键行为
     func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
         if text == "\n" {
             // 当输入为换行符(即按下 return 键)时,执行相应操作
-            actionHandler(any: customTextView.text)
-            textView.text = ""
-            textView.resignFirstResponder()
+            if submitBtn.isEnabled {
+                actionHandler(any: customTextView.text)
+                textView.text = ""
+                textView.resignFirstResponder()
+            }
             return false
         }
         return true