diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 2ea56abc86..606e528a26 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -10663,7 +10663,7 @@ Sorry for the inconvenience."; "Story.ViewList.ContextSortChannelInfo" = "Choose the order for the list of reactions."; -"Premium.Gift.MultipleDescription" = "Get **%1$@**%2$@ access to exclusive features with **Telegram Premium**."; +"Premium.Gift.MultipleDescription" = "Get %1$@%2$@ access to exclusive features with **Telegram Premium**."; "Premium.Gift.NamesAndMore_1" = " and %@ more"; "Premium.Gift.NamesAndMore_any" = " and %@ more"; @@ -10684,3 +10684,5 @@ Sorry for the inconvenience."; "Message.GiveawayEndedWinners_1" = "%@ winner of the giveaway was randomly selected by Telegram"; "Message.GiveawayEndedWinners_any" = "%@ winners of the giveaway was randomly selected by Telegram"; "Message.GiveawayEndedNoWinners" = "Due to the giveaway terms, no winners could be selected by Telegram"; + +"Story.ViewMessage" = "View Message"; diff --git a/submodules/PremiumUI/Sources/CreateGiveawayController.swift b/submodules/PremiumUI/Sources/CreateGiveawayController.swift index c780bee94d..cd331d7da2 100644 --- a/submodules/PremiumUI/Sources/CreateGiveawayController.swift +++ b/submodules/PremiumUI/Sources/CreateGiveawayController.swift @@ -501,7 +501,7 @@ private enum CreateGiveawayEntry: ItemListNodeEntry { } }) case let .prizeDescriptionText(_, placeholder, value, count): - return ItemListSingleLineInputItem(presentationData: presentationData, title: NSAttributedString(string: "\(count)"), text: value, placeholder: placeholder, returnKeyType: .done, spacing: 24.0, tag: CreateGiveawayEntryTag.description, sectionId: self.section, textUpdated: { value in + return ItemListSingleLineInputItem(presentationData: presentationData, title: NSAttributedString(string: "\(count)"), text: value, placeholder: placeholder, returnKeyType: .done, spacing: 24.0, maxLength: 128, tag: CreateGiveawayEntryTag.description, sectionId: self.section, textUpdated: { value in arguments.updateState { state in var updatedState = state updatedState.prizeDescription = value diff --git a/submodules/PremiumUI/Sources/GiftAvatarComponent.swift b/submodules/PremiumUI/Sources/GiftAvatarComponent.swift index 5a21c535cd..e3fd75b997 100644 --- a/submodules/PremiumUI/Sources/GiftAvatarComponent.swift +++ b/submodules/PremiumUI/Sources/GiftAvatarComponent.swift @@ -266,7 +266,7 @@ class GiftAvatarComponent: Component { } mergedAvatarsNode.update(context: component.context, peers: Array(component.peers.map { $0._asPeer() }.prefix(3)), synchronousLoad: false, imageSize: avatarSize.width, imageSpacing: 30.0, borderWidth: 2.0, avatarFontSize: 26.0) - let avatarsSize = CGSize(width: avatarSize.width + 60.0, height: avatarSize.height) + let avatarsSize = CGSize(width: avatarSize.width + 30.0 * CGFloat(min(3, component.peers.count) - 1), height: avatarSize.height) mergedAvatarsNode.updateLayout(size: avatarsSize) mergedAvatarsNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((availableSize.width - avatarsSize.width) / 2.0), y: 113.0 - avatarSize.height / 2.0), size: avatarsSize) self.avatarNode.isHidden = true diff --git a/submodules/PremiumUI/Sources/PremiumGiftScreen.swift b/submodules/PremiumUI/Sources/PremiumGiftScreen.swift index bb06a80b32..fb60900031 100644 --- a/submodules/PremiumUI/Sources/PremiumGiftScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumGiftScreen.swift @@ -222,7 +222,7 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent { } else { names.append(environment.strings.CreateGroup_PeersTitleLastDelimeter) } - names.append(context.component.peers[i].compactDisplayTitle) + names.append("**\(context.component.peers[i].compactDisplayTitle)**") } descriptionString = environment.strings.Premium_Gift_MultipleDescription(names, "").string } else { @@ -233,10 +233,9 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent { } else { names.append(environment.strings.CreateGroup_PeersTitleDelimeter) } - names.append(context.component.peers[i].compactDisplayTitle) + names.append("**\(context.component.peers[i].compactDisplayTitle)**") } let more = environment.strings.Premium_Gift_NamesAndMore(Int32(context.component.peers.count - 3)) - descriptionString = environment.strings.Premium_Gift_MultipleDescription(names, more).string } } else { @@ -996,7 +995,7 @@ private final class PremiumGiftScreenComponent: CombinedComponent { let price: String? if let products = state.products, let selectedProductId = state.selectedProductId, let product = products.first(where: { $0.id == selectedProductId }) { - price = product.price + price = product.storeProduct.multipliedPrice(count: context.component.peerIds.count) } else { price = nil } diff --git a/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift b/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift index 47765cad02..dc9083423c 100644 --- a/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift +++ b/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift @@ -1130,6 +1130,8 @@ public final class SolidRoundedButtonView: UIView { strongSelf.iconNode.alpha = 0.55 strongSelf.animationNode?.layer.removeAnimation(forKey: "opacity") strongSelf.animationNode?.alpha = 0.55 + strongSelf.badgeNode?.layer.removeAnimation(forKey: "opacity") + strongSelf.badgeNode?.alpha = 0.55 } else { if strongSelf.buttonBackgroundNode.alpha > 0.0 { strongSelf.buttonBackgroundNode.alpha = 1.0 @@ -1142,6 +1144,8 @@ public final class SolidRoundedButtonView: UIView { strongSelf.iconNode.layer.animateAlpha(from: 0.55, to: 1.0, duration: 0.2) strongSelf.animationNode?.alpha = 1.0 strongSelf.animationNode?.layer.animateAlpha(from: 0.55, to: 1.0, duration: 0.2) + strongSelf.badgeNode?.alpha = 1.0 + strongSelf.badgeNode?.layer.animateAlpha(from: 0.55, to: 1.0, duration: 0.2) } } } diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift index 8161639e43..db0b78557c 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift @@ -8726,6 +8726,9 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro case .premium: self.controller?.push(PremiumIntroScreen(context: self.context, modal: false, source: .settings)) case .premiumGift: + let options = Promise<[PremiumGiftCodeOption]>() + options.set(self.context.engine.payments.premiumGiftCodeOptions(peerId: nil)) + let controller = self.context.sharedContext.makeContactMultiselectionController(ContactMultiselectionControllerParams(context: self.context, mode: .premiumGifting, options: [], isPeerEnabled: { peer in if case let .user(user) = peer, user.botInfo == nil { return true @@ -8734,8 +8737,8 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro } })) self.controller?.push(controller) - self.activeActionDisposable.set((controller.result - |> deliverOnMainQueue).startStrict(next: { [weak self, weak controller] result in + self.activeActionDisposable.set(combineLatest(queue: Queue.mainQueue(), controller.result, options.get()) + .startStrict(next: { [weak self, weak controller] result, options in guard let self, let controller else { return } @@ -8758,7 +8761,9 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro return } - let giftController = PremiumGiftScreen(context: self.context, peerIds: peerIds, options: [], source: .settings, pushController: { [weak self] c in + let mappedOptions = options.filter { $0.users == 1 }.map { CachedPremiumGiftOption(months: $0.months, currency: $0.currency, amount: $0.amount, botUrl: "", storeProductId: $0.storeProductId) } + + let giftController = PremiumGiftScreen(context: self.context, peerIds: peerIds, options: mappedOptions, source: .settings, pushController: { [weak self] c in self?.controller?.push(c) }, completion: { [weak self] in if let self, let navigationController = self.controller?.navigationController as? NavigationController, peerIds.count == 1, let peerId = peerIds.first {