mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-20 02:01:10 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
0da5f08f22
@ -1074,13 +1074,7 @@ public final class StarsContext {
|
|||||||
return peerId!
|
return peerId!
|
||||||
}
|
}
|
||||||
|
|
||||||
var ton: Bool {
|
let ton: Bool
|
||||||
var ton = false
|
|
||||||
self.impl.syncWith { impl in
|
|
||||||
ton = impl.ton
|
|
||||||
}
|
|
||||||
return ton
|
|
||||||
}
|
|
||||||
|
|
||||||
public var currentState: StarsContext.State? {
|
public var currentState: StarsContext.State? {
|
||||||
var state: StarsContext.State?
|
var state: StarsContext.State?
|
||||||
@ -1122,6 +1116,7 @@ public final class StarsContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(account: Account, ton: Bool) {
|
init(account: Account, ton: Bool) {
|
||||||
|
self.ton = ton
|
||||||
self.impl = QueueLocalObject(queue: Queue.mainQueue(), generate: {
|
self.impl = QueueLocalObject(queue: Queue.mainQueue(), generate: {
|
||||||
return StarsContextImpl(account: account, ton: ton)
|
return StarsContextImpl(account: account, ton: ton)
|
||||||
})
|
})
|
||||||
|
@ -1444,27 +1444,25 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
|||||||
}
|
}
|
||||||
attributedString = NSAttributedString(string: string, font: titleFont, textColor: primaryTextColor)
|
attributedString = NSAttributedString(string: string, font: titleFont, textColor: primaryTextColor)
|
||||||
case let .giftTon(currency, amount, _, _, _):
|
case let .giftTon(currency, amount, _, _, _):
|
||||||
let _ = currency
|
|
||||||
let _ = amount
|
|
||||||
attributedString = nil
|
attributedString = nil
|
||||||
// if !forAdditionalServiceMessage {
|
if !forAdditionalServiceMessage {
|
||||||
// attributedString = NSAttributedString(string: strings.Notification_Gift, font: titleFont, textColor: primaryTextColor)
|
attributedString = NSAttributedString(string: strings.Notification_Gift, font: titleFont, textColor: primaryTextColor)
|
||||||
// } else {
|
} else {
|
||||||
// let price = formatCurrencyAmount(amount, currency: currency)
|
let price = formatCurrencyAmount(amount, currency: currency)
|
||||||
// if message.author?.id == accountPeerId {
|
if message.author?.id == accountPeerId {
|
||||||
// attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_SentYou(price)._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_SentYou(price)._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
||||||
// } else {
|
} else {
|
||||||
// var authorName = compactAuthorName
|
var authorName = compactAuthorName
|
||||||
// var peerIds: [(Int, EnginePeer.Id?)] = [(0, message.author?.id)]
|
var peerIds: [(Int, EnginePeer.Id?)] = [(0, message.author?.id)]
|
||||||
// if message.id.peerId.namespace == Namespaces.Peer.CloudUser && message.id.peerId.id._internalGetInt64Value() == 777000 {
|
if message.id.peerId.namespace == Namespaces.Peer.CloudUser && message.id.peerId.id._internalGetInt64Value() == 777000 {
|
||||||
// authorName = strings.Notification_StarsGift_UnknownUser
|
authorName = strings.Notification_StarsGift_UnknownUser
|
||||||
// peerIds = []
|
peerIds = []
|
||||||
// }
|
}
|
||||||
// var attributes = peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: peerIds)
|
var attributes = peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: peerIds)
|
||||||
// attributes[1] = boldAttributes
|
attributes[1] = boldAttributes
|
||||||
// attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Sent(authorName, price)._tuple, body: bodyAttributes, argumentAttributes: attributes)
|
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Sent(authorName, price)._tuple, body: bodyAttributes, argumentAttributes: attributes)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
case .unknown:
|
case .unknown:
|
||||||
attributedString = nil
|
attributedString = nil
|
||||||
}
|
}
|
||||||
|
@ -258,38 +258,52 @@ public class ChatMessageActionBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
}
|
}
|
||||||
)).string
|
)).string
|
||||||
|
|
||||||
let amountString: String
|
var pricePart = ""
|
||||||
if let amount, amount.amount != .zero {
|
if let amount, amount.amount != .zero {
|
||||||
|
let amountString: String
|
||||||
switch amount.currency {
|
switch amount.currency {
|
||||||
case .stars:
|
case .stars:
|
||||||
amountString = amount.amount.value == 1 ? "\(amount.amount) Star" : "\(amount.amount) Stars"
|
amountString = amount.amount.value == 1 ? "\(amount.amount) Star" : "\(amount.amount) Stars"
|
||||||
case .ton:
|
case .ton:
|
||||||
amountString = "\(amount.amount) TON"
|
amountString = "\(formatTonAmountText(amount.amount.value, dateTimeFormat: item.presentationData.dateTimeFormat)) TON"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch amount.currency {
|
||||||
|
case .stars:
|
||||||
|
if !item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||||
|
pricePart = "\n\n💰 The user have been charged \(amountString).\n\n⌛ **\(channelName)** will receive the Stars once the post has been live for 24 hours.\n\n🔄 If your remove the post before it has been live for 24 hours, the user's Stars will be refunded."
|
||||||
} else {
|
} else {
|
||||||
amountString = "0 Stars"
|
pricePart = "\n\n💰 You have been charged \(amountString).\n\n⌛ **\(channelName)** will receive your Stars once the post has been live for 24 hours.\n\n🔄 If **\(channelName)** removes the post before it has been live for 24 hours, your Stars will be refunded."
|
||||||
|
}
|
||||||
|
case .ton:
|
||||||
|
if !item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||||
|
pricePart = "\n\n💰 The user have been charged \(amountString).\n\n⌛ **\(channelName)** will receive TON once the post has been live for 24 hours.\n\n🔄 If your remove the post before it has been live for 24 hours, the user's TON will be refunded."
|
||||||
|
} else {
|
||||||
|
pricePart = "\n\n💰 You have been charged \(amountString).\n\n⌛ **\(channelName)** will receive your TON once the post has been live for 24 hours.\n\n🔄 If **\(channelName)** removes the post before it has been live for 24 hours, your TON will be refunded."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let rawString: String
|
let rawString: String
|
||||||
if let timestamp {
|
if let timestamp {
|
||||||
if Int32(Date().timeIntervalSince1970) >= timestamp {
|
if Int32(Date().timeIntervalSince1970) >= timestamp {
|
||||||
if !item.message.effectivelyIncoming(item.context.account.peerId) {
|
if !item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||||
rawString = "📅 The post has been automatically published in **\(channelName)** **\(timeString)**.\n\n💰 The user have been charged \(amountString).\n\n⌛ **\(channelName)** will receive the Stars once the post has been live for 24 hours.\n\n🔄 If your remove the post before it has been live for 24 hours, the user's Stars will be refunded."
|
rawString = "📅 The post has been automatically published in **\(channelName)** **\(timeString)**." + pricePart
|
||||||
} else {
|
} else {
|
||||||
rawString = "📅 Your post has been automatically published in **\(channelName)** **\(timeString)**.\n\n💰 You have been charged \(amountString).\n\n⌛ **\(channelName)** will receive your Stars once the post has been live for 24 hours.\n\n🔄 If **\(channelName)** removes the post before it has been live for 24 hours, your Stars will be refunded."
|
rawString = "📅 Your post has been automatically published in **\(channelName)** **\(timeString)**." + pricePart
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !item.message.effectivelyIncoming(item.context.account.peerId) {
|
if !item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||||
rawString = "📅 The post will be automatically published in **\(channelName)** **\(timeString)**.\n\n💰 The user have been charged \(amountString).\n\n⌛ **\(channelName)** will receive the Stars once the post has been live for 24 hours.\n\n🔄 If your remove the post before it has been live for 24 hours, the user's Stars will be refunded."
|
rawString = "📅 The post will be automatically published in **\(channelName)** **\(timeString)**." + pricePart
|
||||||
} else {
|
} else {
|
||||||
rawString = "📅 Your post will be automatically published in **\(channelName)** **\(timeString)**.\n\n💰 You have been charged \(amountString).\n\n⌛ **\(channelName)** will receive your Stars once the post has been live for 24 hours.\n\n🔄 If **\(channelName)** removes the post before it has been live for 24 hours, your Stars will be refunded."
|
rawString = "📅 Your post will be automatically published in **\(channelName)** **\(timeString)**." + pricePart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !item.message.effectivelyIncoming(item.context.account.peerId) {
|
if !item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||||
rawString = "📅 The post has been automatically published in **\(channelName)**.\n\n💰 The user have been charged \(amountString).\n\n⌛ **\(channelName)** will receive the Stars once the post has been live for 24 hours.\n\n🔄 If your remove the post before it has been live for 24 hours, the user's Stars will be refunded."
|
rawString = "📅 The post has been automatically published in **\(channelName)**." + pricePart
|
||||||
} else {
|
} else {
|
||||||
rawString = "📅 Your post has been automatically published in **\(channelName)**.\n\n💰 You have been charged \(amountString).\n\n⌛ **\(channelName)** will receive your Stars once the post has been live for 24 hours.\n\n🔄 If **\(channelName)** removes the post before it has been live for 24 hours, your Stars will be refunded."
|
rawString = "📅 Your post has been automatically published in **\(channelName)**." + pricePart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updatedAttributedString = parseMarkdownIntoAttributedString(rawString, attributes: MarkdownAttributes(
|
updatedAttributedString = parseMarkdownIntoAttributedString(rawString, attributes: MarkdownAttributes(
|
||||||
|
@ -222,6 +222,8 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([
|
|||||||
result.append((message, ChatMessageGiftBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
|
result.append((message, ChatMessageGiftBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
|
||||||
} else if case .giftStars = action.action {
|
} else if case .giftStars = action.action {
|
||||||
result.append((message, ChatMessageGiftBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
|
result.append((message, ChatMessageGiftBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
|
||||||
|
} else if case .giftTon = action.action {
|
||||||
|
result.append((message, ChatMessageGiftBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
|
||||||
} else if case .starGift = action.action {
|
} else if case .starGift = action.action {
|
||||||
result.append((message, ChatMessageGiftBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
|
result.append((message, ChatMessageGiftBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
|
||||||
skipText = true
|
skipText = true
|
||||||
|
@ -413,6 +413,20 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
}
|
}
|
||||||
title = item.presentationData.strings.Notification_StarsGift_Title(Int32(count))
|
title = item.presentationData.strings.Notification_StarsGift_Title(Int32(count))
|
||||||
text = incoming ? item.presentationData.strings.Notification_StarsGift_Subtitle : item.presentationData.strings.Notification_StarsGift_SubtitleYou(peerName).string
|
text = incoming ? item.presentationData.strings.Notification_StarsGift_Subtitle : item.presentationData.strings.Notification_StarsGift_SubtitleYou(peerName).string
|
||||||
|
case let .giftTon(currency, amount, cryptoCurrency, cryptoAmount, _):
|
||||||
|
var peerName = ""
|
||||||
|
if let peer = item.message.peers[item.message.id.peerId] {
|
||||||
|
peerName = EnginePeer(peer).compactDisplayTitle
|
||||||
|
}
|
||||||
|
//TODO:localize
|
||||||
|
let _ = currency
|
||||||
|
let _ = amount
|
||||||
|
let _ = cryptoCurrency
|
||||||
|
|
||||||
|
let cryptoAmount = cryptoAmount ?? 0
|
||||||
|
|
||||||
|
title = item.presentationData.strings.Notification_StarsGift_Title(Int32(cryptoAmount))
|
||||||
|
text = incoming ? item.presentationData.strings.Notification_StarsGift_Subtitle : item.presentationData.strings.Notification_StarsGift_SubtitleYou(peerName).string
|
||||||
case let .prizeStars(count, _, channelId, _, _):
|
case let .prizeStars(count, _, channelId, _, _):
|
||||||
if count <= 1000 {
|
if count <= 1000 {
|
||||||
months = 3
|
months = 3
|
||||||
|
@ -60,19 +60,19 @@ public final class ChatMessageSuggestedPostInfoNode: ASDisplayNode {
|
|||||||
|
|
||||||
//TODO:localize
|
//TODO:localize
|
||||||
let amountString: String
|
let amountString: String
|
||||||
if let amount, amount.amount.value != 0, amount.amount.nanos != 0 {
|
if let amount, amount.amount != .zero {
|
||||||
switch amount.currency {
|
switch amount.currency {
|
||||||
case .stars:
|
case .stars:
|
||||||
if amount.amount.value == 1 {
|
if amount.amount.value == 1 {
|
||||||
amountString = "1 Star"
|
amountString = "1 Star"
|
||||||
} else {
|
} else {
|
||||||
amountString = "\(amount) Stars"
|
amountString = "\(amount.amount) Stars"
|
||||||
}
|
}
|
||||||
case .ton:
|
case .ton:
|
||||||
if amount.amount.value == 1 {
|
if amount.amount.value == 1 {
|
||||||
amountString = "1 TON"
|
amountString = "1 TON"
|
||||||
} else {
|
} else {
|
||||||
amountString = "\(amount) TON"
|
amountString = "\(formatTonAmountText(amount.amount.value, dateTimeFormat: item.presentationData.dateTimeFormat)) TON"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -81,7 +81,7 @@ public final class ChatMessageSuggestedPostInfoNode: ASDisplayNode {
|
|||||||
|
|
||||||
var timestampString: String
|
var timestampString: String
|
||||||
if let timestamp {
|
if let timestamp {
|
||||||
timestampString = humanReadableStringForTimestamp(strings: item.presentationData.strings, dateTimeFormat: PresentationDateTimeFormat(), timestamp: timestamp, alwaysShowTime: true).string
|
timestampString = humanReadableStringForTimestamp(strings: item.presentationData.strings, dateTimeFormat: item.presentationData.dateTimeFormat, timestamp: timestamp, alwaysShowTime: true).string
|
||||||
if timestampString.count > 1 {
|
if timestampString.count > 1 {
|
||||||
timestampString = String(timestampString[timestampString.startIndex]).capitalized + timestampString[timestampString.index(after: timestampString.startIndex)...]
|
timestampString = String(timestampString[timestampString.startIndex]).capitalized + timestampString[timestampString.index(after: timestampString.startIndex)...]
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ public final class SuggestPostAccessoryPanelNode: AccessoryPanelNode {
|
|||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
public var theme: PresentationTheme
|
public var theme: PresentationTheme
|
||||||
public var strings: PresentationStrings
|
public var strings: PresentationStrings
|
||||||
|
private let dateTimeFormat: PresentationDateTimeFormat
|
||||||
|
|
||||||
private var textIsOptions: Bool = false
|
private var textIsOptions: Bool = false
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ public final class SuggestPostAccessoryPanelNode: AccessoryPanelNode {
|
|||||||
self.context = context
|
self.context = context
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.dateTimeFormat = dateTimeFormat
|
||||||
|
|
||||||
self.closeButton = HighlightableButtonNode()
|
self.closeButton = HighlightableButtonNode()
|
||||||
self.closeButton.accessibilityLabel = strings.VoiceOver_DiscardPreparedContent
|
self.closeButton.accessibilityLabel = strings.VoiceOver_DiscardPreparedContent
|
||||||
@ -241,11 +243,14 @@ public final class SuggestPostAccessoryPanelNode: AccessoryPanelNode {
|
|||||||
let textString: NSAttributedString
|
let textString: NSAttributedString
|
||||||
if let postSuggestionState = interfaceState.interfaceState.postSuggestionState, let price = postSuggestionState.price, price.amount != .zero {
|
if let postSuggestionState = interfaceState.interfaceState.postSuggestionState, let price = postSuggestionState.price, price.amount != .zero {
|
||||||
let currencySymbol: String
|
let currencySymbol: String
|
||||||
|
let amountString: String
|
||||||
switch price.currency {
|
switch price.currency {
|
||||||
case .stars:
|
case .stars:
|
||||||
currencySymbol = "#"
|
currencySymbol = "#"
|
||||||
|
amountString = "\(price.amount)"
|
||||||
case .ton:
|
case .ton:
|
||||||
currencySymbol = "$"
|
currencySymbol = "$"
|
||||||
|
amountString = formatTonAmountText(price.amount.value, dateTimeFormat: self.dateTimeFormat)
|
||||||
}
|
}
|
||||||
if let timestamp = postSuggestionState.timestamp {
|
if let timestamp = postSuggestionState.timestamp {
|
||||||
let timeString = humanReadableStringForTimestamp(strings: interfaceState.strings, dateTimeFormat: interfaceState.dateTimeFormat, timestamp: timestamp, alwaysShowTime: true, allowYesterday: false, format: HumanReadableStringFormat(
|
let timeString = humanReadableStringForTimestamp(strings: interfaceState.strings, dateTimeFormat: interfaceState.dateTimeFormat, timestamp: timestamp, alwaysShowTime: true, allowYesterday: false, format: HumanReadableStringFormat(
|
||||||
@ -262,9 +267,9 @@ public final class SuggestPostAccessoryPanelNode: AccessoryPanelNode {
|
|||||||
return PresentationStrings.FormattedString(string: interfaceState.strings.SuggestPost_SetTimeFormat_TodayAt(value).string, ranges: [])
|
return PresentationStrings.FormattedString(string: interfaceState.strings.SuggestPost_SetTimeFormat_TodayAt(value).string, ranges: [])
|
||||||
}
|
}
|
||||||
)).string
|
)).string
|
||||||
textString = NSAttributedString(string: "\(currencySymbol)\(price.amount) 📅 \(timeString)", font: textFont, textColor: self.theme.chat.inputPanel.primaryTextColor)
|
textString = NSAttributedString(string: "\(currencySymbol)\(amountString) 📅 \(timeString)", font: textFont, textColor: self.theme.chat.inputPanel.primaryTextColor)
|
||||||
} else {
|
} else {
|
||||||
textString = NSAttributedString(string: "\(currencySymbol)\(price.amount) for publishing anytime", font: textFont, textColor: self.theme.chat.inputPanel.primaryTextColor)
|
textString = NSAttributedString(string: "\(currencySymbol)\(amountString) for publishing anytime", font: textFont, textColor: self.theme.chat.inputPanel.primaryTextColor)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
textString = NSAttributedString(string: "Tap to offer a price for publishing", font: textFont, textColor: self.theme.chat.inputPanel.primaryTextColor)
|
textString = NSAttributedString(string: "Tap to offer a price for publishing", font: textFont, textColor: self.theme.chat.inputPanel.primaryTextColor)
|
||||||
|
@ -383,6 +383,7 @@ final class PeerInfoScreenData {
|
|||||||
let personalChannel: PeerInfoPersonalChannelData?
|
let personalChannel: PeerInfoPersonalChannelData?
|
||||||
let tonState: StarsContext.State?
|
let tonState: StarsContext.State?
|
||||||
let starsState: StarsContext.State?
|
let starsState: StarsContext.State?
|
||||||
|
let tonState: StarsContext.State?
|
||||||
let starsRevenueStatsState: StarsRevenueStats?
|
let starsRevenueStatsState: StarsRevenueStats?
|
||||||
let starsRevenueStatsContext: StarsRevenueStatsContext?
|
let starsRevenueStatsContext: StarsRevenueStatsContext?
|
||||||
let revenueStatsState: RevenueStats?
|
let revenueStatsState: RevenueStats?
|
||||||
@ -435,6 +436,7 @@ final class PeerInfoScreenData {
|
|||||||
personalChannel: PeerInfoPersonalChannelData?,
|
personalChannel: PeerInfoPersonalChannelData?,
|
||||||
tonState: StarsContext.State?,
|
tonState: StarsContext.State?,
|
||||||
starsState: StarsContext.State?,
|
starsState: StarsContext.State?,
|
||||||
|
tonState: StarsContext.State?,
|
||||||
starsRevenueStatsState: StarsRevenueStats?,
|
starsRevenueStatsState: StarsRevenueStats?,
|
||||||
starsRevenueStatsContext: StarsRevenueStatsContext?,
|
starsRevenueStatsContext: StarsRevenueStatsContext?,
|
||||||
revenueStatsState: RevenueStats?,
|
revenueStatsState: RevenueStats?,
|
||||||
@ -475,6 +477,7 @@ final class PeerInfoScreenData {
|
|||||||
self.personalChannel = personalChannel
|
self.personalChannel = personalChannel
|
||||||
self.tonState = tonState
|
self.tonState = tonState
|
||||||
self.starsState = starsState
|
self.starsState = starsState
|
||||||
|
self.tonState = tonState
|
||||||
self.starsRevenueStatsState = starsRevenueStatsState
|
self.starsRevenueStatsState = starsRevenueStatsState
|
||||||
self.starsRevenueStatsContext = starsRevenueStatsContext
|
self.starsRevenueStatsContext = starsRevenueStatsContext
|
||||||
self.revenueStatsState = revenueStatsState
|
self.revenueStatsState = revenueStatsState
|
||||||
@ -862,6 +865,12 @@ func peerInfoScreenSettingsData(context: AccountContext, peerId: EnginePeer.Id,
|
|||||||
} else {
|
} else {
|
||||||
starsState = .single(nil)
|
starsState = .single(nil)
|
||||||
}
|
}
|
||||||
|
let tonState: Signal<StarsContext.State?, NoError>
|
||||||
|
if let tonContext {
|
||||||
|
tonState = tonContext.state
|
||||||
|
} else {
|
||||||
|
tonState = .single(nil)
|
||||||
|
}
|
||||||
|
|
||||||
let profileGiftsContext = ProfileGiftsContext(account: context.account, peerId: peerId)
|
let profileGiftsContext = ProfileGiftsContext(account: context.account, peerId: peerId)
|
||||||
|
|
||||||
@ -972,6 +981,7 @@ func peerInfoScreenSettingsData(context: AccountContext, peerId: EnginePeer.Id,
|
|||||||
personalChannel: personalChannel,
|
personalChannel: personalChannel,
|
||||||
tonState: tonState,
|
tonState: tonState,
|
||||||
starsState: starsState,
|
starsState: starsState,
|
||||||
|
tonState: tonState,
|
||||||
starsRevenueStatsState: nil,
|
starsRevenueStatsState: nil,
|
||||||
starsRevenueStatsContext: nil,
|
starsRevenueStatsContext: nil,
|
||||||
revenueStatsState: nil,
|
revenueStatsState: nil,
|
||||||
@ -1023,6 +1033,7 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
|
|||||||
personalChannel: nil,
|
personalChannel: nil,
|
||||||
tonState: nil,
|
tonState: nil,
|
||||||
starsState: nil,
|
starsState: nil,
|
||||||
|
tonState: nil,
|
||||||
starsRevenueStatsState: nil,
|
starsRevenueStatsState: nil,
|
||||||
starsRevenueStatsContext: nil,
|
starsRevenueStatsContext: nil,
|
||||||
revenueStatsState: nil,
|
revenueStatsState: nil,
|
||||||
@ -1483,6 +1494,7 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
|
|||||||
personalChannel: personalChannel,
|
personalChannel: personalChannel,
|
||||||
tonState: nil,
|
tonState: nil,
|
||||||
starsState: nil,
|
starsState: nil,
|
||||||
|
tonState: nil,
|
||||||
starsRevenueStatsState: starsRevenueContextAndState.1,
|
starsRevenueStatsState: starsRevenueContextAndState.1,
|
||||||
starsRevenueStatsContext: starsRevenueContextAndState.0,
|
starsRevenueStatsContext: starsRevenueContextAndState.0,
|
||||||
revenueStatsState: revenueContextAndState.1,
|
revenueStatsState: revenueContextAndState.1,
|
||||||
@ -1715,6 +1727,7 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
|
|||||||
personalChannel: personalChannel,
|
personalChannel: personalChannel,
|
||||||
tonState: nil,
|
tonState: nil,
|
||||||
starsState: nil,
|
starsState: nil,
|
||||||
|
tonState: nil,
|
||||||
starsRevenueStatsState: starsRevenueContextAndState.1,
|
starsRevenueStatsState: starsRevenueContextAndState.1,
|
||||||
starsRevenueStatsContext: starsRevenueContextAndState.0,
|
starsRevenueStatsContext: starsRevenueContextAndState.0,
|
||||||
revenueStatsState: revenueContextAndState.1,
|
revenueStatsState: revenueContextAndState.1,
|
||||||
@ -2048,6 +2061,7 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
|
|||||||
personalChannel: nil,
|
personalChannel: nil,
|
||||||
tonState: nil,
|
tonState: nil,
|
||||||
starsState: nil,
|
starsState: nil,
|
||||||
|
tonState: nil,
|
||||||
starsRevenueStatsState: starsRevenueContextAndState.1,
|
starsRevenueStatsState: starsRevenueContextAndState.1,
|
||||||
starsRevenueStatsContext: starsRevenueContextAndState.0,
|
starsRevenueStatsContext: starsRevenueContextAndState.0,
|
||||||
revenueStatsState: nil,
|
revenueStatsState: nil,
|
||||||
|
@ -1048,6 +1048,7 @@ private func settingsItems(data: PeerInfoScreenData?, context: AccountContext, p
|
|||||||
} else {
|
} else {
|
||||||
balanceText = NSAttributedString()
|
balanceText = NSAttributedString()
|
||||||
}
|
}
|
||||||
|
//TODO:localize
|
||||||
items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 103, label: .attributedText(balanceText), text: "My TON", icon: PresentationResourcesSettings.ton, action: {
|
items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 103, label: .attributedText(balanceText), text: "My TON", icon: PresentationResourcesSettings.ton, action: {
|
||||||
interaction.openSettings(.ton)
|
interaction.openSettings(.ton)
|
||||||
}))
|
}))
|
||||||
@ -10669,7 +10670,11 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
}
|
}
|
||||||
case .ton:
|
case .ton:
|
||||||
if let tonContext = self.controller?.tonContext {
|
if let tonContext = self.controller?.tonContext {
|
||||||
|
<<<<<<< HEAD
|
||||||
push(self.context.sharedContext.makeTonTransactionsScreen(context: self.context, tonContext: tonContext))
|
push(self.context.sharedContext.makeTonTransactionsScreen(context: self.context, tonContext: tonContext))
|
||||||
|
=======
|
||||||
|
push(self.context.sharedContext.makeStarsTransactionsScreen(context: self.context, starsContext: tonContext))
|
||||||
|
>>>>>>> 51a16c711078fab6940623bf1de0ec85516ba699
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12987,6 +12992,12 @@ public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen, KeyShortc
|
|||||||
self.starsContext = nil
|
self.starsContext = nil
|
||||||
self.tonContext = nil
|
self.tonContext = nil
|
||||||
}
|
}
|
||||||
|
if isSettings, let tonContext = context.tonContext {
|
||||||
|
self.tonContext = tonContext
|
||||||
|
tonContext.load(force: true)
|
||||||
|
} else {
|
||||||
|
self.tonContext = nil
|
||||||
|
}
|
||||||
|
|
||||||
if isMyProfile, let profileGiftsContext {
|
if isMyProfile, let profileGiftsContext {
|
||||||
profileGiftsContext.updateFilter(.All)
|
profileGiftsContext.updateFilter(.All)
|
||||||
|
@ -481,7 +481,7 @@ private final class SheetContent: CombinedComponent {
|
|||||||
accentColor: theme.list.itemAccentColor,
|
accentColor: theme.list.itemAccentColor,
|
||||||
value: state.amount?.value,
|
value: state.amount?.value,
|
||||||
minValue: minAmount?.value,
|
minValue: minAmount?.value,
|
||||||
maxValue: maxAmount?.value,
|
maxValue: state.currency == .ton ? nil : maxAmount?.value,
|
||||||
placeholderText: amountPlaceholder,
|
placeholderText: amountPlaceholder,
|
||||||
labelText: amountLabel,
|
labelText: amountLabel,
|
||||||
currency: state.currency,
|
currency: state.currency,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user