@@ -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 {
0 commit comments