mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Folders improvements
This commit is contained in:
parent
752fb745d3
commit
57406bb292
@ -2212,6 +2212,7 @@ Unused sets are archived when you add more.";
|
||||
"DialogList.Pin" = "Pin";
|
||||
"DialogList.Unpin" = "Unpin";
|
||||
"DialogList.PinLimitError" = "Sorry, you can pin no more than %@ chats to the top.";
|
||||
"DialogList.UnknownPinLimitError" = "Sorry, you can't pin any more chats to the top.";
|
||||
|
||||
"Conversation.DeleteMessagesForMe" = "Delete for me";
|
||||
"Conversation.DeleteMessagesFor" = "Delete for me and %@";
|
||||
@ -5462,3 +5463,8 @@ Any member of this group will be able to see messages in the channel.";
|
||||
"ChatListFilter.ShowMoreChats_3_10" = "Show %@ More Chats";
|
||||
"ChatListFilter.ShowMoreChats_many" = "Show %@ More Chats";
|
||||
"ChatListFilter.ShowMoreChats_any" = "Show %@ More Chats";
|
||||
|
||||
"SetupUsername.ChangeNameWarningChannel" = "Warning, if you change the name of your channel, it will loose its verified status. You will need to send a new application to @verification_bot";
|
||||
"SetupUsername.ChangeNameWarningGroup" = "Warning, if you change the name of your group, it will loose its verified status. You will need to send a new application to @verification_bot";
|
||||
"SetupUsername.ChangeLinkWarningChannel" = "Warning, if you change the short link to your channel, it will loose its verified status. You will need to send a new application to @verification_bot";
|
||||
"SetupUsername.ChangeLinkWarningGroup" = "Warning, if you change the short link to your group, it will loose its verified status. You will need to send a new application to @verification_bot";
|
||||
|
@ -64,8 +64,12 @@ private final class ItemNode: ASDisplayNode {
|
||||
private let containerNode: ContextControllerSourceNode
|
||||
|
||||
private let extractedBackgroundNode: ASImageNode
|
||||
private let titleContainer: ASDisplayNode
|
||||
private let titleNode: ImmediateTextNode
|
||||
private let titleActiveNode: ImmediateTextNode
|
||||
private let shortTitleContainer: ASDisplayNode
|
||||
private let shortTitleNode: ImmediateTextNode
|
||||
private let shortTitleActiveNode: ImmediateTextNode
|
||||
private let badgeContainerNode: ASDisplayNode
|
||||
private let badgeTextNode: ImmediateTextNode
|
||||
private let badgeBackgroundActiveNode: ASImageNode
|
||||
@ -74,7 +78,7 @@ private final class ItemNode: ASDisplayNode {
|
||||
private var deleteButtonNode: ItemNodeDeleteButtonNode?
|
||||
private let buttonNode: HighlightTrackingButtonNode
|
||||
|
||||
private var isSelected: Bool = false
|
||||
private var selectionFraction: CGFloat = 0.0
|
||||
private(set) var unreadCount: Int = 0
|
||||
|
||||
private var isReordering: Bool = false
|
||||
@ -93,15 +97,30 @@ private final class ItemNode: ASDisplayNode {
|
||||
|
||||
let titleInset: CGFloat = 4.0
|
||||
|
||||
self.titleContainer = ASDisplayNode()
|
||||
|
||||
self.titleNode = ImmediateTextNode()
|
||||
self.titleNode.displaysAsynchronously = false
|
||||
self.titleNode.insets = UIEdgeInsets(top: titleInset, left: 0.0, bottom: titleInset, right: 0.0)
|
||||
|
||||
self.titleActiveNode = ImmediateTextNode()
|
||||
self.titleActiveNode.displaysAsynchronously = false
|
||||
self.titleActiveNode.insets = UIEdgeInsets(top: titleInset, left: 0.0, bottom: titleInset, right: 0.0)
|
||||
self.titleActiveNode.alpha = 0.0
|
||||
|
||||
self.shortTitleContainer = ASDisplayNode()
|
||||
|
||||
self.shortTitleNode = ImmediateTextNode()
|
||||
self.shortTitleNode.displaysAsynchronously = false
|
||||
self.shortTitleNode.alpha = 0.0
|
||||
self.shortTitleNode.insets = UIEdgeInsets(top: titleInset, left: 0.0, bottom: titleInset, right: 0.0)
|
||||
|
||||
self.shortTitleActiveNode = ImmediateTextNode()
|
||||
self.shortTitleActiveNode.displaysAsynchronously = false
|
||||
self.shortTitleActiveNode.alpha = 0.0
|
||||
self.shortTitleActiveNode.insets = UIEdgeInsets(top: titleInset, left: 0.0, bottom: titleInset, right: 0.0)
|
||||
self.shortTitleActiveNode.alpha = 0.0
|
||||
|
||||
self.badgeContainerNode = ASDisplayNode()
|
||||
|
||||
self.badgeTextNode = ImmediateTextNode()
|
||||
@ -114,17 +133,20 @@ private final class ItemNode: ASDisplayNode {
|
||||
self.badgeBackgroundInactiveNode = ASImageNode()
|
||||
self.badgeBackgroundInactiveNode.displaysAsynchronously = false
|
||||
self.badgeBackgroundInactiveNode.displayWithoutProcessing = true
|
||||
self.badgeBackgroundInactiveNode.isHidden = true
|
||||
|
||||
self.buttonNode = HighlightTrackingButtonNode()
|
||||
|
||||
super.init()
|
||||
|
||||
self.extractedContainerNode.contentNode.addSubnode(self.extractedBackgroundNode)
|
||||
self.extractedContainerNode.contentNode.addSubnode(self.titleNode)
|
||||
self.extractedContainerNode.contentNode.addSubnode(self.shortTitleNode)
|
||||
self.badgeContainerNode.addSubnode(self.badgeBackgroundActiveNode)
|
||||
self.extractedContainerNode.contentNode.addSubnode(self.titleContainer)
|
||||
self.titleContainer.addSubnode(self.titleNode)
|
||||
self.titleContainer.addSubnode(self.titleActiveNode)
|
||||
self.extractedContainerNode.contentNode.addSubnode(self.shortTitleContainer)
|
||||
self.shortTitleContainer.addSubnode(self.shortTitleNode)
|
||||
self.shortTitleContainer.addSubnode(self.shortTitleActiveNode)
|
||||
self.badgeContainerNode.addSubnode(self.badgeBackgroundInactiveNode)
|
||||
self.badgeContainerNode.addSubnode(self.badgeBackgroundActiveNode)
|
||||
self.badgeContainerNode.addSubnode(self.badgeTextNode)
|
||||
self.extractedContainerNode.contentNode.addSubnode(self.badgeContainerNode)
|
||||
self.extractedContainerNode.contentNode.addSubnode(self.buttonNode)
|
||||
@ -162,7 +184,7 @@ private final class ItemNode: ASDisplayNode {
|
||||
self.pressed()
|
||||
}
|
||||
|
||||
func updateText(title: String, shortTitle: String, unreadCount: Int, unreadHasUnmuted: Bool, isNoFilter: Bool, isSelected: Bool, isEditing: Bool, isAllChats: Bool, isReordering: Bool, presentationData: PresentationData, transition: ContainedViewLayoutTransition) {
|
||||
func updateText(title: String, shortTitle: String, unreadCount: Int, unreadHasUnmuted: Bool, isNoFilter: Bool, selectionFraction: CGFloat, isEditing: Bool, isAllChats: Bool, isReordering: Bool, presentationData: PresentationData, transition: ContainedViewLayoutTransition) {
|
||||
if self.theme !== presentationData.theme {
|
||||
self.theme = presentationData.theme
|
||||
|
||||
@ -173,7 +195,7 @@ private final class ItemNode: ASDisplayNode {
|
||||
self.containerNode.isGestureEnabled = !isEditing && !isReordering
|
||||
self.buttonNode.isUserInteractionEnabled = !isEditing && !isReordering
|
||||
|
||||
self.isSelected = isSelected
|
||||
self.selectionFraction = selectionFraction
|
||||
self.unreadCount = unreadCount
|
||||
|
||||
transition.updateAlpha(node: self.containerNode, alpha: isReordering && isAllChats ? 0.5 : 1.0)
|
||||
@ -200,12 +222,28 @@ private final class ItemNode: ASDisplayNode {
|
||||
|
||||
transition.updateAlpha(node: self.badgeContainerNode, alpha: (isReordering || unreadCount == 0) ? 0.0 : 1.0)
|
||||
|
||||
self.titleNode.attributedText = NSAttributedString(string: title, font: Font.medium(14.0), textColor: isSelected ? presentationData.theme.list.itemAccentColor : presentationData.theme.list.itemSecondaryTextColor)
|
||||
self.shortTitleNode.attributedText = NSAttributedString(string: shortTitle, font: Font.medium(14.0), textColor: isSelected ? presentationData.theme.list.itemAccentColor : presentationData.theme.list.itemSecondaryTextColor)
|
||||
let selectionAlpha: CGFloat = selectionFraction * selectionFraction
|
||||
let deselectionAlpha: CGFloat = 1.0// - selectionFraction
|
||||
|
||||
transition.updateAlpha(node: self.titleNode, alpha: deselectionAlpha)
|
||||
transition.updateAlpha(node: self.titleActiveNode, alpha: selectionAlpha)
|
||||
transition.updateAlpha(node: self.shortTitleNode, alpha: deselectionAlpha)
|
||||
transition.updateAlpha(node: self.shortTitleActiveNode, alpha: selectionAlpha)
|
||||
|
||||
self.titleNode.attributedText = NSAttributedString(string: title, font: Font.medium(14.0), textColor: presentationData.theme.list.itemSecondaryTextColor)
|
||||
self.titleActiveNode.attributedText = NSAttributedString(string: title, font: Font.medium(14.0), textColor: presentationData.theme.list.itemAccentColor)
|
||||
self.shortTitleNode.attributedText = NSAttributedString(string: shortTitle, font: Font.medium(14.0), textColor: presentationData.theme.list.itemSecondaryTextColor)
|
||||
self.shortTitleActiveNode.attributedText = NSAttributedString(string: shortTitle, font: Font.medium(14.0), textColor: presentationData.theme.list.itemAccentColor)
|
||||
if unreadCount != 0 {
|
||||
self.badgeTextNode.attributedText = NSAttributedString(string: "\(unreadCount)", font: Font.regular(14.0), textColor: presentationData.theme.list.itemCheckColors.foregroundColor)
|
||||
self.badgeBackgroundActiveNode.isHidden = !isSelected && !unreadHasUnmuted
|
||||
self.badgeBackgroundInactiveNode.isHidden = isSelected || unreadHasUnmuted
|
||||
let badgeSelectionFraction: CGFloat = unreadHasUnmuted ? 1.0 : selectionFraction
|
||||
|
||||
let badgeSelectionAlpha: CGFloat = badgeSelectionFraction
|
||||
//let badgeDeselectionAlpha: CGFloat = 1.0 - badgeSelectionFraction
|
||||
|
||||
transition.updateAlpha(node: self.badgeBackgroundActiveNode, alpha: badgeSelectionAlpha * badgeSelectionAlpha)
|
||||
//transition.updateAlpha(node: self.badgeBackgroundInactiveNode, alpha: badgeDeselectionAlpha)
|
||||
self.badgeBackgroundInactiveNode.alpha = 1.0
|
||||
}
|
||||
|
||||
if self.isReordering != isReordering {
|
||||
@ -221,10 +259,18 @@ private final class ItemNode: ASDisplayNode {
|
||||
|
||||
func updateLayout(height: CGFloat, transition: ContainedViewLayoutTransition) -> (width: CGFloat, shortWidth: CGFloat) {
|
||||
let titleSize = self.titleNode.updateLayout(CGSize(width: 160.0, height: .greatestFiniteMagnitude))
|
||||
self.titleNode.frame = CGRect(origin: CGPoint(x: -self.titleNode.insets.left, y: floor((height - titleSize.height) / 2.0)), size: titleSize)
|
||||
let _ = self.titleActiveNode.updateLayout(CGSize(width: 160.0, height: .greatestFiniteMagnitude))
|
||||
let titleFrame = CGRect(origin: CGPoint(x: -self.titleNode.insets.left, y: floor((height - titleSize.height) / 2.0)), size: titleSize)
|
||||
self.titleContainer.frame = titleFrame
|
||||
self.titleNode.frame = CGRect(origin: CGPoint(), size: titleFrame.size)
|
||||
self.titleActiveNode.frame = CGRect(origin: CGPoint(), size: titleFrame.size)
|
||||
|
||||
let shortTitleSize = self.shortTitleNode.updateLayout(CGSize(width: 160.0, height: .greatestFiniteMagnitude))
|
||||
self.shortTitleNode.frame = CGRect(origin: CGPoint(x: -self.shortTitleNode.insets.left, y: floor((height - shortTitleSize.height) / 2.0)), size: shortTitleSize)
|
||||
let _ = self.shortTitleActiveNode.updateLayout(CGSize(width: 160.0, height: .greatestFiniteMagnitude))
|
||||
let shortTitleFrame = CGRect(origin: CGPoint(x: -self.shortTitleNode.insets.left, y: floor((height - shortTitleSize.height) / 2.0)), size: shortTitleSize)
|
||||
self.shortTitleContainer.frame = shortTitleFrame
|
||||
self.shortTitleNode.frame = CGRect(origin: CGPoint(), size: shortTitleFrame.size)
|
||||
self.shortTitleActiveNode.frame = CGRect(origin: CGPoint(), size: shortTitleFrame.size)
|
||||
|
||||
if let deleteButtonNode = self.deleteButtonNode {
|
||||
if let theme = self.theme {
|
||||
@ -235,7 +281,7 @@ private final class ItemNode: ASDisplayNode {
|
||||
|
||||
let badgeSize = self.badgeTextNode.updateLayout(CGSize(width: 200.0, height: .greatestFiniteMagnitude))
|
||||
let badgeInset: CGFloat = 4.0
|
||||
let badgeBackgroundFrame = CGRect(origin: CGPoint(x: titleSize.width - self.titleNode.insets.left - self.titleNode.insets.right + 5.0 + 5.0, y: floor((height - 18.0) / 2.0)), size: CGSize(width: max(18.0, badgeSize.width + badgeInset * 2.0), height: 18.0))
|
||||
let badgeBackgroundFrame = CGRect(origin: CGPoint(x: titleSize.width - self.titleNode.insets.left - self.titleNode.insets.right + 4.0, y: floor((height - 18.0) / 2.0)), size: CGSize(width: max(18.0, badgeSize.width + badgeInset * 2.0), height: 18.0))
|
||||
self.badgeContainerNode.frame = badgeBackgroundFrame
|
||||
self.badgeBackgroundActiveNode.frame = CGRect(origin: CGPoint(), size: badgeBackgroundFrame.size)
|
||||
self.badgeBackgroundInactiveNode.frame = CGRect(origin: CGPoint(), size: badgeBackgroundFrame.size)
|
||||
@ -258,8 +304,8 @@ private final class ItemNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
func updateArea(size: CGSize, sideInset: CGFloat, useShortTitle: Bool, transition: ContainedViewLayoutTransition) {
|
||||
transition.updateAlpha(node: self.titleNode, alpha: useShortTitle ? 0.0 : 1.0)
|
||||
transition.updateAlpha(node: self.shortTitleNode, alpha: useShortTitle ? 1.0 : 0.0)
|
||||
transition.updateAlpha(node: self.titleContainer, alpha: useShortTitle ? 0.0 : 1.0)
|
||||
transition.updateAlpha(node: self.shortTitleContainer, alpha: useShortTitle ? 1.0 : 0.0)
|
||||
|
||||
self.buttonNode.frame = CGRect(origin: CGPoint(x: -sideInset, y: 0.0), size: CGSize(width: size.width + sideInset * 2.0, height: size.height))
|
||||
|
||||
@ -628,7 +674,9 @@ final class ChatListFilterTabContainerNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
for filter in reorderedFilters {
|
||||
for i in 0 ..< reorderedFilters.count {
|
||||
let filter = reorderedFilters[i]
|
||||
|
||||
let itemNode: ItemNode
|
||||
var itemNodeTransition = transition
|
||||
var wasAdded = false
|
||||
@ -672,7 +720,19 @@ final class ChatListFilterTabContainerNode: ASDisplayNode {
|
||||
if !wasAdded && (itemNode.unreadCount != 0) != (unreadCount != 0) {
|
||||
badgeAnimations[filter.id] = (unreadCount != 0) ? .in : .out
|
||||
}
|
||||
itemNode.updateText(title: filter.title(strings: presentationData.strings), shortTitle: filter.shortTitle(strings: presentationData.strings), unreadCount: unreadCount, unreadHasUnmuted: unreadHasUnmuted, isNoFilter: isNoFilter, isSelected: selectedFilter == filter.id, isEditing: false, isAllChats: isNoFilter, isReordering: isEditing || isReordering, presentationData: presentationData, transition: itemNodeTransition)
|
||||
|
||||
let selectionFraction: CGFloat
|
||||
if selectedFilter == filter.id {
|
||||
selectionFraction = 1.0 - abs(transitionFraction)
|
||||
} else if i != 0 && selectedFilter == reorderedFilters[i - 1].id {
|
||||
selectionFraction = max(0.0, -transitionFraction)
|
||||
} else if i != reorderedFilters.count - 1 && selectedFilter == reorderedFilters[i + 1].id {
|
||||
selectionFraction = max(0.0, transitionFraction)
|
||||
} else {
|
||||
selectionFraction = 0.0
|
||||
}
|
||||
|
||||
itemNode.updateText(title: filter.title(strings: presentationData.strings), shortTitle: filter.shortTitle(strings: presentationData.strings), unreadCount: unreadCount, unreadHasUnmuted: unreadHasUnmuted, isNoFilter: isNoFilter, selectionFraction: selectionFraction, isEditing: false, isAllChats: isNoFilter, isReordering: isEditing || isReordering, presentationData: presentationData, transition: itemNodeTransition)
|
||||
}
|
||||
var removeKeys: [ChatListFilterTabEntryId] = []
|
||||
for (id, _) in self.itemNodes {
|
||||
|
@ -1689,7 +1689,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
}
|
||||
|
||||
let titleFrame = self.titleNode.frame
|
||||
transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: contentRect.origin.x + titleOffset, y: titleFrame.origin.y), size: titleFrame.size))
|
||||
transition.updateFrameAdditive(node: self.titleNode, frame: CGRect(origin: CGPoint(x: contentRect.origin.x + titleOffset, y: titleFrame.origin.y), size: titleFrame.size))
|
||||
|
||||
let authorFrame = self.authorNode.frame
|
||||
transition.updateFrame(node: self.authorNode, frame: CGRect(origin: CGPoint(x: contentRect.origin.x, y: authorFrame.origin.y), size: authorFrame.size))
|
||||
@ -1697,10 +1697,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
transition.updateFrame(node: self.inputActivitiesNode, frame: CGRect(origin: CGPoint(x: contentRect.origin.x, y: self.inputActivitiesNode.frame.minY), size: self.inputActivitiesNode.bounds.size))
|
||||
|
||||
var textFrame = self.textNode.frame
|
||||
let textDeltaX = textFrame.origin.x - contentRect.origin.x
|
||||
transition.animatePositionAdditive(node: self.textNode, offset: CGPoint(x: textDeltaX, y: 0.0))
|
||||
textFrame.origin.x = contentRect.origin.x
|
||||
transition.updateFrame(node: textNode, frame: textFrame)
|
||||
transition.updateFrameAdditive(node: self.textNode, frame: textFrame)
|
||||
|
||||
var contentImageFrame = self.contentImageNode.frame
|
||||
contentImageFrame.origin = textFrame.origin.offsetBy(dx: 1.0, dy: 0.0)
|
||||
|
@ -579,10 +579,16 @@ public final class ChatListNode: ListView {
|
||||
|> deliverOnMainQueue).start(next: { result in
|
||||
if let strongSelf = self {
|
||||
switch result {
|
||||
case .done:
|
||||
break
|
||||
case let .limitExceeded(maxCount):
|
||||
strongSelf.presentAlert?(strongSelf.currentState.presentationData.strings.DialogList_PinLimitError("\(maxCount)").0)
|
||||
case .done:
|
||||
break
|
||||
case let .limitExceeded(maxCount):
|
||||
let text: String
|
||||
if chatListFilter != nil {
|
||||
text = strongSelf.currentState.presentationData.strings.DialogList_UnknownPinLimitError
|
||||
} else {
|
||||
text = strongSelf.currentState.presentationData.strings.DialogList_PinLimitError("\(maxCount)").0
|
||||
}
|
||||
strongSelf.presentAlert?(text)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -1490,7 +1496,7 @@ public final class ChatListNode: ListView {
|
||||
var isNavigationInAFinalState: Bool {
|
||||
switch self.visibleContentOffset() {
|
||||
case let .known(value):
|
||||
if value < navigationBarSearchContentHeight + 1.0 {
|
||||
if value < navigationBarSearchContentHeight - 1.0 {
|
||||
if abs(value - 0.0) < 1.0 {
|
||||
return true
|
||||
}
|
||||
|
@ -1424,7 +1424,9 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
||||
} else if topItemFound {
|
||||
self.scroller.contentSize = CGSize(width: self.visibleSize.width, height: infiniteScrollSize * 2.0)
|
||||
self.lastContentOffset = CGPoint(x: 0.0, y: -topItemEdge)
|
||||
self.scroller.contentOffset = self.lastContentOffset
|
||||
if self.scroller.contentOffset != self.lastContentOffset {
|
||||
self.scroller.contentOffset = self.lastContentOffset
|
||||
}
|
||||
} else if bottomItemFound {
|
||||
self.scroller.contentSize = CGSize(width: self.visibleSize.width, height: infiniteScrollSize * 2.0)
|
||||
self.lastContentOffset = CGPoint(x: 0.0, y: infiniteScrollSize * 2.0 - bottomItemEdge)
|
||||
|
@ -1051,13 +1051,23 @@ public func channelVisibilityController(context: AccountContext, peerId: PeerId,
|
||||
|
||||
}
|
||||
|
||||
_ = (ApplicationSpecificNotice.getSetPublicChannelLink(accountManager: context.sharedContext.accountManager) |> deliverOnMainQueue).start(next: { showAlert in
|
||||
if showAlert {
|
||||
presentControllerImpl?(textAlertController(context: context, title: nil, text: presentationData.strings.Channel_Edit_PrivatePublicLinkAlert, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: invokeAction)]), nil)
|
||||
if peer.isVerified {
|
||||
let alertText: String
|
||||
if case .broadcast = peer.info {
|
||||
alertText = presentationData.strings.SetupUsername_ChangeLinkWarningChannel
|
||||
} else {
|
||||
invokeAction()
|
||||
alertText = presentationData.strings.SetupUsername_ChangeLinkWarningGroup
|
||||
}
|
||||
})
|
||||
presentControllerImpl?(textAlertController(context: context, title: nil, text: alertText, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: invokeAction)]), nil)
|
||||
} else {
|
||||
_ = (ApplicationSpecificNotice.getSetPublicChannelLink(accountManager: context.sharedContext.accountManager) |> deliverOnMainQueue).start(next: { showAlert in
|
||||
if showAlert {
|
||||
presentControllerImpl?(textAlertController(context: context, title: nil, text: presentationData.strings.Channel_Edit_PrivatePublicLinkAlert, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: invokeAction)]), nil)
|
||||
} else {
|
||||
invokeAction()
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
switch mode {
|
||||
case .initialSetup:
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1840,52 +1840,70 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
let title = strongSelf.headerNode.editingContentNode.editingTextForKey(.title) ?? ""
|
||||
let description = strongSelf.headerNode.editingContentNode.editingTextForKey(.description) ?? ""
|
||||
|
||||
if title.isEmpty {
|
||||
strongSelf.headerNode.editingContentNode.shakeTextForKey(.title)
|
||||
let proceed: () -> Void = {
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
if title.isEmpty {
|
||||
strongSelf.headerNode.editingContentNode.shakeTextForKey(.title)
|
||||
} else {
|
||||
var updateDataSignals: [Signal<Never, Void>] = []
|
||||
|
||||
if title != channel.title {
|
||||
updateDataSignals.append(
|
||||
updatePeerTitle(account: strongSelf.context.account, peerId: channel.id, title: title)
|
||||
|> ignoreValues
|
||||
|> mapError { _ in return Void() }
|
||||
)
|
||||
}
|
||||
if description != (data.cachedData as? CachedChannelData)?.about {
|
||||
updateDataSignals.append(
|
||||
updatePeerDescription(account: strongSelf.context.account, peerId: channel.id, description: description.isEmpty ? nil : description)
|
||||
|> ignoreValues
|
||||
|> mapError { _ in return Void() }
|
||||
)
|
||||
}
|
||||
|
||||
var dismissStatus: (() -> Void)?
|
||||
let statusController = OverlayStatusController(theme: strongSelf.presentationData.theme, type: .loading(cancelled: {
|
||||
dismissStatus?()
|
||||
}))
|
||||
dismissStatus = { [weak statusController] in
|
||||
self?.activeActionDisposable.set(nil)
|
||||
statusController?.dismiss()
|
||||
}
|
||||
strongSelf.controller?.present(statusController, in: .window(.root))
|
||||
|
||||
strongSelf.activeActionDisposable.set((combineLatest(updateDataSignals)
|
||||
|> deliverOnMainQueue).start(error: { _ in
|
||||
dismissStatus?()
|
||||
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel)
|
||||
}, completed: {
|
||||
dismissStatus?()
|
||||
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
if channel.isVerified && title != channel.title {
|
||||
let alertText: String
|
||||
if case .broadcast = channel.info {
|
||||
alertText = strongSelf.presentationData.strings.SetupUsername_ChangeNameWarningChannel
|
||||
} else {
|
||||
alertText = strongSelf.presentationData.strings.SetupUsername_ChangeNameWarningGroup
|
||||
}
|
||||
strongSelf.controller?.present(textAlertController(context: context, title: nil, text: alertText, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_OK, action: proceed)]), in: .window(.root))
|
||||
} else {
|
||||
var updateDataSignals: [Signal<Never, Void>] = []
|
||||
|
||||
if title != channel.title {
|
||||
updateDataSignals.append(
|
||||
updatePeerTitle(account: strongSelf.context.account, peerId: channel.id, title: title)
|
||||
|> ignoreValues
|
||||
|> mapError { _ in return Void() }
|
||||
)
|
||||
}
|
||||
if description != (data.cachedData as? CachedChannelData)?.about {
|
||||
updateDataSignals.append(
|
||||
updatePeerDescription(account: strongSelf.context.account, peerId: channel.id, description: description.isEmpty ? nil : description)
|
||||
|> ignoreValues
|
||||
|> mapError { _ in return Void() }
|
||||
)
|
||||
}
|
||||
|
||||
var dismissStatus: (() -> Void)?
|
||||
let statusController = OverlayStatusController(theme: strongSelf.presentationData.theme, type: .loading(cancelled: {
|
||||
dismissStatus?()
|
||||
}))
|
||||
dismissStatus = { [weak statusController] in
|
||||
self?.activeActionDisposable.set(nil)
|
||||
statusController?.dismiss()
|
||||
}
|
||||
strongSelf.controller?.present(statusController, in: .window(.root))
|
||||
|
||||
strongSelf.activeActionDisposable.set((combineLatest(updateDataSignals)
|
||||
|> deliverOnMainQueue).start(error: { _ in
|
||||
dismissStatus?()
|
||||
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel)
|
||||
}, completed: {
|
||||
dismissStatus?()
|
||||
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel)
|
||||
}))
|
||||
proceed()
|
||||
}
|
||||
} else {
|
||||
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel)
|
||||
|
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_Receive_CommentHeader: String { return self._s[220]! }
|
||||
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 stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
|
||||
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 stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
|
||||
return String(format: self._ps[1 * 6 + Int(form.rawValue)]!, stringValue)
|
||||
|
Loading…
x
Reference in New Issue
Block a user