mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Merge commit '183bc34f79'
This commit is contained in:
commit
c67ed1a009
7 changed files with 94 additions and 71 deletions
|
|
@ -347,3 +347,7 @@ public struct AccountFreezeConfiguration {
|
|||
public protocol GiftOptionsScreenProtocol {
|
||||
|
||||
}
|
||||
|
||||
public protocol GiftSetupScreenProtocol {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2047,6 +2047,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
|||
subtitle = environment.strings.Premium_PricePerYear(subtitle).string
|
||||
accessibilitySubtitle = environment.strings.Premium_PricePerYear(accessibilitySubtitle).string
|
||||
}
|
||||
subtitle = "\(environment.strings.Gift_Options_Premium_Months(product.months)) • \(product.price)"
|
||||
} else {
|
||||
subtitle = product.price
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,6 +212,7 @@ public func loginEmailSetupController(context: AccountContext, blocking: Bool, e
|
|||
}
|
||||
|
||||
dismissEmailControllerImpl = { [weak emailController] in
|
||||
dismiss()
|
||||
emailController?.dismiss()
|
||||
}
|
||||
return emailController
|
||||
|
|
|
|||
|
|
@ -584,7 +584,6 @@ private final class GiftSetupScreenComponent: Component {
|
|||
}
|
||||
navigationController.setViewControllers(controllers, animated: true)
|
||||
|
||||
|
||||
if case let .starGift(starGift, _) = component.subject, let perUserLimit = starGift.perUserLimit {
|
||||
Queue.mainQueue().after(0.5) {
|
||||
let remains = max(0, perUserLimit.remains - 1)
|
||||
|
|
@ -2019,7 +2018,7 @@ private final class GiftSetupScreenComponent: Component {
|
|||
}
|
||||
}
|
||||
|
||||
public class GiftSetupScreen: ViewControllerComponentContainer {
|
||||
public class GiftSetupScreen: ViewControllerComponentContainer, GiftSetupScreenProtocol {
|
||||
public enum Subject: Equatable {
|
||||
case premium(PremiumGiftProduct)
|
||||
case starGift(StarGift.Gift, Bool?)
|
||||
|
|
|
|||
|
|
@ -1635,7 +1635,9 @@ private final class GiftAuctionBidScreenComponent: Component {
|
|||
customUndoText: nil
|
||||
),
|
||||
position: .bottom,
|
||||
action: { _ in return true }
|
||||
action: { _ in
|
||||
return true
|
||||
}
|
||||
),
|
||||
in: .current
|
||||
)
|
||||
|
|
@ -2018,8 +2020,30 @@ private final class GiftAuctionBidScreenComponent: Component {
|
|||
self.loadAcquiredGifts()
|
||||
}
|
||||
if !isFirstTime {
|
||||
self.resetSliderValue()
|
||||
self.addSubview(ConfettiView(frame: self.bounds))
|
||||
if let bidPeerId = previousState?.myState.bidPeerId, let controller = self.environment?.controller() {
|
||||
if let navigationController = controller.navigationController as? NavigationController {
|
||||
var controllers = navigationController.viewControllers
|
||||
controllers = controllers.filter { !($0 is GiftAuctionBidScreen) && !($0 is GiftSetupScreenProtocol) && !($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: bidPeerId) = chatController.chatLocation {
|
||||
chatController.hintPlayNextOutgoingGift()
|
||||
foundController = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !foundController {
|
||||
let chatController = component.context.sharedContext.makeChatController(context: component.context, chatLocation: .peer(id: bidPeerId), subject: nil, botStart: nil, mode: .standard(.default), params: nil)
|
||||
chatController.hintPlayNextOutgoingGift()
|
||||
controllers.append(chatController)
|
||||
}
|
||||
navigationController.setViewControllers(controllers, animated: true)
|
||||
}
|
||||
} else {
|
||||
self.resetSliderValue()
|
||||
self.addSubview(ConfettiView(frame: self.bounds))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import ListSectionComponent
|
|||
import TelegramStringFormatting
|
||||
import MediaEditor
|
||||
import UrlEscaping
|
||||
import GlassBarButtonComponent
|
||||
|
||||
private let linkTag = GenericComponentViewTag()
|
||||
private let nameTag = GenericComponentViewTag()
|
||||
|
|
@ -69,8 +70,8 @@ private final class SheetContent: CombinedComponent {
|
|||
|
||||
static var body: Body {
|
||||
let background = Child(RoundedRectangle.self)
|
||||
let cancelButton = Child(Button.self)
|
||||
let doneButton = Child(Button.self)
|
||||
let cancelButton = Child(GlassBarButtonComponent.self)
|
||||
let doneButton = Child(GlassBarButtonComponent.self)
|
||||
let title = Child(Text.self)
|
||||
let urlSection = Child(ListSectionComponent.self)
|
||||
let nameSection = Child(ListSectionComponent.self)
|
||||
|
|
@ -85,7 +86,7 @@ private final class SheetContent: CombinedComponent {
|
|||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
let sideInset: CGFloat = 16.0
|
||||
var contentSize = CGSize(width: context.availableSize.width, height: 18.0)
|
||||
var contentSize = CGSize(width: context.availableSize.width, height: 36.0)
|
||||
|
||||
let background = background.update(
|
||||
component: RoundedRectangle(color: theme.list.blocksBackgroundColor, cornerRadius: 8.0),
|
||||
|
|
@ -98,16 +99,20 @@ private final class SheetContent: CombinedComponent {
|
|||
|
||||
let constrainedTitleWidth = context.availableSize.width - 16.0 * 2.0
|
||||
|
||||
let barButtonSize = CGSize(width: 40.0, height: 40.0)
|
||||
let cancelButton = cancelButton.update(
|
||||
component: Button(
|
||||
content: AnyComponent(
|
||||
Text(
|
||||
text: strings.Common_Cancel,
|
||||
font: Font.regular(17.0),
|
||||
color: theme.actionSheet.controlAccentColor
|
||||
component: GlassBarButtonComponent(
|
||||
size: barButtonSize,
|
||||
backgroundColor: theme.rootController.navigationBar.glassBarButtonBackgroundColor,
|
||||
isDark: theme.overallDarkAppearance,
|
||||
state: .generic,
|
||||
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
|
||||
BundleIconComponent(
|
||||
name: "Navigation/Close",
|
||||
tintColor: theme.rootController.navigationBar.glassBarButtonForegroundColor
|
||||
)
|
||||
),
|
||||
action: {
|
||||
)),
|
||||
action: { _ in
|
||||
component.dismiss()
|
||||
}
|
||||
),
|
||||
|
|
@ -115,7 +120,7 @@ private final class SheetContent: CombinedComponent {
|
|||
transition: .immediate
|
||||
)
|
||||
context.add(cancelButton
|
||||
.position(CGPoint(x: sideInset + cancelButton.size.width / 2.0, y: contentSize.height + cancelButton.size.height / 2.0))
|
||||
.position(CGPoint(x: sideInset + cancelButton.size.width / 2.0, y: 16.0 + cancelButton.size.height / 2.0))
|
||||
)
|
||||
|
||||
let explicitLink = explicitUrl(context.component.link)
|
||||
|
|
@ -126,16 +131,19 @@ private final class SheetContent: CombinedComponent {
|
|||
|
||||
let controller = environment.controller
|
||||
let doneButton = doneButton.update(
|
||||
component: Button(
|
||||
content: AnyComponent(
|
||||
Text(
|
||||
text: strings.Common_Done,
|
||||
font: Font.bold(17.0),
|
||||
color: isValidLink ? theme.actionSheet.controlAccentColor : theme.actionSheet.secondaryTextColor
|
||||
)
|
||||
),
|
||||
component: GlassBarButtonComponent(
|
||||
size: barButtonSize,
|
||||
backgroundColor: isValidLink ? environment.theme.list.itemCheckColors.fillColor : environment.theme.list.itemCheckColors.fillColor.desaturated().withMultipliedAlpha(0.5),
|
||||
isDark: environment.theme.overallDarkAppearance,
|
||||
state: .tintedGlass,
|
||||
isEnabled: isValidLink,
|
||||
action: { [weak state] in
|
||||
component: AnyComponentWithIdentity(id: "done", component: AnyComponent(
|
||||
BundleIconComponent(
|
||||
name: "Navigation/Done",
|
||||
tintColor: environment.theme.list.itemCheckColors.foregroundColor
|
||||
)
|
||||
)),
|
||||
action: { [weak state] _ in
|
||||
if let controller = controller() as? CreateLinkScreen, let state {
|
||||
if state.complete(controller: controller) {
|
||||
component.dismiss()
|
||||
|
|
@ -147,17 +155,16 @@ private final class SheetContent: CombinedComponent {
|
|||
transition: .immediate
|
||||
)
|
||||
context.add(doneButton
|
||||
.position(CGPoint(x: context.availableSize.width - sideInset - doneButton.size.width / 2.0, y: contentSize.height + doneButton.size.height / 2.0))
|
||||
.position(CGPoint(x: context.availableSize.width - sideInset - doneButton.size.width / 2.0, y: 16.0 + doneButton.size.height / 2.0))
|
||||
)
|
||||
|
||||
|
||||
let title = title.update(
|
||||
component: Text(text: component.isEdit ? strings.MediaEditor_Link_EditTitle : strings.MediaEditor_Link_CreateTitle, font: Font.bold(17.0), color: theme.list.itemPrimaryTextColor),
|
||||
availableSize: CGSize(width: constrainedTitleWidth, height: context.availableSize.height),
|
||||
transition: .immediate
|
||||
)
|
||||
context.add(title
|
||||
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + title.size.height / 2.0))
|
||||
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height))
|
||||
)
|
||||
contentSize.height += title.size.height
|
||||
contentSize.height += 40.0
|
||||
|
|
@ -222,6 +229,7 @@ private final class SheetContent: CombinedComponent {
|
|||
let urlSection = urlSection.update(
|
||||
component: ListSectionComponent(
|
||||
theme: theme,
|
||||
style: .glass,
|
||||
header: AnyComponent(MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(
|
||||
string: strings.MediaEditor_Link_LinkTo_Title.uppercased(),
|
||||
|
|
@ -249,6 +257,7 @@ private final class SheetContent: CombinedComponent {
|
|||
let nameSection = nameSection.update(
|
||||
component: ListSectionComponent(
|
||||
theme: theme,
|
||||
style: .glass,
|
||||
header: AnyComponent(MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(
|
||||
string: strings.MediaEditor_Link_LinkName_Title.uppercased(),
|
||||
|
|
@ -542,6 +551,7 @@ private final class CreateLinkSheetComponent: CombinedComponent {
|
|||
})
|
||||
}
|
||||
)),
|
||||
style: .glass,
|
||||
backgroundColor: .blur(.dark),
|
||||
followContentSizeChanges: true,
|
||||
clipsContent: true,
|
||||
|
|
@ -816,7 +826,7 @@ private final class LinkFieldComponent: Component {
|
|||
containerSize: availableSize
|
||||
)
|
||||
|
||||
let size = CGSize(width: availableSize.width, height: 44.0)
|
||||
let size = CGSize(width: availableSize.width, height: 52.0)
|
||||
if let placeholderComponentView = self.placeholderView.view {
|
||||
if placeholderComponentView.superview == nil {
|
||||
self.insertSubview(placeholderComponentView, at: 0)
|
||||
|
|
@ -827,7 +837,7 @@ private final class LinkFieldComponent: Component {
|
|||
placeholderComponentView.isHidden = !component.text.isEmpty
|
||||
}
|
||||
|
||||
self.textField.frame = CGRect(x: 15.0, y: 0.0, width: size.width - 30.0, height: 44.0)
|
||||
self.textField.frame = CGRect(x: 15.0, y: 4.0, width: size.width - 30.0, height: 44.0)
|
||||
|
||||
return size
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ private final class SheetContent: CombinedComponent {
|
|||
|
||||
static var body: (CombinedComponentContext<SheetContent>) -> CGSize {
|
||||
let closeButton = Child(GlassBarButtonComponent.self)
|
||||
let cancelButton = Child(Button.self)
|
||||
let balance = Child(BalanceComponent.self)
|
||||
let title = Child(Text.self)
|
||||
let currencyToggle = Child(TabSelectorComponent.self)
|
||||
|
|
@ -115,46 +114,31 @@ private final class SheetContent: CombinedComponent {
|
|||
.position(CGPoint(x: balanceFrame.maxX, y: balanceFrame.minY))
|
||||
)
|
||||
}
|
||||
|
||||
let cancelButton = cancelButton.update(
|
||||
component: Button(
|
||||
content: AnyComponent(Text(text: environment.strings.Common_Cancel, font: Font.regular(17.0), color: environment.theme.list.itemAccentColor)),
|
||||
action: {
|
||||
component.dismiss()
|
||||
}
|
||||
).minSize(CGSize(width: 8.0, height: 44.0)),
|
||||
availableSize: CGSize(width: 200.0, height: 100.0),
|
||||
transition: .immediate
|
||||
)
|
||||
let closeFrame = CGRect(origin: CGPoint(x: 16.0, y: floor((56.0 - cancelButton.size.height) * 0.5)), size: cancelButton.size)
|
||||
context.add(cancelButton
|
||||
.position(closeFrame.center)
|
||||
)
|
||||
} else {
|
||||
let closeButton = closeButton.update(
|
||||
component: GlassBarButtonComponent(
|
||||
size: CGSize(width: 40.0, height: 40.0),
|
||||
backgroundColor: theme.rootController.navigationBar.glassBarButtonBackgroundColor,
|
||||
isDark: theme.overallDarkAppearance,
|
||||
state: .generic,
|
||||
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
|
||||
BundleIconComponent(
|
||||
name: "Navigation/Close",
|
||||
tintColor: theme.rootController.navigationBar.glassBarButtonForegroundColor
|
||||
)
|
||||
)),
|
||||
action: { _ in
|
||||
component.dismiss()
|
||||
}
|
||||
),
|
||||
availableSize: CGSize(width: 40.0, height: 40.0),
|
||||
transition: .immediate
|
||||
)
|
||||
context.add(closeButton
|
||||
.position(CGPoint(x: 16.0 + closeButton.size.width / 2.0, y: 16.0 + closeButton.size.height / 2.0))
|
||||
)
|
||||
}
|
||||
|
||||
let closeButton = closeButton.update(
|
||||
component: GlassBarButtonComponent(
|
||||
size: CGSize(width: 40.0, height: 40.0),
|
||||
backgroundColor: theme.rootController.navigationBar.glassBarButtonBackgroundColor,
|
||||
isDark: theme.overallDarkAppearance,
|
||||
state: .generic,
|
||||
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
|
||||
BundleIconComponent(
|
||||
name: "Navigation/Close",
|
||||
tintColor: theme.rootController.navigationBar.glassBarButtonForegroundColor
|
||||
)
|
||||
)),
|
||||
action: { _ in
|
||||
component.dismiss()
|
||||
}
|
||||
),
|
||||
availableSize: CGSize(width: 40.0, height: 40.0),
|
||||
transition: .immediate
|
||||
)
|
||||
context.add(closeButton
|
||||
.position(CGPoint(x: 16.0 + closeButton.size.width / 2.0, y: 16.0 + closeButton.size.height / 2.0))
|
||||
)
|
||||
|
||||
let titleString: String
|
||||
let amountTitle: String
|
||||
let amountPlaceholder: String
|
||||
|
|
@ -264,7 +248,7 @@ private final class SheetContent: CombinedComponent {
|
|||
.position(CGPoint(x: context.availableSize.width / 2.0, y: 36.0))
|
||||
)
|
||||
contentSize.height += title.size.height
|
||||
contentSize.height += 40.0
|
||||
contentSize.height += 56.0
|
||||
|
||||
let balance: StarsAmount?
|
||||
if case .accountWithdraw = component.mode {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue