Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DemoUI调整 #420

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion IMUIKitOC/IMUIKitOCExample/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ target 'IMUIKitOCExample' do
pod 'NEMapKit', '10.5.1'

# 扩展库 - AI 划词搜索
pod 'NEAISearchKit', '1.0.4'
pod 'NEAISearchKit', '1.0.5'

# 扩展库 - 呼叫组件
pod 'NERtcCallKit/NOS_Special', '3.1.0'
Expand Down
4 changes: 2 additions & 2 deletions NEAISearchKit/NEAISearchKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'NEAISearchKit'
s.version = '1.0.4'
s.version = '1.0.5'
s.summary = 'Netease XKit'

# This description is used to generate tags and improve search results.
Expand Down Expand Up @@ -38,6 +38,6 @@ TODO: Add long description of the pod here.
s.resource = 'NEAISearchKit/Assets/**/*'

s.dependency 'NEChatKit'
s.dependency 'NECommonUIKit', '9.7.4'
s.dependency 'NECommonUIKit'

end
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

"you_were_mentioned"="[You were mentioned]";

"security_warning"="For test only. Beware of money transfer, lottery winnings & strange call scams.";

// error toast
"leave_team_desc"="You have been removed from the group chat or the group chat has been dissolved.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@

"you_were_mentioned"="[有人@我]";

"security_warning"="仅用于体验云信IM 产品功能,请勿轻信汇款、中奖等涉及钱款的信息,勿轻易拨打陌生电话,谨防上当受骗。";


// error toast

"leave_team_desc"="您已被移出群聊或该群聊已被解散";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,3 @@ func localizable(_ key: String) -> String {
}

public let ModuleName = "NEConversationUIKit"

