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", "Premium",
"PremiumBlack", "PremiumBlack",
"PremiumTurbo", "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**"; "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."; "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") image = UIImage(bundleImageName: "Premium/Icons/Black")
case "PremiumTurbo": case "PremiumTurbo":
image = UIImage(bundleImageName: "Premium/Icons/Turbo") 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: default:
image = nil image = nil
} }

View File

@ -365,6 +365,12 @@ class ThemeSettingsAppIconItemNode: ListViewItemNode, ItemListItemNode {
name = item.strings.Appearance_AppIconBlack name = item.strings.Appearance_AppIconBlack
case "PremiumTurbo": case "PremiumTurbo":
name = item.strings.Appearance_AppIconTurbo 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: default:
name = icon.name name = icon.name
} }

View File

@ -26,6 +26,7 @@ public enum MessageContentKindKey {
case dice case dice
case invoice case invoice
case story case story
case giveaway
} }
public enum MessageContentKind: Equatable { public enum MessageContentKind: Equatable {
@ -48,6 +49,7 @@ public enum MessageContentKind: Equatable {
case dice(String) case dice(String)
case invoice(String) case invoice(String)
case story case story
case giveaway
public func isSemanticallyEqual(to other: MessageContentKind) -> Bool { public func isSemanticallyEqual(to other: MessageContentKind) -> Bool {
switch self { switch self {
@ -165,6 +167,12 @@ public enum MessageContentKind: Equatable {
} else { } else {
return false return false
} }
case .giveaway:
if case .giveaway = other {
return true
} else {
return false
}
} }
} }
@ -208,6 +216,8 @@ public enum MessageContentKind: Equatable {
return .invoice return .invoice
case .story: case .story:
return .story return .story
case .giveaway:
return .giveaway
} }
} }
} }
@ -397,6 +407,8 @@ public func stringForMediaKind(_ kind: MessageContentKind, strings: Presentation
return (NSAttributedString(string: text), true) return (NSAttributedString(string: text), true)
case .story: case .story:
return (NSAttributedString(string: strings.Message_Story), true) 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]) attributedString = addAttributesToStringWithRanges(resultTitleString._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
} }
case .giftCode: case .giftCode:
attributedString = NSAttributedString(string: "Gift Link", font: titleFont, textColor: primaryTextColor) attributedString = NSAttributedString(string: strings.Notification_GiftLink, font: titleFont, textColor: primaryTextColor)
case .unknown: case .unknown:
attributedString = nil attributedString = nil
} }

View File

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

View File

@ -416,7 +416,7 @@ final class StoryItemContentComponent: Component {
return effectiveDuration return effectiveDuration
} }
private func updateVideoPlaybackProgress() { private func updateVideoPlaybackProgress(_ scrubbingTimestamp: Double? = nil) {
guard let videoPlaybackStatus = self.videoPlaybackStatus else { guard let videoPlaybackStatus = self.videoPlaybackStatus else {
return 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)) let clippedProgress = max(0.0, min(1.0, currentProgress))
self.environment?.presentationProgressUpdated(clippedProgress, isBuffering, false) 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 { guard let videoNode = self.videoNode else {
return return
} }
if apply {
videoNode.seek(timestamp) videoNode.seek(timestamp)
self.updateVideoPlaybackProgress() }
self.updateVideoPlaybackProgress(timestamp)
} }
func update(component: StoryItemContentComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<StoryContentItem.Environment>, transition: Transition) -> CGSize { 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 count = dayCounters.totalCount
} }
let isSeeking = component.isProgressPaused && component.hideUI let isSeeking = component.isProgressPaused && component.hideUI && isVideo
var navigationStripTransition = transition var navigationStripTransition = transition
if let previousComponent, (previousComponent.isProgressPaused && component.hideUI) != isSeeking { if let previousComponent, (previousComponent.isProgressPaused && component.hideUI) != isSeeking {
@ -4705,7 +4705,9 @@ public final class StoryItemSetContainerComponent: Component {
self.controlsNavigationClippingView.addSubview(navigationStripView) 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.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( 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: "PremiumBlack", imageName: "PremiumBlack", isPremium: true))
icons.append(PresentationAppIcon(name: "PremiumTurbo", imageName: "PremiumTurbo", 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 return icons
} else { } else {
return [] return []