mirror of
https://github.com/Finb/Bark.git
synced 2025-12-08 21:36:01 +00:00
添加上传铃声提示
This commit is contained in:
parent
5af2a5529d
commit
cf32d33d3e
@ -173,3 +173,5 @@ Github Issue: https://github.com/Finb/Bark/issues
|
||||
uploadSound = "Upload Sound";
|
||||
customSounds = "Custom Sounds";
|
||||
defaultSounds = "Default Sounds";
|
||||
uploadSoundNoticeFullText = "Please convert the sound file to caf format, and make sure it's no longer than 30 seconds.";
|
||||
uploadSoundNoticeHighlightText = "convert the sound file to caf format";
|
||||
|
||||
@ -173,3 +173,5 @@ Github Issue: https://github.com/Finb/Bark/issues
|
||||
uploadSound = "Upload Sound";
|
||||
customSounds = "Custom Sounds";
|
||||
defaultSounds = "Default Sounds";
|
||||
uploadSoundNoticeFullText = "Please convert the sound file to caf format, and make sure it's no longer than 30 seconds.";
|
||||
uploadSoundNoticeHighlightText = "convert the sound file to caf format";
|
||||
|
||||
@ -173,3 +173,5 @@ Github Issue: https://github.com/Finb/Bark/issues
|
||||
uploadSound = "上传铃声";
|
||||
customSounds = "自定义铃声";
|
||||
defaultSounds = "默认铃声";
|
||||
uploadSoundNoticeFullText = "请先将铃声转换成 caf 格式,时长不超过 30 秒。";
|
||||
uploadSoundNoticeHighlightText = "转换成 caf 格式";
|
||||
|
||||
@ -97,6 +97,14 @@ class SoundsViewController: BaseViewController<SoundsViewModel> {
|
||||
}
|
||||
|
||||
extension SoundsViewController: UITableViewDelegate {
|
||||
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
||||
return 40
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
|
||||
return NSLocalizedString("uploadSoundNoticeFullText").count <= 30 ? 50 : 60
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
|
||||
let sectionTitle = tableView.dataSource?.tableView?(tableView, titleForHeaderInSection: section) ?? ""
|
||||
|
||||
@ -115,8 +123,40 @@ extension SoundsViewController: UITableViewDelegate {
|
||||
return view
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
||||
return 40
|
||||
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
|
||||
let view = UIView()
|
||||
|
||||
let fullText = NSLocalizedString("uploadSoundNoticeFullText")
|
||||
let highlightText = NSLocalizedString("uploadSoundNoticeHighlightText")
|
||||
let attrStr = NSMutableAttributedString(
|
||||
string: fullText,
|
||||
attributes: [
|
||||
NSAttributedString.Key.foregroundColor: BKColor.grey.darken3,
|
||||
NSAttributedString.Key.font: RobotoFont.regular(with: 14)
|
||||
]
|
||||
)
|
||||
attrStr.setAttributes([
|
||||
NSAttributedString.Key.foregroundColor: BKColor.lightBlue.darken3,
|
||||
NSAttributedString.Key.font: RobotoFont.regular(with: 14)
|
||||
], range: (fullText as NSString).range(of: highlightText))
|
||||
|
||||
let label = UILabel()
|
||||
label.attributedText = attrStr
|
||||
label.numberOfLines = 0
|
||||
view.addSubview(label)
|
||||
label.snp.makeConstraints { make in
|
||||
make.left.equalTo(12)
|
||||
make.right.equalTo(-12)
|
||||
make.top.equalTo(12)
|
||||
}
|
||||
|
||||
label.isUserInteractionEnabled = true
|
||||
label.addGestureRecognizer(UITapGestureRecognizer())
|
||||
label.gestureRecognizers?.first?.rx.event.subscribe(onNext: { _ in
|
||||
UIApplication.shared.open(URL(string: "https://convertio.co/mp3-caf/")!)
|
||||
}).disposed(by: label.rx.disposeBag)
|
||||
|
||||
return view
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user