extension UIColor {
static let securityWarningBg = UIColor(hexString: "#FFF5E1")
static let securityWarningTextColor = UIColor(hexString: "#EB9718")
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,11 @@ open class NEBaseConversationController: UIViewController, UIGestureRecognizerDe
view.translatesAutoresizingMaskIntoConstraints = false
view.backgroundColor = .clear

view.addSubview(securityWarningView)
view.addSubview(brokenNetworkView)
view.addSubview(contentView)

NSLayoutConstraint.activate([
securityWarningView.topAnchor.constraint(equalTo: view.topAnchor),
securityWarningView.leftAnchor.constraint(equalTo: view.leftAnchor),
securityWarningView.rightAnchor.constraint(equalTo: view.rightAnchor),
securityWarningView.heightAnchor.constraint(equalToConstant: 56),
])

NSLayoutConstraint.activate([
brokenNetworkView.topAnchor.constraint(equalTo: securityWarningView.bottomAnchor),
brokenNetworkView.topAnchor.constraint(equalTo: view.topAnchor),
brokenNetworkView.leftAnchor.constraint(equalTo: view.leftAnchor),
brokenNetworkView.rightAnchor.constraint(equalTo: view.rightAnchor),
brokenNetworkView.heightAnchor.constraint(equalToConstant: brokenNetworkViewHeight),
Expand All @@ -132,12 +124,6 @@ open class NEBaseConversationController: UIViewController, UIGestureRecognizerDe
return view
}()

public lazy var securityWarningView: NESecurityWarningView = {
let view = NESecurityWarningView()
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()

public lazy var contentView: UIView = {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
Expand Down Expand Up @@ -246,10 +232,10 @@ open class NEBaseConversationController: UIViewController, UIGestureRecognizerDe
NEChatDetectNetworkTool.shareInstance.netWorkReachability { [weak self] status in
if status == .notReachable {
self?.brokenNetworkView.isHidden = false
self?.contentViewTopAnchor?.constant = (self?.brokenNetworkViewHeight ?? 36) + 56
self?.contentViewTopAnchor?.constant = (self?.brokenNetworkViewHeight ?? 36)
} else {
self?.brokenNetworkView.isHidden = true
self?.contentViewTopAnchor?.constant = 56
self?.contentViewTopAnchor?.constant = 0
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ open class FunConversationController: NEBaseConversationController {
popListView = FunPopListView()
searchView.searchButton.setTitle(commonLocalizable("search"), for: .normal)
brokenNetworkView.contentLabel.text = commonLocalizable("network_error")
securityWarningView.warningLabel.text = localizable("security_warning")
}

override func initSystemNav() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ open class ConversationController: NEBaseConversationController {
initSystemNav()
popListView = PopListView()
brokenNetworkView.contentLabel.text = commonLocalizable("network_error")
securityWarningView.warningLabel.text = localizable("security_warning")
}

override func initSystemNav() {
Expand Down
18 changes: 9 additions & 9 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ target 'app' do
pod 'NEMapKit', '10.5.1'

# 扩展库 - AI 划词搜索
pod 'NEAISearchKit', '1.0.4'
pod 'NEAISearchKit', '1.0.5'

# 扩展库 - 呼叫组件
pod 'NERtcCallKit/NOS_Special', '3.1.0'
pod 'NERtcCallUIKit/NOS_Special', '3.1.0'
pod 'NERtcCallUIKit/NOS_Special', '3.1.0'

# 扩展库,依次为 RTC 音视频基础组件、RTC 音视频神经网络组件(使用背景虚化功能需要集成)、RTC 音视频背景分割组件(使用背景虚化功能需要集成)
pod 'NERtcSDK/RtcBasic', '5.6.33'
Expand All @@ -32,13 +32,13 @@ target 'app' do


# 如果需要查看UI部分源码请注释掉以上在线依赖,打开下面的本地依赖
# pod 'NEContactUIKit', :path => 'NEContactUIKit/NEContactUIKit.podspec'
# pod 'NEConversationUIKit', :path => 'NEConversationUIKit/NEConversationUIKit.podspec'
# pod 'NETeamUIKit', :path => 'NETeamUIKit/NETeamUIKit.podspec'
# pod 'NEChatUIKit', :path => 'NEChatUIKit/NEChatUIKit.podspec'
# pod 'NEMapKit', :path => 'NEMapKit/NEMapKit.podspec'
# pod 'NEAISearchKit', :path => 'NEAISearchKit/NEAISearchKit.podspec'
# pod 'NERtcCallUIKit', :path => 'NERtcCallUIKit/NERtcCallUIKit.podspec'
# pod 'NEContactUIKit', :path => 'NEContactUIKit/NEContactUIKit.podspec'
# pod 'NEConversationUIKit', :path => 'NEConversationUIKit/NEConversationUIKit.podspec'
# pod 'NETeamUIKit', :path => 'NETeamUIKit/NETeamUIKit.podspec'
# pod 'NEChatUIKit', :path => 'NEChatUIKit/NEChatUIKit.podspec'
# pod 'NEMapKit', :path => 'NEMapKit/NEMapKit.podspec'
# pod 'NEAISearchKit', :path => 'NEAISearchKit/NEAISearchKit.podspec'
# pod 'NERtcCallUIKit', :path => 'NERtcCallUIKit/NERtcCallUIKit.podspec'


end
Expand Down
8 changes: 6 additions & 2 deletions app.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
181EE58D2B234C510043817F /* CustomContactTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5842B234C510043817F /* CustomContactTableViewCell.swift */; };
181EE58E2B234C510043817F /* CustomChatCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5852B234C510043817F /* CustomChatCell.swift */; };
181EE58F2B234C510043817F /* CustomConversationListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 181EE5862B234C510043817F /* CustomConversationListCell.swift */; };
18A6A9842D1E822900209FC5 /* NESecurityWarningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A6A9832D1E822900209FC5 /* NESecurityWarningView.swift */; };
18B05B342BD5FD0300666AD1 /* CustomFunChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18B05B322BD5FD0300666AD1 /* CustomFunChatViewController.swift */; };
18B05B352BD5FD0300666AD1 /* CustomNormalChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18B05B332BD5FD0300666AD1 /* CustomNormalChatViewController.swift */; };
18CF8A3B2D01B312000CF406 /* CustomContactViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18CF8A392D01B312000CF406 /* CustomContactViewController.swift */; };
Expand Down Expand Up @@ -125,6 +126,7 @@
181EE5842B234C510043817F /* CustomContactTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomContactTableViewCell.swift; sourceTree = "<group>"; };
181EE5852B234C510043817F /* CustomChatCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomChatCell.swift; sourceTree = "<group>"; };
181EE5862B234C510043817F /* CustomConversationListCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomConversationListCell.swift; sourceTree = "<group>"; };
18A6A9832D1E822900209FC5 /* NESecurityWarningView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NESecurityWarningView.swift; sourceTree = "<group>"; };
18B05B322BD5FD0300666AD1 /* CustomFunChatViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomFunChatViewController.swift; sourceTree = "<group>"; };
18B05B332BD5FD0300666AD1 /* CustomNormalChatViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomNormalChatViewController.swift; sourceTree = "<group>"; };
18CF8A382D01B312000CF406 /* CustomConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomConfig.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -244,6 +246,7 @@
181EE57D2B234C510043817F /* Custom */ = {
isa = PBXGroup;
children = (
18A6A9832D1E822900209FC5 /* NESecurityWarningView.swift */,
18CF8A382D01B312000CF406 /* CustomConfig.swift */,
18CF8A392D01B312000CF406 /* CustomContactViewController.swift */,
18B05B322BD5FD0300666AD1 /* CustomFunChatViewController.swift */,
Expand Down Expand Up @@ -470,6 +473,7 @@
buildActionMask = 2147483647;
files = (
181EE58D2B234C510043817F /* CustomContactTableViewCell.swift in Sources */,
18A6A9842D1E822900209FC5 /* NESecurityWarningView.swift in Sources */,
181EE5872B234C510043817F /* CustomView.swift in Sources */,
181EE58F2B234C510043817F /* CustomConversationListCell.swift in Sources */,
181EE5882B234C510043817F /* CustomP2PChatViewController.swift in Sources */,
Expand Down Expand Up @@ -715,7 +719,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 10.4.0;
MARKETING_VERSION = 10.5.1;
PRODUCT_BUNDLE_IDENTIFIER = com.netease.yunxin.app.im;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -764,7 +768,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 10.4.0;
MARKETING_VERSION = 10.5.1;
PRODUCT_BUNDLE_IDENTIFIER = com.netease.yunxin.app.im;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = inHouseYunxin;
Expand Down
2 changes: 1 addition & 1 deletion app/Custom/CustomChatCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CustomChatCell: NEChatBaseCell {
super.init(coder: coder)
}

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
backgroundColor = .lightGray
Expand Down
30 changes: 28 additions & 2 deletions app/Custom/CustomConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class CustomConfig {
public static let shared = CustomConfig()

/// 通过配置项实现 UI 自定义,该方式不需要继承自 ChatViewController
public func configChatUIKit() {
open func configChatUIKit() {
ChatUIConfig.shared.messageProperties.avatarType = .cycle
ChatUIConfig.shared.messageProperties.avatarCornerRadius = 8.0
ChatUIConfig.shared.messageProperties.signalBgColor = UIColor.yellow
Expand Down Expand Up @@ -151,7 +151,7 @@ public class CustomConfig {
}

/// 通过配置项实现自定义,该方式不需要继承自 ContactViewController
public func configContactUIKit() {
open func configContactUIKit() {
/*
UI 属性自定义
*/
Expand Down Expand Up @@ -352,6 +352,26 @@ public class CustomConfig {
}
}

/// 通过布局自定义实现顶部警告
open func loadSecurityWarningView() {
ConversationUIConfig.shared.customController = { [weak self] viewController in
guard let self = self else {
return
}

// 顶部bodyTopView中添加自定义view(需要设置bodyTopView的高度)
self.securityWarningView.warningLabel.text = localizable("security_warning")
viewController.bodyTopView.addSubview(self.securityWarningView)
NSLayoutConstraint.activate([
self.securityWarningView.topAnchor.constraint(equalTo: viewController.bodyTopView.topAnchor),
self.securityWarningView.leftAnchor.constraint(equalTo: viewController.bodyTopView.leftAnchor),
self.securityWarningView.rightAnchor.constraint(equalTo: viewController.bodyTopView.rightAnchor),
self.securityWarningView.heightAnchor.constraint(equalToConstant: 56),
])
viewController.bodyTopViewHeight = 56
}
}

@objc func customClick(_ button: UIButton) {
button.neViewContainingController()?.showToast("文本输入框下方 tab 按钮自定义点击事件")
}
Expand All @@ -369,4 +389,10 @@ public class CustomConfig {
view.backgroundColor = .green
return view
}()

public lazy var securityWarningView: NESecurityWarningView = {
let view = NESecurityWarningView()
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
}
2 changes: 1 addition & 1 deletion app/Custom/CustomContactTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class CustomContactTableViewCell: ContactTableViewCell {
}

// 根据数据模型设置 cell 内容
override public func setModel(_ model: ContactInfo) {
override open func setModel(_ model: ContactInfo) {
super.setModel(model)
onlineView.isHidden = false
}
Expand Down
8 changes: 4 additions & 4 deletions app/Custom/CustomContactViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class CustomContactViewController: ContactViewController, NEBaseContactVi
super.init(coder: coder)
}

override public func viewDidLoad() {
override open func viewDidLoad() {
// 通过重写实现自定义,该方式需要继承自 ChatViewController
// customByOverread()

Expand All @@ -45,19 +45,19 @@ public class CustomContactViewController: ContactViewController, NEBaseContactVi
}

// 通过继承方式重写次最右侧按钮点击事件, 这种方式会覆盖配置项中的点击事件
override public func searchAction() {
override open func searchAction() {
bodyTopViewHeight = 80
bodyBottomViewHeight = 80
}

// 通过继承方式重写最右侧按钮点击事件, 这种方式会覆盖配置项中的点击事件
override public func didClickAddBtn() {
override open func didClickAddBtn() {
bodyTopViewHeight = 0
bodyBottomViewHeight = 0
}

// 父类加载完数据后会调用此方法,可在此对数据进行二次处理
public func onDataLoaded() {
open func onDataLoaded() {
for info in viewModel.contacts[1].contacts {
info.contactCellType = ContactCellType.ContactCutom.rawValue
}
Expand Down
4 changes: 2 additions & 2 deletions app/Custom/CustomConversationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ open class CustomConversationController: ConversationController, NEBaseConversat
super.init(coder: coder)
}

override public func viewDidLoad() {
override open func viewDidLoad() {
// 通过重写实现自定义,该方式需要继承自 ChatViewController
// customByOverread()

Expand Down Expand Up @@ -76,7 +76,7 @@ open class CustomConversationController: ConversationController, NEBaseConversat
}

// 可自行处理数据
public func onDataLoaded() {
open func onDataLoaded() {
for model in viewModel.conversationListData {
model.customType = 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

import Foundation
import UIKit

open class NESecurityWarningView: UIView {
override public init(frame: CGRect) {
Expand All @@ -27,7 +28,7 @@ open class NESecurityWarningView: UIView {
public lazy var backView: UIView = {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
view.backgroundColor = .securityWarningBg
view.backgroundColor = UIColor(hexString: "#FFF5E1")

view.addSubview(warningLabel)
NSLayoutConstraint.activate([
Expand All @@ -42,7 +43,7 @@ open class NESecurityWarningView: UIView {
public lazy var warningLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.textColor = .securityWarningTextColor
label.textColor = UIColor(hexString: "#EB9718")
label.font = .systemFont(ofSize: 14)
label.text = localizable("security_warning")
label.textAlignment = .justified
Expand Down
7 changes: 6 additions & 1 deletion app/Main/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
self.window?.rootViewController = tab
}

// regist router
// regist router
func loadService() {
// 注册路由
ChatKitClient.shared.setupInit(isFun: !NEStyleManager.instance.isNormalStyle())
if NEStyleManager.instance.isNormalStyle() == false {
registerFunCustom()
}else {
registerNormalCustom()
}

// 会话列表顶部插入警告内容
CustomConfig.shared.loadSecurityWarningView()

// 注册【个人信息】页面
Router.shared.register(MeSettingRouter) { param in
if let nav = param["nav"] as? UINavigationController {
let me = PersonInfoViewController()
Expand Down
4 changes: 2 additions & 2 deletions app/Main/NENavigationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import UIKit

class NENavigationController: UINavigationController {
override public func viewDidLoad() {
override open func viewDidLoad() {
super.viewDidLoad()
setUpNavigation()
}
Expand All @@ -22,7 +22,7 @@ class NENavigationController: UINavigationController {
}
}

override public func pushViewController(_ viewController: UIViewController, animated: Bool) {
override open func pushViewController(_ viewController: UIViewController, animated: Bool) {
if children.count > 0 {
viewController.hidesBottomBarWhenPushed = true
if children.count > 1 {
Expand Down
Loading