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
00516523a4
commit
ed655a3945
@ -656,7 +656,7 @@ private func dataAndStorageControllerEntries(state: DataAndStorageControllerStat
|
|||||||
entries.append(.raiseToListen(presentationData.theme, presentationData.strings.Settings_RaiseToListen, data.mediaInputSettings.enableRaiseToSpeak))
|
entries.append(.raiseToListen(presentationData.theme, presentationData.strings.Settings_RaiseToListen, data.mediaInputSettings.enableRaiseToSpeak))
|
||||||
entries.append(.raiseToListenInfo(presentationData.theme, presentationData.strings.Settings_RaiseToListenInfo))
|
entries.append(.raiseToListenInfo(presentationData.theme, presentationData.strings.Settings_RaiseToListenInfo))
|
||||||
|
|
||||||
if let contentSettingsConfiguration = contentSettingsConfiguration, contentSettingsConfiguration.canAdjustSensitiveContent {
|
if !"".isEmpty, let contentSettingsConfiguration = contentSettingsConfiguration, contentSettingsConfiguration.canAdjustSensitiveContent {
|
||||||
entries.append(.sensitiveContent(presentationData.strings.Settings_SensitiveContent, contentSettingsConfiguration.sensitiveContentEnabled))
|
entries.append(.sensitiveContent(presentationData.strings.Settings_SensitiveContent, contentSettingsConfiguration.sensitiveContentEnabled))
|
||||||
entries.append(.sensitiveContentInfo(presentationData.strings.Settings_SensitiveContentInfo))
|
entries.append(.sensitiveContentInfo(presentationData.strings.Settings_SensitiveContentInfo))
|
||||||
}
|
}
|
||||||
|
@ -33,17 +33,20 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
let starsContext: StarsContext
|
let starsContext: StarsContext
|
||||||
let peerId: EnginePeer.Id
|
let peerId: EnginePeer.Id
|
||||||
let premiumOptions: [CachedPremiumGiftOption]
|
let premiumOptions: [CachedPremiumGiftOption]
|
||||||
|
let completion: (() -> Void)?
|
||||||
|
|
||||||
init(
|
init(
|
||||||
context: AccountContext,
|
context: AccountContext,
|
||||||
starsContext: StarsContext,
|
starsContext: StarsContext,
|
||||||
peerId: EnginePeer.Id,
|
peerId: EnginePeer.Id,
|
||||||
premiumOptions: [CachedPremiumGiftOption]
|
premiumOptions: [CachedPremiumGiftOption],
|
||||||
|
completion: (() -> Void)?
|
||||||
) {
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.starsContext = starsContext
|
self.starsContext = starsContext
|
||||||
self.peerId = peerId
|
self.peerId = peerId
|
||||||
self.premiumOptions = premiumOptions
|
self.premiumOptions = premiumOptions
|
||||||
|
self.completion = completion
|
||||||
}
|
}
|
||||||
|
|
||||||
static func ==(lhs: GiftOptionsScreenComponent, rhs: GiftOptionsScreenComponent) -> Bool {
|
static func ==(lhs: GiftOptionsScreenComponent, rhs: GiftOptionsScreenComponent) -> Bool {
|
||||||
@ -293,7 +296,21 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
effectAlignment: .center,
|
effectAlignment: .center,
|
||||||
action: { [weak self] in
|
action: { [weak self] in
|
||||||
if let self, let component = self.component {
|
if let self, let component = self.component {
|
||||||
controller()?.push(GiftSetupScreen(context: component.context, peerId: component.peerId, gift: gift))
|
if let controller = controller() as? GiftOptionsScreen {
|
||||||
|
let mainController: ViewController
|
||||||
|
if let parentController = controller.parentController() {
|
||||||
|
mainController = parentController
|
||||||
|
} else {
|
||||||
|
mainController = controller
|
||||||
|
}
|
||||||
|
let giftController = GiftSetupScreen(
|
||||||
|
context: component.context,
|
||||||
|
peerId: component.peerId,
|
||||||
|
gift: gift,
|
||||||
|
completion: component.completion
|
||||||
|
)
|
||||||
|
mainController.push(giftController)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
animateAlpha: false
|
animateAlpha: false
|
||||||
@ -357,6 +374,8 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
let purpose: AppStoreTransactionPurpose = .giftCode(peerIds: [component.peerId], boostPeer: nil, currency: currency, amount: amount)
|
let purpose: AppStoreTransactionPurpose = .giftCode(peerIds: [component.peerId], boostPeer: nil, currency: currency, amount: amount)
|
||||||
let quantity: Int32 = 1
|
let quantity: Int32 = 1
|
||||||
|
|
||||||
|
let completion = component.completion
|
||||||
|
|
||||||
let _ = (component.context.engine.payments.canPurchasePremium(purpose: purpose)
|
let _ = (component.context.engine.payments.canPurchasePremium(purpose: purpose)
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] available in
|
|> deliverOnMainQueue).start(next: { [weak self] available in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
@ -364,26 +383,30 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
if available {
|
if available {
|
||||||
strongSelf.purchaseDisposable.set((inAppPurchaseManager.buyProduct(product.storeProduct, quantity: quantity, purpose: purpose)
|
strongSelf.purchaseDisposable.set((inAppPurchaseManager.buyProduct(product.storeProduct, quantity: quantity, purpose: purpose)
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] status in
|
|> deliverOnMainQueue).start(next: { [weak self] status in
|
||||||
guard let self, case .purchased = status, let controller = self.environment?.controller(), let navigationController = controller.navigationController as? NavigationController else {
|
if let completion {
|
||||||
return
|
completion()
|
||||||
}
|
} else {
|
||||||
|
guard let self, case .purchased = status, let controller = self.environment?.controller(), let navigationController = controller.navigationController as? NavigationController else {
|
||||||
var controllers = navigationController.viewControllers
|
return
|
||||||
controllers = controllers.filter { !($0 is GiftOptionsScreen) && !($0 is PeerInfoScreen) && !($0 is ContactSelectionController) }
|
|
||||||
var foundController = false
|
|
||||||
for controller in controllers.reversed() {
|
|
||||||
if let chatController = controller as? ChatController, case .peer(id: component.peerId) = chatController.chatLocation {
|
|
||||||
chatController.hintPlayNextOutgoingGift()
|
|
||||||
foundController = true
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var controllers = navigationController.viewControllers
|
||||||
|
controllers = controllers.filter { !($0 is GiftOptionsScreen) && !($0 is PeerInfoScreen) && !($0 is ContactSelectionController) }
|
||||||
|
var foundController = false
|
||||||
|
for controller in controllers.reversed() {
|
||||||
|
if let chatController = controller as? ChatController, case .peer(id: component.peerId) = chatController.chatLocation {
|
||||||
|
chatController.hintPlayNextOutgoingGift()
|
||||||
|
foundController = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !foundController {
|
||||||
|
let chatController = component.context.sharedContext.makeChatController(context: component.context, chatLocation: .peer(id: component.peerId), subject: nil, botStart: nil, mode: .standard(.default), params: nil)
|
||||||
|
chatController.hintPlayNextOutgoingGift()
|
||||||
|
controllers.append(chatController)
|
||||||
|
}
|
||||||
|
navigationController.setViewControllers(controllers, animated: true)
|
||||||
}
|
}
|
||||||
if !foundController {
|
|
||||||
let chatController = component.context.sharedContext.makeChatController(context: component.context, chatLocation: .peer(id: component.peerId), subject: nil, botStart: nil, mode: .standard(.default), params: nil)
|
|
||||||
chatController.hintPlayNextOutgoingGift()
|
|
||||||
controllers.append(chatController)
|
|
||||||
}
|
|
||||||
navigationController.setViewControllers(controllers, animated: true)
|
|
||||||
}, error: { [weak self] error in
|
}, error: { [weak self] error in
|
||||||
guard let self, let controller = self.environment?.controller() else {
|
guard let self, let controller = self.environment?.controller() else {
|
||||||
return
|
return
|
||||||
@ -454,7 +477,6 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
self.backgroundColor = environment.theme.list.blocksBackgroundColor
|
self.backgroundColor = environment.theme.list.blocksBackgroundColor
|
||||||
}
|
}
|
||||||
|
|
||||||
// let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
|
||||||
let theme = environment.theme
|
let theme = environment.theme
|
||||||
let strings = environment.strings
|
let strings = environment.strings
|
||||||
|
|
||||||
@ -651,7 +673,16 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
let introController = component.context.sharedContext.makePremiumIntroController(context: component.context, source: .settings, forceDark: false, dismissed: nil)
|
let introController = component.context.sharedContext.makePremiumIntroController(context: component.context, source: .settings, forceDark: false, dismissed: nil)
|
||||||
introController.navigationPresentation = .modal
|
introController.navigationPresentation = .modal
|
||||||
environment.controller()?.push(introController)
|
|
||||||
|
if let controller = environment.controller() as? GiftOptionsScreen {
|
||||||
|
let mainController: ViewController
|
||||||
|
if let parentController = controller.parentController() {
|
||||||
|
mainController = parentController
|
||||||
|
} else {
|
||||||
|
mainController = controller
|
||||||
|
}
|
||||||
|
mainController.push(introController)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
environment: {},
|
environment: {},
|
||||||
@ -814,7 +845,16 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
let introController = component.context.sharedContext.makeStarsIntroScreen(context: component.context)
|
let introController = component.context.sharedContext.makeStarsIntroScreen(context: component.context)
|
||||||
introController.navigationPresentation = .modal
|
introController.navigationPresentation = .modal
|
||||||
environment.controller()?.push(introController)
|
|
||||||
|
if let controller = environment.controller() as? GiftOptionsScreen {
|
||||||
|
let mainController: ViewController
|
||||||
|
if let parentController = controller.parentController() {
|
||||||
|
mainController = parentController
|
||||||
|
} else {
|
||||||
|
mainController = controller
|
||||||
|
}
|
||||||
|
mainController.push(introController)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
environment: {},
|
environment: {},
|
||||||
@ -835,17 +875,25 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
id: AnyHashable(StarsFilter.all.rawValue),
|
id: AnyHashable(StarsFilter.all.rawValue),
|
||||||
title: "All Gifts"
|
title: "All Gifts"
|
||||||
))
|
))
|
||||||
tabSelectorItems.append(TabSelectorComponent.Item(
|
|
||||||
id: AnyHashable(StarsFilter.limited.rawValue),
|
|
||||||
title: "Limited"
|
|
||||||
))
|
|
||||||
|
|
||||||
|
var hasLimited = false
|
||||||
var starsAmountsSet = Set<Int64>()
|
var starsAmountsSet = Set<Int64>()
|
||||||
if let starGifts = self.state?.starGifts {
|
if let starGifts = self.state?.starGifts {
|
||||||
for product in starGifts {
|
for product in starGifts {
|
||||||
starsAmountsSet.insert(product.price)
|
starsAmountsSet.insert(product.price)
|
||||||
|
if product.availability != nil {
|
||||||
|
hasLimited = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if hasLimited {
|
||||||
|
tabSelectorItems.append(TabSelectorComponent.Item(
|
||||||
|
id: AnyHashable(StarsFilter.limited.rawValue),
|
||||||
|
title: "Limited"
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
let starsAmounts = Array(starsAmountsSet).sorted()
|
let starsAmounts = Array(starsAmountsSet).sorted()
|
||||||
for amount in starsAmounts {
|
for amount in starsAmounts {
|
||||||
tabSelectorItems.append(TabSelectorComponent.Item(
|
tabSelectorItems.append(TabSelectorComponent.Item(
|
||||||
@ -1014,12 +1062,16 @@ final class GiftOptionsScreenComponent: Component {
|
|||||||
open class GiftOptionsScreen: ViewControllerComponentContainer, GiftOptionsScreenProtocol {
|
open class GiftOptionsScreen: ViewControllerComponentContainer, GiftOptionsScreenProtocol {
|
||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
|
|
||||||
|
public var parentController: () -> ViewController? = {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
public init(
|
public init(
|
||||||
context: AccountContext,
|
context: AccountContext,
|
||||||
starsContext: StarsContext,
|
starsContext: StarsContext,
|
||||||
peerId: EnginePeer.Id,
|
peerId: EnginePeer.Id,
|
||||||
premiumOptions: [CachedPremiumGiftOption],
|
premiumOptions: [CachedPremiumGiftOption],
|
||||||
completion: @escaping () -> Void = {}
|
completion: (() -> Void)? = nil
|
||||||
) {
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
|
|
||||||
@ -1027,7 +1079,8 @@ open class GiftOptionsScreen: ViewControllerComponentContainer, GiftOptionsScree
|
|||||||
context: context,
|
context: context,
|
||||||
starsContext: starsContext,
|
starsContext: starsContext,
|
||||||
peerId: peerId,
|
peerId: peerId,
|
||||||
premiumOptions: premiumOptions
|
premiumOptions: premiumOptions,
|
||||||
|
completion: completion
|
||||||
), navigationBarAppearance: .none, theme: .default, updatedPresentationData: nil)
|
), navigationBarAppearance: .none, theme: .default, updatedPresentationData: nil)
|
||||||
|
|
||||||
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.context.sharedContext.currentPresentationData.with { $0 }.strings.Common_Back, style: .plain, target: nil, action: nil)
|
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.context.sharedContext.currentPresentationData.with { $0 }.strings.Common_Back, style: .plain, target: nil, action: nil)
|
||||||
|
@ -34,15 +34,18 @@ final class GiftSetupScreenComponent: Component {
|
|||||||
let context: AccountContext
|
let context: AccountContext
|
||||||
let peerId: EnginePeer.Id
|
let peerId: EnginePeer.Id
|
||||||
let gift: StarGift
|
let gift: StarGift
|
||||||
|
let completion: (() -> Void)?
|
||||||
|
|
||||||
init(
|
init(
|
||||||
context: AccountContext,
|
context: AccountContext,
|
||||||
peerId: EnginePeer.Id,
|
peerId: EnginePeer.Id,
|
||||||
gift: StarGift
|
gift: StarGift,
|
||||||
|
completion: (() -> Void)? = nil
|
||||||
) {
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.peerId = peerId
|
self.peerId = peerId
|
||||||
self.gift = gift
|
self.gift = gift
|
||||||
|
self.completion = completion
|
||||||
}
|
}
|
||||||
|
|
||||||
static func ==(lhs: GiftSetupScreenComponent, rhs: GiftSetupScreenComponent) -> Bool {
|
static func ==(lhs: GiftSetupScreenComponent, rhs: GiftSetupScreenComponent) -> Bool {
|
||||||
@ -202,6 +205,8 @@ final class GiftSetupScreenComponent: Component {
|
|||||||
return .single(nil)
|
return .single(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let completion = component.completion
|
||||||
|
|
||||||
let _ = (inputData
|
let _ = (inputData
|
||||||
|> deliverOnMainQueue).startStandalone(next: { [weak self] inputData in
|
|> deliverOnMainQueue).startStandalone(next: { [weak self] inputData in
|
||||||
guard let inputData else {
|
guard let inputData else {
|
||||||
@ -209,26 +214,34 @@ final class GiftSetupScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
let _ = (component.context.engine.payments.sendStarsPaymentForm(formId: inputData.form.id, source: source)
|
let _ = (component.context.engine.payments.sendStarsPaymentForm(formId: inputData.form.id, source: source)
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] result in
|
|> deliverOnMainQueue).start(next: { [weak self] result in
|
||||||
guard let self, let controller = self.environment?.controller(), let navigationController = controller.navigationController as? NavigationController else {
|
if let completion {
|
||||||
return
|
completion()
|
||||||
}
|
|
||||||
|
if let self, let controller = self.environment?.controller() {
|
||||||
var controllers = navigationController.viewControllers
|
controller.dismiss()
|
||||||
controllers = controllers.filter { !($0 is GiftSetupScreen) && !($0 is GiftOptionsScreenProtocol) && !($0 is PeerInfoScreen) && !($0 is ContactSelectionController) }
|
|
||||||
var foundController = false
|
|
||||||
for controller in controllers.reversed() {
|
|
||||||
if let chatController = controller as? ChatController, case .peer(id: component.peerId) = chatController.chatLocation {
|
|
||||||
chatController.hintPlayNextOutgoingGift()
|
|
||||||
foundController = true
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
guard let self, let controller = self.environment?.controller(), let navigationController = controller.navigationController as? NavigationController else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var controllers = navigationController.viewControllers
|
||||||
|
controllers = controllers.filter { !($0 is GiftSetupScreen) && !($0 is GiftOptionsScreenProtocol) && !($0 is PeerInfoScreen) && !($0 is ContactSelectionController) }
|
||||||
|
var foundController = false
|
||||||
|
for controller in controllers.reversed() {
|
||||||
|
if let chatController = controller as? ChatController, case .peer(id: component.peerId) = chatController.chatLocation {
|
||||||
|
chatController.hintPlayNextOutgoingGift()
|
||||||
|
foundController = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !foundController {
|
||||||
|
let chatController = component.context.sharedContext.makeChatController(context: component.context, chatLocation: .peer(id: component.peerId), subject: nil, botStart: nil, mode: .standard(.default), params: nil)
|
||||||
|
chatController.hintPlayNextOutgoingGift()
|
||||||
|
controllers.append(chatController)
|
||||||
|
}
|
||||||
|
navigationController.setViewControllers(controllers, animated: true)
|
||||||
}
|
}
|
||||||
if !foundController {
|
|
||||||
let chatController = component.context.sharedContext.makeChatController(context: component.context, chatLocation: .peer(id: component.peerId), subject: nil, botStart: nil, mode: .standard(.default), params: nil)
|
|
||||||
chatController.hintPlayNextOutgoingGift()
|
|
||||||
controllers.append(chatController)
|
|
||||||
}
|
|
||||||
navigationController.setViewControllers(controllers, animated: true)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1028,18 +1041,19 @@ public final class GiftSetupScreen: ViewControllerComponentContainer {
|
|||||||
public init(
|
public init(
|
||||||
context: AccountContext,
|
context: AccountContext,
|
||||||
peerId: EnginePeer.Id,
|
peerId: EnginePeer.Id,
|
||||||
gift: StarGift
|
gift: StarGift,
|
||||||
|
completion: (() -> Void)? = nil
|
||||||
) {
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
|
|
||||||
super.init(context: context, component: GiftSetupScreenComponent(
|
super.init(context: context, component: GiftSetupScreenComponent(
|
||||||
context: context,
|
context: context,
|
||||||
peerId: peerId,
|
peerId: peerId,
|
||||||
gift: gift
|
gift: gift,
|
||||||
|
completion: completion
|
||||||
), navigationBarAppearance: .default, theme: .default, updatedPresentationData: nil)
|
), navigationBarAppearance: .default, theme: .default, updatedPresentationData: nil)
|
||||||
|
|
||||||
self.title = ""
|
self.title = ""
|
||||||
//self.navigationItem.backBarButtonItem = UIBarButtonItem(title: presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
|
|
||||||
|
|
||||||
self.scrollToTop = { [weak self] in
|
self.scrollToTop = { [weak self] in
|
||||||
guard let self, let componentView = self.node.hostView.componentView as? GiftSetupScreenComponent.View else {
|
guard let self, let componentView = self.node.hostView.componentView as? GiftSetupScreenComponent.View else {
|
||||||
|
@ -38,11 +38,12 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
private let backgroundNode: ASDisplayNode
|
private let backgroundNode: ASDisplayNode
|
||||||
private let scrollNode: ASScrollNode
|
private let scrollNode: ASScrollNode
|
||||||
|
|
||||||
private var unlockBackground: UIImageView?
|
private var unlockBackground: ASDisplayNode?
|
||||||
|
private var unlockSeparator: ASDisplayNode?
|
||||||
private var unlockText: ComponentView<Empty>?
|
private var unlockText: ComponentView<Empty>?
|
||||||
private var unlockButton: SolidRoundedButtonNode?
|
private var unlockButton: SolidRoundedButtonNode?
|
||||||
|
|
||||||
private var currentParams: (size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, isScrollingLockedAtTop: Bool, presentationData: PresentationData)?
|
private var currentParams: (size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, isScrollingLockedAtTop: Bool, presentationData: PresentationData)?
|
||||||
|
|
||||||
private var theme: PresentationTheme?
|
private var theme: PresentationTheme?
|
||||||
private let presentationDataPromise = Promise<PresentationData>()
|
private let presentationDataPromise = Promise<PresentationData>()
|
||||||
@ -257,7 +258,8 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
self.theme = presentationData.theme
|
self.theme = presentationData.theme
|
||||||
|
|
||||||
let unlockText: ComponentView<Empty>
|
let unlockText: ComponentView<Empty>
|
||||||
let unlockBackground: UIImageView
|
let unlockBackground: ASDisplayNode
|
||||||
|
let unlockSeparator: ASDisplayNode
|
||||||
let unlockButton: SolidRoundedButtonNode
|
let unlockButton: SolidRoundedButtonNode
|
||||||
if let current = self.unlockText {
|
if let current = self.unlockText {
|
||||||
unlockText = current
|
unlockText = current
|
||||||
@ -269,11 +271,18 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
if let current = self.unlockBackground {
|
if let current = self.unlockBackground {
|
||||||
unlockBackground = current
|
unlockBackground = current
|
||||||
} else {
|
} else {
|
||||||
unlockBackground = UIImageView()
|
unlockBackground = ASDisplayNode()
|
||||||
unlockBackground.contentMode = .scaleToFill
|
self.addSubnode(unlockBackground)
|
||||||
self.view.addSubview(unlockBackground)
|
|
||||||
self.unlockBackground = unlockBackground
|
self.unlockBackground = unlockBackground
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let current = self.unlockSeparator {
|
||||||
|
unlockSeparator = current
|
||||||
|
} else {
|
||||||
|
unlockSeparator = ASDisplayNode()
|
||||||
|
self.addSubnode(unlockSeparator)
|
||||||
|
self.unlockSeparator = unlockSeparator
|
||||||
|
}
|
||||||
|
|
||||||
if let current = self.unlockButton {
|
if let current = self.unlockButton {
|
||||||
unlockButton = current
|
unlockButton = current
|
||||||
@ -291,9 +300,8 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
}
|
}
|
||||||
|
|
||||||
if themeUpdated {
|
if themeUpdated {
|
||||||
let topColor = presentationData.theme.list.plainBackgroundColor.withAlphaComponent(0.0)
|
unlockBackground.backgroundColor = presentationData.theme.rootController.tabBar.backgroundColor
|
||||||
let bottomColor = presentationData.theme.list.plainBackgroundColor
|
unlockSeparator.backgroundColor = presentationData.theme.rootController.tabBar.separatorColor
|
||||||
unlockBackground.image = generateGradientImage(size: CGSize(width: 1.0, height: 170.0), colors: [topColor, bottomColor, bottomColor], locations: [0.0, 0.3, 1.0])
|
|
||||||
unlockButton.updateTheme(SolidRoundedButtonTheme(theme: presentationData.theme))
|
unlockButton.updateTheme(SolidRoundedButtonTheme(theme: presentationData.theme))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,15 +313,16 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
let scrollOffset: CGFloat = min(0.0, self.scrollNode.view.contentOffset.y + bottomInset + 80.0)
|
let scrollOffset: CGFloat = max(0.0, size.height - params.visibleHeight)
|
||||||
|
|
||||||
transition.setFrame(view: unlockBackground, frame: CGRect(x: 0.0, y: size.height - bottomInset - 170.0 + scrollOffset, width: size.width, height: bottomInset + 170.0))
|
|
||||||
|
|
||||||
let buttonSideInset = sideInset + 16.0
|
let buttonSideInset = sideInset + 16.0
|
||||||
let buttonSize = CGSize(width: size.width - buttonSideInset * 2.0, height: 50.0)
|
let buttonSize = CGSize(width: size.width - buttonSideInset * 2.0, height: 50.0)
|
||||||
transition.setFrame(view: unlockButton.view, frame: CGRect(origin: CGPoint(x: buttonSideInset, y: size.height - bottomInset - buttonSize.height - 26.0), size: buttonSize))
|
transition.setFrame(view: unlockButton.view, frame: CGRect(origin: CGPoint(x: buttonSideInset, y: size.height - bottomInset - buttonSize.height - scrollOffset), size: buttonSize))
|
||||||
let _ = unlockButton.updateLayout(width: buttonSize.width, transition: .immediate)
|
let _ = unlockButton.updateLayout(width: buttonSize.width, transition: .immediate)
|
||||||
|
|
||||||
|
transition.setFrame(view: unlockBackground.view, frame: CGRect(x: 0.0, y: size.height - bottomInset - buttonSize.height - 8.0 - scrollOffset, width: size.width, height: bottomInset + buttonSize.height + 8.0))
|
||||||
|
transition.setFrame(view: unlockSeparator.view, frame: CGRect(x: 0.0, y: size.height - bottomInset - buttonSize.height - 8.0 - scrollOffset, width: size.width, height: UIScreenPixel))
|
||||||
|
|
||||||
let unlockSize = unlockText.update(
|
let unlockSize = unlockText.update(
|
||||||
transition: .immediate,
|
transition: .immediate,
|
||||||
component: AnyComponent(
|
component: AnyComponent(
|
||||||
@ -364,7 +373,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func update(size: CGSize, topInset: CGFloat, sideInset: CGFloat, bottomInset: CGFloat, deviceMetrics: DeviceMetrics, visibleHeight: CGFloat, isScrollingLockedAtTop: Bool, expandProgress: CGFloat, navigationHeight: CGFloat, presentationData: PresentationData, synchronous: Bool, transition: ContainedViewLayoutTransition) {
|
public func update(size: CGSize, topInset: CGFloat, sideInset: CGFloat, bottomInset: CGFloat, deviceMetrics: DeviceMetrics, visibleHeight: CGFloat, isScrollingLockedAtTop: Bool, expandProgress: CGFloat, navigationHeight: CGFloat, presentationData: PresentationData, synchronous: Bool, transition: ContainedViewLayoutTransition) {
|
||||||
self.currentParams = (size, sideInset, bottomInset, isScrollingLockedAtTop, presentationData)
|
self.currentParams = (size, sideInset, bottomInset, visibleHeight, isScrollingLockedAtTop, presentationData)
|
||||||
self.presentationDataPromise.set(.single(presentationData))
|
self.presentationDataPromise.set(.single(presentationData))
|
||||||
|
|
||||||
self.backgroundNode.backgroundColor = presentationData.theme.list.blocksBackgroundColor
|
self.backgroundNode.backgroundColor = presentationData.theme.list.blocksBackgroundColor
|
||||||
|
@ -11,9 +11,6 @@ import GiftOptionsScreen
|
|||||||
public class PremiumGiftAttachmentScreen: GiftOptionsScreen, AttachmentContainable {
|
public class PremiumGiftAttachmentScreen: GiftOptionsScreen, AttachmentContainable {
|
||||||
public var requestAttachmentMenuExpansion: () -> Void = {}
|
public var requestAttachmentMenuExpansion: () -> Void = {}
|
||||||
public var updateNavigationStack: (@escaping ([AttachmentContainable]) -> ([AttachmentContainable], AttachmentMediaPickerContext?)) -> Void = { _ in }
|
public var updateNavigationStack: (@escaping ([AttachmentContainable]) -> ([AttachmentContainable], AttachmentMediaPickerContext?)) -> Void = { _ in }
|
||||||
public var parentController: () -> ViewController? = {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
public var updateTabBarAlpha: (CGFloat, ContainedViewLayoutTransition) -> Void = { _, _ in }
|
public var updateTabBarAlpha: (CGFloat, ContainedViewLayoutTransition) -> Void = { _, _ in }
|
||||||
public var updateTabBarVisibility: (Bool, ContainedViewLayoutTransition) -> Void = { _, _ in }
|
public var updateTabBarVisibility: (Bool, ContainedViewLayoutTransition) -> Void = { _, _ in }
|
||||||
public var cancelPanGesture: () -> Void = { }
|
public var cancelPanGesture: () -> Void = { }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user