Przeglądaj źródła

Merge branch 'master' of https://git.yishihui.com/iOS/BFRecordScreenKit

* 'master' of https://git.yishihui.com/iOS/BFRecordScreenKit:
  修改取消位置
  添加阴影效果
  国际化
  自适应字号
  关闭字幕显示 UI 宽度
  录制到头了国际化
  国际化
  国际化
  国际化
  修改国际化文字
  1,国际化文字 2,国际翻译 APP key

# Conflicts:
#	BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift
harry 3 lat temu
rodzic
commit
89b35f938d
36 zmienionych plików z 32 dodań i 25 usunięć
  1. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/soundBtn.imageset/soundBtn.png
  2. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/soundBtn.imageset/soundBtn@2x.png
  3. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/soundBtn.imageset/soundBtn@3x.png
  4. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_off.imageset/subtitleBtn_off.png
  5. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_off.imageset/subtitleBtn_off@2x.png
  6. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_off.imageset/subtitleBtn_off@3x.png
  7. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_on.imageset/subtitleBtn_on.png
  8. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_on.imageset/subtitleBtn_on@2x.png
  9. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_on.imageset/subtitleBtn_on@3x.png
  10. 3 0
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle1.imageset/Contents.json
  11. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle1.imageset/wordStyle1.png
  12. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle1.imageset/wordStyle1@2x.png
  13. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle1.imageset/wordStyle1@3x.png
  14. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle2.imageset/wordStyle2.png
  15. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle2.imageset/wordStyle2@2x.png
  16. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle2.imageset/wordStyle2@3x.png
  17. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle3.imageset/wordStyle3.png
  18. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle3.imageset/wordStyle3@2x.png
  19. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle3.imageset/wordStyle3@3x.png
  20. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle4.imageset/wordStyle4.png
  21. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle4.imageset/wordStyle4@2x.png
  22. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle4.imageset/wordStyle4@3x.png
  23. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle5.imageset/wordStyle5.png
  24. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle5.imageset/wordStyle5@2x.png
  25. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle5.imageset/wordStyle5@3x.png
  26. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle6.imageset/wordStyle6.png
  27. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle6.imageset/wordStyle6@2x.png
  28. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle6.imageset/wordStyle6@3x.png
  29. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle7.imageset/wordStyle7.png
  30. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle7.imageset/wordStyle7@2x.png
  31. BIN
      BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle7.imageset/wordStyle7@3x.png
  32. 5 5
      BFRecordScreenKit/Classes/BFRecordExport.swift
  33. 2 2
      BFRecordScreenKit/Classes/RecordScreen/View/BFAudioSettingView.swift
  34. 4 3
      BFRecordScreenKit/Classes/RecordScreen/View/BFSubtitleEditView.swift
  35. 8 7
      BFRecordScreenKit/Classes/RecordScreen/View/BFSubtitleSettingView.swift
  36. 10 8
      BFRecordScreenKit/Classes/RecordScreen/ViewModel/BFRecordScreenViewModel.swift

BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/soundBtn.imageset/soundBtn.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/soundBtn.imageset/soundBtn@2x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/soundBtn.imageset/soundBtn@3x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_off.imageset/subtitleBtn_off.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_off.imageset/subtitleBtn_off@2x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_off.imageset/subtitleBtn_off@3x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_on.imageset/subtitleBtn_on.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_on.imageset/subtitleBtn_on@2x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/subtitleBtn_on.imageset/subtitleBtn_on@3x.png


+ 3 - 0
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle1.imageset/Contents.json

@@ -19,5 +19,8 @@
   "info" : {
     "author" : "xcode",
     "version" : 1
+  },
+  "properties" : {
+    "localizable" : true
   }
 }

BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle1.imageset/wordStyle1.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle1.imageset/wordStyle1@2x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle1.imageset/wordStyle1@3x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle2.imageset/wordStyle2.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle2.imageset/wordStyle2@2x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle2.imageset/wordStyle2@3x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle3.imageset/wordStyle3.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle3.imageset/wordStyle3@2x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle3.imageset/wordStyle3@3x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle4.imageset/wordStyle4.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle4.imageset/wordStyle4@2x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle4.imageset/wordStyle4@3x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle5.imageset/wordStyle5.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle5.imageset/wordStyle5@2x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle5.imageset/wordStyle5@3x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle6.imageset/wordStyle6.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle6.imageset/wordStyle6@2x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle6.imageset/wordStyle6@3x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle7.imageset/wordStyle7.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle7.imageset/wordStyle7@2x.png


BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/wordStyle7.imageset/wordStyle7@3x.png


+ 5 - 5
BFRecordScreenKit/Classes/BFRecordExport.swift

