加了安卓设备登录切换后解绑所有设备。因为安卓设备绑定的返回的mac地址不一致,没法扫描到
authorliangzhenying <867174124@qq.com>
Tue, 31 Mar 2026 03:06:10 +0000 (11:06 +0800)
committerliangzhenying <867174124@qq.com>
Tue, 31 Mar 2026 03:06:10 +0000 (11:06 +0800)
19 files changed:
ShenYin/ShenYin/Cache/Model/UserModel.swift
ShenYin/ShenYin/Channel/DeepChords/Channel/Config/CCConfig.swift
ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/mine/copy_icon_2.imageset/Contents.json [new file with mode: 0644]
ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png [new file with mode: 0644]
ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png [new file with mode: 0644]
ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/mine/copy_icon_2.imageset/Contents.json [new file with mode: 0644]
ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png [new file with mode: 0644]
ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png [new file with mode: 0644]
ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/mine/copy_icon_2.imageset/Contents.json [new file with mode: 0644]
ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png [new file with mode: 0644]
ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png [new file with mode: 0644]
ShenYin/ShenYin/UI/Login/Controller/DcLoginVC.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/Login/ViewModel/LoginVM.swift
ShenYin/ShenYin/UI/Mine/UserInfo/UserInfoCell.swift
ShenYin/ShenYin/UI/Mine/UserInfo/UserInfoVC.swift
ShenYin/ShenYin/UI/common/NotificationManager.swift

