Various fixes

This commit is contained in:
Ilya Laktyushin 2025-09-01 13:14:37 +04:00
parent 7b3cf92720
commit b1bcf52a09
3 changed files with 39 additions and 13 deletions

View File

@ -15004,3 +15004,7 @@ Sorry for the inconvenience.";
"Notification.PrepaidGiftUpgrade" = "Gift Upgrade for %@"; "Notification.PrepaidGiftUpgrade" = "Gift Upgrade for %@";
"Notification.PrepaidGiftUpgrade.Stars_1" = "%@ Star"; "Notification.PrepaidGiftUpgrade.Stars_1" = "%@ Star";
"Notification.PrepaidGiftUpgrade.Stars_any" = "%@ Stars"; "Notification.PrepaidGiftUpgrade.Stars_any" = "%@ Stars";
"ProfileLevelInfo.RatingTitle" = "Rating";
"ProfileLevelInfo.FutureRatingTitle" = "Future Rating";

View File

@ -589,7 +589,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
} }
var currentSavedMusic: TelegramMediaFile? var currentSavedMusic: TelegramMediaFile?
if !self.isSettings, let screenData { if let peer, peer.id != self.context.account.peerId || self.isMyProfile, let screenData {
if let savedMusicState = screenData.savedMusicState { if let savedMusicState = screenData.savedMusicState {
currentSavedMusic = savedMusicState.files.first currentSavedMusic = savedMusicState.files.first
} else if let cachedUserData = screenData.cachedData as? CachedUserData { } else if let cachedUserData = screenData.cachedData as? CachedUserData {

View File

@ -377,24 +377,46 @@ private final class ProfileLevelInfoScreenComponent: Component {
descriptionTextString = environment.strings.ProfileLevelInfo_OtherDescription(component.peer.compactDisplayTitle).string descriptionTextString = environment.strings.ProfileLevelInfo_OtherDescription(component.peer.compactDisplayTitle).string
} }
//TODO:localize
var titleItems: [AnimatedTextComponent.Item] = [] var titleItems: [AnimatedTextComponent.Item] = []
let ratingTitle = environment.strings.ProfileLevelInfo_RatingTitle
let futureTitle = environment.strings.ProfileLevelInfo_FutureRatingTitle
if self.isPreviewingPendingRating { if self.isPreviewingPendingRating {
titleItems.append(AnimatedTextComponent.Item( if let range = futureTitle.range(of: ratingTitle) {
id: AnyHashable(0), if !futureTitle[..<range.lowerBound].isEmpty {
isUnbreakable: false, titleItems.append(AnimatedTextComponent.Item(
content: .text("Future ") id: AnyHashable(0),
)) isUnbreakable: false,
titleItems.append(AnimatedTextComponent.Item( content: .text(String(futureTitle[..<range.lowerBound]))
id: AnyHashable(1), ))
isUnbreakable: true, }
content: .text("Rating")
)) titleItems.append(AnimatedTextComponent.Item(
id: AnyHashable(1),
isUnbreakable: true,
content: .text(ratingTitle)
))
if !futureTitle[range.upperBound...].isEmpty {
titleItems.append(AnimatedTextComponent.Item(
id: AnyHashable(2),
isUnbreakable: false,
content: .text(String(futureTitle[range.upperBound...]))
))
}
} else {
titleItems.append(AnimatedTextComponent.Item(
id: AnyHashable(0),
isUnbreakable: true,
content: .text(futureTitle)
))
}
} else { } else {
titleItems.append(AnimatedTextComponent.Item( titleItems.append(AnimatedTextComponent.Item(
id: AnyHashable(1), id: AnyHashable(1),
isUnbreakable: true, isUnbreakable: true,
content: .text("Rating") content: .text(ratingTitle)
)) ))
} }