mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various improvements
This commit is contained in:
@@ -172,7 +172,7 @@ func telegramMediaFileFromApiDocument(_ document: Api.Document) -> TelegramMedia
|
||||
videoThumbnails.append(TelegramMediaFile.VideoThumbnail(
|
||||
dimensions: PixelDimensions(width: w, height: h),
|
||||
resource: resource))
|
||||
case .videoSizeEmojiMarkup:
|
||||
case .videoSizeEmojiMarkup, .videoSizeStickerMarkup:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,10 @@ func telegramMediaImageFromApiPhoto(_ photo: Api.Photo) -> TelegramMediaImage? {
|
||||
resource = CloudPhotoSizeMediaResource(datacenterId: dcId, photoId: id, accessHash: accessHash, sizeSpec: type, size: Int64(size), fileReference: fileReference.makeData())
|
||||
|
||||
videoRepresentations.append(TelegramMediaImage.VideoRepresentation(dimensions: PixelDimensions(width: w, height: h), resource: resource, startTimestamp: videoStartTs))
|
||||
case let .videoSizeEmojiMarkup(_, emojiId, backgroundColors):
|
||||
case let .videoSizeEmojiMarkup(emojiId, backgroundColors):
|
||||
emojiMarkup = TelegramMediaImage.EmojiMarkup(fileId: emojiId, backgroundColors: backgroundColors)
|
||||
case .videoSizeStickerMarkup:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,6 @@ private extension PremiumPromoConfiguration {
|
||||
|
||||
var productOptions: [PremiumProductOption] = []
|
||||
for option in options {
|
||||
|
||||
if case let .premiumSubscriptionOption(flags, transaction, months, currency, amount, botUrl, storeProduct) = option {
|
||||
productOptions.append(PremiumProductOption(isCurrent: (flags & (1 << 1)) != 0, months: months, currency: currency, amount: amount, botUrl: botUrl, transactionId: transaction, availableForUpgrade: (flags & (1 << 2)) != 0, storeProductId: storeProduct))
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ public enum ServerProvidedSuggestion: String {
|
||||
case validatePhoneNumber = "VALIDATE_PHONE_NUMBER"
|
||||
case validatePassword = "VALIDATE_PASSWORD"
|
||||
case setupPassword = "SETUP_PASSWORD"
|
||||
case upgradePremium = "PREMIUM_UPGRADE"
|
||||
case annualPremium = "PREMIUM_ANNUAL"
|
||||
}
|
||||
|
||||
private var dismissedSuggestionsPromise = ValuePromise<[AccountRecordId: Set<ServerProvidedSuggestion>]>([:])
|
||||
|
||||
@@ -69,8 +69,13 @@ func _internal_canPurchasePremium(account: Account, purpose: AppStoreTransaction
|
||||
switch purpose {
|
||||
case .subscription, .restore, .upgrade:
|
||||
var flags: Int32 = 0
|
||||
if case .restore = purpose {
|
||||
switch purpose {
|
||||
case .upgrade:
|
||||
flags |= (1 << 1)
|
||||
case .restore:
|
||||
flags |= (1 << 0)
|
||||
default:
|
||||
break
|
||||
}
|
||||
purposeSignal = .single(.inputStorePaymentPremiumSubscription(flags: flags))
|
||||
case let .gift(peerId, currency, amount):
|
||||
|
||||
@@ -4,7 +4,6 @@ import SwiftSignalKit
|
||||
import MtProtoKit
|
||||
import TelegramApi
|
||||
|
||||
|
||||
public enum UpdatePeerPhotoStatus {
|
||||
case progress(Float)
|
||||
case complete([TelegramMediaImageRepresentation])
|
||||
@@ -153,7 +152,7 @@ func _internal_updatePeerPhotoInternal(postbox: Postbox, network: Network, state
|
||||
|
||||
var videoEmojiMarkup: Api.VideoSize?
|
||||
if let fileId, let backgroundColors {
|
||||
videoEmojiMarkup = .videoSizeEmojiMarkup(type: "e", emojiId: fileId, backgroundColors: backgroundColors)
|
||||
videoEmojiMarkup = .videoSizeEmojiMarkup(emojiId: fileId, backgroundColors: backgroundColors)
|
||||
flags |= (1 << 4)
|
||||
}
|
||||
|
||||
@@ -217,7 +216,7 @@ func _internal_updatePeerPhotoInternal(postbox: Postbox, network: Network, state
|
||||
resource = CloudPhotoSizeMediaResource(datacenterId: dcId, photoId: id, accessHash: accessHash, sizeSpec: type, size: Int64(size), fileReference: fileReference.makeData())
|
||||
|
||||
videoRepresentations.append(TelegramMediaImage.VideoRepresentation(dimensions: PixelDimensions(width: w, height: h), resource: resource, startTimestamp: videoStartTs))
|
||||
case .videoSizeEmojiMarkup:
|
||||
case .videoSizeEmojiMarkup, .videoSizeStickerMarkup:
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -280,9 +279,9 @@ func _internal_updatePeerPhotoInternal(postbox: Postbox, network: Network, state
|
||||
|
||||
let request: Signal<Api.Updates, MTRpcError>
|
||||
if let peer = peer as? TelegramGroup {
|
||||
request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt64Value(), photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp)))
|
||||
request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt64Value(), photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp, videoEmojiMarkup: nil)))
|
||||
} else if let peer = peer as? TelegramChannel, let inputChannel = apiInputChannel(peer) {
|
||||
request = network.request(Api.functions.channels.editPhoto(channel: inputChannel, photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp)))
|
||||
request = network.request(Api.functions.channels.editPhoto(channel: inputChannel, photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp, videoEmojiMarkup: nil)))
|
||||
} else {
|
||||
assertionFailure()
|
||||
request = .complete()
|
||||
|
||||
Reference in New Issue
Block a user