浏览代码

2.5(1)修改App名称Ghibli AI为 ArtVibe

100Years 2 周之前
父节点
当前提交
c18d16b858

+ 6 - 6
AIEmoji.xcodeproj/project.pbxproj

@@ -1912,12 +1912,12 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = AIEmoji/Info.plist;
-				INFOPLIST_KEY_CFBundleDisplayName = Artt;
+				INFOPLIST_KEY_CFBundleDisplayName = ArtVibe;
 				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Allow us to access Photos in order to save emoji to your device.";
 				INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
 				INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
@@ -1928,7 +1928,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 2.3;
+				MARKETING_VERSION = 2.5;
 				PRODUCT_BUNDLE_IDENTIFIER = com.girl.music.wallpaper;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -1951,12 +1951,12 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = AIEmoji/Info.plist;
-				INFOPLIST_KEY_CFBundleDisplayName = Artt;
+				INFOPLIST_KEY_CFBundleDisplayName = ArtVibe;
 				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Allow us to access Photos in order to save emoji to your device.";
 				INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
 				INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
@@ -1967,7 +1967,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 2.3;
+				MARKETING_VERSION = 2.5;
 				PRODUCT_BUNDLE_IDENTIFIER = com.girl.music.wallpaper;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";

+ 1 - 1
AIEmoji.xcodeproj/xcshareddata/xcschemes/AIEmoji.xcscheme

@@ -31,7 +31,7 @@
       shouldAutocreateTestPlan = "YES">
    </TestAction>
    <LaunchAction
-      buildConfiguration = "Release"
+      buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"

+ 21 - 1
AIEmoji/AppDelegate.swift

@@ -6,7 +6,7 @@
 //
 
 import UIKit
-
+var kAppNewVerison = ""
 @main
 class AppDelegate: UIResponder, UIApplicationDelegate {
 
@@ -53,6 +53,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
     func initPlatform() {
         TSColorConfigShared.naviMianTextColor = .white
+        checkAppConfig()
     }
 
 }
@@ -80,4 +81,23 @@ extension AppDelegate {
             backgroundTaskIdentifier = .invalid
         }
     }
+    
+    func applicationWillEnterForeground(_ application: UIApplication) {
+        checkAppConfig()
+    }
+}
+
+
+extension AppDelegate {
+    
+    func checkAppConfig(){
+        _ = TSNetworkShared.get(urlType: .config) { data,error in
+            
+            if let result = kNetWorkResultSuccess(data: data) {
+                kAppNewVerison = result.safeString(forKey: "version")
+                NotificationCenter.default.post(name: .kRefreshSettingView, object: nil)
+            }
+        }
+    }
+    
 }

+ 3 - 1
AIEmoji/Business/General/Ex/Notification+Ex.swift

@@ -3,10 +3,12 @@
 //  AIEmoji
 //
 //  Created by 100Years on 2025/2/13.
-//
+//t
 
 import Foundation
 
 extension Notification.Name {
     static let kApplicationWillTerminate = Notification.Name("applicationWillTerminate")
+    
+    static let kRefreshSettingView = Notification.Name("kRefreshSettingView")   //刷新设置按钮
 }

+ 23 - 7
AIEmoji/Business/TSPTPGeneratorVC/TSPTPGeneratorVC/VM/TSPTPGeneratorVM.swift

