mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit '982bdec3a313c65587918394d217b03733b88c74'
This commit is contained in:
commit
e20b505b4a
@ -2540,7 +2540,9 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
var hasActiveGroupCall = false
|
var hasActiveGroupCall = false
|
||||||
|
|
||||||
let storiesCountLimit = self.context.userLimits.maxExpiringStoriesCount
|
let storiesCountLimit = self.context.userLimits.maxExpiringStoriesCount
|
||||||
|
var storiesCount = 0
|
||||||
if let rawStorySubscriptions = self.rawStorySubscriptions, let accountItem = rawStorySubscriptions.accountItem {
|
if let rawStorySubscriptions = self.rawStorySubscriptions, let accountItem = rawStorySubscriptions.accountItem {
|
||||||
|
storiesCount = accountItem.storyCount
|
||||||
if accountItem.storyCount >= self.context.userLimits.maxExpiringStoriesCount {
|
if accountItem.storyCount >= self.context.userLimits.maxExpiringStoriesCount {
|
||||||
reachedCountLimit = true
|
reachedCountLimit = true
|
||||||
}
|
}
|
||||||
@ -2570,7 +2572,11 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
var sourceFrame: CGRect?
|
var sourceFrame: CGRect?
|
||||||
if fromList {
|
if fromList {
|
||||||
if let (transitionView, _) = componentView.storyPeerListView()?.transitionViewForItem(peerId: self.context.account.peerId) {
|
if let (transitionView, _) = componentView.storyPeerListView()?.transitionViewForItem(peerId: self.context.account.peerId) {
|
||||||
sourceFrame = transitionView.convert(transitionView.bounds, to: nil).offsetBy(dx: 18.0 - UIScreenPixel, dy: 1.0)
|
if storiesCount == 0 {
|
||||||
|
sourceFrame = transitionView.convert(transitionView.bounds, to: nil).offsetBy(dx: 18.0 - UIScreenPixel, dy: 1.0)
|
||||||
|
} else {
|
||||||
|
sourceFrame = transitionView.convert(transitionView.bounds, to: nil).offsetBy(dx: 0.0, dy: 5.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let rightButtonView = componentView.rightButtonViews["story"] {
|
if let rightButtonView = componentView.rightButtonViews["story"] {
|
||||||
@ -2604,7 +2610,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
icon: .none,
|
icon: .none,
|
||||||
location: .point(location, .top),
|
location: .point(location, .top),
|
||||||
shouldDismissOnTouch: { [weak self] point, containerFrame in
|
shouldDismissOnTouch: { [weak self] point, containerFrame in
|
||||||
if containerFrame.contains(point) {
|
if containerFrame.contains(point), premiumNeeded {
|
||||||
let controller = context.sharedContext.makePremiumIntroController(context: context, source: .stories)
|
let controller = context.sharedContext.makePremiumIntroController(context: context, source: .stories)
|
||||||
self?.push(controller)
|
self?.push(controller)
|
||||||
return .dismiss(consume: true)
|
return .dismiss(consume: true)
|
||||||
|
@ -154,15 +154,15 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
|
|||||||
return 11
|
return 11
|
||||||
case .profilePhotoPrivacy:
|
case .profilePhotoPrivacy:
|
||||||
return 12
|
return 12
|
||||||
case .voiceCallPrivacy:
|
case .bioPrivacy:
|
||||||
return 13
|
return 13
|
||||||
case .voiceMessagePrivacy:
|
|
||||||
return 14
|
|
||||||
case .forwardPrivacy:
|
case .forwardPrivacy:
|
||||||
|
return 14
|
||||||
|
case .voiceCallPrivacy:
|
||||||
return 15
|
return 15
|
||||||
case .groupPrivacy:
|
case .groupPrivacy:
|
||||||
return 16
|
return 16
|
||||||
case .bioPrivacy:
|
case .voiceMessagePrivacy:
|
||||||
return 17
|
return 17
|
||||||
case .selectivePrivacyInfo:
|
case .selectivePrivacyInfo:
|
||||||
return 18
|
return 18
|
||||||
@ -570,25 +570,27 @@ private func privacyAndSecurityControllerEntries(
|
|||||||
entries.append(.phoneNumberPrivacy(presentationData.theme, presentationData.strings.PrivacySettings_PhoneNumber, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.phoneNumber)))
|
entries.append(.phoneNumberPrivacy(presentationData.theme, presentationData.strings.PrivacySettings_PhoneNumber, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.phoneNumber)))
|
||||||
entries.append(.lastSeenPrivacy(presentationData.theme, presentationData.strings.PrivacySettings_LastSeen, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.presence)))
|
entries.append(.lastSeenPrivacy(presentationData.theme, presentationData.strings.PrivacySettings_LastSeen, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.presence)))
|
||||||
entries.append(.profilePhotoPrivacy(presentationData.theme, presentationData.strings.Privacy_ProfilePhoto, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.profilePhoto)))
|
entries.append(.profilePhotoPrivacy(presentationData.theme, presentationData.strings.Privacy_ProfilePhoto, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.profilePhoto)))
|
||||||
|
entries.append(.bioPrivacy(presentationData.theme, presentationData.strings.Privacy_Bio, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.bio)))
|
||||||
|
entries.append(.forwardPrivacy(presentationData.theme, presentationData.strings.Privacy_Forwards, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.forwards)))
|
||||||
entries.append(.voiceCallPrivacy(presentationData.theme, presentationData.strings.Privacy_Calls, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.voiceCalls)))
|
entries.append(.voiceCallPrivacy(presentationData.theme, presentationData.strings.Privacy_Calls, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.voiceCalls)))
|
||||||
|
entries.append(.groupPrivacy(presentationData.theme, presentationData.strings.Privacy_GroupsAndChannels, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.groupInvitations)))
|
||||||
if !isPremiumDisabled {
|
if !isPremiumDisabled {
|
||||||
entries.append(.voiceMessagePrivacy(presentationData.theme, presentationData.strings.Privacy_VoiceMessages, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.voiceMessages), !isPremium))
|
entries.append(.voiceMessagePrivacy(presentationData.theme, presentationData.strings.Privacy_VoiceMessages, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.voiceMessages), !isPremium))
|
||||||
}
|
}
|
||||||
entries.append(.forwardPrivacy(presentationData.theme, presentationData.strings.Privacy_Forwards, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.forwards)))
|
|
||||||
entries.append(.groupPrivacy(presentationData.theme, presentationData.strings.Privacy_GroupsAndChannels, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.groupInvitations)))
|
|
||||||
entries.append(.bioPrivacy(presentationData.theme, presentationData.strings.Privacy_Bio, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.bio)))
|
|
||||||
|
|
||||||
entries.append(.selectivePrivacyInfo(presentationData.theme, presentationData.strings.PrivacyLastSeenSettings_GroupsAndChannelsHelp))
|
entries.append(.selectivePrivacyInfo(presentationData.theme, presentationData.strings.PrivacyLastSeenSettings_GroupsAndChannelsHelp))
|
||||||
} else {
|
} else {
|
||||||
|
entries.append(.phoneNumberPrivacy(presentationData.theme, presentationData.strings.PrivacySettings_PhoneNumber, presentationData.strings.Channel_NotificationLoading))
|
||||||
entries.append(.lastSeenPrivacy(presentationData.theme, presentationData.strings.PrivacySettings_LastSeen, presentationData.strings.Channel_NotificationLoading))
|
entries.append(.lastSeenPrivacy(presentationData.theme, presentationData.strings.PrivacySettings_LastSeen, presentationData.strings.Channel_NotificationLoading))
|
||||||
entries.append(.profilePhotoPrivacy(presentationData.theme, presentationData.strings.Privacy_ProfilePhoto, presentationData.strings.Channel_NotificationLoading))
|
entries.append(.profilePhotoPrivacy(presentationData.theme, presentationData.strings.Privacy_ProfilePhoto, presentationData.strings.Channel_NotificationLoading))
|
||||||
|
entries.append(.bioPrivacy(presentationData.theme, presentationData.strings.Privacy_GroupsAndChannels, presentationData.strings.Channel_NotificationLoading))
|
||||||
|
entries.append(.forwardPrivacy(presentationData.theme, presentationData.strings.Privacy_Forwards, presentationData.strings.Channel_NotificationLoading))
|
||||||
entries.append(.voiceCallPrivacy(presentationData.theme, presentationData.strings.Privacy_Calls, presentationData.strings.Channel_NotificationLoading))
|
entries.append(.voiceCallPrivacy(presentationData.theme, presentationData.strings.Privacy_Calls, presentationData.strings.Channel_NotificationLoading))
|
||||||
|
entries.append(.groupPrivacy(presentationData.theme, presentationData.strings.Privacy_GroupsAndChannels, presentationData.strings.Channel_NotificationLoading))
|
||||||
if !isPremiumDisabled {
|
if !isPremiumDisabled {
|
||||||
entries.append(.voiceMessagePrivacy(presentationData.theme, presentationData.strings.Privacy_VoiceMessages, presentationData.strings.Channel_NotificationLoading, !isPremium))
|
entries.append(.voiceMessagePrivacy(presentationData.theme, presentationData.strings.Privacy_VoiceMessages, presentationData.strings.Channel_NotificationLoading, !isPremium))
|
||||||
}
|
}
|
||||||
entries.append(.forwardPrivacy(presentationData.theme, presentationData.strings.Privacy_Forwards, presentationData.strings.Channel_NotificationLoading))
|
|
||||||
entries.append(.groupPrivacy(presentationData.theme, presentationData.strings.Privacy_GroupsAndChannels, presentationData.strings.Channel_NotificationLoading))
|
|
||||||
entries.append(.bioPrivacy(presentationData.theme, presentationData.strings.Privacy_GroupsAndChannels, presentationData.strings.Channel_NotificationLoading))
|
|
||||||
entries.append(.selectivePrivacyInfo(presentationData.theme, presentationData.strings.PrivacyLastSeenSettings_GroupsAndChannelsHelp))
|
entries.append(.selectivePrivacyInfo(presentationData.theme, presentationData.strings.PrivacyLastSeenSettings_GroupsAndChannelsHelp))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,33 +191,6 @@ final class StickerPackEmojisItemNode: GridItemNode {
|
|||||||
self?.standaloneShimmerEffect?.updateLayer()
|
self?.standaloneShimmerEffect?.updateLayer()
|
||||||
}
|
}
|
||||||
self.boundsChangeTrackerLayer = boundsChangeTrackerLayer
|
self.boundsChangeTrackerLayer = boundsChangeTrackerLayer
|
||||||
|
|
||||||
/*let gestureRecognizer = TapLongTapOrDoubleTapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:)))
|
|
||||||
gestureRecognizer.longTap = { [weak self] point, _ in
|
|
||||||
guard let strongSelf = self else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if let (item, itemFrame) = strongSelf.item(atPoint: point), let file = item.itemFile {
|
|
||||||
var text = "."
|
|
||||||
var emojiAttribute: ChatTextInputTextCustomEmojiAttribute?
|
|
||||||
loop: for attribute in file.attributes {
|
|
||||||
switch attribute {
|
|
||||||
case let .CustomEmoji(_, _, displayText, _):
|
|
||||||
text = displayText
|
|
||||||
emojiAttribute = ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: file.fileId.id, file: file)
|
|
||||||
break loop
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let emojiAttribute = emojiAttribute {
|
|
||||||
strongSelf.item?.interaction.emojiLongPressed(text, emojiAttribute, strongSelf.containerNode, itemFrame)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.containerNode.view.addGestureRecognizer(gestureRecognizer)*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func targetItem(at point: CGPoint) -> (TelegramMediaFile, CALayer)? {
|
func targetItem(at point: CGPoint) -> (TelegramMediaFile, CALayer)? {
|
||||||
@ -410,7 +383,7 @@ final class StickerPackEmojisItemNode: GridItemNode {
|
|||||||
size: itemNativeFitSize
|
size: itemNativeFitSize
|
||||||
)
|
)
|
||||||
strongSelf.visibleItemPlaceholderViews[itemId] = placeholderView
|
strongSelf.visibleItemPlaceholderViews[itemId] = placeholderView
|
||||||
strongSelf.view.insertSubview(placeholderView, at: 0)
|
strongSelf.containerNode.view.insertSubview(placeholderView, at: 0)
|
||||||
}
|
}
|
||||||
placeholderView.frame = itemLayer.frame
|
placeholderView.frame = itemLayer.frame
|
||||||
placeholderView.update(size: placeholderView.bounds.size)
|
placeholderView.update(size: placeholderView.bounds.size)
|
||||||
@ -420,7 +393,7 @@ final class StickerPackEmojisItemNode: GridItemNode {
|
|||||||
} else {
|
} else {
|
||||||
if let placeholderView = strongSelf.visibleItemPlaceholderViews[itemId] {
|
if let placeholderView = strongSelf.visibleItemPlaceholderViews[itemId] {
|
||||||
strongSelf.visibleItemPlaceholderViews.removeValue(forKey: itemId)
|
strongSelf.visibleItemPlaceholderViews.removeValue(forKey: itemId)
|
||||||
|
|
||||||
if duration > 0.0 {
|
if duration > 0.0 {
|
||||||
placeholderView.layer.opacity = 0.0
|
placeholderView.layer.opacity = 0.0
|
||||||
placeholderView.layer.animateAlpha(from: 1.0, to: 0.0, duration: duration, completion: { [weak self, weak placeholderView] _ in
|
placeholderView.layer.animateAlpha(from: 1.0, to: 0.0, duration: duration, completion: { [weak self, weak placeholderView] _ in
|
||||||
|
@ -380,29 +380,32 @@ public final class PeerListItemComponent: Component {
|
|||||||
statusIcon = .premium(color: component.theme.list.itemAccentColor)
|
statusIcon = .premium(color: component.theme.list.itemAccentColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let labelSize = self.label.update(
|
|
||||||
transition: .immediate,
|
|
||||||
component: AnyComponent(MultilineTextComponent(
|
|
||||||
text: .plain(NSAttributedString(string: labelData.0, font: subtitleFont, textColor: labelData.1 ? component.theme.list.itemAccentColor : component.theme.list.itemSecondaryTextColor))
|
|
||||||
)),
|
|
||||||
environment: {},
|
|
||||||
containerSize: CGSize(width: availableSize.width - leftInset - rightInset, height: 100.0)
|
|
||||||
)
|
|
||||||
|
|
||||||
let previousTitleFrame = self.title.view?.frame
|
let previousTitleFrame = self.title.view?.frame
|
||||||
var previousTitleContents: UIView?
|
var previousTitleContents: UIView?
|
||||||
if hasSelectionUpdated && !"".isEmpty {
|
if hasSelectionUpdated && !"".isEmpty {
|
||||||
previousTitleContents = self.title.view?.snapshotView(afterScreenUpdates: false)
|
previousTitleContents = self.title.view?.snapshotView(afterScreenUpdates: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let availableTextWidth = availableSize.width - leftInset - rightInset
|
||||||
|
let titleAvailableWidth = component.style == .compact ? availableTextWidth * 0.7 : availableSize.width - leftInset - rightInset
|
||||||
let titleSize = self.title.update(
|
let titleSize = self.title.update(
|
||||||
transition: .immediate,
|
transition: .immediate,
|
||||||
component: AnyComponent(MultilineTextComponent(
|
component: AnyComponent(MultilineTextComponent(
|
||||||
text: .plain(NSAttributedString(string: component.title, font: titleFont, textColor: component.theme.list.itemPrimaryTextColor))
|
text: .plain(NSAttributedString(string: component.title, font: titleFont, textColor: component.theme.list.itemPrimaryTextColor))
|
||||||
)),
|
)),
|
||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: availableSize.width - leftInset - rightInset, height: 100.0)
|
containerSize: CGSize(width: titleAvailableWidth, height: 100.0)
|
||||||
|
)
|
||||||
|
|
||||||
|
let labelAvailableWidth = component.style == .compact ? availableTextWidth - titleSize.width : availableSize.width - leftInset - rightInset
|
||||||
|
let labelSize = self.label.update(
|
||||||
|
transition: .immediate,
|
||||||
|
component: AnyComponent(MultilineTextComponent(
|
||||||
|
text: .plain(NSAttributedString(string: labelData.0, font: subtitleFont, textColor: labelData.1 ? component.theme.list.itemAccentColor : component.theme.list.itemSecondaryTextColor))
|
||||||
|
)),
|
||||||
|
environment: {},
|
||||||
|
containerSize: CGSize(width: labelAvailableWidth, height: 100.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
let titleSpacing: CGFloat = 2.0
|
let titleSpacing: CGFloat = 2.0
|
||||||
@ -415,7 +418,6 @@ public final class PeerListItemComponent: Component {
|
|||||||
centralContentHeight = titleSize.height
|
centralContentHeight = titleSize.height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let titleFrame = CGRect(origin: CGPoint(x: leftInset, y: titleVerticalOffset + floor((height - verticalInset * 2.0 - centralContentHeight) / 2.0)), size: titleSize)
|
let titleFrame = CGRect(origin: CGPoint(x: leftInset, y: titleVerticalOffset + floor((height - verticalInset * 2.0 - centralContentHeight) / 2.0)), size: titleSize)
|
||||||
if let titleView = self.title.view {
|
if let titleView = self.title.view {
|
||||||
if titleView.superview == nil {
|
if titleView.superview == nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user