mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various improvements
This commit is contained in:
@@ -30,6 +30,7 @@ import AudioToolbox
|
||||
import TextFormat
|
||||
import InAppPurchaseManager
|
||||
import BlurredBackgroundComponent
|
||||
import ProgressNavigationButtonNode
|
||||
|
||||
final class GiftSetupScreenComponent: Component {
|
||||
typealias EnvironmentType = ViewControllerComponentContainer.Environment
|
||||
@@ -203,7 +204,7 @@ final class GiftSetupScreenComponent: Component {
|
||||
self.buttonSeparator.opacity = Float(bottomPanelAlpha)
|
||||
}
|
||||
|
||||
func proceed() {
|
||||
@objc private func proceed() {
|
||||
guard let component = self.component else {
|
||||
return
|
||||
}
|
||||
@@ -215,7 +216,7 @@ final class GiftSetupScreenComponent: Component {
|
||||
}
|
||||
}
|
||||
|
||||
func proceedWithPremiumGift() {
|
||||
private func proceedWithPremiumGift() {
|
||||
guard let component = self.component, case let .premium(product) = component.subject, let storeProduct = product.storeProduct, let inAppPurchaseManager = component.context.inAppPurchaseManager else {
|
||||
return
|
||||
}
|
||||
@@ -304,7 +305,7 @@ final class GiftSetupScreenComponent: Component {
|
||||
})
|
||||
}
|
||||
|
||||
func proceedWithStarGift() {
|
||||
private func proceedWithStarGift() {
|
||||
guard let component = self.component, case let .starGift(starGift) = component.subject, let starsContext = component.context.starsContext, let starsState = starsContext.currentState else {
|
||||
return
|
||||
}
|
||||
@@ -450,6 +451,8 @@ final class GiftSetupScreenComponent: Component {
|
||||
self.isUpdating = false
|
||||
}
|
||||
|
||||
let peerName = self.peerMap[component.peerId]?.compactDisplayTitle ?? ""
|
||||
|
||||
if self.component == nil {
|
||||
let _ = (component.context.engine.data.get(
|
||||
TelegramEngine.EngineData.Item.Peer.Peer(id: component.peerId),
|
||||
@@ -588,26 +591,16 @@ final class GiftSetupScreenComponent: Component {
|
||||
self.component = component
|
||||
self.state = state
|
||||
|
||||
let alphaTransition: ComponentTransition
|
||||
if !transition.animation.isImmediate {
|
||||
alphaTransition = .easeInOut(duration: 0.25)
|
||||
} else {
|
||||
alphaTransition = .immediate
|
||||
}
|
||||
|
||||
if themeUpdated {
|
||||
self.backgroundColor = environment.theme.list.blocksBackgroundColor
|
||||
}
|
||||
|
||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
let _ = alphaTransition
|
||||
let _ = presentationData
|
||||
|
||||
|
||||
let navigationTitleSize = self.navigationTitle.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(string: environment.strings.Gift_Send_Title, font: Font.semibold(17.0), textColor: environment.theme.rootController.navigationBar.primaryTextColor)),
|
||||
text: .plain(NSAttributedString(string: environment.strings.Gift_Send_TitleTo(peerName).string, font: Font.semibold(17.0), textColor: environment.theme.rootController.navigationBar.primaryTextColor)),
|
||||
horizontalAlignment: .center
|
||||
)),
|
||||
environment: {},
|
||||
@@ -720,7 +713,6 @@ final class GiftSetupScreenComponent: Component {
|
||||
))))
|
||||
self.resetText = nil
|
||||
|
||||
let peerName = self.peerMap[component.peerId]?.compactDisplayTitle ?? ""
|
||||
let introFooter: AnyComponent<Empty>?
|
||||
switch component.subject {
|
||||
case .premium:
|
||||
@@ -960,6 +952,20 @@ final class GiftSetupScreenComponent: Component {
|
||||
buttonView.frame = CGRect(origin: CGPoint(x: floor((availableSize.width - buttonSize.width) / 2.0), y: availableSize.height - bottomPanelHeight + bottomPanelPadding), size: buttonSize)
|
||||
}
|
||||
|
||||
let controller = environment.controller()
|
||||
if inputHeight > 10.0 {
|
||||
if self.inProgress {
|
||||
let item = UIBarButtonItem(customDisplayNode: ProgressNavigationButtonNode(color: environment.theme.rootController.navigationBar.accentTextColor))
|
||||
controller?.navigationItem.rightBarButtonItem = item
|
||||
} else {
|
||||
let rightBarButtonItem = UIBarButtonItem(title: environment.strings.Gift_Send_SendShort, style: .done, target: self, action: #selector(self.proceed))
|
||||
rightBarButtonItem.isEnabled = buttonIsEnabled
|
||||
controller?.navigationItem.setRightBarButton(rightBarButtonItem, animated: controller?.navigationItem.rightBarButtonItem == nil)
|
||||
}
|
||||
} else {
|
||||
controller?.navigationItem.setRightBarButton(nil, animated: true)
|
||||
}
|
||||
|
||||
if self.textInputState.isEditing, let emojiSuggestion = self.textInputState.currentEmojiSuggestion, emojiSuggestion.disposable == nil {
|
||||
emojiSuggestion.disposable = (EmojiSuggestionsComponent.suggestionData(context: component.context, isSavedMessages: false, query: emojiSuggestion.position.value)
|
||||
|> deliverOnMainQueue).start(next: { [weak self, weak emojiSuggestion] result in
|
||||
@@ -1090,7 +1096,6 @@ final class GiftSetupScreenComponent: Component {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let previousBounds = self.scrollView.bounds
|
||||
|
||||
self.recenterOnTag = nil
|
||||
|
||||
Reference in New Issue
Block a user