Skip to content

Commit

Permalink
DemoUI调整 (#420)
Browse files Browse the repository at this point in the history
* NEAISearchKit v1.0.5 (#416)

* add sample code

* update Podfile

* v10.4.0

* v10.4.1

* fix NEMapKit.podspec

* update Podfile

* update NETeamUIKit.podspec

* v10.5.0

* 优化登录登出体验

* v10.5.1

* NEAISearchKit v1.0.5

* OC demo Podfile update (#417)

* add sample code

* update Podfile

* v10.4.0

* v10.4.1

* fix NEMapKit.podspec

* update Podfile

* update NETeamUIKit.podspec

* v10.5.0

* 优化登录登出体验

* v10.5.1

* NEAISearchKit v1.0.5

* OC Podfile update

* update NEConversationUIKit (#419)

* add sample code

---------

Co-authored-by: zsw666 <[email protected]>
  • Loading branch information
shine2008 and zsw666 authored Jan 8, 2025
1 parent e6d4e4b commit c25d2ac
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 32 deletions.
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
4 changes: 4 additions & 0 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
26 changes: 26 additions & 0 deletions app/Custom/CustomConfig.swift
Original file line number Diff line number Diff line change
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
}()
}
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
1 change: 1 addition & 0 deletions app/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@

"privatized_configuration"="Privatized configuration";
"login_by_account"="login";
"security_warning"="For test only. Beware of money transfer, lottery winnings & strange call scams.";
1 change: 1 addition & 0 deletions app/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@
"anti_error"="存在不安全内容,请重新输入。";
"privatized_configuration"="私有化配置";
"login_by_account"="账号登录";
"security_warning"="仅用于体验云信IM 产品功能,请勿轻信汇款、中奖等涉及钱款的信息,勿轻易拨打陌生电话,谨防上当受骗。";

0 comments on commit c25d2ac

Please sign in to comment.