|
@@ -22,6 +22,13 @@ class TSChatMsgToolView: TSChatMsgBaseView {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //是否显示复制用户文生图提示词
|
|
|
+ var isShowUsePrompts:Bool = false {
|
|
|
+ didSet{
|
|
|
+ usePromptsBtn.isHidden = !isShowUsePrompts
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
lazy var copyBtn: UIButton = {
|
|
|
let copyBtn = UIButton.createButton(image: UIImage(named: "aichat_copy")) { [weak self] in
|
|
|
guard let self = self else { return }
|
|
@@ -41,6 +48,17 @@ class TSChatMsgToolView: TSChatMsgBaseView {
|
|
|
}()
|
|
|
|
|
|
|
|
|
+ lazy var usePromptsBtn: UIButton = {
|
|
|
+ let usePromptsBtn = UIButton.createButton(title: "Use prompts".localized, backgroundColor: .white.withAlphaComponent(0.05), font: .font(size: 14), titleColor: .white, corner: 8) { [weak self] in
|
|
|
+ guard let self = self else { return }
|
|
|
+ didTapCustomViewBlock?(.copyHint)
|
|
|
+ }
|
|
|
+ usePromptsBtn.layer.borderWidth = 1
|
|
|
+ usePromptsBtn.layer.borderColor = UIColor.white.withAlphaComponent(0.1).cgColor
|
|
|
+ usePromptsBtn.contentEdgeInsets = UIEdgeInsets(top: 0, left: 8, bottom: 0, right: 8)
|
|
|
+ return usePromptsBtn
|
|
|
+ }()
|
|
|
+
|
|
|
lazy var stackView: TSCustomStackView = {
|
|
|
let stackView = TSCustomStackView(axis: .horizontal,spacing: 16)
|
|
|
return stackView
|
|
@@ -55,38 +73,54 @@ class TSChatMsgToolView: TSChatMsgBaseView {
|
|
|
make.leading.equalTo(12)
|
|
|
make.trailing.equalTo(-12)
|
|
|
make.top.equalTo(0)
|
|
|
- make.height.equalTo(20)
|
|
|
+// make.height.equalTo(20)
|
|
|
}
|
|
|
|
|
|
- // stackView.addSubviewToStack(copyBtn)
|
|
|
- // copyBtn.snp.makeConstraints { make in
|
|
|
- // make.width.equalTo(20)
|
|
|
- // }
|
|
|
+ stackView.addSubviewToStack(refreshBtn, length: 20)
|
|
|
+ stackView.addSubviewToStack(copyBtn, length: 20)
|
|
|
+ stackView.addSubviewToStack(usePromptsBtn)
|
|
|
|
|
|
+ stackView.stackView.addArrangedSubview(usePromptsBtn)
|
|
|
+ usePromptsBtn.snp.makeConstraints { make in
|
|
|
+ make.height.equalTo(28)
|
|
|
+ }
|
|
|
+ refreshBtn.isHidden = true
|
|
|
+ copyBtn.isHidden = true
|
|
|
+ usePromptsBtn.isHidden = true
|
|
|
}
|
|
|
|
|
|
func updateRefreshBtn() {
|
|
|
- if isShowRefresh {
|
|
|
- stackView.insertViewToStack(refreshBtn, at: 0)
|
|
|
- refreshBtn.snp.makeConstraints { make in
|
|
|
- make.width.equalTo(20)
|
|
|
- }
|
|
|
- }else{
|
|
|
- stackView.removeViewToStack(refreshBtn)
|
|
|
- }
|
|
|
+ refreshBtn.isHidden = !isShowRefresh
|
|
|
}
|
|
|
|
|
|
|
|
|
func updateNotRefreshBtn(){
|
|
|
- if isOnlyShowRefresh {
|
|
|
- stackView.removeViewToStack(copyBtn)
|
|
|
- }else{
|
|
|
- if copyBtn.superview == nil {
|
|
|
- stackView.addSubviewToStack(copyBtn)
|
|
|
- copyBtn.snp.makeConstraints { make in
|
|
|
- make.width.equalTo(20)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ copyBtn.isHidden = isOnlyShowRefresh
|
|
|
+ usePromptsBtn.isHidden = isShowUsePrompts ? isOnlyShowRefresh : true
|
|
|
}
|
|
|
+
|
|
|
+// func updateRefreshBtn() {
|
|
|
+// if isShowRefresh {
|
|
|
+// stackView.insertViewToStack(refreshBtn, at: 0)
|
|
|
+// refreshBtn.snp.makeConstraints { make in
|
|
|
+// make.width.equalTo(20)
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// stackView.removeViewToStack(refreshBtn)
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// func updateNotRefreshBtn(){
|
|
|
+// if isOnlyShowRefresh {
|
|
|
+// stackView.removeViewToStack(copyBtn)
|
|
|
+// }else{
|
|
|
+// if copyBtn.superview == nil {
|
|
|
+// stackView.addSubviewToStack(copyBtn)
|
|
|
+// copyBtn.snp.makeConstraints { make in
|
|
|
+// make.width.equalTo(20)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|