@@ -317,7 +317,7 @@ public class BFRecordExport {
         BFLog(1, message: "导出视频地址 \(outPutMP4URL)")
 
         guard let itemData = data else {
-            let error = NSError(domain: "err", code: ExportError.DataLost.rawValue, userInfo: ["msg": "所有数据丢失"])
+            let error = NSError(domain: "err", code: ExportError.DataLost.rawValue, userInfo: ["msg": "compose_fail_lost".BFLocale])
             exportCompletion?(error as Error, nil)
             return
         }
@@ -391,7 +391,7 @@ public class BFRecordExport {
             let preSize = Double(orgeBitRate) * totalDuration / (1024 * 1024 * 8)
             let freeSize = PQBridgeObject.getPhoneDiskFreeSize()
             if preSize + 100.0 > freeSize { // 存储完后磁盘剩余至少100M
-                let error = NSError(domain: "err", code: ExportError.DiskNoSpace.rawValue, userInfo: ["msg": "需要\(Int(preSize))MB,可用\(Int(freeSize))MB"])
+                let error = NSError(domain: "err", code: ExportError.DiskNoSpace.rawValue, userInfo: ["msg": "\("option_need".BFLocale)\(Int(preSize))MB,\("option_available".BFLocale)\(Int(freeSize))MB"])
                 exportCompletion?(error as Error, nil)
                 return
             }
@@ -414,15 +414,15 @@ public class BFRecordExport {
                     let exportEndTime = Date().timeIntervalSince1970
                     BFLog(1, message: "生成视频时长为:\(outSeconds) 总用时:\(exportEndTime - tempBeginExport)")
                     if(PQENVUtil.shared.channel == "Development"){
-                        cShowHUB(superView: nil, msg: (outSeconds == 0) ? "合成失败请重试。" : String(format: "总用时: %.2f", exportEndTime - tempBeginExport))
+                        cShowHUB(superView: nil, msg: (outSeconds == 0) ? "compose_retry3".BFLocale : String(format: "总用时: %.2f", exportEndTime - tempBeginExport))
                     }
 
                     self?.exportCompletion?(nil, url)
 
                 } else {
-                    let error = NSError(domain: "err", code: ExportError.ExportExcept.rawValue, userInfo: ["msg": "导出异常失败"])
+                    let error = NSError(domain: "err", code: ExportError.ExportExcept.rawValue, userInfo: ["msg": "compose_fail_export".BFLocale])
                     self?.exportCompletion?(error as Error, nil)
-                    cShowHUB(superView: nil, msg: "导出失败")
+                    cShowHUB(superView: nil, msg: "compose_fail_export".BFLocale)
                 }
 
                 // 导出完成后取消导出

+ 2 - 2
BFRecordScreenKit/Classes/RecordScreen/View/BFAudioSettingView.swift

@@ -22,7 +22,7 @@ class BFAudioSettingView: UIView {
         let haveSpeakLab = UILabel()
         haveSpeakLab.font = UIFont.boldSystemFont(ofSize: 16)
         haveSpeakLab.textAlignment = .left
-        haveSpeakLab.text = "录音时 视频原声"
+        haveSpeakLab.text = "sound_record_ture".BFLocale
         haveSpeakLab.textColor = .white
         haveSpeakLab.backgroundColor = .clear
         return haveSpeakLab
@@ -59,7 +59,7 @@ class BFAudioSettingView: UIView {
         let noSpeakLab = UILabel()
         noSpeakLab.font = UIFont.boldSystemFont(ofSize: 16)
         noSpeakLab.textAlignment = .left
-        noSpeakLab.text = "未录音时 视频原声"
+        noSpeakLab.text = "sound_record_false".BFLocale
         noSpeakLab.textColor = .white
         return noSpeakLab
     }()

+ 4 - 3
BFRecordScreenKit/Classes/RecordScreen/View/BFSubtitleEditView.swift

@@ -60,7 +60,7 @@ class BFSubtitleEditView: UIView {
 
         let doneBtn = UIButton()
         doneBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#389AFF")
-        doneBtn.setTitle("完成", for: .normal)
+        doneBtn.setTitle("option_done".BFLocale, for: .normal)
         doneBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16)
         doneBtn.addTarget(self, action: #selector(doneAction), for: .touchUpInside)
         doneBtn.addCorner(corner: 4)
@@ -74,11 +74,12 @@ class BFSubtitleEditView: UIView {
 
         let cancelBtn = UIButton()
         cancelBtn.backgroundColor = .clear
-        cancelBtn.setTitle("取消", for: .normal)
+        cancelBtn.setTitle("option_cancel".BFLocale, for: .normal)
         cancelBtn.setTitleColor(.white, for: .normal)
         cancelBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16)
         cancelBtn.addTarget(self, action: #selector(cancelAction), for: .touchUpInside)
         addSubview(cancelBtn)
+        
         cancelBtn.snp.makeConstraints { make in
             make.left.equalToSuperview().offset(12)
             make.width.equalTo(60)
@@ -120,7 +121,7 @@ extension BFSubtitleEditView: UITextViewDelegate {
 
     func textView(_: UITextView, shouldChangeTextIn _: NSRange, replacementText text: String) -> Bool {
         if text.isEmoji() {
-            cShowHUB(superView: nil, msg: "不能输入表情")
+            cShowHUB(superView: nil, msg: "option_fail_emoji".BFLocale)
             return false
         }
  

+ 8 - 7
BFRecordScreenKit/Classes/RecordScreen/View/BFSubtitleSettingView.swift

@@ -90,7 +90,7 @@ class BFSubtitleSettingView: UIView {
         pointTitle.textAlignment = .center
         pointTitle.font = UIFont.systemFont(ofSize: 15)
         pointTitle.textColor = .white
-        pointTitle.text = "位置"
+        pointTitle.text = "option_location".BFLocale
         pointTitle.alpha = 0.6
         backView.addSubview(pointTitle)
         pointTitle.snp.makeConstraints { make in
@@ -110,11 +110,11 @@ class BFSubtitleSettingView: UIView {
                 pointBtn.layer.borderColor = UIColor.hexColor(hexadecimal: "#389AFF").cgColor
                 pointBtn.layer.borderWidth = 1.5
                 lastSelectPointBtn = pointBtn
-                pointBtn.setTitle("下", for: .normal)
+                pointBtn.setTitle("option_bottom".BFLocale, for: .normal)
             } else if i == 1 {
-                pointBtn.setTitle("中", for: .normal)
+                pointBtn.setTitle("option_middle".BFLocale, for: .normal)
             } else {
-                pointBtn.setTitle("上", for: .normal)
+                pointBtn.setTitle("option_top".BFLocale, for: .normal)
             }
             pointBtn.addCorner(corner: 10)
             pointBtn.tag = i
@@ -133,8 +133,9 @@ class BFSubtitleSettingView: UIView {
         wordSizeTitle.textAlignment = .center
         wordSizeTitle.font = UIFont.systemFont(ofSize: 15)
         wordSizeTitle.textColor = .white
-        wordSizeTitle.text = "字号"
+        wordSizeTitle.text = "option_size".BFLocale
         wordSizeTitle.alpha = 0.6
+        wordSizeTitle.adjustsFontSizeToFitWidth = true
         backView.addSubview(wordSizeTitle)
         wordSizeTitle.snp.makeConstraints { make in
             make.width.equalTo(40)
@@ -185,10 +186,10 @@ class BFSubtitleSettingView: UIView {
         disabelTitle.textAlignment = .left
         disabelTitle.font = UIFont.boldSystemFont(ofSize: 17)
         disabelTitle.textColor = .white
-        disabelTitle.text = "关闭字幕"
+        disabelTitle.text = "option_off".BFLocale
         backView.addSubview(disabelTitle)
         disabelTitle.snp.makeConstraints { make in
-            make.width.equalTo(100)
+            make.right.equalTo(cScreenWidth - 80)
             make.height.equalTo(24)
             make.left.equalToSuperview().offset(18)
             make.top.equalTo(line.snp.top).offset(17)

+ 10 - 8
BFRecordScreenKit/Classes/RecordScreen/ViewModel/BFRecordScreenViewModel.swift

@@ -16,25 +16,27 @@ public class BFRecordScreenViewModel: NSObject {
     /// 取文本转语言 token
     /// - Parameter completeHander: <#completeHander description#>
     public class func getNlsAccessToken(completeHander: @escaping (_ token: String, _ appkey: String) -> Void) {
-        let NlsAccessTokenKey: String = "NlsAccessTokenKey_JiangjieApp"
-
+   
+        let currentLanguage =  BFLocalizedUtil.currentLanguage()
+        BFLog(2,message: "当前的系统语言是:\(currentLanguage)")
         let nowTime: TimeInterval = Date().timeIntervalSince1970
-
-        //        token = "5d96258dcea34d7b91576031cd25a9ba"; 返回数据
-        //        expireTime = 1601376826000; //1601377050000;
-        let saveToken: Dictionary? = getUserDefaults(key: NlsAccessTokenKey) as? [String: Any] ?? nil
+        //token = "5d96258dcea34d7b91576031cd25a9ba"; 返回数据
+        //expireTime = 1601376826000; //1601377050000;
+        let saveToken: Dictionary? = getUserDefaults(key: currentLanguage) as? [String: Any] ?? nil
         if saveToken != nil && Double(saveToken!["expireTime"] as! Double) > nowTime * 1000 {
             BFLog(message: "nls token 还有效期内不用重新请求 \(String(describing: saveToken!["expireTime"])) nowTime:\(nowTime * 1000)")
             completeHander(saveToken!["token"] as! String, saveToken!["appkey"] as! String)
             return
         }
-        BFNetRequestAdaptor.getRequestData(url: PQENVUtil.shared.clipapiapi + getNlsAccessTokenForJiangjieApp, parames: nil, commonParams: commonParams()) { response, _, _, _ in
+        
+  
+        BFNetRequestAdaptor.getRequestData(url: PQENVUtil.shared.clipapiapi + getNlsAccessTokenForJiangjieApp, parames: ["languageCode":currentLanguage], commonParams: commonParams()) { response, _, _, _ in
 
             if let response = response as? [String: Any], let token = response["token"] as? String, let appkey = response["appkey"] as? String {
                 let nowTime: TimeInterval = Date().timeIntervalSince1970
 
                 BFLog(message: "nowTime is \(nowTime) token is \(token)")
-                saveUserDefaults(key: NlsAccessTokenKey, value: response)
+                saveUserDefaults(key: currentLanguage, value: response)
 
                 completeHander(token, appkey)
             } else {