Browse Source

1.增加几分钟后台保活
2.更换聊天输入框默认文案

100Years 2 months ago
parent
commit
5bf36c7356

+ 2 - 2
AIEmoji.xcodeproj/project.pbxproj

@@ -1193,7 +1193,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 5;
+				CURRENT_PROJECT_VERSION = 6;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -1232,7 +1232,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 5;
+				CURRENT_PROJECT_VERSION = 6;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;

+ 26 - 2
AIEmoji/AppDelegate.swift

@@ -6,16 +6,21 @@
 //
 
 import UIKit
-import SQLite3
+
 @main
 class AppDelegate: UIResponder, UIApplicationDelegate {
 
     var window: UIWindow?
-
+    var backgroundTaskIdentifier: UIBackgroundTaskIdentifier = .invalid
+    
     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         window = UIWindow(frame: UIScreen.main.bounds)
         window?.backgroundColor = UIColor.white
         window?.makeKeyAndVisible()
+        
+        // 监听应用进入后台的通知
+        NotificationCenter.default.addObserver(self, selector: #selector(applicationDidEnterBackground), name: UIApplication.didEnterBackgroundNotification, object: nil)
+        
         initPlatform()
         goToLoadVC()
         return true
@@ -64,3 +69,22 @@ extension AppDelegate {
     }
 }
 
+
+extension AppDelegate {
+    @objc func applicationDidEnterBackground() {
+        beginBackgroundTask()
+    }
+    
+    func beginBackgroundTask() {
+        backgroundTaskIdentifier = UIApplication.shared.beginBackgroundTask { [weak self] in
+            self?.endBackgroundTask()
+        }
+    }
+    
+    func endBackgroundTask() {
+        if backgroundTaskIdentifier != .invalid {
+            UIApplication.shared.endBackgroundTask(backgroundTaskIdentifier)
+            backgroundTaskIdentifier = .invalid
+        }
+    }
+}

+ 1 - 1
AIEmoji/Business/AIChat/TSChatViewController/TSChatInputBarVC/TSChatInputBarVC.swift

@@ -85,7 +85,7 @@ class TSChatInputBarVC: TSBaseVC, UITextViewDelegate {
         textView.isScrollEnabled = false
         textView.tintColor = .themeColor
         textView.returnKeyType = .send
-        textView.placeholder = "Type all necessary details".localized
+        textView.placeholder = "Message chat".localized
         textView.placeholderColor = .white.withAlphaComponent(0.4)
         textView.placeholderLabel.font = .font(size: 16.0)
         textView.textInsets = UIEdgeInsets(top: 18, left: 16, bottom: 14, right: 0)

+ 1 - 1
AIEmoji/Business/AIChat/TSChatViewController/TSChatInputBarVC/TSChatInputFullScreenVC.swift

@@ -55,7 +55,7 @@ class TSChatInputFullScreenVC: TSBaseVC, UITextViewDelegate {
         textView.isScrollEnabled = false
         textView.tintColor = .themeColor
         textView.returnKeyType = .send
-        textView.placeholder = "Type all necessary details".localized
+        textView.placeholder = "Message chat".localized
         textView.placeholderColor = .white.withAlphaComponent(0.4)
         textView.placeholderLabel.font = .font(size: 16.0)
         textView.textInsets = UIEdgeInsets(top: 5, left: 0, bottom: 5, right: 0)