Explorar el Código

1.emoji vip 还原回初版
2.去除多分支的 SVProgressHUD

100Years hace 1 mes
padre
commit
21eee2f29a

+ 2 - 6
AIEmoji.xcodeproj/project.pbxproj

@@ -81,7 +81,6 @@
 		A8F774902D38E8B700AA6E93 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A8F774852D38E8B700AA6E93 /* LaunchScreen.storyboard */; };
 		A8F774E02D38EA8C00AA6E93 /* TSCommonTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F774C72D38EA8C00AA6E93 /* TSCommonTool.swift */; };
 		A8F774E12D38EA8C00AA6E93 /* TSFileManagerTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F774CA2D38EA8C00AA6E93 /* TSFileManagerTool.swift */; };
-		A8F774EC2D38EA8C00AA6E93 /* TSToastTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F774CC2D38EA8C00AA6E93 /* TSToastTool.swift */; };
 		A8F775002D38EA8C00AA6E93 /* WindowHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F774CD2D38EA8C00AA6E93 /* WindowHelper.swift */; };
 		A8F775032D38EA8C00AA6E93 /* GlobalImports.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F774B42D38EA8C00AA6E93 /* GlobalImports.swift */; };
 		A8F7750A2D38EA8C00AA6E93 /* TSNetworkTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F774CB2D38EA8C00AA6E93 /* TSNetworkTool.swift */; };
@@ -205,7 +204,6 @@
 		A8F774C72D38EA8C00AA6E93 /* TSCommonTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSCommonTool.swift; sourceTree = "<group>"; };
 		A8F774CA2D38EA8C00AA6E93 /* TSFileManagerTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSFileManagerTool.swift; sourceTree = "<group>"; };
 		A8F774CB2D38EA8C00AA6E93 /* TSNetworkTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSNetworkTool.swift; sourceTree = "<group>"; };
-		A8F774CC2D38EA8C00AA6E93 /* TSToastTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSToastTool.swift; sourceTree = "<group>"; };
 		A8F774CD2D38EA8C00AA6E93 /* WindowHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowHelper.swift; sourceTree = "<group>"; };
 		A8F775162D38EB7400AA6E93 /* TSTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSTabBarController.swift; sourceTree = "<group>"; };
 		A8F775182D38EC6700AA6E93 /* TSEmojisVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSEmojisVC.swift; sourceTree = "<group>"; };
@@ -639,7 +637,6 @@
 				A8F774CA2D38EA8C00AA6E93 /* TSFileManagerTool.swift */,
 				A8F7754F2D39ECED00AA6E93 /* PhotoManager.swift */,
 				A8F774CB2D38EA8C00AA6E93 /* TSNetworkTool.swift */,
-				A8F774CC2D38EA8C00AA6E93 /* TSToastTool.swift */,
 				A8F774CD2D38EA8C00AA6E93 /* WindowHelper.swift */,
 			);
 			path = Tool;
@@ -1112,7 +1109,6 @@
 				A80E72632D40925000C64288 /* TSDiyKeyboardVM.swift in Sources */,
 				A8F775432D39346400AA6E93 /* TSSetingModel.swift in Sources */,
 				A89EA6BA2D5DDE5B000EB181 /* TSPageNullView.swift in Sources */,
-				A8F774EC2D38EA8C00AA6E93 /* TSToastTool.swift in Sources */,
 				A89EA6C12D5ED289000EB181 /* TSChatCellConfig.swift in Sources */,
 				A8F775502D39ECED00AA6E93 /* PhotoManager.swift in Sources */,
 				A8F7763F2D3B68E100AA6E93 /* TSGenmojiGennerateViewModel.swift in Sources */,
@@ -1197,7 +1193,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 4;
+				CURRENT_PROJECT_VERSION = 5;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -1236,7 +1232,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 4;
+				CURRENT_PROJECT_VERSION = 5;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;

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


+ 0 - 63
AIEmoji/Business/AIChat/TSChatViewController/Models/MockMessage.swift

