Various fixes

This commit is contained in:
Ilya Laktyushin 2021-02-14 13:39:26 +04:00
parent a3a2d0efe9
commit 9dd0e3f69e
5 changed files with 105 additions and 70 deletions

View File

@ -563,6 +563,7 @@ public func inviteLinkListController(context: AccountContext, peerId: PeerId, ad
}))) })))
if !invite.isRevoked { if !invite.isRevoked {
if !invitationAvailability(invite).isZero {
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextShare, icon: { theme in items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextShare, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor) return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor)
}, action: { _, f in }, action: { _, f in
@ -591,6 +592,7 @@ public func inviteLinkListController(context: AccountContext, peerId: PeerId, ad
} }
}) })
}))) })))
}
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)

View File

@ -487,6 +487,7 @@ public final class InviteLinkViewController: ViewController {
self?.controller?.present(controller, in: .window(.root)) self?.controller?.present(controller, in: .window(.root))
}))) })))
} else { } else {
if !invitationAvailability(invite).isZero {
items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextGetQRCode, icon: { theme in items.append(.action(ContextMenuActionItem(text: presentationData.strings.InviteLink_ContextGetQRCode, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Wallet/QrIcon"), color: theme.contextMenu.primaryColor) return generateTintedImage(image: UIImage(bundleImageName: "Wallet/QrIcon"), color: theme.contextMenu.primaryColor)
}, action: { [weak self] _, f in }, action: { [weak self] _, f in
@ -504,6 +505,7 @@ public final class InviteLinkViewController: ViewController {
self?.controller?.present(controller, in: .window(.root)) 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

View File

@ -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,6 +161,8 @@ public func peerReportOptionsController(context: AccountContext, subject: PeerRe
if [.fake, .custom].contains(reportReason) { if [.fake, .custom].contains(reportReason) {
passthrough = false passthrough = false
} }
let action = {
switch subject { switch subject {
case let .peer(peerId): case let .peer(peerId):
if passthrough { if passthrough {
@ -185,6 +189,33 @@ public func peerReportOptionsController(context: AccountContext, subject: PeerRe
}) })
} }
} }
}
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))
} }