diff --git a/Telegram/BUILD b/Telegram/BUILD index bd8e5cbd95..94ae56d601 100644 --- a/Telegram/BUILD +++ b/Telegram/BUILD @@ -329,6 +329,9 @@ alternate_icon_folders = [ "Premium", "PremiumBlack", "PremiumTurbo", + "PremiumCoffee", + "PremiumDuck", + "PremiumSteam", ] [ diff --git a/Telegram/Telegram-iOS/PremiumCoffee.alticon/PremiumCoffee@2x.png b/Telegram/Telegram-iOS/PremiumCoffee.alticon/PremiumCoffee@2x.png new file mode 100644 index 0000000000..abdd22ae69 Binary files /dev/null and b/Telegram/Telegram-iOS/PremiumCoffee.alticon/PremiumCoffee@2x.png differ diff --git a/Telegram/Telegram-iOS/PremiumCoffee.alticon/PremiumCoffee@3x.png b/Telegram/Telegram-iOS/PremiumCoffee.alticon/PremiumCoffee@3x.png new file mode 100644 index 0000000000..8a0de8458b Binary files /dev/null and b/Telegram/Telegram-iOS/PremiumCoffee.alticon/PremiumCoffee@3x.png differ diff --git a/Telegram/Telegram-iOS/PremiumDuck.alticon/PremiumDuck@2x.png b/Telegram/Telegram-iOS/PremiumDuck.alticon/PremiumDuck@2x.png new file mode 100644 index 0000000000..eeb7340627 Binary files /dev/null and b/Telegram/Telegram-iOS/PremiumDuck.alticon/PremiumDuck@2x.png differ diff --git a/Telegram/Telegram-iOS/PremiumDuck.alticon/PremiumDuck@3x.png b/Telegram/Telegram-iOS/PremiumDuck.alticon/PremiumDuck@3x.png new file mode 100644 index 0000000000..dea2849f51 Binary files /dev/null and b/Telegram/Telegram-iOS/PremiumDuck.alticon/PremiumDuck@3x.png differ diff --git a/Telegram/Telegram-iOS/PremiumSteam.alticon/PremiumSteam@2x.png b/Telegram/Telegram-iOS/PremiumSteam.alticon/PremiumSteam@2x.png new file mode 100644 index 0000000000..abdd22ae69 Binary files /dev/null and b/Telegram/Telegram-iOS/PremiumSteam.alticon/PremiumSteam@2x.png differ diff --git a/Telegram/Telegram-iOS/PremiumSteam.alticon/PremiumSteam@3x.png b/Telegram/Telegram-iOS/PremiumSteam.alticon/PremiumSteam@3x.png new file mode 100644 index 0000000000..8a0de8458b Binary files /dev/null and b/Telegram/Telegram-iOS/PremiumSteam.alticon/PremiumSteam@3x.png differ diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 9ffe647121..212ff08558 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -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"; diff --git a/submodules/PremiumUI/Sources/AppIconsDemoComponent.swift b/submodules/PremiumUI/Sources/AppIconsDemoComponent.swift index 7c0fb63798..8d21a8df56 100644 --- a/submodules/PremiumUI/Sources/AppIconsDemoComponent.swift +++ b/submodules/PremiumUI/Sources/AppIconsDemoComponent.swift @@ -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 } diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsAppIconItem.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsAppIconItem.swift index b88e7e4a58..ab34ed2885 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsAppIconItem.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsAppIconItem.swift @@ -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 } diff --git a/submodules/TelegramStringFormatting/Sources/MessageContentKind.swift b/submodules/TelegramStringFormatting/Sources/MessageContentKind.swift index 4efe89b396..ad09669c77 100644 --- a/submodules/TelegramStringFormatting/Sources/MessageContentKind.swift +++ b/submodules/TelegramStringFormatting/Sources/MessageContentKind.swift @@ -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) } } diff --git a/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift b/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift index 055e03eaa9..fbf17cfae4 100644 --- a/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift +++ b/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift @@ -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 } diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContainerScreen.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContainerScreen.swift index 9d46f2ae0c..a445c3dde6 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContainerScreen.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContainerScreen.swift @@ -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 { diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemContentComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemContentComponent.swift index c8f533cab9..40ec787d68 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemContentComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemContentComponent.swift @@ -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, transition: Transition) -> CGSize { diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift index cbccc58b3d..4d0af55aa4 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift @@ -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( diff --git a/submodules/TelegramUI/Sources/AppDelegate.swift b/submodules/TelegramUI/Sources/AppDelegate.swift index cce7c9a3e2..d6480fa206 100644 --- a/submodules/TelegramUI/Sources/AppDelegate.swift +++ b/submodules/TelegramUI/Sources/AppDelegate.swift @@ -799,6 +799,10 @@ private func extractAccountManagerState(records: AccountRecordsView