mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Add story reply chatlist icon
Add context menu for own story item
This commit is contained in:
parent
ae32ccca68
commit
9ae260945c
@ -2528,6 +2528,19 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
var items: [ContextMenuItem] = []
|
||||
|
||||
//TODO:localize
|
||||
if peer.id == self.context.account.peerId {
|
||||
items.append(.action(ContextMenuActionItem(text: "Add Story", icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Add"), color: theme.contextMenu.primaryColor)
|
||||
}, action: { [weak self] c, _ in
|
||||
c.dismiss(completion: {
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
|
||||
self.openStoryCamera()
|
||||
})
|
||||
})))
|
||||
} else {
|
||||
items.append(.action(ContextMenuActionItem(text: "View Profile", icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/User"), color: theme.contextMenu.primaryColor)
|
||||
}, action: { [weak self] c, _ in
|
||||
@ -2560,6 +2573,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
}, action: { _, f in
|
||||
f(.default)
|
||||
})))
|
||||
}
|
||||
|
||||
let controller = ContextController(account: self.context.account, presentationData: self.presentationData, source: .extracted(ChatListHeaderBarContextExtractedContentSource(controller: self, sourceNode: sourceNode, keepInPlace: false)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture)
|
||||
self.context.sharedContext.mainWindow?.presentInGlobalOverlay(controller)
|
||||
|
@ -1683,6 +1683,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
var currentCredibilityIconContent: EmojiStatusComponent.Content?
|
||||
var currentSecretIconImage: UIImage?
|
||||
var currentForwardedIcon: UIImage?
|
||||
var currentStoryIcon: UIImage?
|
||||
|
||||
var selectableControlSizeAndApply: (CGFloat, (CGSize, Bool) -> ItemListSelectableControlNode)?
|
||||
var reorderControlSizeAndApply: (CGFloat, (CGFloat, Bool, ContainedViewLayoutTransition) -> ItemListEditableReorderControlNode)?
|
||||
@ -1805,6 +1806,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
var forumThread: (id: Int64, title: String, iconId: Int64?, iconColor: Int32, isUnread: Bool)?
|
||||
|
||||
var displayForwardedIcon = false
|
||||
var displayStoryReplyIcon = false
|
||||
|
||||
switch contentData {
|
||||
case let .chat(itemPeer, _, _, _, text, spoilers, customEmojiRanges):
|
||||
@ -1983,6 +1985,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
if let forwardInfo = message.forwardInfo, !forwardInfo.flags.contains(.isImported) {
|
||||
displayForwardedIcon = true
|
||||
} else if let _ = message.attributes.first(where: { $0 is ReplyStoryAttribute }) {
|
||||
displayStoryReplyIcon = true
|
||||
}
|
||||
|
||||
var displayMediaPreviews = true
|
||||
@ -2070,6 +2074,10 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
currentForwardedIcon = PresentationResourcesChatList.forwardedIcon(item.presentationData.theme)
|
||||
}
|
||||
|
||||
if displayStoryReplyIcon {
|
||||
currentStoryIcon = PresentationResourcesChatList.storyReplyIcon(item.presentationData.theme)
|
||||
}
|
||||
|
||||
if let currentForwardedIcon {
|
||||
textLeftCutout += currentForwardedIcon.size.width
|
||||
if !contentImageSpecs.isEmpty {
|
||||
@ -2079,6 +2087,15 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
}
|
||||
}
|
||||
|
||||
if let currentStoryIcon {
|
||||
textLeftCutout += currentStoryIcon.size.width
|
||||
if !contentImageSpecs.isEmpty {
|
||||
textLeftCutout += forwardedIconSpacing
|
||||
} else {
|
||||
textLeftCutout += contentImageTrailingSpace
|
||||
}
|
||||
}
|
||||
|
||||
for i in 0 ..< contentImageSpecs.count {
|
||||
if i != 0 {
|
||||
textLeftCutout += contentImageSpacing
|
||||
@ -3337,13 +3354,22 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
var mediaPreviewOffset = textNodeFrame.origin.offsetBy(dx: 1.0, dy: floor((measureLayout.size.height - contentImageSize.height) / 2.0))
|
||||
|
||||
if let currentForwardedIcon = currentForwardedIcon {
|
||||
strongSelf.forwardedIconNode.image = currentForwardedIcon
|
||||
var messageTypeIcon: UIImage?
|
||||
var messageTypeIconOffset = mediaPreviewOffset
|
||||
if let currentForwardedIcon {
|
||||
messageTypeIcon = currentForwardedIcon
|
||||
messageTypeIconOffset.y += 3.0
|
||||
} else if let currentStoryIcon {
|
||||
messageTypeIcon = currentStoryIcon
|
||||
}
|
||||
|
||||
if let messageTypeIcon {
|
||||
strongSelf.forwardedIconNode.image = messageTypeIcon
|
||||
if strongSelf.forwardedIconNode.supernode == nil {
|
||||
strongSelf.mainContentContainerNode.addSubnode(strongSelf.forwardedIconNode)
|
||||
}
|
||||
transition.updateFrame(node: strongSelf.forwardedIconNode, frame: CGRect(origin: CGPoint(x: mediaPreviewOffset.x, y: mediaPreviewOffset.y + 3.0), size: currentForwardedIcon.size))
|
||||
mediaPreviewOffset.x += currentForwardedIcon.size.width + forwardedIconSpacing
|
||||
transition.updateFrame(node: strongSelf.forwardedIconNode, frame: CGRect(origin: messageTypeIconOffset, size: messageTypeIcon.size))
|
||||
mediaPreviewOffset.x += messageTypeIcon.size.width + forwardedIconSpacing
|
||||
} else if strongSelf.forwardedIconNode.supernode != nil {
|
||||
strongSelf.forwardedIconNode.removeFromSupernode()
|
||||
}
|
||||
|
@ -107,6 +107,7 @@ public enum PresentationResourceKey: Int32 {
|
||||
case chatListRecentStatusVoiceChatPanelIcon
|
||||
|
||||
case chatListForwardedIcon
|
||||
case chatListStoryReplyIcon
|
||||
|
||||
case chatListGeneralTopicIcon
|
||||
case chatListGeneralTopicSmallIcon
|
||||
|
@ -253,6 +253,12 @@ public struct PresentationResourcesChatList {
|
||||
})
|
||||
}
|
||||
|
||||
public static func storyReplyIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
return theme.image(PresentationResourceKey.chatListStoryReplyIcon.rawValue, { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat List/StoryReplyIcon"), color: theme.chatList.muteIconColor)
|
||||
})
|
||||
}
|
||||
|
||||
public static func verifiedIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
return theme.image(PresentationResourceKey.chatListVerifiedIcon.rawValue, { theme in
|
||||
if let backgroundImage = UIImage(bundleImageName: "Chat List/PeerVerifiedIconBackground"), let foregroundImage = UIImage(bundleImageName: "Chat List/PeerVerifiedIconForeground") {
|
||||
|
@ -363,8 +363,6 @@ public final class StoryPeerListItemComponent: Component {
|
||||
|
||||
let previousComponent = self.component
|
||||
|
||||
self.containerNode.isGestureEnabled = component.peer.id != component.context.account.peerId
|
||||
|
||||
self.component = component
|
||||
self.componentState = state
|
||||
|
||||
|
12
submodules/TelegramUI/Images.xcassets/Chat List/StoryReplyIcon.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Chat List/StoryReplyIcon.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "ic_storyreply.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
139
submodules/TelegramUI/Images.xcassets/Chat List/StoryReplyIcon.imageset/ic_storyreply.pdf
vendored
Normal file
139
submodules/TelegramUI/Images.xcassets/Chat List/StoryReplyIcon.imageset/ic_storyreply.pdf
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
%PDF-1.7
|
||||
|
||||
1 0 obj
|
||||
<< >>
|
||||
endobj
|
||||
|
||||
2 0 obj
|
||||
<< /Length 3 0 R >>
|
||||
stream
|
||||
/DeviceRGB CS
|
||||
/DeviceRGB cs
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 1.250000 1.250000 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
8.750000 16.000000 m
|
||||
8.687436 16.000000 8.625057 15.999207 8.562874 15.997632 c
|
||||
6.709939 15.950687 5.029772 15.208538 3.773461 14.022270 c
|
||||
3.680609 13.934595 3.590072 13.844494 3.501952 13.752068 c
|
||||
2.310160 12.502043 1.560415 10.826810 1.503491 8.977144 c
|
||||
1.501169 8.901714 1.500000 8.825994 1.500000 8.750000 c
|
||||
1.500000 8.687436 1.500792 8.625057 1.502368 8.562874 c
|
||||
1.547463 6.782922 2.234077 5.162397 3.339638 3.923870 c
|
||||
3.508653 3.734527 3.687460 3.554111 3.875264 3.383418 c
|
||||
5.109709 2.261445 6.732838 1.559564 8.518808 1.503616 c
|
||||
8.595577 1.501211 8.672647 1.500000 8.750000 1.500000 c
|
||||
9.071613 1.500000 9.387973 1.520895 9.697865 1.561318 c
|
||||
10.108599 1.614895 10.484997 1.325361 10.538574 0.914627 c
|
||||
10.592151 0.503893 10.302618 0.127495 9.891884 0.073919 c
|
||||
9.517827 0.025126 9.136661 0.000000 8.750000 0.000000 c
|
||||
8.636739 0.000000 8.523980 0.002151 8.411762 0.006416 c
|
||||
6.298033 0.086756 4.376344 0.916882 2.905031 2.238455 c
|
||||
2.683921 2.437062 2.472982 2.646769 2.273091 2.866697 c
|
||||
0.860781 4.420585 0.000000 6.484770 0.000000 8.750000 c
|
||||
0.000000 11.081320 0.911740 13.199690 2.398106 14.767997 c
|
||||
2.500393 14.875923 2.605402 14.981244 2.713021 15.083851 c
|
||||
4.283196 16.580877 6.409262 17.500000 8.750000 17.500000 c
|
||||
9.136661 17.500000 9.517827 17.474874 9.891884 17.426081 c
|
||||
10.302618 17.372505 10.592151 16.996107 10.538574 16.585373 c
|
||||
10.484998 16.174639 10.108600 15.885105 9.697865 15.938683 c
|
||||
9.387973 15.979105 9.071614 16.000000 8.750000 16.000000 c
|
||||
h
|
||||
13.025583 15.554191 m
|
||||
13.277974 15.882628 13.748830 15.944277 14.077268 15.691885 c
|
||||
14.683157 15.226283 15.226282 14.683159 15.691885 14.077269 c
|
||||
15.944276 13.748831 15.882628 13.277975 15.554191 13.025583 c
|
||||
15.225752 12.773192 14.754897 12.834841 14.502505 13.163279 c
|
||||
14.116343 13.665794 13.665793 14.116343 13.163278 14.502506 c
|
||||
12.834840 14.754898 12.773191 15.225753 13.025583 15.554191 c
|
||||
h
|
||||
16.585373 10.538574 m
|
||||
16.996107 10.592151 17.372505 10.302618 17.426081 9.891884 c
|
||||
17.474874 9.517827 17.500000 9.136661 17.500000 8.750000 c
|
||||
17.500000 8.363339 17.474874 7.982173 17.426081 7.608116 c
|
||||
17.372505 7.197382 16.996107 6.907849 16.585373 6.961426 c
|
||||
16.174639 7.015002 15.885105 7.391400 15.938682 7.802135 c
|
||||
15.979105 8.112027 16.000000 8.428386 16.000000 8.750000 c
|
||||
16.000000 9.071613 15.979105 9.387972 15.938682 9.697865 c
|
||||
15.885105 10.108599 16.174639 10.484997 16.585373 10.538574 c
|
||||
h
|
||||
15.554191 4.474417 m
|
||||
15.882628 4.222026 15.944277 3.751170 15.691885 3.422732 c
|
||||
15.226283 2.816843 14.683158 2.273718 14.077269 1.808115 c
|
||||
13.748831 1.555724 13.277975 1.617372 13.025584 1.945809 c
|
||||
12.773192 2.274248 12.834840 2.745103 13.163279 2.997495 c
|
||||
13.665794 3.383657 14.116343 3.834207 14.502506 4.336722 c
|
||||
14.754898 4.665160 15.225753 4.726809 15.554191 4.474417 c
|
||||
h
|
||||
8.273390 11.921345 m
|
||||
8.273390 11.050000 l
|
||||
11.703422 11.050000 12.866389 8.579929 13.256549 6.733100 c
|
||||
13.256555 6.733077 l
|
||||
13.383529 6.132035 13.447016 5.831513 13.389845 5.732118 c
|
||||
13.335299 5.637283 13.261444 5.590770 13.152351 5.582543 c
|
||||
13.038011 5.573922 12.743963 5.799743 12.155870 6.251384 c
|
||||
11.347326 6.872325 10.103362 7.450000 8.273390 7.450000 c
|
||||
8.273390 6.578653 l
|
||||
8.273390 6.000751 8.273390 5.711799 8.157403 5.572701 c
|
||||
8.056680 5.451907 7.904991 5.385546 7.747917 5.393559 c
|
||||
7.567042 5.402785 7.354835 5.598900 6.930421 5.991130 c
|
||||
4.039881 8.662477 l
|
||||
3.819108 8.866508 3.708722 8.968524 3.667804 9.088018 c
|
||||
3.631850 9.193013 3.631850 9.306987 3.667804 9.411982 c
|
||||
3.708722 9.531476 3.819108 9.633492 4.039880 9.837523 c
|
||||
6.930419 12.508869 l
|
||||
7.354834 12.901100 7.567042 13.097216 7.747917 13.106441 c
|
||||
7.904991 13.114454 8.056680 13.048094 8.157403 12.927299 c
|
||||
8.273390 12.788202 8.273390 12.499249 8.273390 11.921345 c
|
||||
h
|
||||
f*
|
||||
n
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
3799
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Annots []
|
||||
/Type /Page
|
||||
/MediaBox [ 0.000000 0.000000 20.000000 20.000000 ]
|
||||
/Resources 1 0 R
|
||||
/Contents 2 0 R
|
||||
/Parent 5 0 R
|
||||
>>
|
||||
endobj
|
||||
|
||||
5 0 obj
|
||||
<< /Kids [ 4 0 R ]
|
||||
/Count 1
|
||||
/Type /Pages
|
||||
>>
|
||||
endobj
|
||||
|
||||
6 0 obj
|
||||
<< /Pages 5 0 R
|
||||
/Type /Catalog
|
||||
>>
|
||||
endobj
|
||||
|
||||
xref
|
||||
0 7
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000034 00000 n
|
||||
0000003889 00000 n
|
||||
0000003912 00000 n
|
||||
0000004085 00000 n
|
||||
0000004159 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 6 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
4218
|
||||
%%EOF
|
Loading…
x
Reference in New Issue
Block a user