mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Paid media improvements
This commit is contained in:
parent
829174356f
commit
837de5b1c2
@ -12454,3 +12454,9 @@ Sorry for the inconvenience.";
|
|||||||
"Premium.MessageEffectsInfo" = "Add over 500 animated effects to private messages.";
|
"Premium.MessageEffectsInfo" = "Add over 500 animated effects to private messages.";
|
||||||
|
|
||||||
"Chat.UnlockMedia" = "Unlock for %@";
|
"Chat.UnlockMedia" = "Unlock for %@";
|
||||||
|
|
||||||
|
"Attachment.SendWithoutGrouping" = "Send Without Grouping";
|
||||||
|
"Attachment.Paid.EditPrice" = "Edit Price";
|
||||||
|
"Attachment.Paid.EditPrice.Stars_1" = "%@ Star";
|
||||||
|
"Attachment.Paid.EditPrice.Stars_any" = "%@ Stars";
|
||||||
|
"Attachment.Paid.Create" = "Make This Content Paid";
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
- (instancetype)initWithGroupingAllowed:(bool)allowGrouping selectionLimit:(int)selectionLimit;
|
- (instancetype)initWithGroupingAllowed:(bool)allowGrouping selectionLimit:(int)selectionLimit;
|
||||||
|
|
||||||
@property (nonatomic, readonly) bool allowGrouping;
|
@property (nonatomic, readonly) bool allowGrouping;
|
||||||
@property (nonatomic, readonly) int selectionLimit;
|
@property (nonatomic, assign) int selectionLimit;
|
||||||
@property (nonatomic, copy) void (^selectionLimitExceeded)(void);
|
@property (nonatomic, copy) void (^selectionLimitExceeded)(void);
|
||||||
@property (nonatomic, copy) bool (^attemptSelectingItem)(id<TGMediaSelectableItem>);
|
@property (nonatomic, copy) bool (^attemptSelectingItem)(id<TGMediaSelectableItem>);
|
||||||
|
|
||||||
|
@ -2488,7 +2488,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
|||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
if selectionCount > 1, price == nil {
|
if selectionCount > 1, price == nil {
|
||||||
items.append(.action(ContextMenuActionItem(text: "Send Without Grouping", icon: { theme in
|
items.append(.action(ContextMenuActionItem(text: strings.Attachment_SendWithoutGrouping, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Media Grid/GroupingOff"), color: theme.contextMenu.primaryColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Media Grid/GroupingOff"), color: theme.contextMenu.primaryColor)
|
||||||
}, action: { [weak self] _, f in
|
}, action: { [weak self] _, f in
|
||||||
f(.default)
|
f(.default)
|
||||||
@ -2499,7 +2499,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isPaidAvailable = false
|
var isPaidAvailable = false
|
||||||
if let peer = self.peer, case let .channel(channel) = peer, case .broadcast = channel.info {
|
if let peer = self.peer, case let .channel(channel) = peer, case .broadcast = channel.info, selectionCount <= 10 {
|
||||||
isPaidAvailable = true
|
isPaidAvailable = true
|
||||||
}
|
}
|
||||||
if isSpoilerAvailable || isPaidAvailable || (selectionCount > 0 && isCaptionAboveMediaAvailable) {
|
if isSpoilerAvailable || isPaidAvailable || (selectionCount > 0 && isCaptionAboveMediaAvailable) {
|
||||||
@ -2547,10 +2547,10 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
|||||||
let title: String
|
let title: String
|
||||||
let titleLayout: ContextMenuActionItemTextLayout
|
let titleLayout: ContextMenuActionItemTextLayout
|
||||||
if let price {
|
if let price {
|
||||||
title = "Edit Price"
|
title = strings.Attachment_Paid_EditPrice
|
||||||
titleLayout = .secondLineWithValue("\(price) Stars")
|
titleLayout = .secondLineWithValue(strings.Attachment_Paid_EditPrice_Stars(Int32(price)))
|
||||||
} else {
|
} else {
|
||||||
title = "Make This Content Paid"
|
title = strings.Attachment_Paid_Create
|
||||||
titleLayout = .singleLine
|
titleLayout = .singleLine
|
||||||
}
|
}
|
||||||
items.append(.action(ContextMenuActionItem(text: title, textLayout: titleLayout, icon: { theme in
|
items.append(.action(ContextMenuActionItem(text: title, textLayout: titleLayout, icon: { theme in
|
||||||
@ -2566,6 +2566,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if let selectionContext = strongSelf.interaction?.selectionState, let editingContext = strongSelf.interaction?.editingState {
|
if let selectionContext = strongSelf.interaction?.selectionState, let editingContext = strongSelf.interaction?.editingState {
|
||||||
|
selectionContext.selectionLimit = 10
|
||||||
for case let item as TGMediaEditableItem in selectionContext.selectedItems() {
|
for case let item as TGMediaEditableItem in selectionContext.selectedItems() {
|
||||||
editingContext.setPrice(NSNumber(value: amount), for: item)
|
editingContext.setPrice(NSNumber(value: amount), for: item)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user