修复了重新登录对话记录没有显示问题
authorliangzhenying <867174124@qq.com>
Thu, 25 Dec 2025 03:38:51 +0000 (11:38 +0800)
committerliangzhenying <867174124@qq.com>
Thu, 25 Dec 2025 03:38:51 +0000 (11:38 +0800)
19 files changed:
DeepChordsSdk_iOS/DeepChordsSdk/Example/DeepChordsSdk/DCBleManager.swift
DeepChordsSdk_iOS/DeepChordsSdk/Example/DeepChordsSdk/DCDevice.swift
DeepChordsSdk_iOS/DeepChordsSdk/Example/Example/tools/BleManager.swift
ShenYin/ShenYin/Cache/UserModel.swift
ShenYin/ShenYin/DcSdk/DCSdkManager.swift
ShenYin/ShenYin/JoySdk/JoyBleManager.swift
ShenYin/ShenYin/JoySdk/JoySdkManager.swift
ShenYin/ShenYin/Launch/AppLaunch.swift
ShenYin/ShenYin/Launch/AppManager.swift
ShenYin/ShenYin/Launch/SceneDelegate.swift
ShenYin/ShenYin/UI/Home/Device/HomeDeviceVC.swift
ShenYin/ShenYin/UI/Login/Controller/Binding/VarifyBindingVC.swift
ShenYin/ShenYin/UI/Login/Controller/LoginVC.swift
ShenYin/ShenYin/UI/Login/Controller/SmsLoginVC.swift
ShenYin/ShenYin/UI/Login/View/OthersLoginView.swift
ShenYin/ShenYin/UI/Mine/AccountSetVC.swift
ShenYin/ShenYin/UI/Mine/LanguageVC.swift
ShenYin/ShenYin/UI/Mine/Root/MineHeaderView.swift
ShenYin/ShenYin/UI/Mine/UserInfo/UserInfoVC.swift

index b028548..38635fd 100644 (file)
@@ -10,6 +10,11 @@ import CoreBluetooth
 import StarburstSdk
 
 public class DCBleManager{
+    public static let serviceUUID = "AE30"
+    public static let writeUUID = "AE03"
+    public static let notifyUUID = "AE04"
+    
+    
     public static let shared = DCBleManager()
     private var connectPeripheral: CBPeripheral?
     private var writeCha: CBCharacteristic?
@@ -46,31 +51,34 @@ public extension DCBleManager{
         DCLogger.debug("蓝牙已连接 \(peripheral)")
         connectPeripheral = peripheral
     }
-    func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
-        DCLogger.debug("peripheral: %@ failed to connect", peripheral)
-    }
+
     func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
         DCLogger.debug("蓝牙已断开 \(peripheral)")
         StarburstSdk.shared().bleDisConnected()
     }
