Skip to content

Commit 3802c50

Browse files
authored
Merge pull request #2 from zjc19891106/main
fix UI issue
2 parents cce4874 + ee779e8 commit 3802c50

File tree

7 files changed

+90
-59
lines changed

7 files changed

+90
-59
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>EaseChatUIKit_Example.xcscheme_^#shared#^_</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>3</integer>
11+
</dict>
12+
</dict>
13+
</dict>
14+
</plist>

Sources/EaseChatUIKit/Classes/UI/Components/Chat/Cells/TextMessageCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import UIKit
2222
}()
2323

2424
@objc open func createContent() -> UILabel {
25-
UILabel(frame: .zero).backgroundColor(.clear).lineBreakMode(LanguageConvertor.chineseLanguage() ? .byCharWrapping:.byWordWrapping).numberOfLines(0)
25+
UILabel(frame: .zero).backgroundColor(.clear).numberOfLines(0)
2626
}
2727

2828
public private(set) lazy var edit: UIButton = {

Sources/EaseChatUIKit/Classes/UI/Components/Chat/ViewModel/MessageEntity.swift

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public let callMessage = "rtcCallWithAgora"
260260
}
261261

262262
open func textSize() -> CGSize {
263-
let label = UILabel().numberOfLines(0).lineBreakMode(LanguageConvertor.chineseLanguage() ? .byCharWrapping:.byWordWrapping)
263+
let label = UILabel().numberOfLines(0).lineBreakMode(.byWordWrapping)
264264
let textAttribute = self.convertTextAttribute()
265265
label.attributedText = textAttribute
266266
var width = label.sizeThatFits(CGSize(width: self.historyMessage ? ScreenWidth-68:limitBubbleWidth-24, height: 9999)).width+(self.historyMessage ? 68:24)
@@ -369,7 +369,7 @@ public let callMessage = "rtcCallWithAgora"
369369
return CGSize(width: self.historyMessage ? ScreenWidth-32:limitBubbleWidth, height: contactCardHeight)
370370
} else {
371371
if body.event == EaseChatUIKit_alert_message {
372-
let label = UILabel().numberOfLines(0).lineBreakMode(LanguageConvertor.chineseLanguage() ? .byCharWrapping:.byWordWrapping)
372+
let label = UILabel().numberOfLines(0).lineBreakMode(.byWordWrapping)
373373
label.attributedText = self.convertTextAttribute()
374374
let size = label.sizeThatFits(CGSize(width: ScreenWidth-32, height: 9999))
375375
return CGSize(width: ScreenWidth-32, height: size.height+50)
@@ -399,13 +399,13 @@ public let callMessage = "rtcCallWithAgora"
399399
}
400400
if self.message.body.type != .text, self.message.body.type != .custom {
401401
text.append(NSAttributedString {
402-
AttributedText(self.message.showType+self.message.showContent).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineHeight(multiple: 0.98, minimum: 18).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
402+
AttributedText(self.message.showType+self.message.showContent).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineHeight(multiple: 0.98, minimum: 18).lineBreakMode(.byWordWrapping)
403403
})
404404
return text
405405
}
406406
if self.historyMessage,self.message.body.type == .custom {
407407
text.append(NSAttributedString {
408-
AttributedText(self.message.showType+self.message.showContent).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping).lineHeight(multiple: 0.98, minimum: 18)
408+
AttributedText(self.message.showType+self.message.showContent).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineBreakMode(.byWordWrapping).lineHeight(multiple: 0.98, minimum: 18)
409409
})
410410
return text
411411
}
@@ -432,7 +432,7 @@ public let callMessage = "rtcCallWithAgora"
432432

