mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Web app improvements
This commit is contained in:
@@ -188,7 +188,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
private let bannedSendPhotos: (Int32, Bool)?
|
||||
private let bannedSendVideos: (Int32, Bool)?
|
||||
private let canBoostToUnrestrict: Bool
|
||||
private let paidMediaAllowed: Bool
|
||||
fileprivate let paidMediaAllowed: Bool
|
||||
private let subject: Subject
|
||||
private let saveEditedPhotos: Bool
|
||||
|
||||
@@ -2207,7 +2207,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
})
|
||||
}
|
||||
|
||||
private var selectionCount: Int32 = 0
|
||||
fileprivate var selectionCount: Int32 = 0
|
||||
fileprivate func updateSelectionState(count: Int32) {
|
||||
self.selectionCount = count
|
||||
|
||||
@@ -2667,6 +2667,45 @@ final class MediaPickerContext: AttachmentMediaPickerContext {
|
||||
return isForcedCaption
|
||||
}
|
||||
|
||||
var canMakePaidContent: Bool {
|
||||
guard let controller = self.controller else {
|
||||
return false
|
||||
}
|
||||
var isPaidAvailable = false
|
||||
if controller.paidMediaAllowed && controller.selectionCount <= 10 {
|
||||
isPaidAvailable = true
|
||||
}
|
||||
return isPaidAvailable
|
||||
}
|
||||
|
||||
var price: Int64? {
|
||||
guard let controller = self.controller else {
|
||||
return nil
|
||||
}
|
||||
var price: Int64?
|
||||
if let selectionContext = controller.interaction?.selectionState, let editingContext = controller.interaction?.editingState {
|
||||
for case let item as TGMediaEditableItem in selectionContext.selectedItems() {
|
||||
if price == nil, let itemPrice = editingContext.price(for: item) as? Int64 {
|
||||
price = itemPrice
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return price
|
||||
}
|
||||
|
||||
func setPrice(_ price: Int64) {
|
||||
guard let controller = self.controller else {
|
||||
return
|
||||
}
|
||||
if let selectionContext = controller.interaction?.selectionState, let editingContext = controller.interaction?.editingState {
|
||||
selectionContext.selectionLimit = 10
|
||||
for case let item as TGMediaEditableItem in selectionContext.selectedItems() {
|
||||
editingContext.setPrice(NSNumber(value: price), for: item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var captionIsAboveMedia: Signal<Bool, NoError> {
|
||||
return Signal { [weak self] subscriber in
|
||||
guard let interaction = self?.controller?.interaction else {
|
||||
|
||||
Reference in New Issue
Block a user