-    
-    func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
-        DCLogger.debug("发现服务成功")
-        for service in peripheral.services! {
-            DCLogger.debug("peripheral service: %@", service)
-            peripheral.discoverCharacteristics(nil, for: service)
-        }
-
-    }
+//    
+//    func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
+//        DCLogger.debug("发现服务成功")
+//        for service in peripheral.services! {
+//            DCLogger.debug("peripheral service: %@", service)
+//            peripheral.discoverCharacteristics(nil, for: service)
+//        }
+//
+//    }
     func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
         if let list = service.characteristics{
             DCLogger.debug("发现特征",list)
             for char in  list{
                 DCLogger.debug(char)
-                peripheral.setNotifyValue(true, for: char)
-                if char.uuid.uuidString == "AE03" {
+                if char.uuid.uuidString == DCBleManager.notifyUUID {
+                    peripheral.setNotifyValue(true, for: char)
+                }
+                if char.uuid.uuidString == DCBleManager.writeUUID {
                     writeCha = char
-                    StarburstSdk.shared().bleConnected()
+                    
+                    DCDevice.shared.handShake { success in
+                        StarburstSdk.shared().bleConnected()
+                    }
                 }
             }
         }
index 5e72154..2b1211c 100644 (file)
@@ -31,6 +31,29 @@ public class DCDevice{
     }
 }
  extension DCDevice{
+     public func handShake(finished:@escaping ((Bool)?)->Void){
+         var head: UInt8 = 0xBA
+         var cmd: UInt8 = 0x11
+         var data:UInt8 = 0x00
+         var total = Data()
+         total.append(&head, count: 1)
+         total.append(&cmd, count: 1)
+         total.append(&data, count: 1)
+         total.addCrc()
+         
+         let sender = BleSender()
+         sender.data = total
+         sender.completion = { result in
+             DCLogger.debug("\(result.description)")
+             if result.isSuccess{
+                 finished(true)
+             }
+             else{
+                 finished(false)
+             }
+         }
+         DCBleManager.shared.send(sender)
+     }
      ///
      ///
     public func getBatery(finished:@escaping ((Int,Int)?)->Void){
index 336e15a..16fa09a 100644 (file)
@@ -40,7 +40,7 @@ class BleManager: NSObject {
         DCLogger.debug("扫描中...")
         devices = []
         
-        if let connectedPeripheral = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: "AE30")]).first{
+        if let connectedPeripheral = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: DCBleManager.serviceUUID)]).first{
             devices = [connectedPeripheral]
         }
         discoverDeviceCallback?(devices)
@@ -88,6 +88,7 @@ extension BleManager:CBCentralManagerDelegate{
             return
         }
         if let name = peripheral.name,name.hasPrefix("AI") {
+            let mac = BleManager.getMac(advertisementData)
             devices.append(peripheral)
             DCLogger.debug(peripheral)
             discoverDeviceCallback?(devices)
@@ -96,7 +97,6 @@ extension BleManager:CBCentralManagerDelegate{
     
     func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
         stopScanDevice()
-        DCLogger.debug("蓝牙已连接 \(peripheral)")
         
         peripheral.delegate = self
         peripheral.discoverServices(nil);
@@ -105,7 +105,7 @@ extension BleManager:CBCentralManagerDelegate{
         App.shared.window?.makeToast("蓝牙已连接")
     }
     func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
-        DCBleManager.shared.centralManager(central, didFailToConnect: peripheral, error: error)
+//        DCBleManager.shared.centralManager(central, didFailToConnect: peripheral, error: error)
     }
     func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
         disConnectDeviceCallback?(peripheral)
@@ -141,3 +141,50 @@ extension BleManager: CBPeripheralDelegate {
         
     }
 }
+
+
+extension BleManager{
+    static func getMac(_ dict:[String:Any])->String?{
+//        DCLogger.debug(dict)
+//        if let advMsd = dict[CBAdvertisementDataManufacturerDataKey] as? Data {
+//            if (advMsd.count >= 13) {
+//                let mac = advMsd[7...12];
+//                let text = mac.map { String($0, radix: 16).padLeft(toLength: 2, withPad: "0") }.joined(separator: ":").uppercased()
+//                
+//                DCLogger.debug(advMsd)
+//                DCLogger.debug(mac.joined())
+//                DCLogger.debug(text)
+//                return text
+//            } else {
+//                return nil
+//            }
+//        } else {
+//            return nil
+//        }
+        DCLogger.debug(dict)
+        if let advMsd = dict[CBAdvertisementDataManufacturerDataKey] as? Data {
+            if (advMsd.count >= 6) {
+                let mac = advMsd;
+                let text = mac.map { String($0, radix: 16).padLeft(toLength: 2, withPad: "0") }.joined(separator: ":").uppercased()
+                
+                DCLogger.debug(advMsd)
+                DCLogger.debug(mac.joined())
+                DCLogger.debug(text)
+                return text
+            } else {
+                return nil
+            }
+        } else {
+            return nil
+        }
+    }
+    
+}
+extension String {
+    var data: Data? { self.data(using: .utf8) }
+    
+    func padLeft(toLength: Int, withPad pad: String) -> String {
+        let paddingCount = max(0, toLength - self.count)
+        return String(repeating: pad, count: paddingCount) + self
+    }
+}
index 50bdc75..34a5ac3 100644 (file)
@@ -41,15 +41,17 @@ extension UserModel{
         self.token = nil
         self.info = UserInfo()
         UserCache.shared.remove()
+        JoyBleManager.shared.cancel()
         NotificationManager.post(type: .logout, objtect: nil)
         App.shared.goToLogin()
     }
