{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCBleRecord.swift",
"kind": "StringLiteral",
- "offset": 311,
+ "offset": 559,
"length": 7,
"value": "\"zh-CN\""
},
{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCBleRecord.swift",
"kind": "StringLiteral",
- "offset": 430,
+ "offset": 678,
"length": 7,
"value": "\"en-US\""
},
{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCBleRecord.swift",
"kind": "BooleanLiteral",
- "offset": 572,
+ "offset": 820,
"length": 5,
"value": "false"
},
{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCBleRecord.swift",
"kind": "BooleanLiteral",
- "offset": 639,
+ "offset": 887,
"length": 5,
"value": "false"
},
{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCBleRecord.swift",
"kind": "StringLiteral",
- "offset": 717,
+ "offset": 965,
"length": 5,
"value": "\"pcm\""
},
{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCBleRecord.swift",
"kind": "Array",
- "offset": 1340,
+ "offset": 1588,
"length": 2,
"value": "[]"
},
{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCBleRecord.swift",
"kind": "StringLiteral",
- "offset": 1361,
+ "offset": 1609,
"length": 2,
"value": "\"\""
},
{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCBleRecord.swift",
"kind": "Array",
- "offset": 1410,
+ "offset": 1658,
"length": 2,
"value": "[]"
},
{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCBleRecord.swift",
"kind": "StringLiteral",
- "offset": 1437,
+ "offset": 1685,
"length": 2,
"value": "\"\""
},
"length": 2,
"value": "[]"
},
+ {
+ "filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCLogger.swift",
+ "kind": "StringLiteral",
+ "offset": 509,
+ "length": 49,
+ "value": "\"***********DeepChordsSdk_v2026111501***********\""
+ },
{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCLogger.swift",
"kind": "BooleanLiteral",
{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCLogger.swift",
"kind": "StringLiteral",
- "offset": 1578,
+ "offset": 1712,
"length": 3,
"value": "\" \""
},
{
"filePath": "\/Users\/yaozuopan\/Documents\/code\/ShenYin\/ShenYin\/DeepChordsSdk\/DCLogger.swift",
"kind": "StringLiteral",
- "offset": 1604,
+ "offset": 1738,
"length": 4,
"value": "\"\n\""
},
</data>
<key>Frameworks/StarburstSdk.framework/StarburstSdk</key>
<data>
- MkQukbCj7SCh2eyrtZPo6Bqdf4A=
+ 8Gs4sXssvRCJN21rU30a67r7N6o=
</data>
<key>Frameworks/StarburstSdk.framework/_CodeSignature/CodeResources</key>
<data>
</data>
<key>Modules/DeepChordsSdk.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo</key>
<data>
- O1x9BrZy7upg08bZqGU/Uc5etPM=
+ mEqZfVrzB53tawxpt2dNXLwsZqU=
</data>
<key>Modules/DeepChordsSdk.swiftmodule/arm64-apple-ios.abi.json</key>
<data>
- aUGMYXcXkccmHGwFIdGWAK/ssp4=
+ CsItm5OKF9/+ftWZEp8o3WqdIBg=
</data>
<key>Modules/DeepChordsSdk.swiftmodule/arm64-apple-ios.private.swiftinterface</key>
<data>
<dict>
<key>hash2</key>
<data>
- xmw2ssE4+Oy+Ou293pFF8Wzmr6D0q15g35a8lDBSEbY=
+ 8ljyW9uNaE17fq+8E2zGO93awpOcEB3qVTJrxo/5UGU=
</data>
</dict>
<key>Frameworks/StarburstSdk.framework/_CodeSignature/CodeResources</key>
<dict>
<key>hash2</key>
<data>
- jY0Vz9dnHqg9VkabsBTOyHmRQCzHAQpzx8qEVoDsZWI=
+ 9kBR1SZb+wEMizfVxGSYHNFLnjf1D03QrkLGHSHZUAc=
</data>
</dict>
<key>Modules/DeepChordsSdk.swiftmodule/arm64-apple-ios.abi.json</key>
<dict>
<key>hash2</key>
<data>
- 7UkzEof8Cs5MlhqxmmMbpwo8Czj4WWOkV/I2+hOGnPw=
+ doBqFM+cZXnCY+J03piPHrTI6lqW1V89sbEslZp6zPg=
</data>
</dict>
<key>Modules/DeepChordsSdk.swiftmodule/arm64-apple-ios.private.swiftinterface</key>
break
case 0x03:
if App.shared.topVC() is BleRecordVC {
- // vc.startRecord()
+ //vc.startRecord()
}else{
App.shared.goToPage(BleRecordVC())
}
+++ /dev/null
-\r
-UUID/AE30 AE03/WRITE_WITHOUT_RESPONSE AE04/NOTIFY \r
-\r
-\r
-\r
-BYTE0 :0xBA\r
-BYTE1 :CMD\r
-BYTE2 :DATA\r
-BYTE3:DATA_LEN\r
-BYTE4:CRC\r
-\r
-CRC:\r
-static u8 chargestore_crc8(u8 *ptr, u8 len)\r
-{\r
- u8 i, crc;\r
- crc = 0;\r
- while (len--) {\r
- crc ^= *ptr++;\r
- for (i = 0; i < 8; i++) {\r
- if (crc & 0x01) {\r
- crc = (crc >> 1) ^ 0x8c;\r
- } else {\r
- crc >>= 1;\r
- }\r
- }\r
- }\r
- return crc;\r
-}\r
-\r
-\r
-CMD:\r
-0x01 代表设置多点连接 DATA:0x00表示关闭多点连接 0x01表示打开多点连接\r
- (例:APP下发 0xBA 0x01 0x01 0x01 CRC 耳机开启空间音频的功能回复 0xBA 0x01 0x01 0x01 CRC)\r
-0x02 代表获取多点连接 DATA:0x00表示关闭多点连接 0x01表示打开多点连接\r
-(例:APP下发 0xBA 0x02 0x00 0x00 CRC 耳机多点连接功能开启的话回复 0xBA 0x02 0x01 0x01 CRC)\r
-0x03 代表设置空间音频 DATA:0x00表示关闭空间音频 0x01表示打开空间音频\r
- (例:APP下发 0xBA 0x03 0x01 0x01 CRC 耳机开启空间音频的功能回复 0xBA 0x03 0x01 0x01 CRC)\r
-0x04 代表获取空间音频 DATA:0x00表示关闭空间音频 0x01表示打开空间音频\r
- (例:APP下发 0xBA 0x04 0x00 0x00 CRC 耳机空间音频功能开启的话回复 0xBA 0x04 0x01 0x01 CRC)\r
-\r
-0x05 代表获取设备ID DATA:0x00 注:TWS有连接记录返回左右耳 TWS未连接过只返回单耳另一个信息都为0XFF\r
- (例:APP下发 0xBA 0x05 0x00 0x00 CRC 耳机回复设备ID: 0xBA 0x05 \r
-0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF(左耳16字节) 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF(右耳16字节)0x20 CRC)\r
-\r
-0x06 开MIC(OPUS传输) DATA:0x01(预留定义豆包AI)\r
- (例:APP下发 0xBA 0x06 0x01 0x01 CRC 耳机回复设备0xBA 0x06 0x01 0x01 CRC)\r
-\r
-\r
-0x07 关MIC(OPUS传输) DATA:0x01(预留定义豆包AI)\r
- (例:APP下发 0xBA 0x07 0x01 0x01 CRC 耳机回复设备0xBA 0x07 0x01 0x01 CRC)\r
-0x08 获取设备名称(UTF-8)\r
- 例:APP下发 0xBA 0x08 0x00 0x00 CRC 耳机回复:假设蓝牙名EARPHONE 0xBA 0x08 0x45(E) 0x41(A) 0x52(R) 0x50(P) 0x48(H) 0x4F(O) 0x4E(N) 0x45(E) 0x08(数据长度) CRC \r
-\r
-0x09 获取电量(左耳/右耳)\r
-例:APP下发 0xBA 0x09 0x00 0x00 CRC 耳机回复: 0xBA 0x09 0x00(左耳) 0x64(100电量) 0x01(右耳) 0x64(100电量) 0x04(数据长度) CRC\r
-\r
-0x0A 获取软件版本,硬件版本\r
-例:APP下发 0xBA 0x0A 0x00(软件版本) 0x01 CRC 耳机回复:假设软件版本(1.0.1) 0xBA 0x0A 0x49(1) 0x46(.) 0x48(0) 0x46(.) 0x49(1) 0x05(数据长度) CRC\r
-例:APP下发 0xBA 0x0A 0x01(硬件版本) 0x01 CRC 耳机回复:假设硬件版本(1.0.0) 0xBA 0x0A 0x49(1) 0x46(.) 0x48(0) 0x46(.) 0x48(0) 0x05(数据长度) CRC\r
-0x0B 查找耳机(耳机声音播放/停止)\r
-例:APP下发 0xBA 0x0A 0x00(关闭查找音) 0x01 CRC 耳机回复:0xBA 0x0A 0x00(关闭查找音) 0x01 CRC\r
-例:APP下发 0xBA 0x0A 0x01(打开查找音) 0x01 CRC 耳机回复:0xBA 0x0A 0x01(打开查找音) 0x01 CRC \r
-0x0C 设置EQ\r
-\r
-\r
-用户在APP设置耳机按键自定义功能\r
-BYTE0 :0x05\r
-BYTE1:DATA1\r
-BYTE2:DATA2\r
-BYTE3:DATA3\r
-BYTE1 :CMD\r
-BYTE4:CRC\r
-\r
-CRC:\r
-static u8 chargestore_crc8(u8 *ptr, u8 len)\r
-{\r
- u8 i, crc;\r
- crc = 0;\r
- while (len--) {\r
- crc ^= *ptr++;\r
- for (i = 0; i < 8; i++) {\r
- if (crc & 0x01) {\r
- crc = (crc >> 1) ^ 0x8c;\r
- } else {\r
- crc >>= 1;\r
- }\r
- }\r
- }\r
- return crc;\r
-}\r
-\r
-\r
-DATA1:\r
- Lift = 0x00\r
- Right = 0x01\r
-\r
-DATA2:\r
- butten0 = 0x00\r
- butten1 = 0x01\r
- butten2 = 0x02\r
- butten3 = 0x03\r
- butten4 = 0x04\r
- \r
-\r
-DATA3:\r
-按键操作类型定义:\r
- KEY_ACTION_SINGLE_CLICK = 0x01 // 单击\r
- KEY_ACTION_LONG_PRESS = 0x02 // 长按\r
- KEY_ACTION_DOUBLE_CLICK = 0x03 // 双击 \r
- KEY_ACTION_TRIPLE_CLICK = 0x04 // 三击\r
-\r
-CMD:\r
-按键功能类型定义:\r
- KEY_TYPE_NONE = 0x00 // 无功能\r
- KEY_TYPE_PREV = 0x03 // 上一曲\r
- KEY_TYPE_NEXT = 0x04 // 下一曲 \r
- TYPE_PP = 0x05 // 播放/暂停\r
- TYPE_ANSWER_CALL = 0x06 // 接听电话\r
- KEY_TYPE_HANG_UP = 0x07 // 挂断电话\r
- KEY_TYPE_CALL_BACK = 0x08 // 回拨\r
- KEY_TYPE_INC_VOICE = 0x09 // 音量增加\r
- KEY_TYPE_DESC_VOICE = 0x0A // 音量减少\r
- KEY_TYPE_TAKE_PHOTO = 0x0B // 拍照\r
- KEY_TYPE_SIRI = 0x0C // 语音助手\r
- KEY_TYPE_ANC_VOICE = 0xFF // ANC/通透\r
-\r
-(例:设置左耳的按键1为单击是播放功能\r
- APP下发 0x05 0x00 0x01 0x01 0x05 CRC 耳机设置成功后回复0x05 0x00 0x01 0x01 0x05 CRC)\r
-\r
-\r
-\r
-按键按下后上报通知给到APP\r
-Button Notifications \r
-Notification ID: 0x7B \r
-Payload: \r
-Byte 0: JieLi button ID \r
-0: Earbuds power left or headset button #0 \r
-1: Earbuds power right or headset button #1 \r
-2:headset button #2\r
-3:headset button #3 \r
-4:headset button #4 \r
-5:headset button #5 \r
-Byte 1: JieLi gesture ID \r
-0: Click \r
-1: Hold Up \r
-2: Double click \r
-3: Triple click \r
-Byte 2: JieLi command ID \r
-0: No action \r
-3: Previous \r
-4: Next \r
-5: Play/pause \r
-6: Take call \r
-7: End call \r
-9: Volume up \r
-10: Volume down\r
-11: Remote up \r
-12: Assistant toggle \r
-0xFF: ANC toggle\r
-\r
-\r
-\r
-\r
-\r
-\r
public static var isDebug:Bool = false{
didSet{
// StarburstConfig.shared().isDebug = false
+ if isDebug {
+ DCLogger.debug("***********DeepChordsSdk_v2026111501***********")
+ }
}
}
Sdk/DcSdk/DcThly.swift,
Sdk/DcSdk/DcXcly.swift,
Sdk/DcSdk/HomeDeviceVC.swift,
+ Sdk/DcSdk/ModeVC.swift,
Sdk/DcSdk/OpusTools.swift,
Sdk/DcSdk/VC/DcCallingRecordVC.swift,
Sdk/DcSdk/VC/DcChatVC.swift,
Sdk/JoySdk/CCBleManager.swift,
Sdk/JoySdk/CCDevice.swift,
Sdk/JoySdk/CCPage.swift,
+ Sdk/JoySdk/HomeDeviceVC.swift,
Sdk/JoySdk/JoyCallRecord.swift,
Sdk/JoySdk/JoyChat.swift,
Sdk/JoySdk/JoyChinse2English.swift,
Sdk/JoySdk/JoyRecord.swift,
Sdk/JoySdk/JoySdkManager.swift,
Sdk/JoySdk/JoyTcty.swift,
+ Sdk/JoySdk/ModeVC.swift,
Sdk/JoySdk/VC/JoyCallingRecordVC.swift,
Sdk/JoySdk/VC/JoyChatVC.swift,
Sdk/JoySdk/VC/JoyChinese2EnglishVC.swift,
case .subTheme:
return 0xF4FAFF
case .first:
- return 0x222222
+ return 0x121212
case .primary:
return 0x333333
case .secondary:
case .placeholder:
return 0xcccccc
case .separateLine:
- return 0xffffff
+ return 0xF2F2F2
case .cellBg:
return 0xffffff
}
func connectPeripheral(_ peripheral: DCPeripheral) {
connectPeripheral = peripheral
- if let name = peripheral.device.name,name.hasPrefix("AI") {
- CCDevice.isJoy = false
- }
- else{
- CCDevice.isJoy = true
- }
+// if let name = peripheral.device.name,name.hasPrefix("AI") {
+// CCDevice.isJoy = false
+// }
+// else{
+// CCDevice.isJoy = true
+// }
CCDevice.initSdk()
Logger.debug(peripheral.device.name ?? "","连接中...")
centralManager.connect(peripheral.device, options: [CBConnectPeripheralOptionEnableTransportBridgingKey:true])
--- /dev/null
+//
+// HomeDeviceVC.swift
+// ShenYin
+//
+// Created by liangshi on 2025/10/20.
+//
+
+import UIKit
+
+class HomeDeviceVC:BaseVC{
+ private var collectionView:UICollectionView!
+ let imgView = UIImageView()
+ let edtLabel = UILabel()
+ var currentBg:BackgroundModel?
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ NotificationManager.add(self, selector: #selector(deviceChange(_:)), forName: .deviceValidChange)
+ }
+ override func viewWillAppear(_ animated: Bool) {
+ super.viewWillAppear(animated)
+ reloadData()
+ }
+
+ override func setupViews() {
+ navBar.do { v in
+ v.leftView.isHidden = true
+ v.rightView.isHidden = false
+ v.rightView.setImage(UIImage(named: "add_icon"), for: .normal)
+ v.backgroundColor = .clear
+ }
+
+ let layout = UICollectionViewFlowLayout()
+ //layout.minimumInteritemSpacing = 10.fitR
+ layout.minimumLineSpacing = 18
+ layout.itemSize = CGSize(width: (kScreenWid-54)/2, height: 128)
+ collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
+ view.addSubviews([imgView,collectionView,edtLabel])
+ self.view.bringSubviewToFront(navBar)
+
+ collectionView.do { (v) in
+ v.dataSource = self
+ v.delegate = self
+ v.backgroundColor = .clear
+ v.bounces = true
+ v.contentInset = UIEdgeInsets(top: 0, left: 18, bottom: 0, right: 18)
+ v.register(HomeDeviceCell.self, forCellWithReuseIdentifier: HomeDeviceCell.reuseID)
+ v.register(HomeHeadInfoView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier:HomeHeadInfoView.reuseID )
+ }
+ imgView.do { v in
+// v.backgroundColor = .red
+ }
+ edtLabel.do { v in
+ v.text = "设置壁纸".l10n
+ v.font = .regular(12)
+ v.backgroundColor = .hexString("#FAFAFA")
+ v.textColor = .hexString("#4E4E4E")
+ v.textAlignment = .center
+ v.yc.setCornerRadius(13)
+ v.yc.addTap(target: self, action: #selector(editAction))
+ }
+
+ currentBg = BackgroundCache.get()
+ if (currentBg != nil) {
+ imgView.kf.setImage(with: currentBg?.bgPath.yc.asUrl)
+ navBar.rightView.setImage(UIImage(named: "add_icon")?.tinted(with: UIColor.hexString(currentBg!.themeColor)), for: .normal)
+ }
+ else{
+ imgView.image = UIImage(named: "home_bg")
+ }
+ }
+ override func setupLayout() {
+ collectionView.snp.makeConstraints { (m) in
+ m.top.equalTo(kNavBtm)
+ m.left.right.bottom.equalToSuperview()
+ }
+ imgView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ edtLabel.snp.makeConstraints { make in
+ make.width.equalTo(120)
+ make.height.equalTo(26)
+ make.centerX.equalToSuperview()
+ make.bottom.equalToSuperview().inset(120)
+ }
+ }
+ func reloadData() {
+ DeviceVM.shared.refresh {[weak self] result in
+ self?.collectionView.reloadData()
+ if CCBleManager.shared.isConnetd{
+ return
+ }
+ var autoConnetced = false
+ if let lastMac = DeviceCache.getLastConnected(){
+ for item in DeviceVM.shared.dataList {
+ if item.mac == lastMac{
+ self?.startConectBle(item)
+ autoConnetced = true
+ }
+ }
+ }
+ if autoConnetced == false,let model = DeviceVM.shared.dataList.first {
+ self?.startConectBle(model)
+ }
+ }
+ CacheManager.shared.user.tokenIsValid(){[weak self] sucess in
+ self?.collectionView.reloadData()
+ }
+ }
+ override func navRightViewTapped() {
+ App.shared.goToPage(BleScanVC())
+// App.shared.goToPage(CalendarPickerVC())
+// CCBleManager.shared.checkSettingsConnected()
+// ChatCache.shared.LargeDateDemoSave()
+ }
+ @objc func editAction(){
+ let vc = BackgroundVC()
+ vc.didSelected = {[weak self] model in
+ guard let self = self else {
+ return
+ }
+ currentBg = model
+ self.imgView.kf.setImage(with: model.bgPath.yc.asUrl)
+ self.collectionView.reloadData()
+ navBar.rightView.setImage(UIImage(named: "add_icon")?.tinted(with: UIColor.hexString(currentBg!.themeColor)), for: .normal)
+ }
+ App.shared.goToPage(vc)
+ }
+
+ func unbindAction(_ deviceModel:HomeDeviceModel){
+ YLprogressHUD.showLoading()
+ let api = CommomApi.unbind(deviceId: deviceModel.deviceId)
+ HttpClient.request(api) {[weak self] (model:HomeDeviceModelRoot,res) in
+ guard let self = self else {return}
+ if model.isSuccess{
+ YLprogressHUD.hidden()
+ if let mac0 = CCBleManager.shared.connectPeripheral?.mac,let mac1 = DeviceCache.getLastConnected(),mac0 == mac1{
+ DeviceCache.remove()
+ }
+ DeviceVM.shared.dataList.removeAll(where: {$0.deviceId == deviceModel.deviceId})
+ collectionView.reloadData()
+ CCBleManager.shared.cancel()
+ reloadData()
+ }
+ else{
+ YLprogressHUD.showAutoHiden("请求失败".l10n)
+ }
+ }
+ }
+ func startConectBle(_ model:HomeDeviceModel){
+ CCBleManager.shared.connect(mac: model.mac) { result in
+ }
+ }
+ @objc func deviceChange(_ noti:Notification){
+ collectionView.reloadData()
+ }
+}
+
+extension HomeDeviceVC:UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout {
+ func numberOfSections(in collectionView: UICollectionView) -> Int {
+ return 1
+ }
+ func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+ return DeviceVM.shared.dataList.count
+ }
+ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+ let cell = HomeDeviceCell.cell(withCollectionView: collectionView, indexPath: indexPath)
+ cell.model = DeviceVM.shared.dataList[indexPath.row]
+ cell.longPress = {[weak self] model in
+ self?.unbindAction(model)
+ }
+ return cell
+ }
+ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+ let model = DeviceVM.shared.dataList[indexPath.row]
+ App.shared.goToPage(HomeVC(device: model))
+
+ }
+ func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView{
+ let header = HomeHeadInfoView.header(with: collectionView, indexPath: indexPath)
+ header.updateUI()
+ header.updateColor(currentBg)
+ return header
+ }
+
+ func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
+ return CGSize(width: kScreenWid, height: 160)
+ }
+}
--- /dev/null
+//
+// Untitled.swift
+// ShenYin
+//
+// Created by liangshi on 2025/8/5.
+//
+import UIKit
+class ModeVC:BaseVC{
+ let bgView = UIScrollView()
+ let headerView = CurrentDeviceView()
+ let effectsView = ModeEffectsView()
+ let findView = ModeFindView()
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ }
+ override func viewWillAppear(_ animated: Bool) {
+ super.viewWillAppear(animated)
+ headerView.updateUI()
+ }
+
+ override func setupViews() {
+ self.navBar.title = CCBleManager.shared.connectPeripheral?.device.name ?? ""
+ navBar.backgroundColor = .clear
+ view.backgroundColor = .color(.bgColor)
+
+ view.addSubview(bgView)
+ bgView.addSubviews([headerView,effectsView,findView])
+
+// bgView.backgroundColor = .red
+ effectsView.do { v in
+ v.selectedMode = {[weak self] mode in
+ self?.selectedModeAction(mode)
+ }
+ }
+ findView.yc.addTap(target: self, action: #selector(findAction))
+ NotificationManager.add(self, selector: #selector(deviceChange(_:)), forName: .deviceValidChange)
+ updateState()
+ }
+ override func setupLayout() {
+ bgView.snp.makeConstraints { make in
+ make.top.equalTo(kNavBtm)
+ make.left.right.equalToSuperview()
+ make.height.equalTo(kScreenHei - kNavBtm - kTabbarHei)
+ }
+ headerView.snp.makeConstraints { make in
+ make.top.equalToSuperview()
+ make.left.equalToSuperview()
+ make.width.equalTo(kScreenWid)
+ }
+// controlView.snp.makeConstraints { make in
+// make.top.equalTo(headerView.snp.bottom).offset(10)
+// make.centerX.equalToSuperview()
+// make.width.equalTo(kScreenWid - 36)
+// make.height.equalTo(128)
+// }
+ effectsView.snp.makeConstraints { make in
+ make.top.equalTo(headerView.snp.bottom).offset(20)
+ make.centerX.equalToSuperview()
+ make.width.equalTo(kScreenWid - 36)
+ make.height.equalTo(325)
+ }
+ findView.snp.makeConstraints { make in
+ make.top.equalTo(effectsView.snp.bottom).offset(10)
+ make.centerX.equalToSuperview()
+ make.width.equalTo(kScreenWid - 36)
+ make.height.equalTo(62)
+ make.bottom.equalToSuperview().inset(20)
+ }
+ }
+ override func setupData() {
+ CCDevice.getEQMode {[weak self] type in
+ guard let self = self else{return}
+ effectsView.mode = type ?? .normal
+ }
+ }
+
+ override func navRightViewTapped() {
+
+ }
+}
+
+extension ModeVC{
+ @objc func deviceChange(_ noti:Notification){
+ updateState()
+ }
+ func updateState(){
+ self.view.alpha = CCBleManager.shared.isConnetd ? 1:0.5
+ }
+
+ func selectedModeAction(_ mode:ModeEffectsType){
+ if !CCBleManager.shared.isConnetd {
+ return
+ }
+ CCDevice.setEQMode(mode)
+ if mode == .custom {
+ App.shared.goToPage(CustomEqVC())
+ }
+ }
+ @objc func findAction(){
+ if CCBleManager.shared.isConnetd {
+ App.shared.goToPage(FindVC())
+ }
+
+ }
+}
+
let appearance = UITabBarAppearance()
appearance.configureWithDefaultBackground()
appearance.stackedLayoutAppearance.normal.titleTextAttributes = [NSAttributedString.Key.foregroundColor:UIColor.rgb(0x8D8D8D)]
- appearance.stackedLayoutAppearance.selected.titleTextAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+ appearance.stackedLayoutAppearance.selected.titleTextAttributes = [NSAttributedString.Key.foregroundColor:UIColor.color(.first)]
self.tabBar.standardAppearance = appearance
self.tabBar.backgroundColor = .white
view.backgroundColor = .color(.bgColor)
// if item !== vm.list.last {
// let line = UIView()
-// line.backgroundColor = .hexString("#.color(.separateLine)")
+// line.backgroundColor = .color(.separateLine)
// line.height = 1
// line.width = kScreenWid - 2*70
// line.left = 10
}
}
@objc func playAction(){
-// UIPasteboard.general.string = data.send + "\n" + data.response
-// YLprogressHUD.showAutoHiden("已拷贝")
if playIcon.isAnimating {
playIcon.stopAnimating()
}
}
originalLabel.do { v in
v.font = .regular(14)
- v.textColor = .color(.first)
+ v.textColor = .color(.secondary)
v.numberOfLines = 0
v.textAlignment = .left
}
make.left.equalToSuperview().inset(18)
}
bgView.backgroundColor = .color(.cellBg)
- originalLabel.textColor = .color(.first)
+ originalLabel.textColor = .color(.secondary)
translationLabel.textColor = .color(.first)
}
line.setNeedsLayout()
}
}
@objc func playAction(){
- // UIPasteboard.general.string = data.send + "\n" + data.response
- // YLprogressHUD.showAutoHiden("已拷贝")
if playIcon.isAnimating {
playIcon.stopAnimating()
}
}
stopWave.image = UIImage(named: "audio_record_normal")
- startWave.kf.setImage(with: Bundle.main.url(forResource: "record_start", withExtension: "gif")!)
+ startWave.kf.setImage(with: Bundle.main.url(forResource: CCDevice.isJoy ? "record_start_joy":"record_start", withExtension: "gif")!)
startWave.isHidden = true
// startWave.backgroundColor = .green
// backgroundColor = .red
v.attributedPlaceholder = NSAttributedString(string: "搜索".l10n, attributes: [NSAttributedString.Key.foregroundColor: UIColor.color(.placeholder)])
v.returnKeyType = .done
v.delegate = self
+ v.textColor = .color(.first)
v.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
}
selectedIcon.image = UIImage(named: "cell_selected")
line.do { v in
- v.backgroundColor = .hexString("#.color(.separateLine)")
+ v.backgroundColor = .color(.separateLine)
}
}
var searchList = [RecordHistoryModel]()
var deleteCallback:((_ list:[RecordHistoryModel])->Void)?
var collectStateChangeCallback:(()->Void)?
- var selectedDate:String = Date().format(.short)
+ var selectedDate:String = ""
init(list:[RecordHistoryModel]) {
orginList = list
searchList = orginList
func searchBarcalendarAction(_ toolBar:RecordSearchBar){
let vc = CalendarPickerVC()
- vc.defaultDate = selectedDate
+ vc.defaultDate = selectedDate.isEmpty ? Date().format(.short):selectedDate
vc.didSelectedDate = {[weak self] date in
guard let self = self else {
return
var searchList = [RecordDetailModel]()
var deleteCallback:((_ list:[RecordDetailModel])->Void)?
var collectStateChangeCallback:((RecordDetailModel)->Void)?
- var selectedDate:String = Date().format(.short)
+ var selectedDate:String = ""
// init(data:[RecordDetailModel]) {
// list = data
// super.init()
func searchBarcalendarAction(_ toolBar:RecordSearchBar){
let vc = CalendarPickerVC()
- vc.defaultDate = selectedDate
+ vc.defaultDate = selectedDate.isEmpty ? Date().format(.short):selectedDate
vc.didSelectedDate = {[weak self] date in
guard let self = self else {
return
weak var delegate:RecordDetailBarDelegate?
override func setupViews() {
- backgroundColor = .clear
+ backgroundColor = .color(.cellBg)
addSubviews([tranlateItem,renameItem,playItem,moreItem])
tranlateItem.do {v in
func updateUI(){
if let device = DeviceVM.shared.currentDevice{
imageView.kf.setImage(with: device.image.yc.asUrl)
-
- if CCBleManager.shared.isConnetd {
- alpha = 1
- }
- else{
- alpha = 0.5
- }
+ }
+ else{
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
-
+ NotificationManager.add(self, selector: #selector(deviceChange(_:)), forName: .deviceValidChange)
+ updateUI()
}
override func setupViews() {
navBar.title = device.productName
navBar.backgroundColor = .color(.bgColor)
view.backgroundColor = .color(.bgColor)
-// navBar.rightView.setImage(UIImage(named: "add_icon"), for: .normal)
view.addSubview(bgView)
bgView.addSubviews([headerView,functionView,bottomView])
make.bottom.equalToSuperview().inset(10)
}
}
-
-
-// @objc func addDeviceAction(){
-// let vc = AddDeviceVC()
-// self.navigationController?.pushViewController(vc, animated: true)
-// }
- @objc func saveAction(){
-// LogManager.instance.add("保存")
-// LogManager.instance.saveToFile()
-
-// SVProgressHUD.showLoading()
-// HttpClient.instance.request(CommomApi.login(userName: "")) { (model:ResponseBaseModel, res) in
-// if model.isSuccess{
-//// SVProgressHUD.show(withStatus: "请求成功")
-// }
-// else{
-//// SVProgressHUD.show(withStatus: "请求失败".l10n)
-// }
-// }
+ @objc func deviceChange(_ noti:Notification){
+ updateUI()
+ }
+ func updateUI(){
+ self.headerView.icon.alpha = CCBleManager.shared.isConnetd ? 1:0.5
}
}
}
originalLabel.do { v in
v.font = .regular(14)
- v.textColor = .color(.first)
+ v.textColor = .color(.secondary)
v.numberOfLines = 0
v.textAlignment = .left
}
}
@objc func copyAction(){
UIPasteboard.general.string = data.send + "\n" + data.response
-// YLprogressHUD.showAutoHiden("已拷贝")
+ YLprogressHUD.showAutoHiden("已复制".l10n)
}
}
if model.isSuccess{
YLprogressHUD.hidden()
self?.codeView.codeButton.start()
+ self?.codeView.textField.becomeFirstResponder()
}
else{
YLprogressHUD.showAutoHiden(model.msg)
class ForgetVC:BaseVC{
- let logoImg = UIImageView(image: UIImage(named: "logo_3"))
- let bgView = UIView()
+ let logoImg = LoginHeaderView()
+ let bgView = LoginBgView()
let titleLabel = UILabel()
let phoneView = CustomInputView()
let codeView = CodeView()
self.navBar.title = ""
view.backgroundColor = .color(.bgColor)
- bgView.do { v in
- v.backgroundColor = .color(.bgColor)
- v.yc.setCorners(withRoundedRect: CGRect(x: 0, y: 0, width: kScreenWid, height: kScreenHei - 244), roundingCorners: [.topLeft,.topRight], cornerRadii: CGSize(width: 50, height: 50))
- }
+
titleLabel.do { v in
v.text = self.type == .forget ? "忘记密码".l10n:"重置密码".l10n
v.font = .medium(18)
}
override func setupLayout(){
logoImg.snp.makeConstraints { make in
- make.width.equalTo(62)
- make.height.equalTo(80)
- make.top.equalTo(kNavBtm + 20)
- make.centerX.equalToSuperview()
+ if CCDevice.isJoy{
+ make.left.equalToSuperview().inset(28)
+ make.top.equalTo(kNavBtm + 20)
+ make.centerX.equalToSuperview()
+ }
+ else{
+ make.width.equalTo(62)
+ make.height.equalTo(80)
+ make.top.equalTo(kNavBtm + 20)
+ make.centerX.equalToSuperview()
+ }
}
bgView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
if model.isSuccess{
YLprogressHUD.hidden()
self?.codeView.codeButton.start()
+ self?.codeView.textField.becomeFirstResponder()
}
else{
YLprogressHUD.showAutoHiden(model.msg)
import DeviceKit
class LoginVC:BaseVC{
-
- let logoImg = UIImageView(image: UIImage(named: "logo_3"))
- let bgView = UIView()
+ let logoImg = LoginHeaderView()
+ let bgView = LoginBgView()
let titleLabel = UILabel()
let phoneView = CustomInputView()
let pwdView = PasswordView()
// self.navBar.title = ""
navBar.isHidden = true
view.backgroundColor = .color(.bgColor)
-
- bgView.do { v in
- v.backgroundColor = .color(.bgColor)
- v.yc.setCorners(withRoundedRect: CGRect(x: 0, y: 0, width: kScreenWid, height: kScreenHei - 244), roundingCorners: [.topLeft,.topRight], cornerRadii: CGSize(width: 50, height: 50))
- }
+
titleLabel.do { v in
v.text = "用户登录".l10n
v.font = .medium(18)
}
override func setupLayout(){
logoImg.snp.makeConstraints { make in
- make.width.equalTo(62)
- make.height.equalTo(80)
- make.top.equalTo(kNavBtm + 20)
- make.centerX.equalToSuperview()
+ if CCDevice.isJoy{
+ make.left.equalToSuperview().inset(28)
+ make.top.equalTo(kNavBtm + 20)
+ make.centerX.equalToSuperview()
+ }
+ else{
+ make.width.equalTo(62)
+ make.height.equalTo(80)
+ make.top.equalTo(kNavBtm + 20)
+ make.centerX.equalToSuperview()
+ }
}
bgView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
class RegisterVC:BaseVC{
- let logoImg = UIImageView(image: UIImage(named: "logo_3"))
- let bgView = UIView()
+ let logoImg = LoginHeaderView()
+ let bgView = LoginBgView()
let titleLabel = UILabel()
let regionView = RegionView()
let phoneView = CustomInputView()
// navBar.isHidden = true
view.backgroundColor = .color(.bgColor)
- bgView.do { v in
- v.backgroundColor = .color(.bgColor)
- v.yc.setCorners(withRoundedRect: CGRect(x: 0, y: 0, width: kScreenWid, height: kScreenHei - 244), roundingCorners: [.topLeft,.topRight], cornerRadii: CGSize(width: 50, height: 50))
- }
+
titleLabel.do { v in
v.text = "用户注册".l10n
v.font = .medium(18)
}
override func setupLayout(){
logoImg.snp.makeConstraints { make in
- make.width.equalTo(62)
- make.height.equalTo(80)
- make.top.equalTo(kNavBtm + 20)
- make.centerX.equalToSuperview()
+ if CCDevice.isJoy{
+ make.left.equalToSuperview().inset(28)
+ make.top.equalTo(kNavBtm + 20)
+ make.centerX.equalToSuperview()
+ }
+ else{
+ make.width.equalTo(62)
+ make.height.equalTo(80)
+ make.top.equalTo(kNavBtm + 20)
+ make.centerX.equalToSuperview()
+ }
}
bgView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
HttpClient.request(CommomApi.sms(account: text,type: .reg)) {[weak self] (model:ResponseBaseModel, res) in
if model.isSuccess{
self?.codeView.codeButton.start()
+ self?.codeView.textField.becomeFirstResponder()
YLprogressHUD.hidden()
}
else{
+++ /dev/null
-//
-// SetPwdVC.swift
-// ShenYin
-//
-// Created by liangshi on 2025/8/25.
-//
-
-import UIKit
-
-class SetPwdVC:BaseVC{
-
- let titleLabel = UILabel()
- let pwdView1 = PasswordView()
- let pwdView2 = PasswordView()
- let loginBtn = CustomButton()
- let desLabel = UILabel()
-
- override func viewDidLoad() {
- super.viewDidLoad()
- }
- override func setupViews(){
- self.navBar.title = "设置密码".l10n
- view.backgroundColor = .color(.bgColor)
-
- titleLabel.do { v in
- v.text = "新密码".l10n
- v.font = .medium(18)
- v.textColor = .color(.first)
- }
- pwdView1.do { v in
- v.textField.attributedPlaceholder = NSAttributedString(string: "请输入密码".l10n, attributes: [NSAttributedString.Key.foregroundColor: UIColor.color(.placeholder)])
-
- }
- pwdView2.do { v in
- v.textField.attributedPlaceholder = NSAttributedString(string: "请输入确认密码".l10n, attributes: [NSAttributedString.Key.foregroundColor: UIColor.color(.placeholder)])
-
- }
- desLabel.do { v in
- v.text = "密码长度8-16位,数字、字母、字符至少包含两种".l10n
- v.font = .regular(12)
- v.textColor = .hexString("#999999")
- }
- loginBtn.set(title: "确定".l10n,style: .theme1, target: self, action: #selector(loginAction))
- view.addSubviews([titleLabel,pwdView1,pwdView2,loginBtn,desLabel])
-
- }
- override func setupLayout(){
-
- titleLabel.snp.makeConstraints { make in
- make.top.equalToSuperview().offset(kNavBtm + 30)
- make.left.right.equalToSuperview().inset(36)
- }
- pwdView1.snp.makeConstraints { make in
- make.top.equalTo(titleLabel.snp.bottom).offset(16)
- make.left.right.equalToSuperview().inset(36)
- }
- pwdView2.snp.makeConstraints { make in
- make.top.equalTo(pwdView1.snp.bottom).offset(20)
- make.left.right.equalToSuperview().inset(36)
- }
- loginBtn.snp.makeConstraints { make in
- make.top.equalTo(pwdView2.snp.bottom).offset(74)
- make.left.right.equalToSuperview().inset(51)
- make.height.equalTo(46)
- }
- desLabel.snp.makeConstraints { make in
- make.top.equalTo(pwdView2.snp.bottom).offset(14)
- make.centerX.equalToSuperview()
- }
- }
-
-}
-
-extension SetPwdVC{
-
- @objc func loginAction(){
- guard let pwd1 = pwdView1.textField.value else{
- YLprogressHUD.showAutoHiden("请输入密码".l10n)
- return
- }
- guard let pwd2 = pwdView2.textField.value else{
- YLprogressHUD.showAutoHiden("请输入确认密码".l10n)
- return
- }
- }
-}
class SmsLoginVC:BaseVC{
- let logoImg = UIImageView(image: UIImage(named: "logo_3"))
- let bgView = UIView()
+ let logoImg = LoginHeaderView()
+ let bgView = LoginBgView()
let titleLabel = UILabel()
let regionView = RegionView()
let phoneView = CustomInputView()
}
override func setupViews(){
view.backgroundColor = .color(.bgColor)
-
- bgView.do { v in
- v.backgroundColor = .color(.bgColor)
- v.yc.setCorners(withRoundedRect: CGRect(x: 0, y: 0, width: kScreenWid, height: kScreenHei - 244), roundingCorners: [.topLeft,.topRight], cornerRadii: CGSize(width: 50, height: 50))
- }
+
titleLabel.do { v in
v.text = "验证码登录".l10n
v.font = .medium(18)
}
override func setupLayout(){
logoImg.snp.makeConstraints { make in
- make.width.equalTo(62)
- make.height.equalTo(80)
- make.top.equalTo(kNavBtm + 20)
- make.centerX.equalToSuperview()
+ if CCDevice.isJoy{
+ make.left.equalToSuperview().inset(28)
+ make.top.equalTo(kNavBtm + 20)
+ make.centerX.equalToSuperview()
+ }
+ else{
+ make.width.equalTo(62)
+ make.height.equalTo(80)
+ make.top.equalTo(kNavBtm + 20)
+ make.centerX.equalToSuperview()
+ }
}
bgView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
HttpClient.request(CommomApi.sms(account: text,type: .login)) {[weak self] (model:ResponseBaseModel, res) in
if model.isSuccess{
self?.codeView.codeButton.start()
+ self?.codeView.textField.becomeFirstResponder()
YLprogressHUD.hidden()
}
else{
HttpClient.request(CommomApi.sms(account: text,type: .update)) {[weak self] (model:ResponseBaseModel, res) in
if model.isSuccess{
self?.codeView.codeButton.start()
+ self?.codeView.textField.becomeFirstResponder()
YLprogressHUD.hidden()
}
else{
HttpClient.request(CommomApi.sms(account: self.email,type: .update)) {[weak self] (model:ResponseBaseModel, res) in
if model.isSuccess{
self?.codeView.codeButton.start()
+ self?.codeView.textField.becomeFirstResponder()
YLprogressHUD.hidden()
}
else{
if model.isSuccess{
YLprogressHUD.hidden()
self?.codeView.codeButton.start()
+ self?.codeView.textField.becomeFirstResponder()
}
else{
YLprogressHUD.showAutoHiden(model.msg)
v.label.text = "点击获取".l10n
}
- inputBgView.backgroundColor = .color(.cellBg)
+ inputBgView.backgroundColor = CCDevice.isJoy ? .rgb(0xF3F4F8): .color(.cellBg)
inputBgView.layer.cornerRadius = 12
inputBgView.layer.masksToBounds = true
}
func addBottomLine(){
let line = UIView()
- line.backgroundColor = .hexString("#.color(.separateLine)")
+ line.backgroundColor = .color(.separateLine)
addSubview(line)
line.snp.makeConstraints { make in
make.height.equalTo(1)
v.leftViewMode = .never
}
- inputBgView.backgroundColor = .color(.cellBg)
+ inputBgView.backgroundColor = CCDevice.isJoy ? .rgb(0xF3F4F8): .color(.cellBg)
inputBgView.layer.cornerRadius = 10
inputBgView.layer.masksToBounds = true
addSubviews([inputBgView])
--- /dev/null
+//
+// LoginBgView.swift
+// ShenYin
+//
+// Created by liangshi on 2026/1/17.
+//
+
+class LoginBgView: BaseView {
+ override func setupViews() {
+ backgroundColor = CCDevice.isJoy ? UIColor.white : .color(.bgColor)
+ yc.setCorners(withRoundedRect: CGRect(x: 0, y: 0, width: kScreenWid, height: kScreenHei - 244), roundingCorners: [.topLeft,.topRight], cornerRadii: CGSize(width: 50, height: 50))
+ }
+}
--- /dev/null
+//
+// LoginHeaderView.swift
+// ShenYin
+//
+// Created by liangshi on 2026/1/17.
+//
+
+class LoginHeaderView: BaseView {
+ override func setupViews() {
+ if CCDevice.isJoy {
+ let tipsLabel = UILabel()
+// tipsLabel.backgroundColor = .red
+// backgroundColor = .green
+ tipsLabel.do { v in
+ v.numberOfLines = 0
+ v.font = .medium(22)
+ v.textColor = .rgb(0x121212)
+ let text = "您好, \n欢迎使用DeepChords".l10n
+ let stype = NSMutableParagraphStyle()
+ stype.lineSpacing = 10
+ let attrString = NSMutableAttributedString(string: text)
+ let attr: [NSAttributedString.Key : Any] = [.font: UIFont.medium(22),.paragraphStyle:stype]
+ attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
+ v.attributedText = attrString
+ }
+ addSubview(tipsLabel)
+ tipsLabel.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ }
+ else{
+ let logo = UIImageView(image: UIImage(named: "logo_3"))
+ addSubview(logo)
+ logo.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ }
+ }
+}
textField.rightView = btn
textField.rightViewMode = .always
- inputBgView.backgroundColor = .color(.cellBg)
+ inputBgView.backgroundColor = CCDevice.isJoy ? .rgb(0xF3F4F8): .color(.cellBg)
inputBgView.layer.cornerRadius = 10
inputBgView.layer.masksToBounds = true
addSubviews([inputBgView])
addSubviews([inputBgView])
inputBgView.addSubviews([titleLabel,valeLabel,arrrowIcon])
- inputBgView.backgroundColor = .color(.cellBg)
+ inputBgView.backgroundColor = CCDevice.isJoy ? .rgb(0xF3F4F8): .color(.cellBg)
inputBgView.layer.cornerRadius = 10
inputBgView.layer.masksToBounds = true
inputBgView.yc.addTap(target: self, action: #selector(tapAction))
HttpClient.request(CommomApi.revokeCode) {[weak self] (model:ResponseBaseModel, res) in
if model.isSuccess{
self?.codeView.codeButton.start()
+ self?.codeView.textField.becomeFirstResponder()
YLprogressHUD.hidden()
}
else{
}
override func setupViews() {
- self.navBar.title = "查找眼镜".l10n
+ self.navBar.title = CCDevice.isJoy ? "查找耳机".l10n:"查找眼镜".l10n
navBar.backgroundColor = .clear
view.backgroundColor = .color(.bgColor)
view.addSubviews([titleLabel,desLabel,leftRadar,rightRadar,leftBtn,rightBtn])
// }
}
}
- NotificationManager.add(self, selector: #selector(deviceChange(_:)), forName: .deviceValidChange)
- updateState()
- }
- @objc func deviceChange(_ noti:Notification){
- updateState()
- }
- func updateState(){
- if CCBleManager.shared.isConnetd {
- alpha = 1
- }
- else{
- alpha = 0.5
- }
+// NotificationManager.add(self, selector: #selector(deviceChange(_:)), forName: .deviceValidChange)
+// updateState()
}
+// @objc func deviceChange(_ noti:Notification){
+// updateState()
+// }
+// func updateState(){
+// if CCBleManager.shared.isConnetd {
+// alpha = 1
+// }
+// else{
+// alpha = 0.5
+// }
+// }
override func setupLayout() {
titleLabel.snp.makeConstraints { make in
icon.image = UIImage(named: "find_icon")
titleLabel.do { v in
- v.text = "查找眼镜".l10n
+ v.text = CCDevice.isJoy ? "查找耳机".l10n:"查找眼镜".l10n
v.font = .bold(16)
v.textColor = .color(.first)
private func setupShapeLayer() {
shapeLayer = CAShapeLayer()
- shapeLayer.strokeColor = UIColor.color(.separateLine).cgColor
+ shapeLayer.strokeColor = CCDevice.isJoy ? UIColor.rgb(0x93C6EC).cgColor: UIColor.color(.separateLine).cgColor
shapeLayer.fillColor = UIColor.clear.cgColor
shapeLayer.lineWidth = 0.5
shapeLayer.lineDashPattern = [NSNumber(value: 5.0), NSNumber(value: 3.0)]
class CustomButton: UIButton {
func set(title:String,font:UIFont = .bold(14),style:CustomButtonStyle = .theme1, target: Any?, action: Selector) {
- setTitle(title, for: .normal)
- addTarget(target, action: action, for: .touchUpInside)
- layer.cornerRadius = 23
- layer.masksToBounds = true
- titleLabel?.font = font
-
- if style == .theme1 {
- setTitleColor(.rgb(0x121212), for: .normal)
- backgroundColor = .white
- }
- else if style == .theme4 {
- setTitleColor(.hexString("#FF4E4E"), for: .normal)
- backgroundColor = UIColor.hexString("#FF4E4E")
- setTitleColor(.white, for: .normal)
- titleLabel?.font = .bold(14)
- }
- else if style == .theme3 {
- layer.cornerRadius = 12
- setTitleColor(.color(.first), for: .normal)
- backgroundColor = .color(.cellBg)
- titleLabel?.font = .regular(14)
+ if CCDevice.isJoy{
+ setTitle(title, for: .normal)
+ addTarget(target, action: action, for: .touchUpInside)
+ layer.cornerRadius = 23
+ layer.masksToBounds = true
+ titleLabel?.font = font
+
+ if style == .theme1 {
+ setTitleColor(.white, for: .normal)
+ backgroundColor = .color(.theme)
+ }
+ else if style == .theme4 {
+ setTitleColor(.hexString("#FF4E4E"), for: .normal)
+ backgroundColor = UIColor.hexString("#FF4E4E")
+ setTitleColor(.white, for: .normal)
+ titleLabel?.font = .bold(14)
+ }
+ else if style == .theme3 {
+ layer.cornerRadius = 12
+ setTitleColor(.color(.first), for: .normal)
+ backgroundColor = .color(.cellBg)
+ titleLabel?.font = .regular(14)
+ }
+ else{
+ setTitleColor(.color(.theme), for: .normal)
+ backgroundColor = .clear
+ layer.borderWidth = 1.4
+ layer.borderColor = UIColor.color(.theme).cgColor
+ }
}
else{
- setTitleColor(.white, for: .normal)
- backgroundColor = .clear
- layer.borderWidth = 1.4
- layer.borderColor = UIColor.color(.first).cgColor
+ setTitle(title, for: .normal)
+ addTarget(target, action: action, for: .touchUpInside)
+ layer.cornerRadius = 23
+ layer.masksToBounds = true
+ titleLabel?.font = font
+
+ if style == .theme1 {
+ setTitleColor(.rgb(0x121212), for: .normal)
+ backgroundColor = .white
+ }
+ else if style == .theme4 {
+ setTitleColor(.hexString("#FF4E4E"), for: .normal)
+ backgroundColor = UIColor.hexString("#FF4E4E")
+ setTitleColor(.white, for: .normal)
+ titleLabel?.font = .bold(14)
+ }
+ else if style == .theme3 {
+ layer.cornerRadius = 12
+ setTitleColor(.color(.first), for: .normal)
+ backgroundColor = .color(.cellBg)
+ titleLabel?.font = .regular(14)
+ }
+ else{
+ setTitleColor(.white, for: .normal)
+ backgroundColor = .clear
+ layer.borderWidth = 1.4
+ layer.borderColor = UIColor.color(.first).cgColor
+ }
}
}
selectedIcon.image = UIImage(named: "cell_selected")
line.do { v in
- v.backgroundColor = .hexString("#.color(.separateLine)")
+ v.backgroundColor = .color(.separateLine)
}
}
selectedIcon.image = UIImage(named: "cell_selected")
line.do { v in
- v.backgroundColor = .hexString("#.color(.separateLine)")
+ v.backgroundColor = .color(.separateLine)
}
}