433433
default:
434434
text.append(NSAttributedString {
435-
AttributedText(self.message.showType+self.message.showContent).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineHeight(multiple: 0.98, minimum: self.historyMessage ? 16:18).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
435+
AttributedText(self.message.showType+self.message.showContent).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineHeight(multiple: 0.98, minimum: self.historyMessage ? 16:18).lineBreakMode(.byWordWrapping)
436436
})
437437
break
438438
}
@@ -445,7 +445,7 @@ public let callMessage = "rtcCallWithAgora"
445445
}
446446
if self.message.mention.isEmpty {
447447
text.append(NSAttributedString {
448-
AttributedText(result).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineHeight(multiple: 0.98, minimum: self.historyMessage ? 16:18).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
448+
AttributedText(result).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineHeight(multiple: 0.98, minimum: self.historyMessage ? 16:18).lineBreakMode(.byWordWrapping)
449449
})
450450
} else {
451451
if self.message.mention == EaseChatUIKitContext.shared?.currentUserId ?? "" {
@@ -462,7 +462,7 @@ public let callMessage = "rtcCallWithAgora"
462462
let mentionRange = content.lowercased().chat.rangeOfString(nickname ?? "")
463463
let range = NSMakeRange(mentionRange.location-1, mentionRange.length+1)
464464
let mentionAttribute = NSMutableAttributedString {
465-
AttributedText(content).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineHeight(multiple: 0.98, minimum: self.historyMessage ? 16:18).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
465+
AttributedText(content).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineHeight(multiple: 0.98, minimum: self.historyMessage ? 16:18).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byWordWrapping)
466466
}
467467
if mentionRange.location != NSNotFound,mentionRange.length != NSNotFound {
468468
mentionAttribute.addAttribute(.foregroundColor, value: (Theme.style == .dark ? UIColor.theme.primaryColor6:UIColor.theme.primaryColor5), range: range)
@@ -474,7 +474,7 @@ public let callMessage = "rtcCallWithAgora"
474474
let mentionRange = content.lowercased().chat.rangeOfString(self.message.mention.lowercased())
475475
let range = NSMakeRange(mentionRange.location-1, mentionRange.length+1)
476476
let mentionAttribute = NSMutableAttributedString {
477-
AttributedText(content).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineHeight(multiple: 0.98, minimum: self.historyMessage ? 16:18).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
477+
AttributedText(content).foregroundColor(textColor).font(self.historyMessage ? UIFont.theme.bodyMedium:UIFont.theme.bodyLarge).lineHeight(multiple: 0.98, minimum: self.historyMessage ? 16:18).lineBreakMode(.byWordWrapping)
478478
}
479479
if mentionRange.location != NSNotFound,mentionRange.length != NSNotFound {
480480
mentionAttribute.addAttribute(.foregroundColor, value: (Theme.style == .dark ? UIColor.theme.primaryColor6:UIColor.theme.primaryColor5), range: range)
@@ -548,7 +548,7 @@ public let callMessage = "rtcCallWithAgora"
548548
var text = NSMutableAttributedString()
549549
if self.message.body.type != .text {
550550
text.append(NSAttributedString {
551-
AttributedText(self.message.showType).foregroundColor(self.message.direction == .send ? Appearance.chat.sendTranslationColor:Appearance.chat.receiveTranslationColor).font(UIFont.theme.bodyLarge).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byWordWrapping).lineHeight(multiple: 0.98, minimum: 18)
551+
AttributedText(self.message.showType).foregroundColor(self.message.direction == .send ? Appearance.chat.sendTranslationColor:Appearance.chat.receiveTranslationColor).font(UIFont.theme.bodyLarge).lineBreakMode(.byWordWrapping).lineHeight(multiple: 0.98, minimum: 18)
552552
})
553553
return text
554554
} else {
@@ -557,7 +557,7 @@ public let callMessage = "rtcCallWithAgora"
557557
result = result.replacingOccurrences(of: key, with: value)
558558
}
559559
text.append(NSAttributedString {
560-
AttributedText(result).foregroundColor(self.message.direction == .send ? Appearance.chat.sendTranslationColor:Appearance.chat.receiveTranslationColor).font(UIFont.theme.bodyLarge).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping).lineHeight(multiple: 0.98, minimum: 18)
560+
AttributedText(result).foregroundColor(self.message.direction == .send ? Appearance.chat.sendTranslationColor:Appearance.chat.receiveTranslationColor).font(UIFont.theme.bodyLarge).lineBreakMode(.byWordWrapping).lineHeight(multiple: 0.98, minimum: 18)
561561
})
562562
let string = text.string as NSString
563563
for symbol in ChatEmojiConvertor.shared.emojis {
@@ -568,7 +568,7 @@ public let callMessage = "rtcCallWithAgora"
568568
text.addAttribute(.font, value: UIFont.theme.bodyLarge, range: range)
569569
text.addAttribute(.foregroundColor, value: self.message.direction == .send ? Appearance.chat.sendTranslationColor:Appearance.chat.receiveTranslationColor, range: range)
570570
let paragraphStyle = NSMutableParagraphStyle()
571-
paragraphStyle.lineBreakMode = Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping
571+
paragraphStyle.lineBreakMode = .byWordWrapping
572572
paragraphStyle.lineHeightMultiple = 0.98
573573
text.addAttribute(.paragraphStyle, value: paragraphStyle, range: range)
574574
}
@@ -580,8 +580,8 @@ public let callMessage = "rtcCallWithAgora"
580580
open func updateReplySize() -> CGSize {
581581
if let attributeContent = self.convertToReply() {
582582
if let attributeTitle = self.replyTitle,attributeContent.length > 0,attributeContent.string != "message doesn't exist".chat.localize {
583-
let labelTitle = UILabel().numberOfLines(1).lineBreakMode(LanguageConvertor.chineseLanguage() ? .byCharWrapping:.byWordWrapping)
584-
let labelContent = UILabel().numberOfLines(2).lineBreakMode(LanguageConvertor.chineseLanguage() ? .byCharWrapping:.byWordWrapping)
583+
let labelTitle = UILabel().numberOfLines(1).lineBreakMode(.byWordWrapping)
584+
let labelContent = UILabel().numberOfLines(2).lineBreakMode(.byWordWrapping)
585585
labelTitle.attributedText = attributeTitle
586586
labelContent.attributedText = attributeContent
587587
let titleSize = labelTitle.sizeThatFits(CGSize(width: limitBubbleWidth, height: 16))
@@ -592,7 +592,7 @@ public let callMessage = "rtcCallWithAgora"
592592
return CGSize(width: (titleSize.width > contentSize.width ? titleSize.width:contentSize.width)+24, height: contentSize.height+34)
593593
}
594594
} else {
595-
let labelContent = UILabel().numberOfLines(2).lineBreakMode(LanguageConvertor.chineseLanguage() ? .byCharWrapping:.byWordWrapping)
595+
let labelContent = UILabel().numberOfLines(2).lineBreakMode(.byWordWrapping)
596596
labelContent.attributedText = attributeContent
597597
let contentSize = labelContent.sizeThatFits(CGSize(width: limitBubbleWidth, height: 36))
598598
return CGSize(width: contentSize.width+10, height: contentSize.height+10)
@@ -617,37 +617,37 @@ public let callMessage = "rtcCallWithAgora"
617617
switch quoteMessage.body.type {
618618
case .text:
619619
reply.append(NSAttributedString {
620-
AttributedText(quoteMessage.showType).font(Font.theme.labelMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
620+
AttributedText(quoteMessage.showType).font(Font.theme.labelMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(.byWordWrapping)
621621
})
622622
case .image,.video,.combine,.location:
623623
reply.append(NSAttributedString {
624-
AttributedText(quoteMessage.showType).font(Font.theme.labelMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
624+
AttributedText(quoteMessage.showType).font(Font.theme.labelMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(.byWordWrapping)
625625
})
626626
case .file,.voice:
627627
reply.append(NSAttributedString {
628-
AttributedText(quoteMessage.showType).font(Font.theme.labelMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
629-
AttributedText(quoteMessage.showContent).font(Font.theme.bodyMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
628+
AttributedText(quoteMessage.showType).font(Font.theme.labelMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(.byWordWrapping)
629+
AttributedText(quoteMessage.showContent).font(Font.theme.bodyMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(.byWordWrapping)
630630
})
631631
case .custom:
632632
if let body = quoteMessage.body as? ChatCustomMessageBody,body.event == EaseChatUIKit_user_card_message {
633633
reply.append(NSAttributedString {
634-
AttributedText(quoteMessage.showType).font(Font.theme.labelMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
635-
AttributedText(quoteMessage.showContent).font(Font.theme.bodyMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
634+
AttributedText(quoteMessage.showType).font(Font.theme.labelMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(.byWordWrapping)
635+
AttributedText(quoteMessage.showContent).font(Font.theme.bodyMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(.byWordWrapping)
636636
})
637637
} else {
638638
reply.append(NSAttributedString {
639-
AttributedText("message doesn't exist".chat.localize).font(Font.theme.bodyMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
639+
AttributedText("message doesn't exist".chat.localize).font(Font.theme.bodyMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(.byWordWrapping)
640640
})
641641
}
642642
default:
643643
reply.append(NSAttributedString {
644-
AttributedText("message doesn't exist".chat.localize).font(Font.theme.bodyMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
644+
AttributedText("message doesn't exist".chat.localize).font(Font.theme.bodyMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(.byWordWrapping)
645645
})
646646
}
647647
return reply
648648
} else {
649649
return NSAttributedString {
650-
AttributedText("message doesn't exist".chat.localize).font(Font.theme.bodyMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(Appearance.chat.targetLanguage == .Chinese ? .byCharWrapping:.byCharWrapping)
650+
AttributedText("message doesn't exist".chat.localize).font(Font.theme.bodyMedium).foregroundColor(Theme.style == .dark ? Color.theme.neutralColor6:Color.theme.neutralColor5).lineBreakMode(.byWordWrapping)
651651
}
652652
}
653653
} else {

Sources/EaseChatUIKit/Classes/UI/Components/Contact/Cells/DetailInfoListCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import UIKit
6161
self.titleLabel.frame = CGRect(x: 16, y: 16, width: (self.frame.width/2.0-22), height: 22)
6262
self.detailLabel.frame = CGRect(x: self.frame.width/2.0, y: 16, width: (self.frame.width/2.0-36), height: 22)
6363
self.switchMenu.frame = CGRect(x: self.frame.width-62, y: (self.contentView.frame.height-30)/2.0, width: 50, height: 30)
64-
self.separatorLine.frame = CGRect(x: 16, y: self.contentView.frame.height-0.5, width: self.contentView.frame.width, height: 0.5)
64+
self.separatorLine.frame = CGRect(x: 16, y: self.contentView.frame.height-0.5, width: self.frame.width, height: 0.5)
6565
}
6666

6767
@objc public func refresh(info: DetailInfo) {

0 commit comments

Comments
 (0)