-    func tokenIsValid(finished: (() -> Void)? = nil){
+    func tokenIsValid(finished: ((Bool) -> Void)? = nil){
         HttpClient.request(CommomApi.token) { [weak self](model:UserInfoRoot,res) in
             guard let self = self else{return}
             if model.isSuccess{
                 self.info = model.data
                 UserCache.shared.save(self.info)
+                finished?(true)
             }
             else{
                 if let dict = YLToos.stringToJson(res),let code = dict["code"] as? Int{
@@ -65,8 +67,9 @@ extension UserModel{
                         }
                     }
                 }
+                finished?(false)
             }
-            finished?()
+            
         }
     }
     
index f249c97..71d1d0f 100644 (file)
@@ -51,3 +51,23 @@ class DCSdkManager{
         }
     }
 }
+extension DCSdkManager{
+    static func getMac(_ dict:[String:Any])->String?{
+        
+        if let advMsd = dict[CBAdvertisementDataManufacturerDataKey] as? Data {
+            if (advMsd.count >= 6) {
+                let mac = advMsd;
+                let text = mac.map { String($0, radix: 16).padLeft(toLength: 2, withPad: "0") }.joined(separator: ":").uppercased()
+                Logger.debug(dict)
+                Logger.debug(advMsd)
+                Logger.debug(mac.joined())
+                Logger.debug(text)
+                return text
+            } else {
+                return nil
+            }
+        } else {
+            return nil
+        }
+    }
+}
index 5bed6f5..d7c3437 100644 (file)
@@ -8,6 +8,7 @@
 import UIKit
 import CoreBluetooth
 import AVFAudio
+import DeepChordsSdk
 
 class DCPeripheral{
     var device:CBPeripheral!
@@ -64,25 +65,31 @@ extension JoyBleManager:CBCentralManagerDelegate{
         if devices.map({ $0.device }).contains(peripheral) {
             return
         }
-        
-        //            DB209A55-DD0E-5031-29FA-40D734C34971
-        //            "edr:21140DE4C3D9"
-        //            "ble:21140D2CC682"
-//        if peripheral.identifier.uuidString != "DB209A55-DD0E-5031-29FA-40D734C34971" {
-//            return
-//        }
-        let mac = JoySdkManager.getMac(advertisementData) ?? ""
-        devices.append(DCPeripheral(device: peripheral,mac: mac))
         Logger.debug(peripheral)
-        discoverDeviceCallback?(devices)
+        
+        if App.shared.isJoy {
+            let mac = JoySdkManager.getMac(advertisementData) ?? ""
+            devices.append(DCPeripheral(device: peripheral,mac: mac))
+            discoverDeviceCallback?(devices)
+        }
+        else{
+            let mac = DCSdkManager.getMac(advertisementData) ?? ""
+            devices.append(DCPeripheral(device: peripheral,mac: mac))
+            discoverDeviceCallback?(devices)
+        }
     }
     
     func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
         stopScanDevice()
         Logger.debug("蓝牙已连接 \(peripheral)")
-
         peripheral.delegate = self
-        peripheral.discoverServices([CBUUID(string: JoySdkManager.serviceUUID),CBUUID(string: OtaMananger.otaServiceUUId)]);
+        if App.shared.isJoy {
+            peripheral.discoverServices([CBUUID(string: JoySdkManager.serviceUUID),CBUUID(string: OtaMananger.otaServiceUUId)]);
+        }
+        else{
+            DCBleManager.shared.centralManager(central, didConnect: peripheral)
+            peripheral.discoverServices([CBUUID(string: DCBleManager.serviceUUID),CBUUID(string: OtaMananger.otaServiceUUId)]);
+        }
     }
     func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
         Logger.debug("peripheral: %@ failed to connect", peripheral)
