mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Move Rate Call menu option up
This commit is contained in:
parent
b97295d6b2
commit
7c0c64d037
@ -237,7 +237,7 @@ func messageMediaEditingOptions(message: Message) -> MessageMediaEditingOptions
|
|||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
func updatedChatEditInterfaceMessagetState(state: ChatPresentationInterfaceState, message: Message) -> ChatPresentationInterfaceState {
|
func updatedChatEditInterfaceMessageState(state: ChatPresentationInterfaceState, message: Message) -> ChatPresentationInterfaceState {
|
||||||
var updated = state
|
var updated = state
|
||||||
for media in message.media {
|
for media in message.media {
|
||||||
if let webpage = media as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content {
|
if let webpage = media as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content {
|
||||||
@ -403,6 +403,33 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
|
|||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if data.messageActions.options.contains(.rateCall) {
|
||||||
|
var callId: CallId?
|
||||||
|
for media in message.media {
|
||||||
|
if let action = media as? TelegramMediaAction, case let .phoneCall(id, discardReason, _) = action.action {
|
||||||
|
if discardReason != .busy && discardReason != .missed {
|
||||||
|
if let logName = callLogNameForId(id: id, account: context.account) {
|
||||||
|
let start = logName.index(logName.startIndex, offsetBy: "\(id)".count + 1)
|
||||||
|
let end = logName.index(logName.endIndex, offsetBy: -4)
|
||||||
|
let accessHash = logName[start..<end]
|
||||||
|
if let accessHash = Int64(accessHash) {
|
||||||
|
callId = CallId(id: id, accessHash: accessHash)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let callId = callId {
|
||||||
|
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Call_RateCall, icon: { theme in
|
||||||
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Rate"), color: theme.actionSheet.primaryTextColor)
|
||||||
|
}, action: { _, f in
|
||||||
|
let _ = controllerInteraction.rateCall(message, callId)
|
||||||
|
f(.dismissWithoutContent)
|
||||||
|
})))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if data.canReply {
|
if data.canReply {
|
||||||
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuReply, icon: { theme in
|
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuReply, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Reply"), color: theme.actionSheet.primaryTextColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Reply"), color: theme.actionSheet.primaryTextColor)
|
||||||
@ -683,34 +710,7 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
|
|||||||
f(.dismissWithoutContent)
|
f(.dismissWithoutContent)
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
if data.messageActions.options.contains(.rateCall) {
|
|
||||||
var callId: CallId?
|
|
||||||
for media in message.media {
|
|
||||||
if let action = media as? TelegramMediaAction, case let .phoneCall(id, discardReason, _) = action.action {
|
|
||||||
if discardReason != .busy && discardReason != .missed {
|
|
||||||
if let logName = callLogNameForId(id: id, account: context.account) {
|
|
||||||
let start = logName.index(logName.startIndex, offsetBy: "\(id)".count + 1)
|
|
||||||
let end = logName.index(logName.endIndex, offsetBy: -4)
|
|
||||||
let accessHash = logName[start..<end]
|
|
||||||
if let accessHash = Int64(accessHash) {
|
|
||||||
callId = CallId(id: id, accessHash: accessHash)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let callId = callId {
|
|
||||||
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Call_RateCall, icon: { theme in
|
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Rate"), color: theme.actionSheet.primaryTextColor)
|
|
||||||
}, action: { _, f in
|
|
||||||
let _ = controllerInteraction.rateCall(message, callId)
|
|
||||||
f(.dismissWithoutContent)
|
|
||||||
})))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if data.messageActions.options.contains(.forward) {
|
if data.messageActions.options.contains(.forward) {
|
||||||
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuForward, icon: { theme in
|
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuForward, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.actionSheet.primaryTextColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.actionSheet.primaryTextColor)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user