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
0648ffbb2a
commit
c696a0aaed
@ -13568,6 +13568,7 @@ Sorry for the inconvenience.";
|
|||||||
|
|
||||||
"Notification.StarGift.Unpack" = "Unpack";
|
"Notification.StarGift.Unpack" = "Unpack";
|
||||||
|
|
||||||
|
"Notification.StarGift.Collectible" = "Collectible";
|
||||||
"Notification.StarGift.Model" = "Model";
|
"Notification.StarGift.Model" = "Model";
|
||||||
"Notification.StarGift.Backdrop" = "Backdrop";
|
"Notification.StarGift.Backdrop" = "Backdrop";
|
||||||
"Notification.StarGift.Symbol" = "Symbol";
|
"Notification.StarGift.Symbol" = "Symbol";
|
||||||
|
@ -190,6 +190,7 @@ public enum ResolvedUrlSettingsSection {
|
|||||||
case autoremoveMessages
|
case autoremoveMessages
|
||||||
case twoStepAuth
|
case twoStepAuth
|
||||||
case enableLog
|
case enableLog
|
||||||
|
case phonePrivacy
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ResolvedBotChoosePeerTypes: OptionSet {
|
public struct ResolvedBotChoosePeerTypes: OptionSet {
|
||||||
|
@ -153,8 +153,7 @@ final class PremiumOptionComponent: CombinedComponent {
|
|||||||
transition: context.transition
|
transition: context.transition
|
||||||
)
|
)
|
||||||
|
|
||||||
let discountPosition = CGPoint(x: insets.left + title.size.width + 6.0 + discountSize.width / 2.0, y: insets.top + title.size.height / 2.0)
|
let discountPosition = CGPoint(x: insets.left + title.size.width + 6.0 + discountSize.width / 2.0, y: insets.top + title.size.height / 2.0 - 2.0)
|
||||||
|
|
||||||
context.add(discountBackground
|
context.add(discountBackground
|
||||||
.position(discountPosition)
|
.position(discountPosition)
|
||||||
)
|
)
|
||||||
|
@ -426,7 +426,8 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
peerName = EnginePeer(channel).compactDisplayTitle
|
peerName = EnginePeer(channel).compactDisplayTitle
|
||||||
}
|
}
|
||||||
title = item.presentationData.strings.Notification_StarsGiveaway_Title
|
title = item.presentationData.strings.Notification_StarsGiveaway_Title
|
||||||
text = item.presentationData.strings.Notification_StarsGiveaway_Subtitle(peerName, item.presentationData.strings.Notification_StarsGiveaway_Subtitle_Stars(Int32(count))).string
|
let starsString = item.presentationData.strings.Notification_StarsGiveaway_Subtitle_Stars(Int32(count)).replacingOccurrences(of: " ", with: "\u{00A0}")
|
||||||
|
text = item.presentationData.strings.Notification_StarsGiveaway_Subtitle(peerName, starsString).string
|
||||||
case let .giftCode(_, fromGiveaway, unclaimed, channelId, monthsValue, _, _, _, _, giftText, giftEntities):
|
case let .giftCode(_, fromGiveaway, unclaimed, channelId, monthsValue, _, _, _, _, giftText, giftEntities):
|
||||||
if channelId == nil {
|
if channelId == nil {
|
||||||
months = monthsValue
|
months = monthsValue
|
||||||
@ -523,7 +524,8 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
}
|
}
|
||||||
if peerName.isEmpty {
|
if peerName.isEmpty {
|
||||||
if let convertStars, convertStars > 0 {
|
if let convertStars, convertStars > 0 {
|
||||||
text = item.presentationData.strings.Notification_StarGift_Subtitle(item.presentationData.strings.Notification_StarGift_Subtitle_Stars(Int32(convertStars))).string
|
let starsString = item.presentationData.strings.Notification_StarGift_Subtitle_Stars(Int32(convertStars)).replacingOccurrences(of: " ", with: "\u{00A0}")
|
||||||
|
text = item.presentationData.strings.Notification_StarGift_Subtitle(starsString).string
|
||||||
} else {
|
} else {
|
||||||
text = item.presentationData.strings.Notification_StarGift_Bot_Subtitle
|
text = item.presentationData.strings.Notification_StarGift_Bot_Subtitle
|
||||||
}
|
}
|
||||||
@ -531,7 +533,8 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
if upgradeStars != nil {
|
if upgradeStars != nil {
|
||||||
text = item.presentationData.strings.Notification_StarGift_Subtitle_Upgrade_Other(peerName).string
|
text = item.presentationData.strings.Notification_StarGift_Subtitle_Upgrade_Other(peerName).string
|
||||||
} else if let convertStars, convertStars > 0 {
|
} else if let convertStars, convertStars > 0 {
|
||||||
let formattedString = item.presentationData.strings.Notification_StarGift_Subtitle_Other(peerName, item.presentationData.strings.Notification_StarGift_Subtitle_Other_Stars(Int32(convertStars)))
|
let starsString = item.presentationData.strings.Notification_StarGift_Subtitle_Other_Stars(Int32(convertStars)).replacingOccurrences(of: " ", with: "\u{00A0}")
|
||||||
|
let formattedString = item.presentationData.strings.Notification_StarGift_Subtitle_Other(peerName, starsString)
|
||||||
text = formattedString.string
|
text = formattedString.string
|
||||||
if let starsRange = formattedString.ranges.last {
|
if let starsRange = formattedString.ranges.last {
|
||||||
entities.append(MessageTextEntity(range: starsRange.range.lowerBound ..< starsRange.range.upperBound, type: .Bold))
|
entities.append(MessageTextEntity(range: starsRange.range.lowerBound ..< starsRange.range.upperBound, type: .Bold))
|
||||||
@ -560,6 +563,8 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
case let .starGiftUnique(gift, isUpgrade, _, _, _, _, isRefunded, _, _, _):
|
case let .starGiftUnique(gift, isUpgrade, _, _, _, _, isRefunded, _, _, _):
|
||||||
if case let .unique(uniqueGift) = gift {
|
if case let .unique(uniqueGift) = gift {
|
||||||
isStarGift = true
|
isStarGift = true
|
||||||
|
|
||||||
|
let isSelfGift = item.message.id.peerId == item.context.account.peerId
|
||||||
let authorName: String
|
let authorName: String
|
||||||
if isUpgrade {
|
if isUpgrade {
|
||||||
if item.message.author?.id == item.context.account.peerId {
|
if item.message.author?.id == item.context.account.peerId {
|
||||||
@ -570,12 +575,14 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
} else {
|
} else {
|
||||||
authorName = item.message.author.flatMap { EnginePeer($0) }?.compactDisplayTitle ?? ""
|
authorName = item.message.author.flatMap { EnginePeer($0) }?.compactDisplayTitle ?? ""
|
||||||
}
|
}
|
||||||
if item.message.id.peerId.isTelegramNotifications {
|
if isSelfGift {
|
||||||
|
title = item.presentationData.strings.Notification_StarGift_Self_Title
|
||||||
|
} else if item.message.id.peerId.isTelegramNotifications {
|
||||||
title = item.presentationData.strings.Notification_StarGift_TitleShort
|
title = item.presentationData.strings.Notification_StarGift_TitleShort
|
||||||
} else {
|
} else {
|
||||||
title = isStoryEntity ? uniqueGift.title : item.presentationData.strings.Notification_StarGift_Title(authorName).string
|
title = isStoryEntity ? uniqueGift.title : item.presentationData.strings.Notification_StarGift_Title(authorName).string
|
||||||
}
|
}
|
||||||
text = isStoryEntity ? "**Collectible #\(uniqueGift.number)**" : "**\(uniqueGift.title) #\(uniqueGift.number)**"
|
text = isStoryEntity ? "**\(item.presentationData.strings.Notification_StarGift_Collectible) #\(uniqueGift.number)**" : "**\(uniqueGift.title) #\(uniqueGift.number)**"
|
||||||
ribbonTitle = isStoryEntity ? "" : item.presentationData.strings.Notification_StarGift_Gift
|
ribbonTitle = isStoryEntity ? "" : item.presentationData.strings.Notification_StarGift_Gift
|
||||||
buttonTitle = isStoryEntity ? "" : item.presentationData.strings.Notification_StarGift_View
|
buttonTitle = isStoryEntity ? "" : item.presentationData.strings.Notification_StarGift_View
|
||||||
modelTitle = item.presentationData.strings.Notification_StarGift_Model
|
modelTitle = item.presentationData.strings.Notification_StarGift_Model
|
||||||
|
@ -952,7 +952,7 @@ func peerInfoScreenSettingsData(context: AccountContext, peerId: EnginePeer.Id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, isSettings: Bool, isMyProfile: Bool, hintGroupInCommon: PeerId?, existingRequestsContext: PeerInvitationImportersContext?, chatLocation: ChatLocation, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>, privacySettings: Signal<AccountPrivacySettings?, NoError>) -> Signal<PeerInfoScreenData, NoError> {
|
func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, isSettings: Bool, isMyProfile: Bool, hintGroupInCommon: PeerId?, existingRequestsContext: PeerInvitationImportersContext?, chatLocation: ChatLocation, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>, privacySettings: Signal<AccountPrivacySettings?, NoError>, forceHasGifts: Bool) -> Signal<PeerInfoScreenData, NoError> {
|
||||||
return peerInfoScreenInputData(context: context, peerId: peerId, isSettings: isSettings)
|
return peerInfoScreenInputData(context: context, peerId: peerId, isSettings: isSettings)
|
||||||
|> mapToSignal { inputData -> Signal<PeerInfoScreenData, NoError> in
|
|> mapToSignal { inputData -> Signal<PeerInfoScreenData, NoError> in
|
||||||
let wasUpgradedGroup = Atomic<Bool?>(value: nil)
|
let wasUpgradedGroup = Atomic<Bool?>(value: nil)
|
||||||
@ -1606,7 +1606,7 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
|
|||||||
}
|
}
|
||||||
|
|
||||||
if availablePanes != nil, let cachedData = peerView.cachedData as? CachedChannelData {
|
if availablePanes != nil, let cachedData = peerView.cachedData as? CachedChannelData {
|
||||||
if (cachedData.starGiftsCount ?? 0) > 0 || (profileGiftsState.count ?? 0) > 0 {
|
if (cachedData.starGiftsCount ?? 0) > 0 || (profileGiftsState.count ?? 0) > 0 || forceHasGifts {
|
||||||
availablePanes?.insert(.gifts, at: hasStories ? 1 : 0)
|
availablePanes?.insert(.gifts, at: hasStories ? 1 : 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1273,9 +1273,12 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, ASGestureRecognizerDelegat
|
|||||||
self.isReady.set(.single(true))
|
self.isReady.set(.single(true))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let previousCurrentPaneKey = previousCurrentPaneKey, self.currentPaneKey != previousCurrentPaneKey {
|
if let previousCurrentPaneKey, self.currentPaneKey != previousCurrentPaneKey || self.expandOnSwitch {
|
||||||
self.currentPaneUpdated?(self.expandOnSwitch)
|
if self.currentPaneKey == nil && previousCurrentPaneKey == .gifts {
|
||||||
self.expandOnSwitch = false
|
} else {
|
||||||
|
self.currentPaneUpdated?(self.expandOnSwitch)
|
||||||
|
self.expandOnSwitch = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if updateCurrentPaneStatus {
|
if updateCurrentPaneStatus {
|
||||||
self.currentPaneStatusPromise.set(self.currentPane?.node.status ?? .single(nil))
|
self.currentPaneStatusPromise.set(self.currentPane?.node.status ?? .single(nil))
|
||||||
|
@ -4603,7 +4603,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
self.privacySettings.set(.single(nil))
|
self.privacySettings.set(.single(nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
screenData = peerInfoScreenData(context: context, peerId: peerId, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, isSettings: self.isSettings, isMyProfile: self.isMyProfile, hintGroupInCommon: hintGroupInCommon, existingRequestsContext: requestsContext, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, privacySettings: self.privacySettings.get())
|
screenData = peerInfoScreenData(context: context, peerId: peerId, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, isSettings: self.isSettings, isMyProfile: self.isMyProfile, hintGroupInCommon: hintGroupInCommon, existingRequestsContext: requestsContext, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, privacySettings: self.privacySettings.get(), forceHasGifts: initialPaneKey == .gifts)
|
||||||
|
|
||||||
var previousTimestamp: Double?
|
var previousTimestamp: Double?
|
||||||
self.headerNode.displayPremiumIntro = { [weak self] sourceView, peerStatus, emojiStatusFileAndPack, white in
|
self.headerNode.displayPremiumIntro = { [weak self] sourceView, peerStatus, emojiStatusFileAndPack, white in
|
||||||
@ -6497,16 +6497,13 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
}
|
}
|
||||||
|
|
||||||
let boostTitle: String
|
let boostTitle: String
|
||||||
var isNew = false
|
|
||||||
switch channel.info {
|
switch channel.info {
|
||||||
case .group:
|
case .group:
|
||||||
boostTitle = presentationData.strings.PeerInfo_Group_Boost
|
boostTitle = presentationData.strings.PeerInfo_Group_Boost
|
||||||
isNew = true
|
|
||||||
case .broadcast:
|
case .broadcast:
|
||||||
boostTitle = presentationData.strings.PeerInfo_Channel_Boost
|
boostTitle = presentationData.strings.PeerInfo_Channel_Boost
|
||||||
}
|
}
|
||||||
|
items.append(.action(ContextMenuActionItem(text: boostTitle, badge: nil, icon: { theme in
|
||||||
items.append(.action(ContextMenuActionItem(text: boostTitle, badge: isNew ? ContextMenuActionBadge(value: presentationData.strings.Settings_New, color: .accent, style: .label) : nil, icon: { theme in
|
|
||||||
generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Boost"), color: theme.contextMenu.primaryColor)
|
generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Boost"), color: theme.contextMenu.primaryColor)
|
||||||
}, action: { [weak self] _, f in
|
}, action: { [weak self] _, f in
|
||||||
f(.dismissWithoutContent)
|
f(.dismissWithoutContent)
|
||||||
|
@ -402,7 +402,7 @@ final class UserAppearanceScreenComponent: Component {
|
|||||||
if case .info = action {
|
if case .info = action {
|
||||||
var replaceImpl: ((ViewController) -> Void)?
|
var replaceImpl: ((ViewController) -> Void)?
|
||||||
let controller = component.context.sharedContext.makePremiumDemoController(context: component.context, subject: .colors, forceDark: false, action: {
|
let controller = component.context.sharedContext.makePremiumDemoController(context: component.context, subject: .colors, forceDark: false, action: {
|
||||||
let controller = component.context.sharedContext.makePremiumIntroController(context: component.context, source: .settings, forceDark: false, dismissed: nil)
|
let controller = component.context.sharedContext.makePremiumIntroController(context: component.context, source: .nameColor, forceDark: false, dismissed: nil)
|
||||||
replaceImpl?(controller)
|
replaceImpl?(controller)
|
||||||
}, dismissed: nil)
|
}, dismissed: nil)
|
||||||
replaceImpl = { [weak controller] c in
|
replaceImpl = { [weak controller] c in
|
||||||
|
@ -703,6 +703,18 @@ func openResolvedUrlImpl(
|
|||||||
navigationController.setViewControllers(controllers, animated: true)
|
navigationController.setViewControllers(controllers, animated: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case .phonePrivacy:
|
||||||
|
let privacySignal = context.engine.privacy.requestAccountPrivacySettings()
|
||||||
|
let _ = (privacySignal
|
||||||
|
|> deliverOnMainQueue).start(next: { info in
|
||||||
|
let current: SelectivePrivacySettings = info.phoneNumber
|
||||||
|
if let navigationController = navigationController {
|
||||||
|
let controller = selectivePrivacySettingsController(context: context, kind: .phoneNumber, current: current, phoneDiscoveryEnabled: info.phoneDiscoveryEnabled, updated: { _, _, _, _ in
|
||||||
|
})
|
||||||
|
controller.navigationPresentation = .modal
|
||||||
|
navigationController.pushViewController(controller)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
case let .premiumOffer(reference):
|
case let .premiumOffer(reference):
|
||||||
dismissInput()
|
dismissInput()
|
||||||
|
@ -1014,6 +1014,8 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
|||||||
section = .twoStepAuth
|
section = .twoStepAuth
|
||||||
case "enable_log":
|
case "enable_log":
|
||||||
section = .enableLog
|
section = .enableLog
|
||||||
|
case "phone_privacy":
|
||||||
|
section = .phonePrivacy
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -353,6 +353,14 @@ final class FullscreenControlsComponent: Component {
|
|||||||
|
|
||||||
return CGSize(width: availableSize.width, height: leftBackgroundSize.height)
|
return CGSize(width: availableSize.width, height: leftBackgroundSize.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||||
|
let result = super.hitTest(point, with: event)
|
||||||
|
if result === self {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeView() -> View {
|
func makeView() -> View {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user