diff --git a/submodules/AccountContext/Sources/AccountContext.swift b/submodules/AccountContext/Sources/AccountContext.swift index 72916f24c5..b87c7bab5d 100644 --- a/submodules/AccountContext/Sources/AccountContext.swift +++ b/submodules/AccountContext/Sources/AccountContext.swift @@ -947,6 +947,11 @@ public enum PremiumIntroSource { case fasterDownload case translation case stories + case storiesDownload + case storiesStealthMode + case storiesPermanentViews + case storiesFormatting + case storiesExpirationDurations } public enum PremiumDemoSubject { diff --git a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift index 87783f91f2..f38ade8550 100644 --- a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift @@ -190,6 +190,36 @@ public enum PremiumSource: Equatable { } else { return false } + case .storiesDownload: + if case .storiesDownload = rhs { + return true + } else { + return false + } + case .storiesStealthMode: + if case .storiesStealthMode = rhs { + return true + } else { + return false + } + case .storiesPermanentViews: + if case .storiesPermanentViews = rhs { + return true + } else { + return false + } + case .storiesFormatting: + if case .storiesFormatting = rhs { + return true + } else { + return false + } + case .storiesExpirationDurations: + if case .storiesExpirationDurations = rhs { + return true + } else { + return false + } } } @@ -220,6 +250,11 @@ public enum PremiumSource: Equatable { case linksPerSharedFolder case membershipInSharedFolders case stories + case storiesDownload + case storiesStealthMode + case storiesPermanentViews + case storiesFormatting + case storiesExpirationDurations var identifier: String? { switch self { @@ -279,6 +314,16 @@ public enum PremiumSource: Equatable { return "double_limits__communities_joined" case .stories: return "stories" + case .storiesDownload: + return "stories__save_stories_to_gallery" + case .storiesStealthMode: + return "stories__stealth_mode" + case .storiesPermanentViews: + return "stories__permanent_views_history" + case .storiesFormatting: + return "stories__links_and_formatting" + case .storiesExpirationDurations: + return "stories__expiration_durations" } } } diff --git a/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift b/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift index 4ef92c455c..d8d8cdab6d 100644 --- a/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift +++ b/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift @@ -499,6 +499,8 @@ public final class PeerListItemComponent: Component { } else { clipStyle = .round } + let _ = clipStyle + let _ = synchronousLoad self.avatarNode.setPeer(context: component.context, theme: component.theme, peer: peer, clipStyle: clipStyle, synchronousLoad: synchronousLoad, displayDimensions: CGSize(width: avatarSize, height: avatarSize)) self.avatarNode.setStoryStats(storyStats: component.storyStats.flatMap { storyStats -> AvatarNode.StoryStats in return AvatarNode.StoryStats( diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift index fa337ce780..079c3b09f4 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift @@ -1163,7 +1163,7 @@ public final class StoryItemSetContainerComponent: Component { if let currentIndex = component.slice.allItems.firstIndex(where: { $0.storyItem.id == component.slice.item.storyItem.id }) { if index != currentIndex { let nextId = component.slice.allItems[index].storyItem.id - self.awaitingSwitchToId = (component.slice.allItems[currentIndex].storyItem.id, nextId) + //self.awaitingSwitchToId = (component.slice.allItems[currentIndex].storyItem.id, nextId) component.navigate(.id(nextId)) } } @@ -1598,12 +1598,25 @@ public final class StoryItemSetContainerComponent: Component { } var footerPanelY: CGFloat = self.itemsContainerView.frame.minY + itemLayout.contentFrame.center.y + itemLayout.contentFrame.height * 0.5 * itemScale - footerPanelY += (1.0 - footerExpandFraction) * 4.0 + footerExpandFraction * (-41.0) + let footerPanelMinScale: CGFloat = (1.0 - scaleFraction) + (itemLayout.sideVisibleItemScale / itemLayout.contentMinScale) * scaleFraction + let footerPanelScale = itemLayout.contentScaleFraction * footerPanelMinScale + 1.0 * (1.0 - itemLayout.contentScaleFraction) + + footerPanelY += (footerSize.height - footerSize.height * footerPanelScale) * 0.5 + let footerPanelFrame = CGRect(origin: CGPoint(x: itemPositionX - footerSize.width * 0.5, y: footerPanelY), size: footerSize) - itemTransition.setFrame(view: footerPanelView, frame: footerPanelFrame) - itemTransition.setAlpha(view: footerPanelView, alpha: 1.0 - itemLayout.contentOverflowFraction) + + itemTransition.setPosition(view: footerPanelView, position: footerPanelFrame.center) + itemTransition.setBounds(view: footerPanelView, bounds: CGRect(origin: CGPoint(), size: footerPanelFrame.size)) + itemTransition.setScale(view: footerPanelView, scale: footerPanelScale) + + var footerAlpha: CGFloat = 1.0 - itemLayout.contentOverflowFraction + if component.hideUI || self.isEditingStory { + footerAlpha = 0.0 + } + + itemTransition.setAlpha(view: footerPanelView, alpha: footerAlpha) } } else if let footerPanel = visibleItem.footerPanel { visibleItem.footerPanel = nil @@ -3034,7 +3047,7 @@ public final class StoryItemSetContainerComponent: Component { guard let self else { return } - self.presentStoriesUpgradeScreen() + self.presentStoriesUpgradeScreen(source: .storiesPermanentViews) }, setIsSearchActive: { [weak self] value in guard let self else { @@ -4718,7 +4731,7 @@ public final class StoryItemSetContainerComponent: Component { } switch action { case .info: - self.presentStoriesUpgradeScreen() + self.presentStoriesUpgradeScreen(source: .storiesDownload) return true default: break @@ -4733,11 +4746,11 @@ public final class StoryItemSetContainerComponent: Component { guard let self else { return } - self.presentStoriesUpgradeScreen() + self.presentStoriesUpgradeScreen(source: .storiesStealthMode) }) } - private func presentStoriesUpgradeScreen() { + private func presentStoriesUpgradeScreen(source: PremiumSource) { guard let component = self.component else { return } @@ -4751,7 +4764,7 @@ public final class StoryItemSetContainerComponent: Component { return } - let controller = PremiumIntroScreen(context: context, source: .stories, forceDark: true) + let controller = PremiumIntroScreen(context: context, source: source, forceDark: true) self.sendMessageContext.actionSheet = controller controller.wasDismissed = { [weak self, weak controller]in guard let self else { diff --git a/submodules/TelegramUI/Sources/SharedAccountContext.swift b/submodules/TelegramUI/Sources/SharedAccountContext.swift index f24cb93861..26c6f7e7d9 100644 --- a/submodules/TelegramUI/Sources/SharedAccountContext.swift +++ b/submodules/TelegramUI/Sources/SharedAccountContext.swift @@ -1779,6 +1779,16 @@ public final class SharedAccountContextImpl: SharedAccountContext { mappedSource = .translation case .stories: mappedSource = .stories + case .storiesDownload: + mappedSource = .storiesDownload + case .storiesStealthMode: + mappedSource = .storiesStealthMode + case .storiesPermanentViews: + mappedSource = .storiesPermanentViews + case .storiesFormatting: + mappedSource = .storiesFormatting + case .storiesExpirationDurations: + mappedSource = .storiesExpirationDurations } let controller = PremiumIntroScreen(context: context, source: mappedSource, forceDark: forceDark) controller.wasDismissed = dismissed