Cherry-pick various fixes

This commit is contained in:
Ilya Laktyushin 2024-04-03 13:25:15 +04:00
parent 9c3a6d0506
commit 78a0365a1e
3 changed files with 5 additions and 6 deletions

View File

@ -854,7 +854,7 @@ public func createGiveawayController(context: AccountContext, updatedPresentatio
let expiryDate = calendar.date(byAdding: .day, value: 3, to: calendar.date(from: components)!)!
let expiryTime = Int32(expiryDate.timeIntervalSince1970)
let minDate = currentTime + 60 * 30
let minDate = currentTime + 60 * 1
let maxDate = currentTime + context.userLimits.maxGiveawayPeriodSeconds
let initialState: CreateGiveawayControllerState = CreateGiveawayControllerState(mode: .giveaway, subscriptions: initialSubscriptions, time: expiryTime)
@ -1099,7 +1099,9 @@ public func createGiveawayController(context: AccountContext, updatedPresentatio
let quantity: Int32
switch state.mode {
case .giveaway:
purpose = .giveaway(boostPeer: peerId, additionalPeerIds: state.channels.filter { $0 != peerId }, countries: state.countries, onlyNewSubscribers: state.onlyNewEligible, showWinners: state.showWinners, prizeDescription: state.prizeDescription.isEmpty ? nil : state.prizeDescription, randomId: Int64.random(in: .min ..< .max), untilDate: state.time, currency: currency, amount: amount)
let currentTime = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970)
let untilDate = max(state.time, currentTime + 60)
purpose = .giveaway(boostPeer: peerId, additionalPeerIds: state.channels.filter { $0 != peerId }, countries: state.countries, onlyNewSubscribers: state.onlyNewEligible, showWinners: state.showWinners, prizeDescription: state.prizeDescription.isEmpty ? nil : state.prizeDescription, randomId: Int64.random(in: .min ..< .max), untilDate: untilDate, currency: currency, amount: amount)
quantity = selectedProduct.giftOption.storeQuantity
case .gift:
purpose = .giftCode(peerIds: state.peers, boostPeer: peerId, currency: currency, amount: amount)

View File

@ -230,7 +230,7 @@ private class AdMessagesHistoryContextImpl {
self.sponsorInfo = try container.decodeIfPresent(String.self, forKey: .sponsorInfo)
self.additionalInfo = try container.decodeIfPresent(String.self, forKey: .additionalInfo)
self.canReport = try container.decodeIfPresent(Bool.self, forKey: .displayAvatar) ?? false
self.canReport = try container.decodeIfPresent(Bool.self, forKey: .canReport) ?? false
}
public func encode(to encoder: Encoder) throws {

View File

@ -510,9 +510,6 @@ public final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContent
break
}
}
if adAttribute.displayAvatar && adAttribute.canReport, let profileImage = item.message.author?.smallProfileImage {
mediaAndFlags = (TelegramMediaImage(imageId: MediaId(namespace: 0, id: 0), representations: [profileImage], immediateThumbnailData: nil, reference: nil, partialReference: nil, flags: []), [.preferMediaInline])
}
if adAttribute.canReport {
titleBadge = item.presentationData.strings.Message_AdWhatIsThis