@@ -1,63 +0,0 @@
-// MIT License
-//
-// Copyright (c) 2017-2019 MessageKit
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-import Foundation
-import MessageKit
-import UIKit
-// MARK: - TSChatMessage
-internal class TSChatMessage: MessageType {
-  // MARK: Lifecycle
-
-    init(kind: MessageKind, user: TSChatUser, messageId: String, date: Date) {
-        self.kind = kind
-        self.user = user
-        self.messageId = messageId
-        sentDate = date
-    }
-
-    convenience init(custom: Any?, user: TSChatUser, messageId: String, date: Date) {
-        self.init(kind: .custom(custom), user: user, messageId: messageId, date: date)
-    }
-
-    convenience init(text: String, user: TSChatUser, messageId: String, date: Date) {
-        self.init(kind: .text(text), user: user, messageId: messageId, date: date)
-    }
-
-    convenience init(attributedText: NSAttributedString, user: TSChatUser, messageId: String, date: Date) {
-        self.init(kind: .attributedText(attributedText), user: user, messageId: messageId, date: date)
-    }
-
-    convenience init(linkItem: LinkItem, user: TSChatUser, messageId: String, date: Date) {
-        self.init(kind: .linkPreview(linkItem), user: user, messageId: messageId, date: date)
-    }
-
-    // MARK: Internal
-    var messageId: String
-    var sentDate: Date
-    var kind: MessageKind
-    var user: TSChatUser
-    var sender: SenderType {
-        user
-    }
-    var sendState: TSProgressState = .none
-}
-

+ 16 - 2
AIEmoji/Business/AIChat/TSChatViewController/TSChatViewController/TSChatViewController+Keyboard.swift

@@ -47,14 +47,28 @@ extension TSChatViewController{
         // 判断是否需要显示滚动到底部的按钮
         if offsetY > contentHeight - frameHeight + inputContainerView.frame.size.height - 10 {
             scrollToBottomButton.isHidden = true
+            updateMessageCollectionViewBottomInset()
         } else {
             scrollToBottomButton.isHidden = false
         }
         
-
+      
     }
     
-    
+    /// Updates bottom messagesCollectionView inset based on the position of inputContainerView
+    func updateMessageCollectionViewBottomInset() {
+      let collectionViewHeight = messagesCollectionView.frame.maxY
+      let newBottomInset = collectionViewHeight - (inputContainerView.frame.minY - additionalBottomInset) -
+        (messagesCollectionView.adjustedContentInset.bottom - messagesCollectionView.contentInset.bottom)
+      let normalizedNewBottomInset = max(0, newBottomInset)
+      let differenceOfBottomInset = newBottomInset - messagesCollectionView.contentInset.bottom
+
+      UIView.performWithoutAnimation {
+        guard differenceOfBottomInset != 0 else { return }
+        messagesCollectionView.contentInset.bottom = normalizedNewBottomInset
+        messagesCollectionView.verticalScrollIndicatorInsets.bottom = newBottomInset
+      }
+    }
 }
 
 

+ 38 - 9
AIEmoji/Business/AIChat/TSChatViewController/Views/TSTextMessageContentCell.swift

@@ -124,14 +124,33 @@ class TSTextMessageContentCell: TSMessageContentCell {
             messageLabel.text = text.string
             messageLabel.attributedText = text
 //            debugPrint("attributedText赋值")
-            
 //            extractAndPrintSubstring(from: messageLabel.text ?? "", to: text.string)
+//            appendTextGradually(originalText: messageLabel.text ?? "", newText: text.string)
         default:
             break
         }
     }
     
+    func appendTextGradually(originalText: String, newText: String) {
+        guard newText.count > originalText.count else { return }
+
+        let startIndex = originalText.endIndex
+        var currentIndex = startIndex
+        let remainingText = newText.suffix(from: startIndex)
+        messageLabel.text = originalText
+        for (index, _) in remainingText.enumerated() {
+            DispatchQueue.main.asyncAfter(deadline: .now() + Double(index) * 0.05) {
+                let nextIndex = newText.index(after: currentIndex)
+                self.messageLabel.text?.append(newText[currentIndex])
+                if let text = self.messageLabel.text {
+                    self.messageLabel.attributedText = kMDAttributedString(text: text)
+                }
+                currentIndex = nextIndex
+            }
+        }
+    }
     
