@@ -260,7 +260,7 @@ public let callMessage = "rtcCallWithAgora"
260
260
}
261
261
262
262
open func textSize( ) -> CGSize {
263
- let label = UILabel ( ) . numberOfLines ( 0 ) . lineBreakMode ( LanguageConvertor . chineseLanguage ( ) ? . byCharWrapping : . byWordWrapping)
263
+ let label = UILabel ( ) . numberOfLines ( 0 ) . lineBreakMode ( . byWordWrapping)
264
264
let textAttribute = self . convertTextAttribute ( )
265
265
label. attributedText = textAttribute
266
266
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"
369
369
return CGSize ( width: self . historyMessage ? ScreenWidth- 32 : limitBubbleWidth, height: contactCardHeight)
370
370
} else {
371
371
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)
373
373
label. attributedText = self . convertTextAttribute ( )
374
374
let size = label. sizeThatFits ( CGSize ( width: ScreenWidth- 32 , height: 9999 ) )
375
375
return CGSize ( width: ScreenWidth- 32 , height: size. height+ 50 )
@@ -399,13 +399,13 @@ public let callMessage = "rtcCallWithAgora"
399
399
}
400
400
if self . message. body. type != . text, self . message. body. type != . custom {
401
401
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 )
403
403
} )
404
404
return text
405
405
}
406
406
if self . historyMessage, self . message. body. type == . custom {
407
407
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 )
409
409
} )
410
410
return text
411
411
}
@@ -432,7 +432,7 @@ public let callMessage = "rtcCallWithAgora"
432
432
433
433
default :
434
434
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 )
436
436
} )
437
437
break
438
438
}
@@ -445,7 +445,7 @@ public let callMessage = "rtcCallWithAgora"
445
445
}
446
446
if self . message. mention. isEmpty {
447
447
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 )
449
449
} )
450
450
} else {
451
451
if self . message. mention == EaseChatUIKitContext . shared? . currentUserId ?? " " {
@@ -462,7 +462,7 @@ public let callMessage = "rtcCallWithAgora"
462
462
let mentionRange = content. lowercased ( ) . chat. rangeOfString ( nickname ?? " " )
463
463
let range = NSMakeRange ( mentionRange. location- 1 , mentionRange. length+ 1 )
464
464
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 )
466
466
}
467
467
if mentionRange. location != NSNotFound, mentionRange. length != NSNotFound {
468
468
mentionAttribute. addAttribute ( . foregroundColor, value: ( Theme . style == . dark ? UIColor . theme. primaryColor6: UIColor . theme. primaryColor5) , range: range)
@@ -474,7 +474,7 @@ public let callMessage = "rtcCallWithAgora"
474
474
let mentionRange = content. lowercased ( ) . chat. rangeOfString ( self . message. mention. lowercased ( ) )
475
475
let range = NSMakeRange ( mentionRange. location- 1 , mentionRange. length+ 1 )
476
476
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 )
478
478
}
479
479
if mentionRange. location != NSNotFound, mentionRange. length != NSNotFound {
480
480
mentionAttribute. addAttribute ( . foregroundColor, value: ( Theme . style == . dark ? UIColor . theme. primaryColor6: UIColor . theme. primaryColor5) , range: range)
@@ -548,7 +548,7 @@ public let callMessage = "rtcCallWithAgora"
548
548
var text = NSMutableAttributedString ( )
549
549
if self . message. body. type != . text {
550
550
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 )
552
552
} )
553
553
return text
554
554
} else {
@@ -557,7 +557,7 @@ public let callMessage = "rtcCallWithAgora"
557
557
result = result. replacingOccurrences ( of: key, with: value)
558
558
}
559
559
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 )
561
561
} )
562
562
let string = text. string as NSString
563
563
for symbol in ChatEmojiConvertor . shared. emojis {
@@ -568,7 +568,7 @@ public let callMessage = "rtcCallWithAgora"
568
568
text. addAttribute ( . font, value: UIFont . theme. bodyLarge, range: range)
569
569
text. addAttribute ( . foregroundColor, value: self . message. direction == . send ? Appearance . chat. sendTranslationColor: Appearance . chat. receiveTranslationColor, range: range)
570
570
let paragraphStyle = NSMutableParagraphStyle ( )
571
- paragraphStyle. lineBreakMode = Appearance . chat . targetLanguage == . Chinese ? . byCharWrapping : . byCharWrapping
571
+ paragraphStyle. lineBreakMode = . byWordWrapping
572
572
paragraphStyle. lineHeightMultiple = 0.98
573
573
text. addAttribute ( . paragraphStyle, value: paragraphStyle, range: range)
574
574
}
@@ -580,8 +580,8 @@ public let callMessage = "rtcCallWithAgora"
580
580
open func updateReplySize( ) -> CGSize {
581
581
if let attributeContent = self . convertToReply ( ) {
582
582
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)
585
585
labelTitle. attributedText = attributeTitle
586
586
labelContent. attributedText = attributeContent
587
587
let titleSize = labelTitle. sizeThatFits ( CGSize ( width: limitBubbleWidth, height: 16 ) )
@@ -592,7 +592,7 @@ public let callMessage = "rtcCallWithAgora"
592
592
return CGSize ( width: ( titleSize. width > contentSize. width ? titleSize. width: contentSize. width) + 24 , height: contentSize. height+ 34 )
593
593
}
594
594
} else {
595
- let labelContent = UILabel ( ) . numberOfLines ( 2 ) . lineBreakMode ( LanguageConvertor . chineseLanguage ( ) ? . byCharWrapping : . byWordWrapping)
595
+ let labelContent = UILabel ( ) . numberOfLines ( 2 ) . lineBreakMode ( . byWordWrapping)
596
596
labelContent. attributedText = attributeContent
597
597
let contentSize = labelContent. sizeThatFits ( CGSize ( width: limitBubbleWidth, height: 36 ) )
598
598
return CGSize ( width: contentSize. width+ 10 , height: contentSize. height+ 10 )
@@ -617,37 +617,37 @@ public let callMessage = "rtcCallWithAgora"
617
617
switch quoteMessage. body. type {
618
618
case . text:
619
619
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 )
621
621
} )
622
622
case . image, . video, . combine, . location:
623
623
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 )
625
625
} )
626
626
case . file, . voice:
627
627
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 )
630
630
} )
631
631
case . custom:
632
632
if let body = quoteMessage. body as? ChatCustomMessageBody , body. event == EaseChatUIKit_user_card_message {
633
633
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 )
636
636
} )
637
637
} else {
638
638
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 )
640
640
} )
641
641
}
642
642
default :
643
643
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 )
645
645
} )
646
646
}
647
647
return reply
648
648
} else {
649
649
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 )
651
651
}
652
652
}
653
653
} else {
0 commit comments