Skip to content

Commit

Permalink
Merge commit '5d26ed41c46d351e3bba18aec94a749b74485d8c' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali committed Nov 8, 2023
2 parents 4bf19ef + 5d26ed4 commit b6e9899
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 57 deletions.
19 changes: 16 additions & 3 deletions Telegram/Telegram-iOS/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -10215,9 +10215,9 @@ Sorry for the inconvenience.";
"ReassignBoost.ExpiresOn" = "Boost expires on %@";
"ReassignBoost.WaitForCooldown" = "Wait until the boost is available or get **%1$@** more boosts by gifting a **Telegram Premium** subscription.";

"ReassignBoost.Success" = "%1$@ are reassigned from %2$@.";
"ReassignBoost.Boosts_1" = "%@ boost";
"ReassignBoost.Boosts_any" = "%@ boosts";
"ReassignBoost.Success" = "%1$@ from %2$@.";
"ReassignBoost.Boosts_1" = "%@ boost is reassigned";
"ReassignBoost.Boosts_any" = "%@ boosts are reassigned";
"ReassignBoost.OtherChannels_1" = "%@ other channel";
"ReassignBoost.OtherChannels_any" = "%@ other channels";

Expand Down Expand Up @@ -10433,6 +10433,10 @@ Sorry for the inconvenience.";
"CountriesList.SaveCountries" = "Save Countries";
"CountriesList.SelectUpTo_1" = "select up to %@ country";
"CountriesList.SelectUpTo_any" = "select up to %@ countries";
"CountriesList.Search" = "Search";
"CountriesList.MaximumReached" = "You can select up to %@.";
"CountriesList.MaximumReached.Countries_1" = "%@ country";
"CountriesList.MaximumReached.Countries_any" = "%@ countries";

"Message.GiveawayOngoing" = "Giveaway: %1$@ on %2$@";
"Message.GiveawayOngoing.Winners_1" = "%@ winner to be selected";
Expand All @@ -10442,6 +10446,9 @@ Sorry for the inconvenience.";
"Message.GiveawayFinished.Winners_1" = "%@ winner was selected";
"Message.GiveawayFinished.Winners_any" = "%@ winners were selected";

"Message.GiveawayStarted" = "Channel started a giveaway";
"Message.GiveawayStartedOther" = "%@ started a giveaway";

"Conversation.PinnedGiveaway" = "Giveaway";

"Conversation.PinnedGiveaway.Ongoing" = "%1$@ on %2$@";
Expand All @@ -10451,3 +10458,9 @@ Sorry for the inconvenience.";
"Conversation.PinnedGiveaway.Finished" = "%1$@ on %2$@";
"Conversation.PinnedGiveaway.Finished.Winners_1" = "%@ winner was selected";
"Conversation.PinnedGiveaway.Finished.Winners_any" = "%@ winners were selected";

"BoostGift.StartConfirmation.Title" = "Start Giveaway";
"BoostGift.StartConfirmation.Text" = "Are you sure you want to start giveaway now?";
"BoostGift.StartConfirmation.Start" = "Start";