@@ -91,6 +98,9 @@ extension JoyBleManager:CBCentralManagerDelegate{
     func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
         Logger.debug("蓝牙已断开 \(peripheral)")
         self.isConnetd = false
+        if App.shared.isJoy {
+            DCBleManager.shared.centralManager(central, didDisconnectPeripheral: peripheral, error: nil)
+        }
         NotificationManager.post(type: .deviceValidChange, objtect: nil)
         OtaMananger.shared.otaManager.centralManager(central, didDisconnectPeripheral: peripheral, error: error)
         checkConectState()
@@ -108,37 +118,49 @@ extension JoyBleManager: CBPeripheralDelegate {
     }
     
     func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
-        if (service.uuid.uuidString == JoySdkManager.serviceUUID) {
-            JoySdkManager.shared.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
+        if App.shared.isJoy {
+            if (service.uuid.uuidString == JoySdkManager.serviceUUID) {
+                JoySdkManager.shared.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
+            }
+            else if service.uuid.uuidString == OtaMananger.otaServiceUUId{
+                OtaMananger.shared.otaManager.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
+            }
         }
-        else if service.uuid.uuidString == OtaMananger.otaServiceUUId{
-            OtaMananger.shared.otaManager.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
+        else{
+            DCBleManager.shared.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: error)
         }
     }
     
     func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: (any Error)?) {
-        if (characteristic.isNotifying == true && characteristic.service?.uuid.uuidString == JoySdkManager.serviceUUID && characteristic.uuid.uuidString == JoySdkManager.notifyUUID) {
-            Logger.debug("特征使能成功")
-            JoySdkManager.shared.bleConnected()
-        }
-        if OtaMananger.isOtadata(characteristic){
-            OtaMananger.shared.otaManager.peripheral(peripheral, didUpdateNotificationStateFor: characteristic, error: error)
+        if App.shared.isJoy {
+            if (characteristic.isNotifying == true && characteristic.service?.uuid.uuidString == JoySdkManager.serviceUUID && characteristic.uuid.uuidString == JoySdkManager.notifyUUID) {
+                Logger.debug("特征使能成功")
+                JoySdkManager.shared.bleConnected()
+            }
+            if OtaMananger.isOtadata(characteristic){
+                OtaMananger.shared.otaManager.peripheral(peripheral, didUpdateNotificationStateFor: characteristic, error: error)
+            }
         }
     }
     
     func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
 //        Logger.debug("收到数据 ===uUId ",characteristic.uuid)
-        if OtaMananger.isOtadata(characteristic){
-            if let _ = characteristic.value,error == nil {
-                OtaMananger.shared.otaManager.peripheral(peripheral, didUpdateValueFor: characteristic)
+        if App.shared.isJoy {
+            if OtaMananger.isOtadata(characteristic){
+                if let _ = characteristic.value,error == nil {
+                    OtaMananger.shared.otaManager.peripheral(peripheral, didUpdateValueFor: characteristic)
+                }
+                else{
+                    Logger.debug("ota 收到数据 ===\(characteristic.uuid)","无数据")
+                }
             }
-            else{
-                Logger.debug("ota 收到数据 ===\(characteristic.uuid)","无数据")
+            else {
+                //MARK: 需要配置传入数据
+                JoySdkManager.shared.receiveValue(characteristic)
             }
         }
-        else {
-            //MARK: 需要配置传入数据
-            JoySdkManager.shared.receiveValue(characteristic)
+        else{
+            DCBleManager.shared.peripheral(peripheral, didUpdateValueFor: characteristic, error: error)
         }
     }
     
@@ -164,7 +186,12 @@ extension JoyBleManager{
 //                devices.append(DCPeripheral(device: item,mac: mac))
 //            }
 //        }
-        centralManager.scanForPeripherals(withServices: [CBUUID(string: JoySdkManager.serviceUUID)],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
+        if App.shared.isJoy {
+            centralManager.scanForPeripherals(withServices: [CBUUID(string: JoySdkManager.serviceUUID)],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
+        }
+        else{
+            centralManager.scanForPeripherals(withServices: [CBUUID(string: DCBleManager.serviceUUID)],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
+        }
         discoverDeviceCallback?(devices)
     }
     
@@ -180,9 +207,12 @@ extension JoyBleManager{
     
     func cancel() {
         guard let peripheral = connectPeripheral else { return  }
-        self.isConnetd = false
+        if self.isConnetd {
+            self.isConnetd = false
+            centralManager.cancelPeripheralConnection(peripheral.device)
+        }
+        
         NotificationManager.post(type: .deviceValidChange, objtect: nil)
-        centralManager.cancelPeripheralConnection(peripheral.device)
         connectPeripheral = nil
     }
     func unbind(_ peripheral: DCPeripheral){
index 4a17dfe..5f76ab5 100644 (file)
@@ -33,6 +33,7 @@ extension JoySdkManager {
         record = JoyRecord()
         callRecord = JoyCallRecord()
         chat = JoyChat()
+        chat.loadChatCache()
         
         let options: AVAudioSession.CategoryOptions = [.allowBluetooth]
         do {
index ca18bc3..95509b7 100644 (file)
@@ -16,7 +16,7 @@ class AppLaunch:NSObject{
 
         
         IASignWithWeChat.shared.register()
-        JoySdkManager.shared.setupSdk()
+        
         setupKeyboard()
         loadCache()
         LoginVM.fetchCountryList {result in
index 5ca0a88..456bec6 100644 (file)
@@ -9,6 +9,7 @@ class App{
     static let shared = App()
     var window:UIWindow?
     var isInBackground = false
+    var isJoy = true
 
     
     func topVC()->UIViewController!{
@@ -19,13 +20,21 @@ class App{
         return getTopViewController(from: vc)
     }
     
+    func willLogin(){
+        CacheManager.shared.user.tokenIsValid {[weak self] success in
+            guard let self = self else{return}
+            if success {
+                didLogin()
+            }
+        }
+    }
     func didLogin(){
         // 加载目录
         Logger.debug(DCFolder.user)
         Logger.debug(DCFolder.record)
-        window?.rootViewController = BaseTC()
-        JoySdkManager.shared.chat.loadChatCache()
-//        DCSdkManager.shared.initSdk()
+        self.window?.rootViewController = BaseTC()
+        JoySdkManager.shared.setupSdk()
+        //        DCSdkManager.shared.initSdk()
     }
     func goToLogin(){
         window?.rootViewController = BaseNC(rootViewController: LoginVC())
index b12effb..22b045e 100644 (file)
@@ -17,7 +17,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
         guard let _ = (scene as? UIWindowScene) else { return }
         
         App.shared.window = window
-        window?.rootViewController = BaseTC()
+//        window?.rootViewController = BaseTC()
 //        window?.rootViewController = UINavigationController(rootViewController: HistorySelectedVC())
         AppLaunch.start()
     }
index 21c3218..5e1166f 100644 (file)
@@ -103,7 +103,7 @@ class HomeDeviceVC:BaseVC{
                 self?.startConectBle(model)
             }
         }
-        CacheManager.shared.user.tokenIsValid(){[weak self] in
+        CacheManager.shared.user.tokenIsValid(){[weak self] sucess in
             self?.collectionView.reloadData()
         }
     }
index 26d50a3..8cac089 100644 (file)
@@ -90,7 +90,7 @@ extension VarifyBindingVC{
         HttpClient.request(api) { (result:ResponseBaseModel,res) in
             if result.isSuccess{
                 YLprogressHUD.showSuccess {
-                    App.shared.didLogin()
+                    App.shared.willLogin()
                 }
             }
             else{
index 61306ab..7762b83 100644 (file)
@@ -152,7 +152,7 @@ extension LoginVC{
         LoginVM.login(param: params) { result in
             if result.isSuccess{
                 YLprogressHUD.showSuccess {
-                    App.shared.didLogin()
+                    App.shared.willLogin()
                 }
             }
             else{
index 0ad0770..6160d7b 100644 (file)
@@ -176,7 +176,7 @@ extension SmsLoginVC{
         LoginVM.phoneCodeLogin(param: params) { result in
             if result.isSuccess{
                 YLprogressHUD.showSuccess {
-                    App.shared.didLogin()
+                    App.shared.willLogin()
                 }
             }
             else{
@@ -205,7 +205,7 @@ extension SmsLoginVC{
         LoginVM.emailCodeLogin(param: params) { result in
             if result.isSuccess{
                 YLprogressHUD.showSuccess {
-                    App.shared.didLogin()
+                    App.shared.willLogin()
                 }
             }
             else{
index c0518cf..9a0b729 100644 (file)
@@ -206,7 +206,7 @@ class ThirdLoginView: BaseView {
         LoginVM.appleLogin(param: params) { result in
             if result.isSuccess{
                 YLprogressHUD.showSuccess {
-                    App.shared.didLogin()
+                    App.shared.willLogin()
                 }
             }
             YLprogressHUD.showAutoHiden(result.msg)
@@ -219,7 +219,7 @@ class ThirdLoginView: BaseView {
         LoginVM.wechatLogin(param: params) { result in
             if result.isSuccess{
                 YLprogressHUD.showSuccess {
-                    App.shared.didLogin()
+                    App.shared.willLogin()
                 }
             }
             else{
index de51dbc..0426dbf 100644 (file)
@@ -39,7 +39,7 @@ class AccountSetVC: BaseVC{
     }
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
-        CacheManager.shared.user.tokenIsValid(){[weak self] in
+        CacheManager.shared.user.tokenIsValid(){[weak self] sucess in
             self?.header.updateUI()
         }
     }
index b622780..3d8bc15 100644 (file)
@@ -64,9 +64,6 @@ extension LanguageVC:UITableViewDelegate,UITableViewDataSource {
     }
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
         let lan = list[indexPath.row]
-//        CustomAlert.showWith(title: "提示".l10n, messgage: "重启APP才会生效,是否立即重启?".l10n, cancelCallback: {}) {
-//
-//            }
         DCConfig.appLanguage = lan
         LanuageCache.save(lan: DCConfig.appLanguage)
         App.shared.didLogin()
index 38a00fb..5a2991c 100644 (file)
@@ -95,7 +95,7 @@ class MineUserInfoView: BaseView {
         }
     }
     func updateUI(){
-        CacheManager.shared.user.tokenIsValid(){[weak self] in
+        CacheManager.shared.user.tokenIsValid(){[weak self] sucess in
             guard let self = self else {return}
             titleLabel.text = CacheManager.shared.user.info.userName
             icon.kf.setImage(with:CacheManager.shared.user.info.avatar.yc.asUrl )
index 1f399f5..b7d72a4 100644 (file)
@@ -160,7 +160,7 @@ extension UserInfoVC{
         }
     }
     func refreshUI(){
-        CacheManager.shared.user.tokenIsValid(){[weak self] in
+        CacheManager.shared.user.tokenIsValid(){ [weak self] success in
             self?.tableView.reloadData()
         }
         LoginVM.fetchCountryList {[weak self] result in