index aea6f40..75373dc 100644 (file)
@@ -30,7 +30,7 @@ class UserModel {
 extension UserModel{
     func login(token:String){
         self.token = token
-        NotificationManager.post(type: .login, objtect: nil)
+//        NotificationManager.post(type: .login, objtect: nil)
         
     }
     func logout(){
index f3c5663..b4d946b 100644 (file)
@@ -33,14 +33,10 @@ class CCConfig{
     
     /// 用户隐私协议地址
     static let yonghuBaseURL = "https://pub-tos.deepchords.com"
-    
 
     
     
     
-    
-    
-    
     static let revokeText = "请您确保您是有权进行本撤回同意隐私政策操作的相关当事人。撤回同意隐私政策,您将放弃以下资产或者权益:\n\n1.数据清空\n将会停止收集您的个人信息。您使用DeepChords应用过程中产生的数据将被清空;手机中DeepChords应用的缓存数据将被清除。\n\n2.设备解除绑定\nDeepChords账号中,所有设备会与您当前登录的账号解除绑定,并清除设备之前存储在服务器的数据。存储在物理设备中的数据请通过人工本地物理重置来清除。如果您需要重新使用设备,需要您再次进行绑定并且重新授权。\n\n3.其他\n此举还将撤回您对用户协议的同意,并退出DeepChords应用。\n\n请您知悉,撤回同意隐私政策不代表撤回同意前的相关行为和责任得到豁免或减轻。若您需要重新在该账号管理设备,需要您重新授权并绑定。请谨慎操作!"
     static let findText = "查找耳机".l10n
     static let deviceType = "耳机".l10n
diff --git a/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/mine/copy_icon_2.imageset/Contents.json b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/mine/copy_icon_2.imageset/Contents.json
new file mode 100644 (file)
index 0000000..df5635c
--- /dev/null
@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "Frame_1938@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "Frame_1938@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png
new file mode 100644 (file)
index 0000000..7b42117
Binary files /dev/null and b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png differ
diff --git a/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png
new file mode 100644 (file)
index 0000000..8ba24c1
Binary files /dev/null and b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png differ
diff --git a/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/mine/copy_icon_2.imageset/Contents.json b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/mine/copy_icon_2.imageset/Contents.json
new file mode 100644 (file)
index 0000000..df5635c
--- /dev/null
@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "Frame_1938@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "Frame_1938@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png
new file mode 100644 (file)
index 0000000..7b42117
Binary files /dev/null and b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png differ
diff --git a/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png
new file mode 100644 (file)
index 0000000..8ba24c1
Binary files /dev/null and b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png differ
diff --git a/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/mine/copy_icon_2.imageset/Contents.json b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/mine/copy_icon_2.imageset/Contents.json
new file mode 100644 (file)
index 0000000..df5635c
--- /dev/null
@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "Frame_1938@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "Frame_1938@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png
new file mode 100644 (file)
index 0000000..7b42117
Binary files /dev/null and b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/mine/copy_icon_2.imageset/Frame_1938@2x.png differ
diff --git a/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png
new file mode 100644 (file)
index 0000000..8ba24c1
Binary files /dev/null and b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/mine/copy_icon_2.imageset/Frame_1938@3x.png differ
index ee600c8..79f99e7 100644 (file)
@@ -152,7 +152,7 @@ extension DcLoginVC{
         params["password"] = encryptedText
         params["nonce"] = iv
         
-        params["deviceName"] = Device.current.name
+        params["deviceName"] = Device.current.safeDescription
         params["deviceCode"] = CacheManager.uuid()
         
         LoginVM.login(param: params) { result in
index 72f4ad0..60befa7 100644 (file)
@@ -138,7 +138,7 @@ extension LoginVC{
         params["password"] = encryptedText
         params["nonce"] = iv
         
-        params["deviceName"] = Device.current.name
+        params["deviceName"] = Device.current.safeDescription
         params["deviceCode"] = CacheManager.uuid()
 
         LoginVM.login(param: params) { result in
index e2fa6f0..cb357ec 100644 (file)
@@ -162,7 +162,7 @@ extension SmsLoginVC{
         YLprogressHUD.showLoading()
         var params:[String:Any] = [:]
         params["phone"] = phone
-        params["deviceName"] = Device.current.name
+        params["deviceName"] = Device.current.safeDescription
         params["deviceCode"] = CacheManager.uuid()
         params["smsCode"] = code
         params["countryId"] = regionView.region.id
@@ -192,7 +192,7 @@ extension SmsLoginVC{
         params["email"] = email
         params["emailCode"] = code
         
-        params["deviceName"] = Device.current.name
+        params["deviceName"] = Device.current.safeDescription
         params["deviceCode"] = CacheManager.uuid()
         params["countryId"] = regionView.region.id
         
index d02c886..b672b11 100644 (file)
@@ -196,7 +196,7 @@ class ThirdLoginView: BaseView {
     
     func appleLogin(with id:String,token:String){
         var params:[String:Any] = [:]
-        params["deviceName"] = Device.current.name
+        params["deviceName"] = Device.current.safeDescription
         params["deviceCode"] = CacheManager.uuid()
         params["token"] = token
         params["userName"] = "DC_\(id)".replacingOccurrences(of: ".", with: "")
index 0a63058..1e792b9 100644 (file)
@@ -37,6 +37,7 @@ class LoginModel:ResponseBaseModel {
 class LoginVM:BaseVM{
     static let shared = LoginVM()
     var countryList = [CountryModel]()
+    private static var deviceLoginVM:DeviceLoginVM?
     
     override init() {
         countryList = CountryCache.shared.get()
@@ -46,46 +47,31 @@ class LoginVM:BaseVM{
     static public func login(param:[String:Any], completion:@escaping (_ result:LoginModel) ->Void) {
         let api = CommomApi.login(param: param)
         HttpClient.request(api) { (model:LoginModel,res) in
-            if model.isSuccess{
-                CacheManager.shared.user.login(token: model.data)
-            }
-            completion(model)
+            loginFinish(model: model, completion: completion)
         }
     }
     static public func phoneCodeLogin(param:[String:Any], completion:@escaping (_ result:LoginModel) ->Void) {
         let api = CommomApi.phoneCodeLogin(param: param)
         HttpClient.request(api) { (model:LoginModel,res) in
-            if model.isSuccess{
-                CacheManager.shared.user.login(token: model.data)
-            }
-            completion(model)
+            loginFinish(model: model, completion: completion)
         }
     }
     static public func emailCodeLogin(param:[String:Any], completion:@escaping (_ result:LoginModel) ->Void) {
         let api = CommomApi.emailCodeLogin(param: param)
         HttpClient.request(api) { (model:LoginModel,res) in
-            if model.isSuccess{
-                CacheManager.shared.user.login(token: model.data)
-            }
-            completion(model)
+            loginFinish(model: model, completion: completion)
         }
     }
     static public func appleLogin(param:[String:Any], completion:@escaping (_ result:LoginModel) ->Void) {
         let api = CommomApi.appleLogin(param: param)
         HttpClient.request(api) { (model:LoginModel,res) in
-            if model.isSuccess{
-                CacheManager.shared.user.login(token: model.data)
-            }
-            completion(model)
+            loginFinish(model: model, completion: completion)
         }
     }
     static public func wechatLogin(param:[String:Any], completion:@escaping (_ result:LoginModel) ->Void) {
         let api = CommomApi.wechatLogin(param: param)
         HttpClient.request(api) { (model:LoginModel,res) in
-            if model.isSuccess{
-                CacheManager.shared.user.login(token: model.data)
-            }
-            completion(model)
+            loginFinish(model: model, completion: completion)
         }
     }
     
@@ -98,4 +84,77 @@ class LoginVM:BaseVM{
             completion(model)
         }
     }
+    static func loginFinish(model:LoginModel,completion:@escaping (_ result:LoginModel) ->Void){
+        if !model.isSuccess{
+            completion(model)
+           return
+        }
+        CacheManager.shared.user.login(token: model.data)
+        checkedUnbind { success in
+//            if success{
+//                model.isSuccess
+//            }
+            completion(model)
+        }
+        
+        
+    }
+}
+
+extension LoginVM{
+    static func checkedUnbind(finished:@escaping ((Bool) -> Void)){
+        deviceLoginVM = DeviceLoginVM()
+        deviceLoginVM?.refresh { result in
+            if result.isSuccess, result.data.list.count > 1{
+                let name = result.data.list[1].deviceName.lowercased()
+                if name.contains("iphone") ||
+                    name.contains("ios") ||
+                    name.contains("ipad") ||
+                    name.contains("homepod") ||
+                    name.contains("simulator")
+                {
+                    finished(true)
+                }
+                else{
+                    needUnBind(finished: finished)
+                }
+            }
+            else{
+                finished(false)
+            }
+        }
+    }
+    
+    static func needUnBind(finished:@escaping ((Bool) -> Void)){
+        DeviceVM.shared.refresh { result in
+            DeviceVM.shared.dataList.removeAll()
+            startUnBindList(result.data,finished: finished)
+        }
+    }
+    
+    
+    static func startUnBindList(_ list:[HomeDeviceModel],finished:@escaping ((Bool) -> Void)){
+        var isSuccess = true
+        let dispatchGroup = DispatchGroup()
+        for item in list {
+            dispatchGroup.enter()
+            startUnbind(item.deviceId) { success in
+                if !success {
+                    isSuccess = false
+                }
+                dispatchGroup.leave()
+            }
+        }
+        
+        dispatchGroup.notify(queue:.main) {
+            finished(isSuccess)
+        }
+    }
+    
+    static func startUnbind(_ deviceId:String,finished:@escaping ((Bool) -> Void)){
+        let api = CommomApi.unbind(deviceId: deviceId)
+        HttpClient.request(api) {(model:HomeDeviceModelRoot,res) in
+            finished(model.isSuccess)
+        }
+    }
 }
index a61009f..06bd35f 100644 (file)
@@ -46,12 +46,15 @@ class UserInfoCell: BaseTableViewCell {
     let titleLabel = UILabel()
     let nextIcon = UIImageView()
     let valueIcon = UIImageView()
+    let copyIcon = UIImageView()
     let valueLabel = UILabel()
     
     var type:UserInfoCellType = .area{
         didSet{
             titleLabel.text = type.title
             valueIcon.isHidden = type != .avatar
+            copyIcon.isHidden = type != .uid
+            nextIcon.isHidden = !copyIcon.isHidden
             
             if type == .avatar  {
                 valueLabel.isHidden = true
@@ -85,6 +88,7 @@ class UserInfoCell: BaseTableViewCell {
             }
             else if type == .uid {
                 valueLabel.text = info.userId
+                
             }
             else if type == .avatar{
                 valueIcon.kf.setImage(with:CacheManager.shared.user.info.avatar.yc.asUrl )
@@ -102,7 +106,7 @@ class UserInfoCell: BaseTableViewCell {
     }
     override func setupViews() {
         contentView.addSubview(bgView)
-        bgView.addSubviews([titleLabel,nextIcon,valueIcon,valueLabel])
+        bgView.addSubviews([titleLabel,nextIcon,valueIcon,valueLabel,copyIcon])
         
         backgroundColor = .color(.bgColor)
         contentView.backgroundColor = .clear
@@ -127,6 +131,7 @@ class UserInfoCell: BaseTableViewCell {
             v.isHidden = true
         }
         nextIcon.image = UIImage(named: "arrow_next")
+        copyIcon.image = UIImage(named: "copy_icon_2")
     }
     
     override func setupLayout() {
@@ -157,5 +162,10 @@ class UserInfoCell: BaseTableViewCell {
             m.height.equalToSuperview()
             m.left.equalToSuperview().inset(90)
         }
+        copyIcon.snp.makeConstraints { (m) in
+            m.size.equalTo(20)
+            m.right.equalToSuperview().inset(15)
+            m.centerY.equalToSuperview()
+        }
     }
 }
index 0b069d5..f1d2d4c 100644 (file)
@@ -78,6 +78,7 @@ class UserInfoVC: BaseVC{
             case .weight:
                 weightAction()
             case .uid:
+                uidAction()
                 break
             case .hobbies:
                 hobiesAction()
@@ -163,6 +164,10 @@ extension UserInfoVC{
         }
         App.shared.goToPage(vc)
     }
+    func uidAction(){
+        UIPasteboard.general.string = CacheManager.shared.user.info.userId
+        YLprogressHUD.showAutoHiden("已复制".l10n)
+    }
     func areaAction(){
         let vc = ContryListVC()
         vc.currentType = CountryModel()
index 7596e8d..24967c7 100644 (file)
@@ -9,7 +9,7 @@ import Foundation
 
 enum NotificationType:String{
     case deviceValidChange
-    case login
+//    case login
     case logout
     case updateLocation
     
@@ -17,8 +17,8 @@ enum NotificationType:String{
         switch self {
         case .deviceValidChange:
             return "deviceValidChange"
-        case .login:
-            return "login"
+//        case .login:
+//            return "login"
         case .logout:
             return "logout"
         case .updateLocation: