mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-03 03:10:47 +00:00
Various fixes
This commit is contained in:
parent
a3a2d0efe9
commit
9dd0e3f69e
@ -563,35 +563,37 @@ public func inviteLinkListController(context: AccountContext, peerId: PeerId, ad
|
|||||||
})))
|
})))
|
||||||
|
|
||||||
if !invite.isRevoked {
|
if !invite.isRevoked {
|
||||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextShare, icon: { theme in
|
if !invitationAvailability(invite).isZero {
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor)
|
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextShare, icon: { theme in
|
||||||
}, action: { _, f in
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor)
|
||||||
f(.default)
|
}, action: { _, f in
|
||||||
|
f(.default)
|
||||||
let shareController = ShareController(context: context, subject: .url(invite.link))
|
|
||||||
presentControllerImpl?(shareController, nil)
|
|
||||||
})))
|
|
||||||
|
|
||||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextGetQRCode, icon: { theme in
|
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Wallet/QrIcon"), color: theme.contextMenu.primaryColor)
|
|
||||||
}, action: { _, f in
|
|
||||||
f(.default)
|
|
||||||
|
|
||||||
let _ = (context.account.postbox.loadedPeerWithId(peerId)
|
let shareController = ShareController(context: context, subject: .url(invite.link))
|
||||||
|> deliverOnMainQueue).start(next: { peer in
|
presentControllerImpl?(shareController, nil)
|
||||||
let isGroup: Bool
|
})))
|
||||||
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
|
||||||
isGroup = false
|
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextGetQRCode, icon: { theme in
|
||||||
} else {
|
return generateTintedImage(image: UIImage(bundleImageName: "Wallet/QrIcon"), color: theme.contextMenu.primaryColor)
|
||||||
isGroup = true
|
}, action: { _, f in
|
||||||
}
|
f(.default)
|
||||||
Queue.mainQueue().after(0.2) {
|
|
||||||
let controller = InviteLinkQRCodeController(context: context, invite: invite, isGroup: isGroup)
|
let _ = (context.account.postbox.loadedPeerWithId(peerId)
|
||||||
presentControllerImpl?(controller, nil)
|
|> deliverOnMainQueue).start(next: { peer in
|
||||||
}
|
let isGroup: Bool
|
||||||
})
|
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
||||||
})))
|
isGroup = false
|
||||||
|
} else {
|
||||||
|
isGroup = true
|
||||||
|
}
|
||||||
|
Queue.mainQueue().after(0.2) {
|
||||||
|
let controller = InviteLinkQRCodeController(context: context, invite: invite, isGroup: isGroup)
|
||||||
|
presentControllerImpl?(controller, nil)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})))
|
||||||
|
}
|
||||||
|
|
||||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextEdit, icon: { theme in
|
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextEdit, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor)
|
||||||
}, action: { _, f in
|
}, action: { _, f in
|
||||||
|
@ -487,23 +487,25 @@ public final class InviteLinkViewController: ViewController {
|
|||||||
self?.controller?.present(controller, in: .window(.root))
|
self?.controller?.present(controller, in: .window(.root))
|
||||||
})))
|
})))
|
||||||
} else {
|
} else {
|
||||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextGetQRCode, icon: { theme in
|
if !invitationAvailability(invite).isZero {
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Wallet/QrIcon"), color: theme.contextMenu.primaryColor)
|
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextGetQRCode, icon: { theme in
|
||||||
}, action: { [weak self] _, f in
|
return generateTintedImage(image: UIImage(bundleImageName: "Wallet/QrIcon"), color: theme.contextMenu.primaryColor)
|
||||||
f(.dismissWithoutContent)
|
}, action: { [weak self] _, f in
|
||||||
|
f(.dismissWithoutContent)
|
||||||
let _ = (context.account.postbox.loadedPeerWithId(peerId)
|
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] peer in
|
let _ = (context.account.postbox.loadedPeerWithId(peerId)
|
||||||
let isGroup: Bool
|
|> deliverOnMainQueue).start(next: { [weak self] peer in
|
||||||
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
let isGroup: Bool
|
||||||
isGroup = false
|
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
|
||||||
} else {
|
isGroup = false
|
||||||
isGroup = true
|
} else {
|
||||||
}
|
isGroup = true
|
||||||
let controller = InviteLinkQRCodeController(context: context, invite: invite, isGroup: isGroup)
|
}
|
||||||
self?.controller?.present(controller, in: .window(.root))
|
let controller = InviteLinkQRCodeController(context: context, invite: invite, isGroup: isGroup)
|
||||||
})
|
self?.controller?.present(controller, in: .window(.root))
|
||||||
})))
|
})
|
||||||
|
})))
|
||||||
|
}
|
||||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextRevoke, textColor: .destructive, icon: { theme in
|
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextRevoke, textColor: .destructive, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.actionSheet.destructiveActionTextColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.actionSheet.destructiveActionTextColor)
|
||||||
}, action: { [weak self] _, f in
|
}, action: { [weak self] _, f in
|
||||||
|
@ -14,6 +14,8 @@ import AlertUI
|
|||||||
import PresentationDataUtils
|
import PresentationDataUtils
|
||||||
import UndoUI
|
import UndoUI
|
||||||
import AppBundle
|
import AppBundle
|
||||||
|
import TelegramPermissionsUI
|
||||||
|
import Markdown
|
||||||
|
|
||||||
public enum PeerReportSubject {
|
public enum PeerReportSubject {
|
||||||
case peer(PeerId)
|
case peer(PeerId)
|
||||||
@ -159,31 +161,60 @@ public func peerReportOptionsController(context: AccountContext, subject: PeerRe
|
|||||||
if [.fake, .custom].contains(reportReason) {
|
if [.fake, .custom].contains(reportReason) {
|
||||||
passthrough = false
|
passthrough = false
|
||||||
}
|
}
|
||||||
switch subject {
|
|
||||||
case let .peer(peerId):
|
let action = {
|
||||||
if passthrough {
|
switch subject {
|
||||||
completion(reportReason, true)
|
case let .peer(peerId):
|
||||||
} else {
|
if passthrough {
|
||||||
let _ = (reportPeer(account: context.account, peerId: peerId, reason: reportReason, message: "")
|
completion(reportReason, true)
|
||||||
|> deliverOnMainQueue).start(completed: {
|
} else {
|
||||||
if let path = getAppBundle().path(forResource: "PoliceCar", ofType: "tgs") {
|
let _ = (reportPeer(account: context.account, peerId: peerId, reason: reportReason, message: "")
|
||||||
present(UndoOverlayController(presentationData: presentationData, content: .emoji(path: path, text: presentationData.strings.Report_Succeed), elevatedLayout: false, action: { _ in return false }), nil)
|
|> deliverOnMainQueue).start(completed: {
|
||||||
}
|
if let path = getAppBundle().path(forResource: "PoliceCar", ofType: "tgs") {
|
||||||
completion(nil, false)
|
present(UndoOverlayController(presentationData: presentationData, content: .emoji(path: path, text: presentationData.strings.Report_Succeed), elevatedLayout: false, action: { _ in return false }), nil)
|
||||||
})
|
}
|
||||||
}
|
completion(nil, false)
|
||||||
case let .messages(messageIds):
|
})
|
||||||
if passthrough {
|
}
|
||||||
completion(reportReason, true)
|
case let .messages(messageIds):
|
||||||
} else {
|
if passthrough {
|
||||||
let _ = (reportPeerMessages(account: context.account, messageIds: messageIds, reason: reportReason, message: "")
|
completion(reportReason, true)
|
||||||
|> deliverOnMainQueue).start(completed: {
|
} else {
|
||||||
if let path = getAppBundle().path(forResource: "PoliceCar", ofType: "tgs") {
|
let _ = (reportPeerMessages(account: context.account, messageIds: messageIds, reason: reportReason, message: "")
|
||||||
present(UndoOverlayController(presentationData: presentationData, content: .emoji(path: path, text: presentationData.strings.Report_Succeed), elevatedLayout: false, action: { _ in return false }), nil)
|
|> deliverOnMainQueue).start(completed: {
|
||||||
}
|
if let path = getAppBundle().path(forResource: "PoliceCar", ofType: "tgs") {
|
||||||
completion(nil, false)
|
present(UndoOverlayController(presentationData: presentationData, content: .emoji(path: path, text: presentationData.strings.Report_Succeed), elevatedLayout: false, action: { _ in return false }), nil)
|
||||||
})
|
}
|
||||||
}
|
completion(nil, false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if [.fake, .custom].contains(reportReason) {
|
||||||
|
let controller = ActionSheetController(presentationData: presentationData, allowInputInset: true)
|
||||||
|
let dismissAction: () -> Void = { [weak controller] in
|
||||||
|
controller?.dismissAnimated()
|
||||||
|
}
|
||||||
|
var message = ""
|
||||||
|
var items: [ActionSheetItem] = []
|
||||||
|
items.append(ReportPeerHeaderActionSheetItem(context: context, text: presentationData.strings.Report_AdditionalDetailsText))
|
||||||
|
items.append(ReportPeerDetailsActionSheetItem(context: context, placeholderText: presentationData.strings.Report_AdditionalDetailsPlaceholder, textUpdated: { text in
|
||||||
|
message = text
|
||||||
|
}))
|
||||||
|
items.append(ActionSheetButtonItem(title: presentationData.strings.Report_Report, color: .accent, font: .bold, enabled: true, action: {
|
||||||
|
dismissAction()
|
||||||
|
|
||||||
|
action()
|
||||||
|
}))
|
||||||
|
|
||||||
|
controller.setItemGroups([
|
||||||
|
ActionSheetItemGroup(items: items),
|
||||||
|
ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
|
||||||
|
])
|
||||||
|
present(controller, nil)
|
||||||
|
} else {
|
||||||
|
action()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
push(peerReportController(context: context, subject: subject, completion: completion))
|
push(peerReportController(context: context, subject: subject, completion: completion))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user