"Channel.Info.Stats" = "Statistics and Boosts";
13 changes: 4 additions & 9 deletions submodules/ChatListUI/Sources/Node/ChatListItemStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,11 @@ public func chatListItemStrings(strings: PresentationStrings, nameDisplayOrder:
} else {
messageText = strings.Notification_Story
}
case let giveaway as TelegramMediaGiveaway:
let dateString = stringForDateWithoutYear(date: Date(timeIntervalSince1970: TimeInterval(giveaway.untilDate)), timeZone: .current, strings: strings)
let currentTime = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970)
let isFinished = currentTime >= giveaway.untilDate
if isFinished {
let winnersString = strings.Message_GiveawayFinished_Winners(giveaway.quantity)
messageText = strings.Message_GiveawayFinished(winnersString, dateString).string
case _ as TelegramMediaGiveaway:
if let forwardInfo = message.forwardInfo, let author = forwardInfo.author {
messageText = strings.Message_GiveawayStartedOther(EnginePeer(author).compactDisplayTitle).string
} else {
let winnersString = strings.Message_GiveawayOngoing_Winners(giveaway.quantity)
messageText = strings.Message_GiveawayOngoing(winnersString, dateString).string
messageText = strings.Message_GiveawayStarted
}
case let webpage as TelegramMediaWebpage:
if messageText.isEmpty, case let .Loaded(content) = webpage.content {
Expand Down
9 changes: 8 additions & 1 deletion submodules/PremiumUI/Sources/CreateGiveawayController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,14 @@ public func createGiveawayController(context: AccountContext, updatedPresentatio
badgeCount = Int32(state.peers.count) * 4
}
let footerItem = CreateGiveawayFooterItem(theme: presentationData.theme, title: state.mode == .gift ? presentationData.strings.BoostGift_GiftPremium : presentationData.strings.BoostGift_StartGiveaway, badgeCount: badgeCount, isLoading: state.updating, action: {
buyActionImpl?()
if case .prepaid = subject {
let alertController = textAlertController(context: context, title: presentationData.strings.BoostGift_StartConfirmation_Title, text: presentationData.strings.BoostGift_StartConfirmation_Text, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.BoostGift_StartConfirmation_Start, action: {
buyActionImpl?()
})], parseMarkdown: true)
presentControllerImpl?(alertController)
} else {
buyActionImpl?()
}
})
let leftNavigationButton = ItemListNavigationButton(content: .none, style: .regular, enabled: false, action: {})

Expand Down
4 changes: 3 additions & 1 deletion submodules/PremiumUI/Sources/GiftOptionItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,14 @@ class GiftOptionItemNode: ItemListRevealOptionsItemNode {
let (labelLayout, labelApply) = makeLabelLayout(TextNodeLayoutArguments(attributedString: labelAttributedString, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width, height: .greatestFiniteMagnitude)))

var textConstrainedWidth = params.width - leftInset - 8.0 - editingOffset - rightInset - labelLayout.size.width - avatarInset
var subtitleConstrainedWidth = textConstrainedWidth
if let label = item.label, case .semitransparent = label {
textConstrainedWidth -= 54.0
subtitleConstrainedWidth -= 30.0
}

