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
8304a9c0a0
commit
a232ba765f
@ -12247,6 +12247,8 @@ Sorry for the inconvenience.";
|
|||||||
"Stars.Intro.Transaction.PremiumBotTopUp.Subtitle" = "via Premium Bot";
|
"Stars.Intro.Transaction.PremiumBotTopUp.Subtitle" = "via Premium Bot";
|
||||||
"Stars.Intro.Transaction.FragmentTopUp.Title" = "Stars Top-Up";
|
"Stars.Intro.Transaction.FragmentTopUp.Title" = "Stars Top-Up";
|
||||||
"Stars.Intro.Transaction.FragmentTopUp.Subtitle" = "via Fragment";
|
"Stars.Intro.Transaction.FragmentTopUp.Subtitle" = "via Fragment";
|
||||||
|
"Stars.Intro.Transaction.FragmentWithdrawal.Title" = "Withdrawal";
|
||||||
|
"Stars.Intro.Transaction.FragmentWithdrawal.Subtitle" = "via Fragment";
|
||||||
"Stars.Intro.Transaction.Unsupported.Title" = "Unsupported";
|
"Stars.Intro.Transaction.Unsupported.Title" = "Unsupported";
|
||||||
"Stars.Intro.Transaction.Refund" = "Refund";
|
"Stars.Intro.Transaction.Refund" = "Refund";
|
||||||
|
|
||||||
@ -12287,6 +12289,8 @@ Sorry for the inconvenience.";
|
|||||||
"Stars.Transaction.PremiumBotTopUp.Subtitle" = "Premium Bot";
|
"Stars.Transaction.PremiumBotTopUp.Subtitle" = "Premium Bot";
|
||||||
"Stars.Transaction.FragmentTopUp.Title" = "Stars Top-Up";
|
"Stars.Transaction.FragmentTopUp.Title" = "Stars Top-Up";
|
||||||
"Stars.Transaction.FragmentTopUp.Subtitle" = "Fragment";
|
"Stars.Transaction.FragmentTopUp.Subtitle" = "Fragment";
|
||||||
|
"Stars.Transaction.FragmentWithdrawal.Title" = "Stars Withdrawal";
|
||||||
|
"Stars.Transaction.FragmentWithdrawal.Subtitle" = "Fragment";
|
||||||
"Stars.Transaction.Unsupported.Title" = "Unsupported";
|
"Stars.Transaction.Unsupported.Title" = "Unsupported";
|
||||||
"Stars.Transaction.Refund" = "Refund";
|
"Stars.Transaction.Refund" = "Refund";
|
||||||
|
|
||||||
@ -12336,6 +12340,7 @@ Sorry for the inconvenience.";
|
|||||||
"Stars.BotRevenue.Withdraw.Balance" = "Available Balance";
|
"Stars.BotRevenue.Withdraw.Balance" = "Available Balance";
|
||||||
"Stars.BotRevenue.Withdraw.Withdraw" = "Withdraw via Fragment";
|
"Stars.BotRevenue.Withdraw.Withdraw" = "Withdraw via Fragment";
|
||||||
"Stars.BotRevenue.Withdraw.Info" = "You can withdraw Stars using Fragment, or use Stars to advertise your bot. [Learn More >]()";
|
"Stars.BotRevenue.Withdraw.Info" = "You can withdraw Stars using Fragment, or use Stars to advertise your bot. [Learn More >]()";
|
||||||
|
"Stars.BotRevenue.Withdraw.Info_URL" = "https://telegram.org/tos";
|
||||||
|
|
||||||
"Stars.BotRevenue.Transactions.Title" = "Transaction History";
|
"Stars.BotRevenue.Transactions.Title" = "Transaction History";
|
||||||
|
|
||||||
|
@ -1066,7 +1066,7 @@ public protocol SharedAccountContext: AnyObject {
|
|||||||
func makeStarsTransactionsScreen(context: AccountContext, starsContext: StarsContext) -> ViewController
|
func makeStarsTransactionsScreen(context: AccountContext, starsContext: StarsContext) -> ViewController
|
||||||
func makeStarsPurchaseScreen(context: AccountContext, starsContext: StarsContext, options: [StarsTopUpOption], peerId: EnginePeer.Id?, requiredStars: Int64?, completion: @escaping (Int64) -> Void) -> ViewController
|
func makeStarsPurchaseScreen(context: AccountContext, starsContext: StarsContext, options: [StarsTopUpOption], peerId: EnginePeer.Id?, requiredStars: Int64?, completion: @escaping (Int64) -> Void) -> ViewController
|
||||||
func makeStarsTransferScreen(context: AccountContext, starsContext: StarsContext, invoice: TelegramMediaInvoice, source: BotPaymentInvoiceSource, inputData: Signal<(StarsContext.State, BotPaymentForm, EnginePeer?)?, NoError>, completion: @escaping (Bool) -> Void) -> ViewController
|
func makeStarsTransferScreen(context: AccountContext, starsContext: StarsContext, invoice: TelegramMediaInvoice, source: BotPaymentInvoiceSource, inputData: Signal<(StarsContext.State, BotPaymentForm, EnginePeer?)?, NoError>, completion: @escaping (Bool) -> Void) -> ViewController
|
||||||
func makeStarsTransactionScreen(context: AccountContext, transaction: StarsContext.State.Transaction) -> ViewController
|
func makeStarsTransactionScreen(context: AccountContext, transaction: StarsContext.State.Transaction, isAccount: Bool) -> ViewController
|
||||||
func makeStarsReceiptScreen(context: AccountContext, receipt: BotPaymentReceipt) -> ViewController
|
func makeStarsReceiptScreen(context: AccountContext, receipt: BotPaymentReceipt) -> ViewController
|
||||||
func makeStarsStatisticsScreen(context: AccountContext, peerId: EnginePeer.Id, revenueContext: StarsRevenueStatsContext) -> ViewController
|
func makeStarsStatisticsScreen(context: AccountContext, peerId: EnginePeer.Id, revenueContext: StarsRevenueStatsContext) -> ViewController
|
||||||
func makeStarsAmountScreen(context: AccountContext, completion: @escaping (Int64) -> Void) -> ViewController
|
func makeStarsAmountScreen(context: AccountContext, completion: @escaping (Int64) -> Void) -> ViewController
|
||||||
|
@ -19,6 +19,7 @@ public enum ChartType {
|
|||||||
case twoAxisHourlyStep
|
case twoAxisHourlyStep
|
||||||
case twoAxis5MinStep
|
case twoAxis5MinStep
|
||||||
case currency
|
case currency
|
||||||
|
case stars
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension ChartTheme {
|
public extension ChartTheme {
|
||||||
@ -87,7 +88,42 @@ public func createChartController(_ data: String, type: ChartType, rate: Double
|
|||||||
controller = StackedBarsChartController(chartsCollection: collection)
|
controller = StackedBarsChartController(chartsCollection: collection)
|
||||||
controller.isZoomable = false
|
controller.isZoomable = false
|
||||||
case .currency:
|
case .currency:
|
||||||
controller = StackedBarsChartController(chartsCollection: collection, currency: .ton, rate: rate)
|
var iconCache: [UInt32: UIImage] = [:]
|
||||||
|
controller = StackedBarsChartController(chartsCollection: collection, currency: .ton, drawCurrency: { context, color, point in
|
||||||
|
let icon: UIImage?
|
||||||
|
if let current = iconCache[color.rgb] {
|
||||||
|
icon = current
|
||||||
|
} else if let image = generateTintedImage(image: UIImage(bundleImageName: "Ads/Ton"), color: color) {
|
||||||
|
icon = generateImage(image.size, rotatedContext: { size, context in
|
||||||
|
context.clear(CGRect(origin: .zero, size: size))
|
||||||
|
if let cgImage = image.cgImage {
|
||||||
|
context.draw(cgImage, in: CGRect(origin: .zero, size: size), byTiling: false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
iconCache[color.rgb] = icon
|
||||||
|
} else {
|
||||||
|
icon = nil
|
||||||
|
}
|
||||||
|
if let icon, let cgImage = icon.cgImage {
|
||||||
|
context.draw(cgImage, in: CGRect(origin: point.offsetBy(dx: 0.0, dy: -2.0), size: icon.size), byTiling: false)
|
||||||
|
}
|
||||||
|
}, rate: rate)
|
||||||
|
controller.isZoomable = false
|
||||||
|
case .stars:
|
||||||
|
var icon: UIImage?
|
||||||
|
if let image = UIImage(bundleImageName: "Premium/Stars/StarSmall") {
|
||||||
|
icon = generateImage(CGSize(width: floor(image.size.width * 0.82), height: floor(image.size.width * 0.82)), rotatedContext: { size, context in
|
||||||
|
context.clear(CGRect(origin: .zero, size: size))
|
||||||
|
if let cgImage = image.cgImage {
|
||||||
|
context.draw(cgImage, in: CGRect(origin: .zero, size: size), byTiling: false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
controller = StackedBarsChartController(chartsCollection: collection, currency: .xtr, drawCurrency: { context, color, point in
|
||||||
|
if let icon, let cgImage = icon.cgImage {
|
||||||
|
context.draw(cgImage, in: CGRect(origin: point.offsetBy(dx: -3.0, dy: -4.0), size: icon.size), byTiling: false)
|
||||||
|
}
|
||||||
|
}, rate: rate)
|
||||||
controller.isZoomable = false
|
controller.isZoomable = false
|
||||||
case .step:
|
case .step:
|
||||||
controller = StepBarsChartController(chartsCollection: collection)
|
controller = StepBarsChartController(chartsCollection: collection)
|
||||||
|
@ -4517,19 +4517,12 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
entity.renderImage = result.image
|
entity.renderImage = result.image
|
||||||
entity.secondaryRenderImage = result.nightImage
|
entity.secondaryRenderImage = result.nightImage
|
||||||
|
|
||||||
let fraction: CGFloat = 1.0
|
|
||||||
// if let image = result.image {
|
|
||||||
// fraction = max(image.size.width, image.size.height) / 353.0
|
|
||||||
// } else {
|
|
||||||
// fraction = 1.0
|
|
||||||
// }
|
|
||||||
|
|
||||||
if let existingEntity {
|
if let existingEntity {
|
||||||
self.entitiesView.remove(uuid: existingEntity.uuid, animated: true)
|
self.entitiesView.remove(uuid: existingEntity.uuid, animated: true)
|
||||||
}
|
}
|
||||||
self.interaction?.insertEntity(
|
self.interaction?.insertEntity(
|
||||||
entity,
|
entity,
|
||||||
scale: existingEntity?.scale ?? min(6.0, fraction),
|
scale: existingEntity?.scale ?? 1.0,
|
||||||
position: existingEntity?.position
|
position: existingEntity?.position
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -258,6 +258,7 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
|
|
||||||
let environment = environment[ViewControllerComponentContainer.Environment.self].value
|
let environment = environment[ViewControllerComponentContainer.Environment.self].value
|
||||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
let strings = environment.strings
|
||||||
|
|
||||||
if self.stateDisposable == nil {
|
if self.stateDisposable == nil {
|
||||||
self.stateDisposable = (component.revenueContext.state
|
self.stateDisposable = (component.revenueContext.state
|
||||||
@ -309,7 +310,7 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
transition: .immediate,
|
transition: .immediate,
|
||||||
component: AnyComponent(
|
component: AnyComponent(
|
||||||
MultilineTextComponent(
|
MultilineTextComponent(
|
||||||
text: .plain(NSAttributedString(string: environment.strings.Stars_BotRevenue_Title, font: Font.semibold(17.0), textColor: environment.theme.list.itemPrimaryTextColor)),
|
text: .plain(NSAttributedString(string: strings.Stars_BotRevenue_Title, font: Font.semibold(17.0), textColor: environment.theme.list.itemPrimaryTextColor)),
|
||||||
horizontalAlignment: .center,
|
horizontalAlignment: .center,
|
||||||
truncationType: .end,
|
truncationType: .end,
|
||||||
maximumNumberOfLines: 1
|
maximumNumberOfLines: 1
|
||||||
@ -334,7 +335,7 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
theme: environment.theme,
|
theme: environment.theme,
|
||||||
header: AnyComponent(MultilineTextComponent(
|
header: AnyComponent(MultilineTextComponent(
|
||||||
text: .plain(NSAttributedString(
|
text: .plain(NSAttributedString(
|
||||||
string: environment.strings.Stars_BotRevenue_Revenue_Title.uppercased(),
|
string: strings.Stars_BotRevenue_Revenue_Title.uppercased(),
|
||||||
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
|
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
|
||||||
textColor: environment.theme.list.freeTextColor
|
textColor: environment.theme.list.freeTextColor
|
||||||
)),
|
)),
|
||||||
@ -343,7 +344,7 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
footer: nil,
|
footer: nil,
|
||||||
items: [
|
items: [
|
||||||
AnyComponentWithIdentity(id: 0, component: AnyComponent(ListItemComponentAdaptor(
|
AnyComponentWithIdentity(id: 0, component: AnyComponent(ListItemComponentAdaptor(
|
||||||
itemGenerator: StatsGraphItem(presentationData: ItemListPresentationData(presentationData), graph: revenueGraph, type: .currency, conversionRate: starsState?.usdRate ?? 0.0, sectionId: 0, style: .blocks),
|
itemGenerator: StatsGraphItem(presentationData: ItemListPresentationData(presentationData), graph: revenueGraph, type: .stars, conversionRate: starsState?.usdRate ?? 0.0, sectionId: 0, style: .blocks),
|
||||||
params: ListViewItemLayoutParams(width: availableSize.width - sideInsets, leftInset: 0.0, rightInset: 0.0, availableHeight: 10000.0, isStandalone: true)
|
params: ListViewItemLayoutParams(width: availableSize.width - sideInsets, leftInset: 0.0, rightInset: 0.0, availableHeight: 10000.0, isStandalone: true)
|
||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
@ -369,7 +370,7 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
theme: environment.theme,
|
theme: environment.theme,
|
||||||
header: AnyComponent(MultilineTextComponent(
|
header: AnyComponent(MultilineTextComponent(
|
||||||
text: .plain(NSAttributedString(
|
text: .plain(NSAttributedString(
|
||||||
string: environment.strings.Stars_BotRevenue_Proceeds_Title.uppercased(),
|
string: strings.Stars_BotRevenue_Proceeds_Title.uppercased(),
|
||||||
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
|
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
|
||||||
textColor: environment.theme.list.freeTextColor
|
textColor: environment.theme.list.freeTextColor
|
||||||
)),
|
)),
|
||||||
@ -380,14 +381,14 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
AnyComponentWithIdentity(id: 0, component: AnyComponent(StarsOverviewItemComponent(
|
AnyComponentWithIdentity(id: 0, component: AnyComponent(StarsOverviewItemComponent(
|
||||||
theme: environment.theme,
|
theme: environment.theme,
|
||||||
dateTimeFormat: environment.dateTimeFormat,
|
dateTimeFormat: environment.dateTimeFormat,
|
||||||
title: environment.strings.Stars_BotRevenue_Proceeds_Available,
|
title: strings.Stars_BotRevenue_Proceeds_Available,
|
||||||
value: starsState?.balances.availableBalance ?? 0,
|
value: starsState?.balances.availableBalance ?? 0,
|
||||||
rate: starsState?.usdRate ?? 0.0
|
rate: starsState?.usdRate ?? 0.0
|
||||||
))),
|
))),
|
||||||
AnyComponentWithIdentity(id: 1, component: AnyComponent(StarsOverviewItemComponent(
|
AnyComponentWithIdentity(id: 1, component: AnyComponent(StarsOverviewItemComponent(
|
||||||
theme: environment.theme,
|
theme: environment.theme,
|
||||||
dateTimeFormat: environment.dateTimeFormat,
|
dateTimeFormat: environment.dateTimeFormat,
|
||||||
title: environment.strings.Stars_BotRevenue_Proceeds_Total,
|
title: strings.Stars_BotRevenue_Proceeds_Total,
|
||||||
value: starsState?.balances.overallRevenue ?? 0,
|
value: starsState?.balances.overallRevenue ?? 0,
|
||||||
rate: starsState?.usdRate ?? 0.0
|
rate: starsState?.usdRate ?? 0.0
|
||||||
)))
|
)))
|
||||||
@ -413,7 +414,7 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
return (TelegramTextAttributes.URL, contents)
|
return (TelegramTextAttributes.URL, contents)
|
||||||
})
|
})
|
||||||
|
|
||||||
let balanceInfoString = NSMutableAttributedString(attributedString: parseMarkdownIntoAttributedString(environment.strings.Stars_BotRevenue_Withdraw_Info, attributes: termsMarkdownAttributes, textAlignment: .natural
|
let balanceInfoString = NSMutableAttributedString(attributedString: parseMarkdownIntoAttributedString(strings.Stars_BotRevenue_Withdraw_Info, attributes: termsMarkdownAttributes, textAlignment: .natural
|
||||||
))
|
))
|
||||||
if self.cachedChevronImage == nil || self.cachedChevronImage?.1 !== environment.theme {
|
if self.cachedChevronImage == nil || self.cachedChevronImage?.1 !== environment.theme {
|
||||||
self.cachedChevronImage = (generateTintedImage(image: UIImage(bundleImageName: "Contact List/SubtitleArrow"), color: environment.theme.list.itemAccentColor)!, environment.theme)
|
self.cachedChevronImage = (generateTintedImage(image: UIImage(bundleImageName: "Contact List/SubtitleArrow"), color: environment.theme.list.itemAccentColor)!, environment.theme)
|
||||||
@ -428,7 +429,7 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
theme: environment.theme,
|
theme: environment.theme,
|
||||||
header: AnyComponent(MultilineTextComponent(
|
header: AnyComponent(MultilineTextComponent(
|
||||||
text: .plain(NSAttributedString(
|
text: .plain(NSAttributedString(
|
||||||
string: environment.strings.Stars_BotRevenue_Withdraw_Balance.uppercased(),
|
string: strings.Stars_BotRevenue_Withdraw_Balance.uppercased(),
|
||||||
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
|
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
|
||||||
textColor: environment.theme.list.freeTextColor
|
textColor: environment.theme.list.freeTextColor
|
||||||
)),
|
)),
|
||||||
@ -436,16 +437,27 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
)),
|
)),
|
||||||
footer: AnyComponent(MultilineTextComponent(
|
footer: AnyComponent(MultilineTextComponent(
|
||||||
text: .plain(balanceInfoString),
|
text: .plain(balanceInfoString),
|
||||||
maximumNumberOfLines: 0
|
maximumNumberOfLines: 0,
|
||||||
|
highlightColor: environment.theme.list.itemAccentColor.withAlphaComponent(0.2),
|
||||||
|
highlightAction: { attributes in
|
||||||
|
if let _ = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.URL)] {
|
||||||
|
return NSAttributedString.Key(rawValue: TelegramTextAttributes.URL)
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tapAction: { attributes, _ in
|
||||||
|
component.context.sharedContext.openExternalUrl(context: component.context, urlContext: .generic, url: strings.Stars_BotRevenue_Withdraw_Info_URL, forceExternal: true, presentationData: presentationData, navigationController: nil, dismissInput: {})
|
||||||
|
}
|
||||||
)),
|
)),
|
||||||
items: [AnyComponentWithIdentity(id: 0, component: AnyComponent(
|
items: [AnyComponentWithIdentity(id: 0, component: AnyComponent(
|
||||||
StarsBalanceComponent(
|
StarsBalanceComponent(
|
||||||
theme: environment.theme,
|
theme: environment.theme,
|
||||||
strings: environment.strings,
|
strings: strings,
|
||||||
dateTimeFormat: environment.dateTimeFormat,
|
dateTimeFormat: environment.dateTimeFormat,
|
||||||
count: self.starsState?.balances.availableBalance ?? 0,
|
count: self.starsState?.balances.availableBalance ?? 0,
|
||||||
rate: 0.2,
|
rate: 0.2,
|
||||||
actionTitle: environment.strings.Stars_BotRevenue_Withdraw_Withdraw,
|
actionTitle: strings.Stars_BotRevenue_Withdraw_Withdraw,
|
||||||
actionAvailable: true,
|
actionAvailable: true,
|
||||||
buy: { [weak self] in
|
buy: { [weak self] in
|
||||||
guard let self, let component = self.component else {
|
guard let self, let component = self.component else {
|
||||||
@ -482,7 +494,7 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
transition: transition,
|
transition: transition,
|
||||||
component: AnyComponent(MultilineTextComponent(
|
component: AnyComponent(MultilineTextComponent(
|
||||||
text: .plain(NSAttributedString(
|
text: .plain(NSAttributedString(
|
||||||
string: environment.strings.Stars_BotRevenue_Transactions_Title.uppercased(),
|
string: strings.Stars_BotRevenue_Transactions_Title.uppercased(),
|
||||||
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
|
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
|
||||||
textColor: environment.theme.list.freeTextColor
|
textColor: environment.theme.list.freeTextColor
|
||||||
)),
|
)),
|
||||||
@ -512,6 +524,7 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
component: AnyComponent(StarsTransactionsListPanelComponent(
|
component: AnyComponent(StarsTransactionsListPanelComponent(
|
||||||
context: component.context,
|
context: component.context,
|
||||||
transactionsContext: allTransactionsContext,
|
transactionsContext: allTransactionsContext,
|
||||||
|
isAccount: false,
|
||||||
action: { transaction in
|
action: { transaction in
|
||||||
component.openTransaction(transaction)
|
component.openTransaction(transaction)
|
||||||
}
|
}
|
||||||
@ -519,15 +532,16 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
environment: {
|
environment: {
|
||||||
StarsTransactionsPanelEnvironment(
|
StarsTransactionsPanelEnvironment(
|
||||||
theme: environment.theme,
|
theme: environment.theme,
|
||||||
strings: environment.strings,
|
strings: strings,
|
||||||
dateTimeFormat: environment.dateTimeFormat,
|
dateTimeFormat: environment.dateTimeFormat,
|
||||||
containerInsets: UIEdgeInsets(top: 0.0, left: environment.safeInsets.left, bottom: environment.safeInsets.bottom, right: environment.safeInsets.right),
|
containerInsets: UIEdgeInsets(top: 0.0, left: environment.safeInsets.left, bottom: 0.0, right: environment.safeInsets.right),
|
||||||
isScrollable: wasLockedAtPanels,
|
isScrollable: wasLockedAtPanels,
|
||||||
isCurrent: true
|
isCurrent: true
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
containerSize: CGSize(width: availableSize.width - sideInsets, height: availableSize.height)
|
containerSize: CGSize(width: availableSize.width - sideInsets, height: availableSize.height)
|
||||||
)
|
)
|
||||||
|
self.transactionsView.parentState = state
|
||||||
let transactionsFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((availableSize.width - transactionsSize.width) / 2.0), y: contentHeight), size: transactionsSize)
|
let transactionsFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((availableSize.width - transactionsSize.width) / 2.0), y: contentHeight), size: transactionsSize)
|
||||||
if let panelContainerView = self.transactionsView.view {
|
if let panelContainerView = self.transactionsView.view {
|
||||||
if panelContainerView.superview == nil {
|
if panelContainerView.superview == nil {
|
||||||
@ -609,7 +623,7 @@ public final class StarsStatisticsScreen: ViewControllerComponentContainer {
|
|||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let controller = context.sharedContext.makeStarsTransactionScreen(context: context, transaction: transaction)
|
let controller = context.sharedContext.makeStarsTransactionScreen(context: context, transaction: transaction, isAccount: false)
|
||||||
self.push(controller)
|
self.push(controller)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ private final class StarsTransactionSheetContent: CombinedComponent {
|
|||||||
|
|
||||||
var peerIds: [EnginePeer.Id] = []
|
var peerIds: [EnginePeer.Id] = []
|
||||||
switch subject {
|
switch subject {
|
||||||
case let .transaction(transaction):
|
case let .transaction(transaction, _):
|
||||||
if case let .peer(peer) = transaction.peer {
|
if case let .peer(peer) = transaction.peer {
|
||||||
peerIds.append(peer.id)
|
peerIds.append(peer.id)
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ private final class StarsTransactionSheetContent: CombinedComponent {
|
|||||||
|
|
||||||
var delayedCloseOnOpenPeer = true
|
var delayedCloseOnOpenPeer = true
|
||||||
switch subject {
|
switch subject {
|
||||||
case let .transaction(transaction):
|
case let .transaction(transaction, isAccount):
|
||||||
switch transaction.peer {
|
switch transaction.peer {
|
||||||
case let .peer(peer):
|
case let .peer(peer):
|
||||||
titleText = transaction.title ?? peer.compactDisplayTitle
|
titleText = transaction.title ?? peer.compactDisplayTitle
|
||||||
@ -194,8 +194,13 @@ private final class StarsTransactionSheetContent: CombinedComponent {
|
|||||||
titleText = strings.Stars_Transaction_PremiumBotTopUp_Title
|
titleText = strings.Stars_Transaction_PremiumBotTopUp_Title
|
||||||
via = strings.Stars_Transaction_PremiumBotTopUp_Subtitle
|
via = strings.Stars_Transaction_PremiumBotTopUp_Subtitle
|
||||||
case .fragment:
|
case .fragment:
|
||||||
|
if isAccount {
|
||||||
titleText = strings.Stars_Transaction_FragmentTopUp_Title
|
titleText = strings.Stars_Transaction_FragmentTopUp_Title
|
||||||
via = strings.Stars_Transaction_FragmentTopUp_Subtitle
|
via = strings.Stars_Transaction_FragmentTopUp_Subtitle
|
||||||
|
} else {
|
||||||
|
titleText = strings.Stars_Transaction_FragmentWithdrawal_Title
|
||||||
|
via = strings.Stars_Transaction_FragmentWithdrawal_Subtitle
|
||||||
|
}
|
||||||
case .unsupported:
|
case .unsupported:
|
||||||
titleText = strings.Stars_Transaction_Unsupported_Title
|
titleText = strings.Stars_Transaction_Unsupported_Title
|
||||||
via = nil
|
via = nil
|
||||||
@ -662,7 +667,7 @@ private final class StarsTransactionSheetComponent: CombinedComponent {
|
|||||||
|
|
||||||
public class StarsTransactionScreen: ViewControllerComponentContainer {
|
public class StarsTransactionScreen: ViewControllerComponentContainer {
|
||||||
public enum Subject: Equatable {
|
public enum Subject: Equatable {
|
||||||
case transaction(StarsContext.State.Transaction)
|
case transaction(StarsContext.State.Transaction, Bool)
|
||||||
case receipt(BotPaymentReceipt)
|
case receipt(BotPaymentReceipt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,15 +31,18 @@ final class StarsTransactionsListPanelComponent: Component {
|
|||||||
|
|
||||||
let context: AccountContext
|
let context: AccountContext
|
||||||
let transactionsContext: StarsTransactionsContext
|
let transactionsContext: StarsTransactionsContext
|
||||||
|
let isAccount: Bool
|
||||||
let action: (StarsContext.State.Transaction) -> Void
|
let action: (StarsContext.State.Transaction) -> Void
|
||||||
|
|
||||||
init(
|
init(
|
||||||
context: AccountContext,
|
context: AccountContext,
|
||||||
transactionsContext: StarsTransactionsContext,
|
transactionsContext: StarsTransactionsContext,
|
||||||
|
isAccount: Bool,
|
||||||
action: @escaping (StarsContext.State.Transaction) -> Void
|
action: @escaping (StarsContext.State.Transaction) -> Void
|
||||||
) {
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.transactionsContext = transactionsContext
|
self.transactionsContext = transactionsContext
|
||||||
|
self.isAccount = isAccount
|
||||||
self.action = action
|
self.action = action
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +50,9 @@ final class StarsTransactionsListPanelComponent: Component {
|
|||||||
if lhs.context !== rhs.context {
|
if lhs.context !== rhs.context {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if lhs.isAccount != rhs.isAccount {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,6 +197,7 @@ final class StarsTransactionsListPanelComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
separatorView.backgroundColor = environment.theme.list.itemBlocksSeparatorColor
|
separatorView.backgroundColor = environment.theme.list.itemBlocksSeparatorColor
|
||||||
|
separatorView.isHidden = index == self.items.count - 1
|
||||||
|
|
||||||
let fontBaseDisplaySize = 17.0
|
let fontBaseDisplaySize = 17.0
|
||||||
|
|
||||||
@ -213,8 +220,13 @@ final class StarsTransactionsListPanelComponent: Component {
|
|||||||
itemTitle = environment.strings.Stars_Intro_Transaction_GoogleTopUp_Title
|
itemTitle = environment.strings.Stars_Intro_Transaction_GoogleTopUp_Title
|
||||||
itemSubtitle = environment.strings.Stars_Intro_Transaction_GoogleTopUp_Subtitle
|
itemSubtitle = environment.strings.Stars_Intro_Transaction_GoogleTopUp_Subtitle
|
||||||
case .fragment:
|
case .fragment:
|
||||||
|
if component.isAccount {
|
||||||
itemTitle = environment.strings.Stars_Intro_Transaction_FragmentTopUp_Title
|
itemTitle = environment.strings.Stars_Intro_Transaction_FragmentTopUp_Title
|
||||||
itemSubtitle = environment.strings.Stars_Intro_Transaction_FragmentTopUp_Subtitle
|
itemSubtitle = environment.strings.Stars_Intro_Transaction_FragmentTopUp_Subtitle
|
||||||
|
} else {
|
||||||
|
itemTitle = environment.strings.Stars_Intro_Transaction_FragmentWithdrawal_Title
|
||||||
|
itemSubtitle = environment.strings.Stars_Intro_Transaction_FragmentWithdrawal_Subtitle
|
||||||
|
}
|
||||||
case .premiumBot:
|
case .premiumBot:
|
||||||
itemTitle = environment.strings.Stars_Intro_Transaction_PremiumBotTopUp_Title
|
itemTitle = environment.strings.Stars_Intro_Transaction_PremiumBotTopUp_Title
|
||||||
itemSubtitle = environment.strings.Stars_Intro_Transaction_PremiumBotTopUp_Subtitle
|
itemSubtitle = environment.strings.Stars_Intro_Transaction_PremiumBotTopUp_Subtitle
|
||||||
@ -444,7 +456,11 @@ final class StarsTransactionsListPanelComponent: Component {
|
|||||||
self.ignoreScrolling = false
|
self.ignoreScrolling = false
|
||||||
self.updateScrolling(transition: transition)
|
self.updateScrolling(transition: transition)
|
||||||
|
|
||||||
|
if component.isAccount {
|
||||||
return availableSize
|
return availableSize
|
||||||
|
} else {
|
||||||
|
return CGSize(width: availableSize.width, height: min(availableSize.height, contentSize.height))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,6 +580,7 @@ final class StarsTransactionsScreenComponent: Component {
|
|||||||
panel: AnyComponent(StarsTransactionsListPanelComponent(
|
panel: AnyComponent(StarsTransactionsListPanelComponent(
|
||||||
context: component.context,
|
context: component.context,
|
||||||
transactionsContext: allTransactionsContext,
|
transactionsContext: allTransactionsContext,
|
||||||
|
isAccount: true,
|
||||||
action: { transaction in
|
action: { transaction in
|
||||||
component.openTransaction(transaction)
|
component.openTransaction(transaction)
|
||||||
}
|
}
|
||||||
@ -592,6 +593,7 @@ final class StarsTransactionsScreenComponent: Component {
|
|||||||
panel: AnyComponent(StarsTransactionsListPanelComponent(
|
panel: AnyComponent(StarsTransactionsListPanelComponent(
|
||||||
context: component.context,
|
context: component.context,
|
||||||
transactionsContext: incomingTransactionsContext,
|
transactionsContext: incomingTransactionsContext,
|
||||||
|
isAccount: true,
|
||||||
action: { transaction in
|
action: { transaction in
|
||||||
component.openTransaction(transaction)
|
component.openTransaction(transaction)
|
||||||
}
|
}
|
||||||
@ -604,6 +606,7 @@ final class StarsTransactionsScreenComponent: Component {
|
|||||||
panel: AnyComponent(StarsTransactionsListPanelComponent(
|
panel: AnyComponent(StarsTransactionsListPanelComponent(
|
||||||
context: component.context,
|
context: component.context,
|
||||||
transactionsContext: outgoingTransactionsContext,
|
transactionsContext: outgoingTransactionsContext,
|
||||||
|
isAccount: true,
|
||||||
action: { transaction in
|
action: { transaction in
|
||||||
component.openTransaction(transaction)
|
component.openTransaction(transaction)
|
||||||
}
|
}
|
||||||
@ -719,7 +722,7 @@ public final class StarsTransactionsScreen: ViewControllerComponentContainer {
|
|||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let controller = context.sharedContext.makeStarsTransactionScreen(context: context, transaction: transaction)
|
let controller = context.sharedContext.makeStarsTransactionScreen(context: context, transaction: transaction, isAccount: true)
|
||||||
self.push(controller)
|
self.push(controller)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2632,8 +2632,8 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||||||
return StarsTransferScreen(context: context, starsContext: starsContext, invoice: invoice, source: source, inputData: inputData, completion: completion)
|
return StarsTransferScreen(context: context, starsContext: starsContext, invoice: invoice, source: source, inputData: inputData, completion: completion)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func makeStarsTransactionScreen(context: AccountContext, transaction: StarsContext.State.Transaction) -> ViewController {
|
public func makeStarsTransactionScreen(context: AccountContext, transaction: StarsContext.State.Transaction, isAccount: Bool) -> ViewController {
|
||||||
return StarsTransactionScreen(context: context, subject: .transaction(transaction), action: {})
|
return StarsTransactionScreen(context: context, subject: .transaction(transaction, isAccount), action: {})
|
||||||
}
|
}
|
||||||
|
|
||||||
public func makeStarsReceiptScreen(context: AccountContext, receipt: BotPaymentReceipt) -> ViewController {
|
public func makeStarsReceiptScreen(context: AccountContext, receipt: BotPaymentReceipt) -> ViewController {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user