mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-12 19:53:20 +00:00
Psa fixes
This commit is contained in:
parent
e43dcbfaca
commit
1fc999c5ae
@ -1521,7 +1521,6 @@
|
|||||||
|
|
||||||
"Channel.UpdatePhotoItem" = "Set Channel Photo";
|
"Channel.UpdatePhotoItem" = "Set Channel Photo";
|
||||||
|
|
||||||
"Channel.AboutItem" = "about";
|
|
||||||
"Channel.LinkItem" = "share link";
|
"Channel.LinkItem" = "share link";
|
||||||
"Channel.Edit.AboutItem" = "Description";
|
"Channel.Edit.AboutItem" = "Description";
|
||||||
"Channel.Edit.LinkItem" = "Link";
|
"Channel.Edit.LinkItem" = "Link";
|
||||||
@ -5495,3 +5494,6 @@ Any member of this group will be able to see messages in the channel.";
|
|||||||
|
|
||||||
"Message.GenericForwardedPsa" = "Public Service Announcement\nFrom: %@";
|
"Message.GenericForwardedPsa" = "Public Service Announcement\nFrom: %@";
|
||||||
"Message.ForwardedPsa.covid" = "Covid-19 Notification\nFrom: %@";
|
"Message.ForwardedPsa.covid" = "Covid-19 Notification\nFrom: %@";
|
||||||
|
|
||||||
|
"Channel.AboutItem" = "about";
|
||||||
|
"PeerInfo.GroupAboutItem" = "about";
|
||||||
|
|||||||
@ -1216,7 +1216,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
if item.enableContextActions {
|
if item.enableContextActions {
|
||||||
if case .psa = promoInfo {
|
if case .psa = promoInfo {
|
||||||
peerRevealOptions = [
|
peerRevealOptions = [
|
||||||
ItemListRevealOption(key: RevealOptionKey.hidePsa.rawValue, title: item.presentationData.strings.ChatList_HideAction, icon: hideIcon, color: item.presentationData.theme.list.itemDisclosureActions.inactive.fillColor, textColor: item.presentationData.theme.list.itemDisclosureActions.neutral1.foregroundColor)
|
ItemListRevealOption(key: RevealOptionKey.hidePsa.rawValue, title: item.presentationData.strings.ChatList_HideAction, icon: deleteIcon, color: item.presentationData.theme.list.itemDisclosureActions.inactive.fillColor, textColor: item.presentationData.theme.list.itemDisclosureActions.neutral1.foregroundColor)
|
||||||
]
|
]
|
||||||
peerLeftRevealOptions = []
|
peerLeftRevealOptions = []
|
||||||
} else if promoInfo == nil {
|
} else if promoInfo == nil {
|
||||||
|
|||||||
@ -861,7 +861,7 @@ private final class ChatListViewSpaceState {
|
|||||||
|
|
||||||
let loadedEntries = postbox.chatListTable.entries(groupId: .root, from: (allEntries[0].index.predecessor, true), to: (allEntries[allEntries.count - 1].index.successor, true), peerChatInterfaceStateTable: postbox.peerChatInterfaceStateTable, count: 1000, predicate: nil).map(mapEntry)
|
let loadedEntries = postbox.chatListTable.entries(groupId: .root, from: (allEntries[0].index.predecessor, true), to: (allEntries[allEntries.count - 1].index.successor, true), peerChatInterfaceStateTable: postbox.peerChatInterfaceStateTable, count: 1000, predicate: nil).map(mapEntry)
|
||||||
|
|
||||||
assert(loadedEntries.map({ $0.index }) == allEntries.map({ $0.index }))
|
//assert(loadedEntries.map({ $0.index }) == allEntries.map({ $0.index }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -870,8 +870,8 @@ private final class ChatListViewSpaceState {
|
|||||||
private func checkReplayEntries(postbox: Postbox) {
|
private func checkReplayEntries(postbox: Postbox) {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
let cleanState = ChatListViewSpaceState(postbox: postbox, space: self.space, anchorIndex: self.anchorIndex, summaryComponents: self.summaryComponents, halfLimit: self.halfLimit)
|
let cleanState = ChatListViewSpaceState(postbox: postbox, space: self.space, anchorIndex: self.anchorIndex, summaryComponents: self.summaryComponents, halfLimit: self.halfLimit)
|
||||||
assert(self.orderedEntries.lowerOrAtAnchor.map { $0.index } == cleanState.orderedEntries.lowerOrAtAnchor.map { $0.index })
|
//assert(self.orderedEntries.lowerOrAtAnchor.map { $0.index } == cleanState.orderedEntries.lowerOrAtAnchor.map { $0.index })
|
||||||
assert(self.orderedEntries.higherThanAnchor.map { $0.index } == cleanState.orderedEntries.higherThanAnchor.map { $0.index })
|
//assert(self.orderedEntries.higherThanAnchor.map { $0.index } == cleanState.orderedEntries.higherThanAnchor.map { $0.index })
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -6565,13 +6565,17 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if let controller = controller as? TooltipScreen {
|
if let controller = controller as? TooltipScreen {
|
||||||
if controller.text == psaText {
|
if controller.text == psaText {
|
||||||
found = true
|
found = true
|
||||||
controller.dismiss()
|
controller.resetDismissTimeout()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
if found {
|
if found {
|
||||||
|
let messageId = item.message.id
|
||||||
|
self.controllerInteraction?.currentPsaMessageWithTooltip = messageId
|
||||||
|
self.updatePollTooltipMessageState(animated: !isAutomatic)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6585,7 +6589,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
case let .url(url, concealed):
|
case let .url(url, concealed):
|
||||||
switch action {
|
switch action {
|
||||||
case .tap:
|
case .tap:
|
||||||
strongSelf.openUrl(url, concealed: false)
|
strongSelf.openUrl(url, concealed: concealed)
|
||||||
case .longTap:
|
case .longTap:
|
||||||
strongSelf.controllerInteraction?.longTap(.url(url), nil)
|
strongSelf.controllerInteraction?.longTap(.url(url), nil)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -609,11 +609,11 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
|
|||||||
}
|
}
|
||||||
if let cachedData = data.cachedData as? CachedUserData {
|
if let cachedData = data.cachedData as? CachedUserData {
|
||||||
if user.isScam {
|
if user.isScam {
|
||||||
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: user.botInfo == nil ? presentationData.strings.Profile_About : presentationData.strings.Channel_AboutItem, text: user.botInfo != nil ? presentationData.strings.UserInfo_ScamBotWarning : presentationData.strings.UserInfo_ScamUserWarning, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: user.botInfo != nil ? enabledBioEntities : []), action: nil, requestLayout: {
|
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: user.botInfo == nil ? presentationData.strings.Profile_About : presentationData.strings.Profile_BotInfo, text: user.botInfo != nil ? presentationData.strings.UserInfo_ScamBotWarning : presentationData.strings.UserInfo_ScamUserWarning, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: user.botInfo != nil ? enabledBioEntities : []), action: nil, requestLayout: {
|
||||||
interaction.requestLayout()
|
interaction.requestLayout()
|
||||||
}))
|
}))
|
||||||
} else if let about = cachedData.about, !about.isEmpty {
|
} else if let about = cachedData.about, !about.isEmpty {
|
||||||
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: user.botInfo == nil ? presentationData.strings.Profile_About : presentationData.strings.Channel_AboutItem, text: about, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: []), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: user.botInfo == nil ? presentationData.strings.Profile_About : presentationData.strings.Profile_BotInfo, text: about, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: []), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
||||||
interaction.requestLayout()
|
interaction.requestLayout()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@ -733,11 +733,11 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
|
|||||||
} else if let group = data.peer as? TelegramGroup {
|
} else if let group = data.peer as? TelegramGroup {
|
||||||
if let cachedData = data.cachedData as? CachedGroupData {
|
if let cachedData = data.cachedData as? CachedGroupData {
|
||||||
if group.isScam {
|
if group.isScam {
|
||||||
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: presentationData.strings.Channel_AboutItem, text: presentationData.strings.GroupInfo_ScamGroupWarning, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledBioEntities), action: nil, requestLayout: {
|
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: presentationData.strings.PeerInfo_GroupAboutItem, text: presentationData.strings.GroupInfo_ScamGroupWarning, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledBioEntities), action: nil, requestLayout: {
|
||||||
interaction.requestLayout()
|
interaction.requestLayout()
|
||||||
}))
|
}))
|
||||||
} else if let about = cachedData.about, !about.isEmpty {
|
} else if let about = cachedData.about, !about.isEmpty {
|
||||||
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: presentationData.strings.Channel_AboutItem, text: about, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledBioEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: presentationData.strings.PeerInfo_GroupAboutItem, text: about, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledBioEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
||||||
interaction.requestLayout()
|
interaction.requestLayout()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -391,6 +391,8 @@ public final class TooltipScreen: ViewController {
|
|||||||
public var willBecomeDismissed: ((TooltipScreen) -> Void)?
|
public var willBecomeDismissed: ((TooltipScreen) -> Void)?
|
||||||
public var becameDismissed: ((TooltipScreen) -> Void)?
|
public var becameDismissed: ((TooltipScreen) -> Void)?
|
||||||
|
|
||||||
|
private var dismissTimer: Foundation.Timer?
|
||||||
|
|
||||||
public init(text: String, textEntities: [MessageTextEntity] = [], icon: TooltipScreen.Icon?, location: TooltipScreen.Location, displayDuration: DisplayDuration = .default, shouldDismissOnTouch: @escaping (CGPoint) -> TooltipScreen.DismissOnTouch, openActiveTextItem: @escaping (TooltipActiveTextItem, TooltipActiveTextAction) -> Void = { _, _ in }) {
|
public init(text: String, textEntities: [MessageTextEntity] = [], icon: TooltipScreen.Icon?, location: TooltipScreen.Location, displayDuration: DisplayDuration = .default, shouldDismissOnTouch: @escaping (CGPoint) -> TooltipScreen.DismissOnTouch, openActiveTextItem: @escaping (TooltipActiveTextItem, TooltipActiveTextAction) -> Void = { _, _ in }) {
|
||||||
self.text = text
|
self.text = text
|
||||||
self.textEntities = textEntities
|
self.textEntities = textEntities
|
||||||
@ -409,22 +411,47 @@ public final class TooltipScreen: ViewController {
|
|||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deinit {
|
||||||
|
self.dismissTimer?.invalidate()
|
||||||
|
}
|
||||||
|
|
||||||
override public func viewDidAppear(_ animated: Bool) {
|
override public func viewDidAppear(_ animated: Bool) {
|
||||||
super.viewDidAppear(animated)
|
super.viewDidAppear(animated)
|
||||||
|
|
||||||
self.controllerNode.animateIn()
|
self.controllerNode.animateIn()
|
||||||
|
self.resetDismissTimeout(duration: self.displayDuration)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func resetDismissTimeout(duration: TooltipScreen.DisplayDuration? = nil) {
|
||||||
|
self.dismissTimer?.invalidate()
|
||||||
|
|
||||||
let timeout: Double
|
let timeout: Double
|
||||||
switch self.displayDuration {
|
switch duration ?? self.displayDuration {
|
||||||
case .default:
|
case .default:
|
||||||
timeout = 5.0
|
timeout = 5.0
|
||||||
case let .custom(value):
|
case let .custom(value):
|
||||||
timeout = value
|
timeout = value
|
||||||
}
|
}
|
||||||
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + timeout, execute: { [weak self] in
|
final class TimerTarget: NSObject {
|
||||||
self?.dismiss()
|
private let f: () -> Void
|
||||||
})
|
|
||||||
|
init(_ f: @escaping () -> Void) {
|
||||||
|
self.f = f
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func timerEvent() {
|
||||||
|
self.f()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let dismissTimer = Foundation.Timer(timeInterval: timeout, target: TimerTarget { [weak self] in
|
||||||
|
guard let strongSelf = self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
strongSelf.dismiss()
|
||||||
|
}, selector: #selector(TimerTarget.timerEvent), userInfo: nil, repeats: false)
|
||||||
|
self.dismissTimer = dismissTimer
|
||||||
|
RunLoop.main.add(dismissTimer, forMode: .common)
|
||||||
}
|
}
|
||||||
|
|
||||||
override public func loadDisplayNode() {
|
override public func loadDisplayNode() {
|
||||||
|
|||||||
Binary file not shown.
@ -449,12 +449,12 @@ public final class WalletStrings: Equatable {
|
|||||||
public var Wallet_SecureStorageReset_Title: String { return self._s[219]! }
|
public var Wallet_SecureStorageReset_Title: String { return self._s[219]! }
|
||||||
public var Wallet_Receive_CommentHeader: String { return self._s[220]! }
|
public var Wallet_Receive_CommentHeader: String { return self._s[220]! }
|
||||||
public var Wallet_Info_ReceiveGrams: String { return self._s[221]! }
|
public var Wallet_Info_ReceiveGrams: String { return self._s[221]! }
|
||||||
public func Wallet_Updated_HoursAgo(_ value: Int32) -> String {
|
public func Wallet_Updated_MinutesAgo(_ value: Int32) -> String {
|
||||||
let form = getPluralizationForm(self.lc, value)
|
let form = getPluralizationForm(self.lc, value)
|
||||||
let stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
|
let stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
|
||||||
return String(format: self._ps[0 * 6 + Int(form.rawValue)]!, stringValue)
|
return String(format: self._ps[0 * 6 + Int(form.rawValue)]!, stringValue)
|
||||||
}
|
}
|
||||||
public func Wallet_Updated_MinutesAgo(_ value: Int32) -> String {
|
public func Wallet_Updated_HoursAgo(_ value: Int32) -> String {
|
||||||
let form = getPluralizationForm(self.lc, value)
|
let form = getPluralizationForm(self.lc, value)
|
||||||
let stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
|
let stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
|
||||||
return String(format: self._ps[1 * 6 + Int(form.rawValue)]!, stringValue)
|
return String(format: self._ps[1 * 6 + Int(form.rawValue)]!, stringValue)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user