Various fixes

This commit is contained in:
Ilya Laktyushin 2023-10-12 15:39:47 +04:00
parent b80f2636d6
commit 4013fca50e
16 changed files with 66 additions and 14 deletions

View File

@ -329,6 +329,9 @@ alternate_icon_folders = [
"Premium",
"PremiumBlack",
"PremiumTurbo",
"PremiumCoffee",
"PremiumDuck",
"PremiumSteam",
]
[

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -10104,3 +10104,9 @@ Sorry for the inconvenience.";
"GiftLink.LinkSharedToSavedMessages" = "Gift link forwarded to **Saved Messages**";
"ChatContextMenu.TextSelectionTip2" = "Hold on a word, then move cursor to select more| text to copy or quote.";
"Appearance.AppIconCoffee" = "Coffee";
"Appearance.AppIconDuck" = "Duck";
"Appearance.AppIconSteam" = "Steam";
"Notification.GiftLink" = "You received a gift";

View File

@ -72,6 +72,12 @@ final class AppIconsDemoComponent: Component {
image = UIImage(bundleImageName: "Premium/Icons/Black")
case "PremiumTurbo":
image = UIImage(bundleImageName: "Premium/Icons/Turbo")
case "PremiumDuck":
image = UIImage(bundleImageName: "Premium/Icons/Duck")
case "PremiumCoffee":
image = UIImage(bundleImageName: "Premium/Icons/Coffee")
case "PremiumSteam":
image = UIImage(bundleImageName: "Premium/Icons/Steam")
default:
image = nil
}

View File

@ -365,6 +365,12 @@ class ThemeSettingsAppIconItemNode: ListViewItemNode, ItemListItemNode {
name = item.strings.Appearance_AppIconBlack
case "PremiumTurbo":
name = item.strings.Appearance_AppIconTurbo
case "PremiumDuck":
name = item.strings.Appearance_AppIconDuck
case "PremiumCoffee":
name = item.strings.Appearance_AppIconCoffee
case "PremiumSteam":
name = item.strings.Appearance_AppIconSteam
default:
name = icon.name
}

View File

@ -26,6 +26,7 @@ public enum MessageContentKindKey {
case dice
case invoice
case story
case giveaway
}
public enum MessageContentKind: Equatable {
@ -48,6 +49,7 @@ public enum MessageContentKind: Equatable {
case dice(String)
case invoice(String)
case story
case giveaway
public func isSemanticallyEqual(to other: MessageContentKind) -> Bool {
switch self {
@ -165,6 +167,12 @@ public enum MessageContentKind: Equatable {
} else {
return false
}
case .giveaway:
if case .giveaway = other {
return true
} else {
return false
}
}
}
@ -208,6 +216,8 @@ public enum MessageContentKind: Equatable {
return .invoice
case .story:
return .story
case .giveaway:
return .giveaway
}
}
}
@ -397,6 +407,8 @@ public func stringForMediaKind(_ kind: MessageContentKind, strings: Presentation
return (NSAttributedString(string: text), true)
case .story:
return (NSAttributedString(string: strings.Message_Story), true)
case .giveaway:
return (NSAttributedString(string: strings.Message_Giveaway), true)
}
}

View File

@ -899,7 +899,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
attributedString = addAttributesToStringWithRanges(resultTitleString._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
}
case .giftCode:
attributedString = NSAttributedString(string: "Gift Link", font: titleFont, textColor: primaryTextColor)
attributedString = NSAttributedString(string: strings.Notification_GiftLink, font: titleFont, textColor: primaryTextColor)
case .unknown:
attributedString = nil
}

View File

