Skip to content

Commit 2945629

Browse files
committed
example change
1 parent 001b511 commit 2945629

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

Example/ChatroomUIKit/ExampleRequiredConfig.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import ChatroomUIKit
1515
**/
1616
public class ExampleRequiredConfig {
1717
//请参看文档 https://docs-im-beta.easemob.com/product/enable_and_configure_IM.html#%E8%8E%B7%E5%8F%96%E7%8E%AF%E4%BF%A1%E5%8D%B3%E6%97%B6%E9%80%9A%E8%AE%AF-im-%E7%9A%84%E4%BF%A1%E6%81%AF
18-
static let appKey: String = <#您的环信Appkey#>
18+
static let appKey: String = ""
1919

2020
//请参看文档 https://docs-im-beta.easemob.com/product/enable_and_configure_IM.html#%E5%88%9B%E5%BB%BA-im-%E7%94%A8%E6%88%B7
21-
static var chatToken: String = <#用户登录使用的token#>
21+
static var chatToken: String = ""
2222
// 然后复制聊天室id在launchRoomView时使用
2323

2424
/// `YourAppUser` 代表您App中的用户类.
@@ -30,7 +30,7 @@ public class ExampleRequiredConfig {
3030
}
3131

3232
//请参看文档 https://docs-im-beta.easemob.com/product/enable_and_configure_IM.html#%E5%88%9B%E5%BB%BA-im-%E7%94%A8%E6%88%B7
33-
public var userId: String = <#用户登录需要的userId#>
33+
public var userId: String = ""
3434

3535
public var nickname: String = "Jack"
3636

Example/ChatroomUIKit/UIComponentsExampleViewController.swift

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,19 @@ final class UIComponentsExampleViewController: UIViewController {
121121

122122
}
123123

124+
125+
124126
extension UIComponentsExampleViewController: UIContextMenuInteractionDelegate {
125127

126128
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
127-
UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { (_) -> UIMenu? in
129+
UIContextMenuConfiguration(identifier: nil, previewProvider: {
130+
// let previewView = UIView()
131+
// previewView.backgroundColor = .gray
132+
// previewView.frame = self.view.bounds
133+
// previewView.layer.cornerRadius = 15
134+
// previewView.layer.masksToBounds = true
135+
return UIComponentsExampleViewController()
136+
}) { (_) -> UIMenu? in
128137
let action1 = UIAction(title: ".all", image: UIImage(systemName: "bookmark.fill")) { (_) in
129138
Appearance.messageDisplayStyle = .all
130139
self.barrageList.messages?.removeAll()
@@ -170,6 +179,26 @@ extension UIComponentsExampleViewController: UIContextMenuInteractionDelegate {
170179
return menu
171180
}
172181
}
182+
183+
// func contextMenuInteraction(_ interaction: UIContextMenuInteraction, previewForHighlightingMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? {
184+
// let previewParams = UIPreviewParameters()
185+
// previewParams.backgroundColor = .clear
186+
// let visiblePath = UIBezierPath(roundedRect: self.view.bounds, cornerRadius: 15)
187+
// previewParams.visiblePath = visiblePath
188+
// return UITargetedPreview(view: self.view, parameters: previewParams)
189+
// }
190+
//
191+
// func contextMenuInteraction(_ interaction: UIContextMenuInteraction, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) {
192+
// animator.addAnimations {
193+
// self.view.backgroundColor = .lightGray // 改变消息气泡的背景色以实现高亮效果
194+
// }
195+
//
196+
// animator.addCompletion {
197+
// UIView.animate(withDuration: 0.25) {
198+
// self.view.backgroundColor = .white // 动画完成后恢复原始颜色
199+
// }
200+
// }
201+
// }
173202
}
174203

175204
extension UIComponentsExampleViewController: BottomAreaToolBarActionEvents,GiftsViewActionEventsDelegate {

0 commit comments

Comments
 (0)