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
ab5595c8d4
commit
8f0481be16
@ -190,6 +190,7 @@ public enum ResolvedUrlSettingsSection {
|
||||
case autoremoveMessages
|
||||
case twoStepAuth
|
||||
case enableLog
|
||||
case phonePrivacy
|
||||
}
|
||||
|
||||
public struct ResolvedBotChoosePeerTypes: OptionSet {
|
||||
|
@ -153,8 +153,7 @@ final class PremiumOptionComponent: CombinedComponent {
|
||||
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
|
||||
.position(discountPosition)
|
||||
)
|
||||
|
@ -426,7 +426,8 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
peerName = EnginePeer(channel).compactDisplayTitle
|
||||
}
|
||||
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):
|
||||
if channelId == nil {
|
||||
months = monthsValue
|
||||
@ -523,7 +524,8 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
if peerName.isEmpty {
|
||||
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 {
|
||||
text = item.presentationData.strings.Notification_StarGift_Bot_Subtitle
|
||||
}
|
||||
@ -531,7 +533,8 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
if upgradeStars != nil {
|
||||
text = item.presentationData.strings.Notification_StarGift_Subtitle_Upgrade_Other(peerName).string
|
||||
} 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
|
||||
if let starsRange = formattedString.ranges.last {
|
||||
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, _, _, _):
|
||||
if case let .unique(uniqueGift) = gift {
|
||||
isStarGift = true
|
||||
|
||||
let isSelfGift = item.message.id.peerId == item.context.account.peerId
|
||||
let authorName: String
|
||||
if isUpgrade {
|
||||
if item.message.author?.id == item.context.account.peerId {
|
||||
@ -570,12 +575,14 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
} else {
|
||||
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
|
||||
} else {
|
||||
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
|
||||
buttonTitle = isStoryEntity ? "" : item.presentationData.strings.Notification_StarGift_View
|
||||
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)
|
||||
|> mapToSignal { inputData -> Signal<PeerInfoScreenData, NoError> in
|
||||
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 (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)
|
||||
}
|
||||
}
|
||||
|
@ -1273,9 +1273,12 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, ASGestureRecognizerDelegat
|
||||
self.isReady.set(.single(true))
|
||||
}
|
||||
}
|
||||
if let previousCurrentPaneKey = previousCurrentPaneKey, self.currentPaneKey != previousCurrentPaneKey {
|
||||
self.currentPaneUpdated?(self.expandOnSwitch)
|
||||
self.expandOnSwitch = false
|
||||
if let previousCurrentPaneKey, self.currentPaneKey != previousCurrentPaneKey || self.expandOnSwitch {
|
||||
if self.currentPaneKey == nil && previousCurrentPaneKey == .gifts {
|
||||
} else {
|
||||
self.currentPaneUpdated?(self.expandOnSwitch)
|
||||
self.expandOnSwitch = false
|
||||
}
|
||||
}
|
||||
if updateCurrentPaneStatus {
|
||||
self.currentPaneStatusPromise.set(self.currentPane?.node.status ?? .single(nil))
|
||||
|
@ -4603,7 +4603,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
||||
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?
|
||||
self.headerNode.displayPremiumIntro = { [weak self] sourceView, peerStatus, emojiStatusFileAndPack, white in
|
||||
@ -6497,16 +6497,13 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
||||
}
|
||||
|
||||
let boostTitle: String
|
||||
var isNew = false
|
||||
switch channel.info {
|
||||
case .group:
|
||||
boostTitle = presentationData.strings.PeerInfo_Group_Boost
|
||||
isNew = true
|
||||
case .broadcast:
|
||||
boostTitle = presentationData.strings.PeerInfo_Channel_Boost
|
||||
}
|
||||
|
||||
items.append(.action(ContextMenuActionItem(text: boostTitle, badge: isNew ? ContextMenuActionBadge(value: presentationData.strings.Settings_New, color: .accent, style: .label) : nil, icon: { theme in
|
||||
items.append(.action(ContextMenuActionItem(text: boostTitle, badge: nil, icon: { theme in
|
||||
generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Boost"), color: theme.contextMenu.primaryColor)
|
||||
}, action: { [weak self] _, f in
|
||||
f(.dismissWithoutContent)
|
||||
|
@ -402,7 +402,7 @@ final class UserAppearanceScreenComponent: Component {
|
||||
if case .info = action {
|
||||
var replaceImpl: ((ViewController) -> Void)?
|
||||
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)
|
||||
}, dismissed: nil)
|
||||
replaceImpl = { [weak controller] c in
|
||||
|
@ -703,6 +703,18 @@ func openResolvedUrlImpl(
|
||||
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):
|
||||
dismissInput()
|
||||
|
@ -1014,6 +1014,8 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
||||
section = .twoStepAuth
|
||||
case "enable_log":
|
||||
section = .enableLog
|
||||
case "phone_privacy":
|
||||
section = .phonePrivacy
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
@ -353,6 +353,14 @@ final class FullscreenControlsComponent: Component {
|
||||
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user