Skip to content

Commit

Permalink
Merge commit '3a9cacfa68948148c3cd7d52cd5c51c869022b9d'
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac committed Sep 13, 2024
2 parents 5e356fd + 3a9cacf commit 1cd853f
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 28 deletions.
6 changes: 6 additions & 0 deletions submodules/AttachmentUI/Sources/AttachmentPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,12 @@ private final class MainButtonNode: HighlightTrackingButtonNode {

self.setupShimmering()

let colorUpdated = previousState.textColor != state.textColor
if let progressNode = self.progressNode, colorUpdated {
let diameter: CGFloat = size.height - 22.0
progressNode.image = generateIndefiniteActivityIndicatorImage(color: state.textColor, diameter: diameter, lineWidth: 3.0)
}

if let text = state.text {
let font: UIFont
switch state.font {
Expand Down
6 changes: 5 additions & 1 deletion submodules/BrowserUI/Sources/BrowserReadability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ private func parseDetails(_ item: [String: Any], _ url: String, _ media: inout [
)
}

private let nonListCharacters = CharacterSet(charactersIn: "0123456789").inverted
private func parseList(_ input: [String: Any], _ url: String, _ media: inout [MediaId: Media]) -> InstantPageBlock? {
guard let content = input["content"] as? [Any], let tag = input["tag"] as? String else {
return nil
Expand Down Expand Up @@ -598,7 +599,10 @@ private func parseList(_ input: [String: Any], _ url: String, _ media: inout [Me
if case let .text(text, _) = item {
if case .empty = text {
} else {
allEmpty = false
let plainText = text.plainText
if !plainText.isEmpty && plainText.rangeOfCharacter(from: nonListCharacters) != nil {
allEmpty = false
}
break
}
} else {
Expand Down
3 changes: 1 addition & 2 deletions submodules/InstantPageUI/Sources/InstantPageTextItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,7 @@ func layoutTextItemWithString(_ string: NSAttributedString, boundingWidth: CGFlo
for var item in additionalItems {
item.frame = item.frame.offsetBy(dx: 0.0, dy: abs(topInset))
}

let scrollableItem = InstantPageScrollableTextItem(frame: CGRect(x: 0.0, y: 0.0, width: boundingWidth + horizontalInset * 2.0, height: height + abs(topInset) + bottomInset), item: textItem, additionalItems: additionalItems, totalWidth: textWidth, horizontalInset: horizontalInset, rtl: textItem.containsRTL)
let scrollableItem = InstantPageScrollableTextItem(frame: CGRect(origin: offset, size: CGSize(width: boundingWidth + horizontalInset * 2.0, height: height + abs(topInset) + bottomInset)), item: textItem, additionalItems: additionalItems, totalWidth: textWidth, horizontalInset: horizontalInset, rtl: textItem.containsRTL)
items.append(scrollableItem)
} else {
items.append(contentsOf: additionalItems)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private enum InviteLinkViewEntry: Comparable, Identifiable {
} else {
interaction.shareLink(invite)
}
}, contextAction: { node, gesture in
}, contextAction: invite.link?.hasSuffix("...") == true ? nil : { node, gesture in
interaction.contextAction(invite, node, gesture)
}, viewAction: {
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
constrainedSize: textConstrainedSize,
availableReactions: item.associatedData.availableReactions,
savedMessageTags: item.associatedData.savedMessageTags,
reactions: dateReactionsAndPeers.reactions,
reactions: item.presentationData.isPreview ? [] : dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
areReactionsTags: item.topMessage.areReactionsTags(accountPeerId: item.context.account.peerId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,27 +188,29 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
return true
}
case let .editExportedInvitation(_, invite), let .revokeExportedInvitation(invite), let .deleteExportedInvitation(invite), let .participantJoinedViaInvite(invite, _), let .participantJoinByRequest(invite, _):
if let inviteLink = invite.link, !inviteLink.hasSuffix("...") {
if let inviteLink = invite.link {
if invite.isPermanent {
let actionSheet = ActionSheetController(presentationData: strongSelf.presentationData)

var items: [ActionSheetItem] = []
items.append(ActionSheetTextItem(title: inviteLink))
items.append(ActionSheetButtonItem(title: strongSelf.presentationData.strings.InviteLink_ContextRevoke, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
if let strongSelf = self {
let _ = (strongSelf.context.engine.peers.revokePeerExportedInvitation(peerId: peer.id, link: inviteLink)
|> deliverOnMainQueue).startStandalone(completed: { [weak self] in
self?.eventLogContext.reload()
})
}
}))
actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [
ActionSheetButtonItem(title: strongSelf.presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
if !inviteLink.hasSuffix("...") {
let actionSheet = ActionSheetController(presentationData: strongSelf.presentationData)

var items: [ActionSheetItem] = []
items.append(ActionSheetTextItem(title: inviteLink))
items.append(ActionSheetButtonItem(title: strongSelf.presentationData.strings.InviteLink_ContextRevoke, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
})
])])
strongSelf.presentController(actionSheet, .window(.root), nil)
if let strongSelf = self {
let _ = (strongSelf.context.engine.peers.revokePeerExportedInvitation(peerId: peer.id, link: inviteLink)
|> deliverOnMainQueue).startStandalone(completed: { [weak self] in
self?.eventLogContext.reload()
})
}
}))
actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [
ActionSheetButtonItem(title: strongSelf.presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
})
])])
strongSelf.presentController(actionSheet, .window(.root), nil)
}
} else {
let controller = InviteLinkViewController(
context: strongSelf.context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ private final class SheetContent: CombinedComponent {
}
if let range = buttonAttributedString.string.range(of: "#"), let starImage = state.cachedStarImage?.0 {
buttonAttributedString.addAttribute(.attachment, value: starImage, range: NSRange(range, in: buttonAttributedString.string))
buttonAttributedString.addAttribute(.foregroundColor, value: UIColor(rgb: 0xffffff), range: NSRange(range, in: buttonAttributedString.string))
buttonAttributedString.addAttribute(.foregroundColor, value: environment.theme.list.itemCheckColors.foregroundColor, range: NSRange(range, in: buttonAttributedString.string))
buttonAttributedString.addAttribute(.baselineOffset, value: 1.0, range: NSRange(range, in: buttonAttributedString.string))
}

Expand Down Expand Up @@ -603,7 +603,7 @@ private final class SheetContent: CombinedComponent {
})
}
),
availableSize: CGSize(width: 361.0, height: 50),
availableSize: CGSize(width: context.availableSize.width - 16.0 * 2.0, height: 50),
transition: .immediate
)
context.add(button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ private final class SheetContent: CombinedComponent {
}
}
),
availableSize: CGSize(width: 361.0, height: 50),
availableSize: CGSize(width: context.availableSize.width - sideInset * 2.0, height: 50),
transition: .immediate
)
context.add(button
Expand Down
2 changes: 1 addition & 1 deletion submodules/TelegramUI/Resources/Readability/ReaderMode.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1cd853f

Please sign in to comment.