mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-06 17:00:13 +00:00
Various fixes
This commit is contained in:
parent
c9e8fe831a
commit
28b0334952
@ -14731,6 +14731,12 @@ Sorry for the inconvenience.";
|
|||||||
"PeerInfo.Gifts.EmptyCollection.Text" = "Add some gifts to this collection.";
|
"PeerInfo.Gifts.EmptyCollection.Text" = "Add some gifts to this collection.";
|
||||||
"PeerInfo.Gifts.EmptyCollection.Action" = "Add to Collection";
|
"PeerInfo.Gifts.EmptyCollection.Action" = "Add to Collection";
|
||||||
|
|
||||||
|
"PeerInfo.Gifts.AddedToCollection" = "The gift has been added to **%@**.";
|
||||||
|
"PeerInfo.Gifts.RemovedFromCollection" = "The gift has been removed from **%@**.";
|
||||||
|
|
||||||
|
"PeerInfo.Gifts.AddedToCollectionUnique" = "**%1$@** has been added to **%2$@**.";
|
||||||
|
"PeerInfo.Gifts.RemovedFromCollectionUnique" = "**%1$@** has been removed from **%2$@**.";
|
||||||
|
|
||||||
"AddGifts.Title" = "Add Gifts";
|
"AddGifts.Title" = "Add Gifts";
|
||||||
"AddGifts.AddGifts_1" = "Add %@ Gift";
|
"AddGifts.AddGifts_1" = "Add %@ Gift";
|
||||||
"AddGifts.AddGifts_any" = "Add %@ Gifts";
|
"AddGifts.AddGifts_any" = "Add %@ Gifts";
|
||||||
|
|||||||
@ -3096,13 +3096,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
|||||||
products.append(PremiumProduct(option: option, storeProduct: product))
|
products.append(PremiumProduct(option: option, storeProduct: product))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO:release
|
|
||||||
if let product = availableProducts.first(where: { $0.id.hasSuffix(".annual") }) {
|
|
||||||
let (currency, price) = product.priceCurrencyAndAmount
|
|
||||||
products.insert(PremiumProduct(option: PremiumPromoConfiguration.PremiumProductOption(isCurrent: false, months: 24, currency: currency, amount: price * 2, botUrl: "", transactionId: nil, availableForUpgrade: true, storeProductId: "org.telegram.telegramPremium.biannual"), storeProduct: product), at: 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
strongSelf.products = products
|
strongSelf.products = products
|
||||||
strongSelf.isPremium = forceHasPremium || isPremium
|
strongSelf.isPremium = forceHasPremium || isPremium
|
||||||
strongSelf.otherPeerName = otherPeerName
|
strongSelf.otherPeerName = otherPeerName
|
||||||
|
|||||||
@ -11364,7 +11364,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
let canReorderEquals = lhs.2 == rhs.2
|
let canReorderEquals = lhs.2 == rhs.2
|
||||||
return filterEquals && sortingEquals && canReorderEquals
|
return filterEquals && sortingEquals && canReorderEquals
|
||||||
})
|
})
|
||||||
|> map { [weak self, weak pane, weak giftsContext] filter, sorting, canReorder -> ContextController.Items in
|
|> map { [weak pane, weak giftsContext] filter, sorting, canReorder -> ContextController.Items in
|
||||||
var items: [ContextMenuItem] = []
|
var items: [ContextMenuItem] = []
|
||||||
|
|
||||||
if hasVisibility {
|
if hasVisibility {
|
||||||
@ -11389,13 +11389,12 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
}
|
}
|
||||||
})))
|
})))
|
||||||
|
|
||||||
items.append(.action(ContextMenuActionItem(text: strings.PeerInfo_Gifts_ShareCollection, icon: { theme in
|
// items.append(.action(ContextMenuActionItem(text: strings.PeerInfo_Gifts_ShareCollection, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor)
|
// return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor)
|
||||||
}, action: { [weak self] _, f in
|
// }, action: { [weak self] _, f in
|
||||||
f(.default)
|
// f(.default)
|
||||||
//TODO:release
|
// self?.openShareLink(url: "https://t.me/")
|
||||||
self?.openShareLink(url: "https://t.me/")
|
// })))
|
||||||
})))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if canReorder {
|
if canReorder {
|
||||||
|
|||||||
@ -408,6 +408,13 @@ final class GiftsListView: UIView {
|
|||||||
}
|
}
|
||||||
return self.updateScrolling(interactive: interactive, topInset: topInset, visibleBounds: visibleBounds, transition: transition)
|
return self.updateScrolling(interactive: interactive, topInset: topInset, visibleBounds: visibleBounds, transition: transition)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||||
|
if let topInset = self.topInset, point.y < topInset {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return super.point(inside: point, with: event)
|
||||||
|
}
|
||||||
|
|
||||||
func updateScrolling(interactive: Bool = false, topInset: CGFloat, visibleBounds: CGRect, transition: ComponentTransition) -> CGFloat {
|
func updateScrolling(interactive: Bool = false, topInset: CGFloat, visibleBounds: CGRect, transition: ComponentTransition) -> CGFloat {
|
||||||
self.topInset = topInset
|
self.topInset = topInset
|
||||||
|
|||||||
@ -184,7 +184,11 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
self.scrollNode.view.contentInsetAdjustmentBehavior = .never
|
self.scrollNode.view.contentInsetAdjustmentBehavior = .never
|
||||||
self.scrollNode.view.delegate = self
|
self.scrollNode.view.delegate = self
|
||||||
|
|
||||||
self.scrollNode.view.insertSubview(self.giftsListView, at: 0)
|
if let tabSelectorView = self.tabSelector.view {
|
||||||
|
self.scrollNode.view.insertSubview(self.giftsListView, aboveSubview: tabSelectorView)
|
||||||
|
} else {
|
||||||
|
self.scrollNode.view.insertSubview(self.giftsListView, at: 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func item(at point: CGPoint) -> (AnyHashable, ComponentView<Empty>)? {
|
private func item(at point: CGPoint) -> (AnyHashable, ComponentView<Empty>)? {
|
||||||
@ -211,6 +215,10 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
}
|
}
|
||||||
if let collection {
|
if let collection {
|
||||||
self.setCurrentCollection(collection: .collection(collection.id))
|
self.setCurrentCollection(collection: .collection(collection.id))
|
||||||
|
|
||||||
|
if let tabSelectorView = self.tabSelector.view as? TabSelectorComponent.View {
|
||||||
|
tabSelectorView.scrollToEnd()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -230,6 +238,10 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
|
|
||||||
self?.setCurrentCollection(collection: .all)
|
self?.setCurrentCollection(collection: .all)
|
||||||
let _ = self?.profileGiftsCollections.deleteCollection(id: id).start()
|
let _ = self?.profileGiftsCollections.deleteCollection(id: id).start()
|
||||||
|
|
||||||
|
if let tabSelectorView = self?.tabSelector.view as? TabSelectorComponent.View {
|
||||||
|
tabSelectorView.scrollToStart()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
]),
|
]),
|
||||||
ActionSheetItemGroup(items: [
|
ActionSheetItemGroup(items: [
|
||||||
@ -468,20 +480,21 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
}
|
}
|
||||||
f(.default)
|
f(.default)
|
||||||
|
|
||||||
self.renameCollection(id: id)
|
Queue.mainQueue().after(0.15) {
|
||||||
|
self.renameCollection(id: id)
|
||||||
|
}
|
||||||
})))
|
})))
|
||||||
|
|
||||||
items.append(.action(ContextMenuActionItem(text: params.presentationData.strings.PeerInfo_Gifts_ShareCollection, icon: { theme in
|
// items.append(.action(ContextMenuActionItem(text: params.presentationData.strings.PeerInfo_Gifts_ShareCollection, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.actionSheet.primaryTextColor)
|
// return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.actionSheet.primaryTextColor)
|
||||||
}, action: { [weak self] _, f in
|
// }, action: { [weak self] _, f in
|
||||||
guard let self else {
|
// guard let self else {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
f(.default)
|
// f(.default)
|
||||||
|
//
|
||||||
//TODO:release
|
// let _ = self
|
||||||
let _ = self
|
// })))
|
||||||
})))
|
|
||||||
|
|
||||||
items.append(.action(ContextMenuActionItem(text: params.presentationData.strings.PeerInfo_Gifts_Reorder, icon: { theme in
|
items.append(.action(ContextMenuActionItem(text: params.presentationData.strings.PeerInfo_Gifts_Reorder, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReorderItems"), color: theme.actionSheet.primaryTextColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReorderItems"), color: theme.actionSheet.primaryTextColor)
|
||||||
@ -502,7 +515,9 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
}
|
}
|
||||||
f(.default)
|
f(.default)
|
||||||
|
|
||||||
self.deleteCollection(id: id)
|
Queue.mainQueue().after(0.15) {
|
||||||
|
self.deleteCollection(id: id)
|
||||||
|
}
|
||||||
})))
|
})))
|
||||||
|
|
||||||
let contextController = ContextController(
|
let contextController = ContextController(
|
||||||
@ -640,7 +655,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
if let tabSelectorView = self.tabSelector.view {
|
if let tabSelectorView = self.tabSelector.view {
|
||||||
if tabSelectorView.superview == nil {
|
if tabSelectorView.superview == nil {
|
||||||
tabSelectorView.alpha = 1.0
|
tabSelectorView.alpha = 1.0
|
||||||
self.scrollNode.view.addSubview(tabSelectorView)
|
self.scrollNode.view.insertSubview(tabSelectorView, at: 0)
|
||||||
|
|
||||||
if !transition.animation.isImmediate {
|
if !transition.animation.isImmediate {
|
||||||
tabSelectorView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
|
tabSelectorView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
|
||||||
@ -957,10 +972,52 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
}, iconPosition: collection.icon == nil ? .left : .right, action: { [weak self] _, f in
|
}, iconPosition: collection.icon == nil ? .left : .right, action: { [weak self] _, f in
|
||||||
f(.default)
|
f(.default)
|
||||||
|
|
||||||
|
guard let self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if isAdded, let giftReference = gift.reference {
|
if isAdded, let giftReference = gift.reference {
|
||||||
let _ = self?.profileGiftsCollections.removeGifts(id: collection.id, gifts: [giftReference]).start()
|
let _ = self.profileGiftsCollections.removeGifts(id: collection.id, gifts: [giftReference]).start()
|
||||||
} else {
|
} else {
|
||||||
let _ = self?.profileGiftsCollections.addGifts(id: collection.id, gifts: [gift]).start()
|
let _ = self.profileGiftsCollections.addGifts(id: collection.id, gifts: [gift]).start()
|
||||||
|
}
|
||||||
|
|
||||||
|
var giftFile: TelegramMediaFile?
|
||||||
|
var giftTitle: String?
|
||||||
|
switch gift.gift {
|
||||||
|
case let .generic(gift):
|
||||||
|
giftFile = gift.file
|
||||||
|
case let .unique(uniqueGift):
|
||||||
|
giftTitle = uniqueGift.title + " #\(presentationStringsFormattedNumber(uniqueGift.number, currentParams.presentationData.dateTimeFormat.groupingSeparator))"
|
||||||
|
for attribute in uniqueGift.attributes {
|
||||||
|
if case let .model(_, file, _) = attribute {
|
||||||
|
giftFile = file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let giftFile {
|
||||||
|
let text: String
|
||||||
|
if let giftTitle {
|
||||||
|
if isAdded {
|
||||||
|
text = currentParams.presentationData.strings.PeerInfo_Gifts_RemovedFromCollectionUnique(giftTitle, collection.title).string
|
||||||
|
} else {
|
||||||
|
text = currentParams.presentationData.strings.PeerInfo_Gifts_AddedToCollectionUnique(giftTitle, collection.title).string
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if isAdded {
|
||||||
|
text = currentParams.presentationData.strings.PeerInfo_Gifts_RemovedFromCollection(collection.title).string
|
||||||
|
} else {
|
||||||
|
text = currentParams.presentationData.strings.PeerInfo_Gifts_AddedToCollection(collection.title).string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let undoController = UndoOverlayController(
|
||||||
|
presentationData: currentParams.presentationData,
|
||||||
|
content: .sticker(context: self.context, file: giftFile, loop: false, title: nil, text: text, undoText: nil, customAction: nil),
|
||||||
|
action: { _ in return true }
|
||||||
|
)
|
||||||
|
self.parentController?.present(undoController, in: .current)
|
||||||
}
|
}
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
@ -1370,14 +1427,12 @@ private final class CollectionTabItemComponent: Component {
|
|||||||
let titleSize = self.title.update(
|
let titleSize = self.title.update(
|
||||||
transition: .immediate,
|
transition: .immediate,
|
||||||
component: AnyComponent(MultilineTextComponent(
|
component: AnyComponent(MultilineTextComponent(
|
||||||
text: .plain(NSAttributedString(string: component.title, font: Font.semibold(14.0), textColor: .white))
|
text: .plain(NSAttributedString(string: component.title, font: Font.semibold(14.0), textColor: component.theme.list.itemSecondaryTextColor))
|
||||||
)),
|
)),
|
||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: availableSize.width, height: 100.0)
|
containerSize: CGSize(width: availableSize.width, height: 100.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
let tintColor = component.theme.list.itemSecondaryTextColor
|
|
||||||
|
|
||||||
var iconOffset: CGFloat = 0.0
|
var iconOffset: CGFloat = 0.0
|
||||||
var iconSize = CGSize()
|
var iconSize = CGSize()
|
||||||
if let icon = component.icon {
|
if let icon = component.icon {
|
||||||
@ -1411,7 +1466,7 @@ private final class CollectionTabItemComponent: Component {
|
|||||||
transition: .immediate,
|
transition: .immediate,
|
||||||
component: AnyComponent(BundleIconComponent(
|
component: AnyComponent(BundleIconComponent(
|
||||||
name: "Chat/Input/Media/PanelBadgeAdd",
|
name: "Chat/Input/Media/PanelBadgeAdd",
|
||||||
tintColor: tintColor
|
tintColor: component.theme.list.itemSecondaryTextColor
|
||||||
)),
|
)),
|
||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: 100.0, height: 100.0)
|
containerSize: CGSize(width: 100.0, height: 100.0)
|
||||||
@ -1447,8 +1502,6 @@ private final class CollectionTabItemComponent: Component {
|
|||||||
self.addSubview(titleView)
|
self.addSubview(titleView)
|
||||||
}
|
}
|
||||||
titleView.frame = titleFrame
|
titleView.frame = titleFrame
|
||||||
|
|
||||||
transition.setTintColor(layer: titleView.layer, color: tintColor)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let size: CGSize
|
let size: CGSize
|
||||||
|
|||||||
@ -483,6 +483,14 @@ public final class TabSelectorComponent: Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func scrollToStart() {
|
||||||
|
self.setContentOffset(.zero, animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func scrollToEnd() {
|
||||||
|
self.setContentOffset(CGPoint(x: self.contentSize.width - self.bounds.width, y: 0.0), animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
func update(component: TabSelectorComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
func update(component: TabSelectorComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||||
let selectionColorUpdated = component.colors.selection != self.component?.colors.selection
|
let selectionColorUpdated = component.colors.selection != self.component?.colors.selection
|
||||||
|
|
||||||
|
|||||||
@ -128,8 +128,7 @@ extension ChatControllerImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if "".isEmpty {
|
if canReplyInChat(self.presentationInterfaceState, accountPeerId: self.context.account.peerId) {
|
||||||
//TODO:release
|
|
||||||
items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.Chat_Todo_ReplyToItem, icon: { theme in
|
items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.Chat_Todo_ReplyToItem, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Reply"), color: theme.actionSheet.primaryTextColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Reply"), color: theme.actionSheet.primaryTextColor)
|
||||||
}, action: { [weak self] c, _ in
|
}, action: { [weak self] c, _ in
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user