+    //延时输出
     func extractAndPrintSubstring(from sourceString: String, to targetString: String) {
         // 查找 sourceString 在 targetString 中的结束位置
         if let range = targetString.range(of: sourceString) {
@@ -139,15 +158,25 @@ class TSTextMessageContentCell: TSMessageContentCell {
             let startIdx = range.upperBound
             // 提取从该位置到 targetString 结束的子字符串
             let extractedSubstring = targetString[startIdx...]
-            
-            // 将提取的子字符串逐个字符输出
-            var string = sourceString
-            for character in extractedSubstring {
-//                print(character)
-                string = string + String(character)
-                messageLabel.text = string
-                messageLabel.attributedText = kMDAttributedString(text: string)
+            let firstString = extractedSubstring.first
+ 
+            if let firstString = firstString {
+                DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
+                    let text = sourceString + String(firstString)
+                    self.messageLabel.text = text
+                    debugPrint("firstString text =\(text)")
+     
+                    self.messageLabel.attributedText = kMDAttributedString(text: text)
+                    
+                    
+                    
+                    self.extractAndPrintSubstring(from: text, to: targetString)
+                }
+            }else{
+                
+                debugPrint("firstString error =\(firstString)")
             }
+
         } else {
             print("未找到 sourceString")
             messageLabel.text = targetString

+ 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(20)
-            make.top.equalTo(4)
-            make.trailing.equalTo(-4)
+            make.width.height.equalTo(40)
+            make.top.equalTo(-5)
+            make.trailing.equalTo(5)
         }
         
     }

+ 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(20)
-            make.top.equalTo(4)
-            make.trailing.equalTo(-4)
+            make.width.height.equalTo(40)
+            make.top.equalTo(-8)
+            make.trailing.equalTo(8)
         }
     }
     

+ 4 - 4
AIEmoji/Business/TSPurchaseMembershipVC/TSPurchaseVC.swift