let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: textConstrainedWidth, height: .greatestFiniteMagnitude)))
let (statusLayout, statusApply) = makeStatusLayout(TextNodeLayoutArguments(attributedString: statusAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: textConstrainedWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
let (statusLayout, statusApply) = makeStatusLayout(TextNodeLayoutArguments(attributedString: statusAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: subtitleConstrainedWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))

let (badgeLayout, badgeApply) = makeBadgeLayout(TextNodeLayoutArguments(attributedString: badgeAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: textConstrainedWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
for contentNodeItemValue in contentNodeMessagesAndClasses {
let contentNodeItem = contentNodeItemValue as (message: Message, type: AnyClass, attributes: ChatMessageEntryAttributes, bubbleAttributes: BubbleItemAttributes)
if contentNodeItem.type == ChatMessageGiveawayBubbleContentNode.self {
maximumContentWidth = 260.0
maximumContentWidth = min(305.0, maximumContentWidth)
break
}
if contentNodeItem.type == ChatMessageInstantVideoBubbleContentNode.self, !contentNodeItem.bubbleAttributes.isAttachment {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public class ChatMessageGiveawayBubbleContentNode: ChatMessageBubbleContentNode
let (participantsTitleLayout, participantsTitleApply) = makeParticipantsTitleLayout(TextNodeLayoutArguments(attributedString: participantsTitleString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: maxTextWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))
let (participantsTextLayout, participantsTextApply) = makeParticipantsTextLayout(TextNodeLayoutArguments(attributedString: participantsTextString, backgroundColor: nil, maximumNumberOfLines: 5, truncationType: .end, constrainedSize: CGSize(width: maxTextWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))

let (countriesTextLayout, countriesTextApply) = makeCountriesTextLayout(TextNodeLayoutArguments(attributedString: countriesTextString, backgroundColor: nil, maximumNumberOfLines: 5, truncationType: .end, constrainedSize: CGSize(width: maxTextWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))
let (countriesTextLayout, countriesTextApply) = makeCountriesTextLayout(TextNodeLayoutArguments(attributedString: countriesTextString, backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: maxTextWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))

let (dateTitleLayout, dateTitleApply) = makeDateTitleLayout(TextNodeLayoutArguments(attributedString: dateTitleString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: maxTextWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))
let (dateTextLayout, dateTextApply) = makeDateTextLayout(TextNodeLayoutArguments(attributedString: dateTextString, backgroundColor: nil, maximumNumberOfLines: 5, truncationType: .end, constrainedSize: CGSize(width: maxTextWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))
Expand Down Expand Up @@ -437,7 +437,7 @@ public class ChatMessageGiveawayBubbleContentNode: ChatMessageBubbleContentNode
}
}
}
let (channelsWidth, continueChannelLayout) = makeChannelsLayout(item.context, 220.0, channelPeers, accentColor, accentColor.withAlphaComponent(0.1))
let (channelsWidth, continueChannelLayout) = makeChannelsLayout(item.context, 220.0, channelPeers, accentColor, accentColor.withAlphaComponent(0.1), incoming, item.presentationData.theme.theme.overallDarkAppearance)
maxContentWidth = max(maxContentWidth, channelsWidth)
maxContentWidth += 30.0

Expand Down Expand Up @@ -649,11 +649,11 @@ private final class PeerButtonsStackNode: ASDisplayNode {
var buttonNodes: [PeerButtonNode] = []
var openPeer: (EnginePeer) -> Void = { _ in }

static func asyncLayout(_ current: PeerButtonsStackNode) -> (_ context: AccountContext, _ width: CGFloat, _ peers: [EnginePeer], _ titleColor: UIColor, _ backgroundColor: UIColor) -> (CGFloat, (CGFloat) -> (CGSize, () -> PeerButtonsStackNode)) {
static func asyncLayout(_ current: PeerButtonsStackNode) -> (_ context: AccountContext, _ width: CGFloat, _ peers: [EnginePeer], _ titleColor: UIColor, _ backgroundColor: UIColor, _ incoming: Bool, _ dark: Bool) -> (CGFloat, (CGFloat) -> (CGSize, () -> PeerButtonsStackNode)) {
let currentChannelButtons = current.buttonNodes.isEmpty ? nil : current.buttonNodes
let maybeMakeChannelButtons = current.buttonNodes.map(PeerButtonNode.asyncLayout)

return { context, width, peers, titleColor, backgroundColor in
return { context, width, peers, titleColor, backgroundColor, incoming, dark in
let targetNode = current

var buttonNodes: [PeerButtonNode] = []
Expand Down Expand Up @@ -682,6 +682,13 @@ private final class PeerButtonsStackNode: ASDisplayNode {
let peer = peers[i]
let makeChannelButtonLayout = makeChannelButtonLayouts[i]

var titleColor = titleColor
var backgroundColor = backgroundColor
if incoming, let nameColor = peer.nameColor {
titleColor = context.peerNameColors.get(nameColor, dark: dark).main
backgroundColor = titleColor.withAlphaComponent(0.1)
}

let (buttonWidth, buttonContinue) = makeChannelButtonLayout(context, width, peer, titleColor, backgroundColor)
sizes.append(CGSize(width: buttonWidth, height: buttonHeight))
buttonContinues.append(buttonContinue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@ final class CountriesMultiselectionScreenComponent: Component {
self.hapticFeedback.error()

let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
controller.present(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: "You can select maximum \(limit) countries.", timeout: nil, customUndoText: nil), elevatedLayout: false, position: .bottom, animateInAsReplacement: false, action: { _ in return false }), in: .current)
let countriesValue = environment.strings.CountriesList_MaximumReached_Countries(limit)
controller.present(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: environment.strings.CountriesList_MaximumReached(countriesValue).string, timeout: nil, customUndoText: nil), elevatedLayout: false, position: .bottom, animateInAsReplacement: false, action: { _ in return false }), in: .current)
return
}
toggleCountry()
Expand Down Expand Up @@ -721,7 +722,7 @@ final class CountriesMultiselectionScreenComponent: Component {
))
}

let placeholder: String = "Search"
let placeholder: String = environment.strings.CountriesList_Search
self.navigationTextField.parentState = state
let navigationTextFieldSize = self.navigationTextField.update(
transition: transition,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "stats_30.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Loading

0 comments on commit b6e9899

Please sign in to comment.