mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
4cca16b10d
commit
e6ba681c03
@ -1615,11 +1615,6 @@ public final class ChatListNode: ListView {
|
|||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Queue.mainQueue().after(0.6) { [weak self] in
|
|
||||||
if let self {
|
|
||||||
let _ = dismissServerProvidedSuggestion(account: self.context.account, suggestion: .xmasPremiumGift).startStandalone()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let controller = self.context.sharedContext.makePremiumGiftController(context: self.context)
|
let controller = self.context.sharedContext.makePremiumGiftController(context: self.context)
|
||||||
self.push?(controller)
|
self.push?(controller)
|
||||||
}, openActiveSessions: { [weak self] in
|
}, openActiveSessions: { [weak self] in
|
||||||
|
@ -12,7 +12,7 @@ public enum ServerProvidedSuggestion: String {
|
|||||||
case upgradePremium = "PREMIUM_UPGRADE"
|
case upgradePremium = "PREMIUM_UPGRADE"
|
||||||
case annualPremium = "PREMIUM_ANNUAL"
|
case annualPremium = "PREMIUM_ANNUAL"
|
||||||
case restorePremium = "PREMIUM_RESTORE"
|
case restorePremium = "PREMIUM_RESTORE"
|
||||||
case xmasPremiumGift = "PREMIUM_GIFT_XMAS"
|
case xmasPremiumGift = "PREMIUM_CHRISTMAS"
|
||||||
}
|
}
|
||||||
|
|
||||||
private var dismissedSuggestionsPromise = ValuePromise<[AccountRecordId: Set<ServerProvidedSuggestion>]>([:])
|
private var dismissedSuggestionsPromise = ValuePromise<[AccountRecordId: Set<ServerProvidedSuggestion>]>([:])
|
||||||
|
@ -924,7 +924,8 @@ final class ChannelAppearanceScreenComponent: Component {
|
|||||||
|
|
||||||
var chatPreviewTheme: PresentationTheme = environment.theme
|
var chatPreviewTheme: PresentationTheme = environment.theme
|
||||||
var chatPreviewWallpaper: TelegramWallpaper = presentationData.chatWallpaper
|
var chatPreviewWallpaper: TelegramWallpaper = presentationData.chatWallpaper
|
||||||
if let temporaryPeerWallpaper = self.temporaryPeerWallpaper {
|
if let updatedWallpaper = self.updatedPeerWallpaper, case .remove = updatedWallpaper {
|
||||||
|
} else if let temporaryPeerWallpaper = self.temporaryPeerWallpaper {
|
||||||
chatPreviewWallpaper = temporaryPeerWallpaper
|
chatPreviewWallpaper = temporaryPeerWallpaper
|
||||||
} else if let resolvedCurrentTheme = self.resolvedCurrentTheme {
|
} else if let resolvedCurrentTheme = self.resolvedCurrentTheme {
|
||||||
chatPreviewTheme = resolvedCurrentTheme.theme
|
chatPreviewTheme = resolvedCurrentTheme.theme
|
||||||
@ -1070,7 +1071,7 @@ final class ChannelAppearanceScreenComponent: Component {
|
|||||||
selectedWallpaper: selectedWallpaper,
|
selectedWallpaper: selectedWallpaper,
|
||||||
currentTheme: currentTheme,
|
currentTheme: currentTheme,
|
||||||
updatedTheme: { [weak self] value in
|
updatedTheme: { [weak self] value in
|
||||||
guard let self else {
|
guard let self, value != .builtin(.day) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.currentTheme = value
|
self.currentTheme = value
|
||||||
|
@ -401,7 +401,12 @@ public final class ThemeGridController: ViewController {
|
|||||||
self.controllerNode.requestDeactivateSearch = { [weak self] in
|
self.controllerNode.requestDeactivateSearch = { [weak self] in
|
||||||
self?.deactivateSearch(animated: true)
|
self?.deactivateSearch(animated: true)
|
||||||
}
|
}
|
||||||
|
self.controllerNode.requestWallpaperRemoval = { [weak self] in
|
||||||
|
if let self {
|
||||||
|
self.completion(.remove)
|
||||||
|
self.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
self.controllerNode.gridNode.visibleContentOffsetChanged = { [weak self] offset in
|
self.controllerNode.gridNode.visibleContentOffsetChanged = { [weak self] offset in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if let searchContentNode = strongSelf.searchContentNode {
|
if let searchContentNode = strongSelf.searchContentNode {
|
||||||
|
@ -30,12 +30,14 @@ final class ThemeGridControllerInteraction {
|
|||||||
let deleteSelectedWallpapers: () -> Void
|
let deleteSelectedWallpapers: () -> Void
|
||||||
let shareSelectedWallpapers: () -> Void
|
let shareSelectedWallpapers: () -> Void
|
||||||
var selectionState: (Bool, Set<ThemeGridControllerEntry.StableId>) = (false, Set())
|
var selectionState: (Bool, Set<ThemeGridControllerEntry.StableId>) = (false, Set())
|
||||||
|
var removeWallpaper: () -> Void
|
||||||
|
|
||||||
init(openWallpaper: @escaping (TelegramWallpaper) -> Void, toggleWallpaperSelection: @escaping (ThemeGridControllerEntry.StableId, Bool) -> Void, deleteSelectedWallpapers: @escaping () -> Void, shareSelectedWallpapers: @escaping () -> Void) {
|
init(openWallpaper: @escaping (TelegramWallpaper) -> Void, toggleWallpaperSelection: @escaping (ThemeGridControllerEntry.StableId, Bool) -> Void, deleteSelectedWallpapers: @escaping () -> Void, shareSelectedWallpapers: @escaping () -> Void, removeWallpaper: @escaping () -> Void) {
|
||||||
self.openWallpaper = openWallpaper
|
self.openWallpaper = openWallpaper
|
||||||
self.toggleWallpaperSelection = toggleWallpaperSelection
|
self.toggleWallpaperSelection = toggleWallpaperSelection
|
||||||
self.deleteSelectedWallpapers = deleteSelectedWallpapers
|
self.deleteSelectedWallpapers = deleteSelectedWallpapers
|
||||||
self.shareSelectedWallpapers = shareSelectedWallpapers
|
self.shareSelectedWallpapers = shareSelectedWallpapers
|
||||||
|
self.removeWallpaper = removeWallpaper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +163,7 @@ final class ThemeGridControllerNode: ASDisplayNode {
|
|||||||
private let resetWallpapers: () -> Void
|
private let resetWallpapers: () -> Void
|
||||||
|
|
||||||
var requestDeactivateSearch: (() -> Void)?
|
var requestDeactivateSearch: (() -> Void)?
|
||||||
|
var requestWallpaperRemoval: (() -> Void)?
|
||||||
|
|
||||||
let ready = ValuePromise<Bool>()
|
let ready = ValuePromise<Bool>()
|
||||||
private let wallpapersPromise = Promise<[Wallpaper]>()
|
private let wallpapersPromise = Promise<[Wallpaper]>()
|
||||||
@ -262,8 +265,9 @@ final class ThemeGridControllerNode: ASDisplayNode {
|
|||||||
self.galleryItemNode = ItemListPeerActionItemNode()
|
self.galleryItemNode = ItemListPeerActionItemNode()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var removeImpl: (() -> Void)?
|
||||||
self.removeItem = ItemListPeerActionItem(presentationData: ItemListPresentationData(presentationData), icon: generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionTrash"), color: presentationData.theme.list.itemDestructiveColor), title: presentationData.strings.Wallpaper_ChannelRemoveBackground, alwaysPlain: false, hasSeparator: true, sectionId: 0, height: .generic, color: .destructive, editing: false, action: {
|
self.removeItem = ItemListPeerActionItem(presentationData: ItemListPresentationData(presentationData), icon: generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionTrash"), color: presentationData.theme.list.itemDestructiveColor), title: presentationData.strings.Wallpaper_ChannelRemoveBackground, alwaysPlain: false, hasSeparator: true, sectionId: 0, height: .generic, color: .destructive, editing: false, action: {
|
||||||
presentGallery()
|
removeImpl?()
|
||||||
})
|
})
|
||||||
self.removeItemNode = ItemListPeerActionItemNode()
|
self.removeItemNode = ItemListPeerActionItemNode()
|
||||||
|
|
||||||
@ -390,6 +394,10 @@ final class ThemeGridControllerNode: ASDisplayNode {
|
|||||||
if let strongSelf = self, let entries = entries {
|
if let strongSelf = self, let entries = entries {
|
||||||
shareWallpapers(selectedWallpapers(entries: entries, state: strongSelf.currentState))
|
shareWallpapers(selectedWallpapers(entries: entries, state: strongSelf.currentState))
|
||||||
}
|
}
|
||||||
|
}, removeWallpaper: { [weak self] in
|
||||||
|
if let self {
|
||||||
|
self.requestWallpaperRemoval?()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
self.controllerInteraction = interaction
|
self.controllerInteraction = interaction
|
||||||
|
|
||||||
@ -516,6 +524,10 @@ final class ThemeGridControllerNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
removeImpl = { [weak self] in
|
||||||
|
self?.controllerInteraction?.removeWallpaper()
|
||||||
|
}
|
||||||
|
|
||||||
self.updateWallpapers()
|
self.updateWallpapers()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,6 +553,8 @@ final class ThemeGridControllerNode: ASDisplayNode {
|
|||||||
highlightedNode = strongSelf.galleryItemNode
|
highlightedNode = strongSelf.galleryItemNode
|
||||||
} else if strongSelf.resetItemNode.frame.contains(point) {
|
} else if strongSelf.resetItemNode.frame.contains(point) {
|
||||||
highlightedNode = strongSelf.resetItemNode
|
highlightedNode = strongSelf.resetItemNode
|
||||||
|
} else if strongSelf.removeItemNode.frame.contains(point) {
|
||||||
|
highlightedNode = strongSelf.removeItemNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,6 +564,7 @@ final class ThemeGridControllerNode: ASDisplayNode {
|
|||||||
strongSelf.colorItemNode.setHighlighted(false, at: CGPoint(), animated: true)
|
strongSelf.colorItemNode.setHighlighted(false, at: CGPoint(), animated: true)
|
||||||
strongSelf.galleryItemNode.setHighlighted(false, at: CGPoint(), animated: true)
|
strongSelf.galleryItemNode.setHighlighted(false, at: CGPoint(), animated: true)
|
||||||
strongSelf.resetItemNode.setHighlighted(false, at: CGPoint(), animated: true)
|
strongSelf.resetItemNode.setHighlighted(false, at: CGPoint(), animated: true)
|
||||||
|
strongSelf.removeItemNode.setHighlighted(false, at: CGPoint(), animated: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -595,6 +610,8 @@ final class ThemeGridControllerNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
} else if self.resetItemNode.frame.contains(location) {
|
} else if self.resetItemNode.frame.contains(location) {
|
||||||
self.resetItem.action()
|
self.resetItem.action()
|
||||||
|
} else if self.removeItemNode.frame.contains(location) {
|
||||||
|
self.removeItem.action?()
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
@ -671,7 +688,7 @@ final class ThemeGridControllerNode: ASDisplayNode {
|
|||||||
self?.presentGallery()
|
self?.presentGallery()
|
||||||
})
|
})
|
||||||
self.removeItem = ItemListPeerActionItem(presentationData: ItemListPresentationData(presentationData), icon: generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionTrash"), color: presentationData.theme.list.itemDestructiveColor), title: presentationData.strings.Wallpaper_ChannelRemoveBackground, alwaysPlain: false, hasSeparator: true, sectionId: 0, height: .generic, color: .destructive, editing: false, action: { [weak self] in
|
self.removeItem = ItemListPeerActionItem(presentationData: ItemListPresentationData(presentationData), icon: generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionTrash"), color: presentationData.theme.list.itemDestructiveColor), title: presentationData.strings.Wallpaper_ChannelRemoveBackground, alwaysPlain: false, hasSeparator: true, sectionId: 0, height: .generic, color: .destructive, editing: false, action: { [weak self] in
|
||||||
self?.presentGallery()
|
self?.controllerInteraction?.removeWallpaper()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user