Sfoglia il codice sorgente

conversation list chat gpt

kevin 1 anno fa
parent
commit
a641b6262a

+ 21 - 0
appbuilder-ios/NexilisLite/NexilisLite/Resource/Assets.xcassets/pb_gpt_bot.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "pb_gpt_bot.png",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
appbuilder-ios/NexilisLite/NexilisLite/Resource/Assets.xcassets/pb_gpt_bot.imageset/pb_gpt_bot.png


+ 3 - 10
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/ChatGPTBotView.swift

@@ -476,23 +476,16 @@ class ChatGPTBotView: UIViewController, UIGestureRecognizerDelegate {
             let imageProfile = UIImageView(frame: CGRect(x: 0, y: 7, width: 30, height: 30))
             imageProfile.circle()
             imageProfile.clipsToBounds = true
-            let pictureImage = dataPerson["picture"]!
             var count = 0
             viewAppBar.addSubview(imageProfile)
-            if !Utils.getIconDock().isEmpty {
-                let dataImage = try? Data(contentsOf: URL(string: Utils.getUrlDock()!)!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
-                if dataImage != nil {
-                    imageProfile.image = UIImage(data: dataImage!)
-                }
-            } else {
-                imageProfile.image = UIImage(named: "pb_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)
-            }
+            imageProfile.image = UIImage(named: "pb_gpt_bot", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)
             imageProfile.contentMode = .scaleAspectFit
             let titleNavigation = UILabel(frame: CGRect(x: 35, y: 0, width: viewAppBar.frame.size.width - 250, height: 44))
             viewAppBar.addSubview(titleNavigation)
-            titleNavigation.text = "GPT SmartBot"
+            titleNavigation.set(image: UIImage(named: "ic_official_flag", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, with: "  GPT SmartBot", size: 15, y: -4)
             titleNavigation.textColor = .white
             titleNavigation.font = UIFont.systemFont(ofSize: 12).bold
+            
             navigationItem.titleView = viewAppBar
             titleText = titleNavigation.text
         } else {

+ 19 - 3
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/ContactChatViewController.swift

@@ -359,6 +359,13 @@ class ContactChatViewController: UITableViewController {
     
     private func getContacts(completion: @escaping ()->()) {
         self.contacts.removeAll()
+        let gptUser = User(pin: "-997",
+                        firstName: "GPT SmartBot",
+                        lastName: "",
+                        thumb: "",
+                        userType: "0",
+                        official: "1")
+        contacts.append(gptUser)
         DispatchQueue.global().async {
             Database.shared.database?.inTransaction({ (fmdb, rollback) in
                 if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: "SELECT f_pin, first_name, last_name, image_id, official_account, user_type FROM BUDDY where f_pin <> '\(UserDefaults.standard.string(forKey: "me")!)' order by 5 desc, 2 collate nocase asc") {
@@ -539,6 +546,10 @@ extension ContactChatViewController {
             } else {
                 data = contacts[indexPath.row]
             }
+            if data.pin == "-997" {
+                APIS.openSmartChatbot()
+                return
+            }
             if let chooser = isChooser {
                 var exblock = User.getDataCanNil(pin: data.pin)?.ex_block
                 exblock = exblock == nil ? "0" : exblock!.isEmpty ? "0" : exblock!
@@ -866,9 +877,14 @@ extension ContactChatViewController {
                     data = contacts[indexPath.row]
                 }
                 content.imageProperties.maximumSize = CGSize(width: 40, height: 40)
-                getImage(name: data.thumb, placeholderImage: UIImage(named: "Profile---Purple", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), isCircle: true, tableView: tableView, indexPath: indexPath, completion: { result, isDownloaded, image in
-                    content.image = image
-                })
+                if data.pin == "-997" {
+                    content.image = UIImage(named: "pb_gpt_bot", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)
+                }
+                else {
+                    getImage(name: data.thumb, placeholderImage: UIImage(named: "Profile---Purple", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), isCircle: true, tableView: tableView, indexPath: indexPath, completion: { result, isDownloaded, image in
+                        content.image = image
+                    })
+                }
                 if User.isOfficial(official_account: data.official ?? "") || User.isOfficialRegular(official_account: data.official ?? "") {
                     content.attributedText = self.set(image: UIImage(named: "ic_official_flag", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, with: "  \(data.fullName)", size: 15, y: -4, colorText: UIColor.officialColor)