@@ -104,7 +104,7 @@ class TSPurchaseVC: TSBaseVC {
                 case .none:
                     break
                 case .loading:
-                    TSToastShared.showLoading(text: "Getting price".localized)
+                    TSToastShared.showLoading(text: "Getting price".localized,containerView: self.view)
                 case .loadSuccess:
                     TSToastShared.hideLoading()
                 case .loadFail:
@@ -115,7 +115,7 @@ class TSPurchaseVC: TSBaseVC {
                         PurchaseManager.default.requestProducts()
                     }
                 case .paying:
-                    TSToastShared.showLoading(text: "Purchasing now".localized)
+                    TSToastShared.showLoading(text: "Purchasing now".localized,containerView: self.view)
                 case .paySuccess:
                     TSToastShared.hideLoading()
                     let loadingText = manager.isVip ? "Congratulation you have become VIP".localized : "Finish".localized
@@ -133,7 +133,7 @@ class TSPurchaseVC: TSBaseVC {
                     }
                     
                 case .restoreing:
-                    TSToastShared.showLoading(text: "Restoring now".localized)
+                    TSToastShared.showLoading(text: "Restoring now".localized,containerView: self.view)
                 case .restoreSuccess:
                     TSToastShared.hideLoading()
                     let loadingText = manager.isVip ? "Congratulation you have become VIP".localized : "Couldn't Restore Subscription".localized
@@ -152,7 +152,7 @@ class TSPurchaseVC: TSBaseVC {
                     TSToastShared.showToast(text: loadingText)
                 case .verifying:
                     #if DEBUG
-                    TSToastShared.showLoading(text: "Verifying receipt...".localized)
+                    TSToastShared.showLoading(text: "Verifying receipt...".localized,containerView: self.view)
                     #endif
                 case .verifySuccess:
                     break

+ 4 - 4
AIEmoji/Common/NetworkManager/TSNetWork/TSNetworkManager+Loading.swift

@@ -21,8 +21,8 @@ extension TSNetworkManager {
             isShowAnimation = true
         }
         
-        if isShowAnimation {
-            TSToastShared.showLoading()
+        if isShowAnimation,let view = animationView {
+            TSToastShared.showLoading(containerView: view)
         }
 
         get(urlType: urlType, parameters:parameters,responseType:responseType) { result in
@@ -61,8 +61,8 @@ extension TSNetworkManager {
             isShowAnimation = true
         }
         
-        if isShowAnimation {
-            TSToastShared.showLoading()
+        if isShowAnimation,let view = animationView {
+            TSToastShared.showLoading(containerView: view)
         }
 
         post(urlType: urlType, parameters:parameters,responseType:responseType){ result in

+ 3 - 3
AIEmoji/Common/Purchase/TSPurchaseManager.swift

@@ -138,9 +138,9 @@ public class PurchaseManager: NSObject {
     }
 
     @objc public var isVip: Bool {
-        #if DEBUG
-        return true
-        #endif
+//        #if DEBUG
+//        return true
+//        #endif
         guard let expiresDate = expiredDate else {
             return false
         }

+ 0 - 54
AIEmoji/Common/Tool/TSToastTool.swift

@@ -1,54 +0,0 @@
-//
-//  TSToastTool.swift
-//  TSLiveWallpaper
-//
-//  Created by 100Years on 2024/12/20.
-//
-
-
-import SVProgressHUD
-
-let TSToastShared = TSToastTool.shared
-
-class TSToastTool {
-    static let shared = TSToastTool()
-
-    private init() {
-        SVProgressHUD.setDefaultStyle(.dark)
-        //如果您想要堆叠 HUD,您可以使用以下方法平衡每个节目通话:
-        //[SVProgressHUD popActivity];
-    }
-
-    /// 显示文字提示
-    func showToast(text: String?, duration: TimeInterval = 3.0) {
-        if let text = text {
-            if text.count == 0 {
-                return
-            }
-            
-            kExecuteOnMainThread {
-                SVProgressHUD.showInfo(withStatus: text)
-            }
-        }
-    }
-    
-
-    /// 显示加载动画
-    func showLoading(text:String? = nil) {
-        kExecuteOnMainThread {
-            SVProgressHUD.show(withStatus: text)
-        }
-    }
-
-    /// 隐藏加载动画
-    func hideLoading() {
-        kExecuteOnMainThread {
-            SVProgressHUD.dismiss()
-        }
-    }
-}
-
-
-func kShowToastDataMissing(){
-    TSToastShared.showToast(text: "Data missing")
-}

+ 0 - 1
Podfile

@@ -10,7 +10,6 @@ target 'AIEmoji' do
   use_frameworks!
   pod 'ObjectMapper'
   pod 'SnapKit'
-  pod 'SVProgressHUD'
   pod 'Kingfisher', '7.10.0'
   pod 'Alamofire', '5.6.4'
   pod 'MJRefresh'

+ 1 - 7
Podfile.lock

@@ -52,9 +52,6 @@ PODS:
   - RealmSwift (10.54.2):
     - Realm (= 10.54.2)
   - SnapKit (5.7.1)
-  - SVProgressHUD (2.3.1):
-    - SVProgressHUD/Core (= 2.3.1)
-  - SVProgressHUD/Core (2.3.1)
   - SwiftyMarkdown (1.2.4)
   - SwipeCellKit (2.7.1)
   - TSSmalCoacopods (0.1.0):
@@ -74,7 +71,6 @@ DEPENDENCIES:
   - ObjectMapper
   - RealmSwift (~> 10)
   - SnapKit
-  - SVProgressHUD
   - SwiftyMarkdown
   - SwipeCellKit
   - TSSmalCoacopods (from `../TSSmalCoacopods`)
@@ -99,7 +95,6 @@ SPEC REPOS:
     - Realm
     - RealmSwift
     - SnapKit
-    - SVProgressHUD
     - SwiftyMarkdown
     - SwipeCellKit
 
@@ -126,11 +121,10 @@ SPEC CHECKSUMS:
   Realm: 16852517a207e98cc6acba9336b56c30d06d84ad
   RealmSwift: bca777b3904ee58a9b16036e1840012f03348060
   SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a
-  SVProgressHUD: 4837c74bdfe2e51e8821c397825996a8d7de6e22
   SwiftyMarkdown: 7cdec87c6ab5cd9ea0e22ced288e889960649ba5
   SwipeCellKit: 3972254a826da74609926daf59b08d6c72e619ea
   TSSmalCoacopods: d143fb37412626673d129359e55eb263a7c7de1d
 
-PODFILE CHECKSUM: 4bfa06c906b32ca1142731b283277c078647da9c
+PODFILE CHECKSUM: f8f8ec7029b49f02d5623720c24c5d01342e39a7
 
 COCOAPODS: 1.16.2