@@ -53,9 +53,25 @@ class TSPTPGeneratorVM {
                 if let genmojiModel = TSGenmojiModel(JSON: result) {
                     switch genmojiModel.actionStatus {
                     case .success:
-                        TSToastShared.hideLoading()
-                        self.stateDatauPblished = (.success(nil),genmojiModel)
-                        generatingProgress = 0
+                        if let url = URL(string:genmojiModel.response.resultUrl) {
+                            UIImageView.downloadImageWithProgress(url: url) { [weak self]  progress in
+                                guard let self = self else { return }
+                        
+                                let progressInt = Int(progress*10.0)
+                                let progressString = "Generating \(90 + progressInt)%"
+                                stateDatauPblished = (.progressString(progressString),nil)
+                                dePrint("当前进度: \(progress)")
+                            } completion: {[weak self] image in
+                                guard let self = self else { return }
+                                self.stateDatauPblished = (.success(nil),genmojiModel)
+                                generatingProgress = 0
+                            }
+
+                        }else{
+                            self.stateDatauPblished = (.success(nil),genmojiModel)
+                            generatingProgress = 0
+                        }
+                        
                     case .failed:
                         self.stateDatauPblished = (.failed(kNetWorkMessage(data: data) ?? ""),nil)
                         generatingProgress = 0
@@ -122,13 +138,13 @@ class TSPTPGeneratorVM {
     }
     
     func generating(progress:Float) -> String {
-
+        let progress = progress*(0.9) // 预留 10% 进度给图片下载
         //Generating 0%-100%
         var progressInt = Int(progress*100)
 
-        if generatingProgress >= progressInt{
-            return "Generating \(generatingProgress)%"
-        }
+//        if generatingProgress >= progressInt{
+//            return "Generating \(generatingProgress)%"
+//        }
 
         if progressInt > 99 {
             progressInt = 99

+ 2 - 1
AIEmoji/Business/TSSetingVC/SetingVC/TSSetingModel.swift

@@ -7,9 +7,10 @@
 
 enum SettingType: String, CaseIterable {
     case howToUse = "How to add emojis to iMessages?"
+    case update = "Update Version"
     case shareus = "Share us"
     case rateus = "Rate us"
     case agreement = "Terms of Service"
     case privacy = "Privacy Policy"
-    case about = "About us"
+//    case about = "About us"
 }

+ 13 - 1
AIEmoji/Business/TSSetingVC/SetingVC/TSSetingVC.swift

@@ -61,15 +61,20 @@ class TSSetingVC: TSBaseVC {
                 viewModel.showAgreement(parent: self)
             case .privacy:
                 viewModel.showPrivacy(parent: self)
-            case .about:
+            case .update:
+                viewModel.updateApp(parent: self)
                 break
+//            case .about:
+//                break
             case .rateus:
                 viewModel.rateAction()
             }
             
         }.store(in: &cancellable)
         vipInfoChanged()
+        refreshView()
         NotificationCenter.default.addObserver(self, selector: #selector(vipInfoChanged), name: .kPurchaseDidChanged, object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(refreshView), name: .kRefreshSettingView, object: nil)
     }
     
     @objc func vipInfoChanged() {
@@ -77,4 +82,11 @@ class TSSetingVC: TSBaseVC {
             self.viewModel.isViper = PurchaseManager.default.isVip
         }
     }
+    
+    @objc func refreshView() {
+        
+        if UIApplication.compareAppVersions(newVersion1: kAppNewVerison, oldVersion: appShortVersion()) == .newer {
+            self.viewModel.isHaveNewVersion = true
+        }
+    }
 }

+ 9 - 0
AIEmoji/Business/TSSetingVC/SetingVC/TSSetingViewModel.swift

@@ -11,6 +11,7 @@ class TSSetingViewModel: ObservableObject {
     
     @Published var settingTypes: [SettingType] = SettingType.allCases
     @Published var isViper: Bool = PurchaseManager.default.isVip
+    @Published var isHaveNewVersion: Bool = false
     
     var appid = "6740220736"
     // todo.kailen-privacy
@@ -45,6 +46,14 @@ class TSSetingViewModel: ObservableObject {
         
     }
     
+    func updateApp(parent: UIViewController) {
+        let httpAppStoreLink = "https://apps.apple.com/app/id\(appid)"
+        if let url = URL(string: httpAppStoreLink),
+            UIApplication.shared.canOpenURL(url) {
+            UIApplication.shared.open(url)
+        }
+    }
+    
     func rateAction() {
         let countKey = "ProcessCompletedCountKey"
         // If the app doesn't store the count, this returns 0.

+ 15 - 4
AIEmoji/Business/TSSetingVC/SetingVC/View/TSSettingListView.swift

@@ -27,7 +27,7 @@ struct TSSettingListView: View {
                 
                 ForEach(viewModel.settingTypes, id:\.self) { type in
                     Spacer().frame(height: 16)
-                    SettingListItemView(type: type)
+                    SettingListItemView(type: type,viewModel: viewModel)
                     .onTapGesture {
                         publisher.settingPublisher.send(type)
                     }
@@ -45,6 +45,7 @@ struct TSSettingListView: View {
 
 struct SettingListItemView: View {
     var type : SettingType
+    var viewModel: TSSetingViewModel
     var body: some View {
         
         ZStack {
@@ -52,11 +53,21 @@ struct SettingListItemView: View {
             HStack {
                 Text(type.rawValue).font(.font(size: 16.0)).foregroundColor(.white)
                 Spacer()
-                if type != .about {
-                    Image(.whiteRightArrow)
-                }else{
+//                if type != .about {
+//                    Image(.whiteRightArrow)
+//                }else{
+//                    Text(appVersion()).foregroundColor(.hex("#FFFFFF").opacity(0.4)).font(.font(size: 16))
+//                }
+                
+                if type == .update {
+                    if viewModel.isHaveNewVersion {
+                        Color.hex("#FECB34").frame(width: 4, height: 4).cornerRadius(2)
+                        Spacer().frame(width: 4)
+                    }
                     Text(appVersion()).foregroundColor(.hex("#FFFFFF").opacity(0.4)).font(.font(size: 16))
                 }
+            
+                Image(.whiteRightArrow)
             }.padding(.horizontal)
         }
         .frame(height: 64)

+ 23 - 7
AIEmoji/Business/TSTextGeneralPictureVC/TSTextPicGennerateVC/TSTextPicGennerateVM.swift

@@ -53,9 +53,25 @@ class TSTextPicGennerateVM {
                 if let genmojiModel = TSGenmojiModel(JSON: result) {
                     switch genmojiModel.actionStatus {
                     case .success:
-                        TSToastShared.hideLoading()
-                        self.stateDatauPblished = (.success(nil),genmojiModel)
-                        generatingProgress = 0
+                        if let url = URL(string:genmojiModel.response.resultUrl) {
+                            UIImageView.downloadImageWithProgress(url: url) { [weak self]  progress in
+                                guard let self = self else { return }
+                        
+                                let progressInt = Int(progress*10.0)
+                                let progressString = "Generating \(90 + progressInt)%"
+                                stateDatauPblished = (.progressString(progressString),nil)
+                                dePrint("当前进度: \(progress)")
+                            } completion: {[weak self] image in
+                                guard let self = self else { return }
+                                self.stateDatauPblished = (.success(nil),genmojiModel)
+                                generatingProgress = 0
+                            }
+
+                        }else{
+                            self.stateDatauPblished = (.success(nil),genmojiModel)
+                            generatingProgress = 0
+                        }
+                        
                     case .failed:
                         self.stateDatauPblished = (.failed(kNetWorkMessage(data: data) ?? ""),nil)
                         generatingProgress = 0
@@ -81,13 +97,13 @@ class TSTextPicGennerateVM {
     }
     
     func generating(progress:Float) -> String {
-
+        let progress = progress*(0.9) // 预留 10% 进度给图片下载
         //Generating 0%-100%
         var progressInt = Int(progress*100)
 
-        if generatingProgress >= progressInt{
-            return "Generating \(generatingProgress)%"
-        }
+//        if generatingProgress >= progressInt{
+//            return "Generating \(generatingProgress)%"
+//        }
 
         if progressInt > 99 {
             progressInt = 99

+ 1 - 0
AIEmoji/Common/NetworkManager/TSNetWork/TSNetWork+Business.swift

@@ -18,6 +18,7 @@ enum TSNeURLType:String {
     case imageRewrite = "/api/image/rewrite"     //图生图
     case chatV2 = "/api/text/chat/v2"             //AI 对话接口V2,扩展了 DeepSeek 深度思考
     
+    case config = "/api/ops/aichat-config"       //App配置
     func getUrlString() -> String {
         return baseURL + self.rawValue
     }

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

@@ -143,9 +143,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
         }