@ -509,11 +509,14 @@ private final class StoryContainerScreenComponent: Component {
return
}
var apply = true
let currentTime = CACurrentMediaTime()
if let previousTime = self.previousSeekTime, currentTime - previousTime < 0.1 {
return
apply = false
}
if apply {
self.previousSeekTime = currentTime
}
self.previousSeekTime = currentTime
let initialSeekTimestamp: Double
if let current = self.initialSeekTimestamp {
@ -523,15 +526,16 @@ private final class StoryContainerScreenComponent: Component {
self.initialSeekTimestamp = initialSeekTimestamp
}
let duration = visibleItemView.effectiveDuration
let timestamp: Double
if translation.x > 0.0 {
let fraction = translation.x / (self.bounds.width - initialLocation.x)
timestamp = initialSeekTimestamp + (visibleItemView.effectiveDuration - initialSeekTimestamp) * fraction * fraction
let fraction = translation.x / (self.bounds.width / 2.0)
timestamp = initialSeekTimestamp + duration * fraction
} else {
let fraction = translation.x / initialLocation.x
timestamp = initialSeekTimestamp + initialSeekTimestamp * fraction * fraction * -1.0
let fraction = translation.x / (self.bounds.width / 2.0)
timestamp = initialSeekTimestamp + duration * fraction
}
visibleItemView.seekTo(timestamp)
visibleItemView.seekTo(max(0.0, min(duration, timestamp)), apply: apply)
}
longPressRecognizer.updatePanEnded = { [weak self] in
guard let self else {

View File

@ -416,7 +416,7 @@ final class StoryItemContentComponent: Component {
return effectiveDuration
}
private func updateVideoPlaybackProgress() {
private func updateVideoPlaybackProgress(_ scrubbingTimestamp: Double? = nil) {
guard let videoPlaybackStatus = self.videoPlaybackStatus else {
return
}
@ -497,6 +497,13 @@ final class StoryItemContentComponent: Component {
}
}
if let scrubbingTimestamp {
currentProgress = CGFloat(scrubbingTimestamp / effectiveDuration)
if currentProgress.isNaN || !currentProgress.isFinite {
currentProgress = 0.0
}
}
let clippedProgress = max(0.0, min(1.0, currentProgress))
self.environment?.presentationProgressUpdated(clippedProgress, isBuffering, false)
}
@ -529,12 +536,14 @@ final class StoryItemContentComponent: Component {
)
}
func seekTo(_ timestamp: Double) {
func seekTo(_ timestamp: Double, apply: Bool) {
guard let videoNode = self.videoNode else {
return
}
videoNode.seek(timestamp)
self.updateVideoPlaybackProgress()
if apply {
videoNode.seek(timestamp)
}
self.updateVideoPlaybackProgress(timestamp)
}
func update(component: StoryItemContentComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<StoryContentItem.Environment>, transition: Transition) -> CGSize {

View File

@ -4678,7 +4678,7 @@ public final class StoryItemSetContainerComponent: Component {
count = dayCounters.totalCount
}
let isSeeking = component.isProgressPaused && component.hideUI
let isSeeking = component.isProgressPaused && component.hideUI && isVideo
var navigationStripTransition = transition
if let previousComponent, (previousComponent.isProgressPaused && component.hideUI) != isSeeking {
@ -4705,7 +4705,9 @@ public final class StoryItemSetContainerComponent: Component {
self.controlsNavigationClippingView.addSubview(navigationStripView)
}
transition.setFrame(view: navigationStripView, frame: CGRect(origin: CGPoint(x: navigationStripSideInset, y: navigationStripTopInset), size: CGSize(width: availableSize.width - navigationStripSideInset * 2.0, height: navigationStripSize.height)))
transition.setAlpha(view: navigationStripView, alpha: self.isEditingStory ? 0.0 : 1.0)
let hideUI = component.hideUI && !isVideo
transition.setAlpha(view: navigationStripView, alpha: self.isEditingStory || hideUI ? 0.0 : 1.0)
}
let seekLabelSize = self.seekLabel.update(

View File

@ -799,6 +799,10 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
icons.append(PresentationAppIcon(name: "PremiumBlack", imageName: "PremiumBlack", isPremium: true))
icons.append(PresentationAppIcon(name: "PremiumTurbo", imageName: "PremiumTurbo", isPremium: true))
icons.append(PresentationAppIcon(name: "PremiumDuck", imageName: "PremiumDuck", isPremium: true))
icons.append(PresentationAppIcon(name: "PremiumCoffee", imageName: "PremiumCoffee", isPremium: true))
icons.append(PresentationAppIcon(name: "PremiumSteam", imageName: "PremiumSteam", isPremium: true))
return icons
} else {
return []