mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
no message
This commit is contained in:
parent
cb30aa60a8
commit
a61a29f6f6
@ -369,7 +369,7 @@ public final class ChatController: TelegramController, UIViewControllerPreviewin
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let _ = contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState: strongSelf.presentationInterfaceState, account: strongSelf.account, messages: updatedMessages, interfaceInteraction: strongSelf.interfaceInteraction, debugStreamSingleVideo: { id in
|
let _ = contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState: strongSelf.presentationInterfaceState, account: strongSelf.account, messages: updatedMessages, controllerInteraction: strongSelf.controllerInteraction, interfaceInteraction: strongSelf.interfaceInteraction, debugStreamSingleVideo: { id in
|
||||||
self?.debugStreamSingleVideo(id)
|
self?.debugStreamSingleVideo(id)
|
||||||
}).start(next: { actions in
|
}).start(next: { actions in
|
||||||
guard let strongSelf = self, !actions.isEmpty else {
|
guard let strongSelf = self, !actions.isEmpty else {
|
||||||
@ -738,7 +738,7 @@ public final class ChatController: TelegramController, UIViewControllerPreviewin
|
|||||||
case let .url(url):
|
case let .url(url):
|
||||||
var cleanUrl = url
|
var cleanUrl = url
|
||||||
var canAddToReadingList = true
|
var canAddToReadingList = true
|
||||||
let canOpenIn = true
|
let canOpenIn = !availableOpenInOptions(applicationContext: strongSelf.account.telegramApplicationContext, item: .url(url: url)).isEmpty
|
||||||
let mailtoString = "mailto:"
|
let mailtoString = "mailto:"
|
||||||
let telString = "tel:"
|
let telString = "tel:"
|
||||||
var openText = strongSelf.presentationData.strings.Conversation_LinkDialogOpen
|
var openText = strongSelf.presentationData.strings.Conversation_LinkDialogOpen
|
||||||
@ -1389,7 +1389,7 @@ public final class ChatController: TelegramController, UIViewControllerPreviewin
|
|||||||
var pinnedMessageId: MessageId?
|
var pinnedMessageId: MessageId?
|
||||||
var peerIsBlocked: Bool = false
|
var peerIsBlocked: Bool = false
|
||||||
var canReport: Bool = false
|
var canReport: Bool = false
|
||||||
var callsAvailable: Bool = false
|
var callsAvailable: Bool = true
|
||||||
var callsPrivate: Bool = false
|
var callsPrivate: Bool = false
|
||||||
if let cachedData = combinedInitialData.cachedData as? CachedChannelData {
|
if let cachedData = combinedInitialData.cachedData as? CachedChannelData {
|
||||||
pinnedMessageId = cachedData.pinnedMessageId
|
pinnedMessageId = cachedData.pinnedMessageId
|
||||||
|
@ -149,8 +149,8 @@ func updatedChatEditInterfaceMessagetState(state: ChatPresentationInterfaceState
|
|||||||
return updated
|
return updated
|
||||||
}
|
}
|
||||||
|
|
||||||
func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState: ChatPresentationInterfaceState, account: Account, messages: [Message], interfaceInteraction: ChatPanelInterfaceInteraction?, debugStreamSingleVideo: @escaping (MessageId) -> Void) -> Signal<[ChatMessageContextMenuAction], NoError> {
|
func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState: ChatPresentationInterfaceState, account: Account, messages: [Message], controllerInteraction: ChatControllerInteraction?, interfaceInteraction: ChatPanelInterfaceInteraction?, debugStreamSingleVideo: @escaping (MessageId) -> Void) -> Signal<[ChatMessageContextMenuAction], NoError> {
|
||||||
guard let interfaceInteraction = interfaceInteraction else {
|
guard let interfaceInteraction = interfaceInteraction, let controllerInteraction = controllerInteraction else {
|
||||||
return .single([])
|
return .single([])
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,6 +440,12 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
|
|||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if data.messageActions.options.contains(.viewStickerPack) {
|
||||||
|
actions.append(.sheet(ChatMessageContextMenuSheetAction(color: .accent, title: chatPresentationInterfaceState.strings.StickerPack_ViewPack, action: {
|
||||||
|
let _ = controllerInteraction.openMessage(message)
|
||||||
|
})))
|
||||||
|
}
|
||||||
|
|
||||||
if data.messageActions.options.contains(.forward) {
|
if data.messageActions.options.contains(.forward) {
|
||||||
actions.append(.sheet(ChatMessageContextMenuSheetAction(color: .accent, title: chatPresentationInterfaceState.strings.Conversation_ContextMenuForward, action: {
|
actions.append(.sheet(ChatMessageContextMenuSheetAction(color: .accent, title: chatPresentationInterfaceState.strings.Conversation_ContextMenuForward, action: {
|
||||||
interfaceInteraction.forwardMessages(messages)
|
interfaceInteraction.forwardMessages(messages)
|
||||||
@ -477,6 +483,7 @@ struct ChatAvailableMessageActionOptions: OptionSet {
|
|||||||
static let deleteGlobally = ChatAvailableMessageActionOptions(rawValue: 1 << 1)
|
static let deleteGlobally = ChatAvailableMessageActionOptions(rawValue: 1 << 1)
|
||||||
static let forward = ChatAvailableMessageActionOptions(rawValue: 1 << 2)
|
static let forward = ChatAvailableMessageActionOptions(rawValue: 1 << 2)
|
||||||
static let report = ChatAvailableMessageActionOptions(rawValue: 1 << 3)
|
static let report = ChatAvailableMessageActionOptions(rawValue: 1 << 3)
|
||||||
|
static let viewStickerPack = ChatAvailableMessageActionOptions(rawValue: 1 << 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ChatAvailableMessageActions {
|
struct ChatAvailableMessageActions {
|
||||||
@ -508,91 +515,103 @@ func chatAvailableMessageActions(postbox: Postbox, accountPeerId: PeerId, messag
|
|||||||
if optionsMap[id] == nil {
|
if optionsMap[id] == nil {
|
||||||
optionsMap[id] = []
|
optionsMap[id] = []
|
||||||
}
|
}
|
||||||
if id.peerId == accountPeerId {
|
if let message = transaction.getMessage(id) {
|
||||||
optionsMap[id]!.insert(.forward)
|
|
||||||
optionsMap[id]!.insert(.deleteLocally)
|
|
||||||
} else if let peer = transaction.getPeer(id.peerId), let message = transaction.getMessage(id) {
|
|
||||||
var isAction = false
|
|
||||||
for media in message.media {
|
for media in message.media {
|
||||||
if media is TelegramMediaAction {
|
if let file = media as? TelegramMediaFile, file.isSticker {
|
||||||
isAction = true
|
for case let .Sticker(sticker) in file.attributes {
|
||||||
|
if let _ = sticker.packReference {
|
||||||
|
optionsMap[id]!.insert(.viewStickerPack)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let channel = peer as? TelegramChannel {
|
if id.peerId == accountPeerId {
|
||||||
if message.flags.contains(.Incoming), channel.adminRights == nil, !channel.flags.contains(.isCreator) {
|
optionsMap[id]!.insert(.forward)
|
||||||
optionsMap[id]!.insert(.report)
|
optionsMap[id]!.insert(.deleteLocally)
|
||||||
|
} else if let peer = transaction.getPeer(id.peerId) {
|
||||||
|
var isAction = false
|
||||||
|
for media in message.media {
|
||||||
|
if media is TelegramMediaAction {
|
||||||
|
isAction = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if channel.hasAdminRights(.canBanUsers), case .group = channel.info {
|
if let channel = peer as? TelegramChannel {
|
||||||
if message.flags.contains(.Incoming) {
|
if message.flags.contains(.Incoming), channel.adminRights == nil, !channel.flags.contains(.isCreator) {
|
||||||
if !hadBanPeerId {
|
optionsMap[id]!.insert(.report)
|
||||||
|
}
|
||||||
|
if channel.hasAdminRights(.canBanUsers), case .group = channel.info {
|
||||||
|
if message.flags.contains(.Incoming) {
|
||||||
|
if !hadBanPeerId {
|
||||||
|
hadBanPeerId = true
|
||||||
|
banPeer = message.author
|
||||||
|
} else if banPeer?.id != message.author?.id {
|
||||||
|
banPeer = nil
|
||||||
|
}
|
||||||
|
} else {
|
||||||
hadBanPeerId = true
|
hadBanPeerId = true
|
||||||
banPeer = message.author
|
|
||||||
} else if banPeer?.id != message.author?.id {
|
|
||||||
banPeer = nil
|
banPeer = nil
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
hadBanPeerId = true
|
|
||||||
banPeer = nil
|
|
||||||
}
|
}
|
||||||
}
|
if message.id.peerId.namespace != Namespaces.Peer.SecretChat && !message.containsSecretMedia && !isAction {
|
||||||
if message.id.peerId.namespace != Namespaces.Peer.SecretChat && !message.containsSecretMedia && !isAction {
|
|
||||||
optionsMap[id]!.insert(.forward)
|
|
||||||
}
|
|
||||||
if !message.flags.contains(.Incoming) {
|
|
||||||
optionsMap[id]!.insert(.deleteGlobally)
|
|
||||||
} else {
|
|
||||||
if channel.hasAdminRights([.canDeleteMessages]) {
|
|
||||||
optionsMap[id]!.insert(.deleteGlobally)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if let group = peer as? TelegramGroup {
|
|
||||||
if message.id.peerId.namespace != Namespaces.Peer.SecretChat && !message.containsSecretMedia {
|
|
||||||
if !isAction {
|
|
||||||
optionsMap[id]!.insert(.forward)
|
optionsMap[id]!.insert(.forward)
|
||||||
}
|
}
|
||||||
}
|
if !message.flags.contains(.Incoming) {
|
||||||
optionsMap[id]!.insert(.deleteLocally)
|
|
||||||
if !message.flags.contains(.Incoming) {
|
|
||||||
optionsMap[id]!.insert(.deleteGlobally)
|
|
||||||
} else {
|
|
||||||
switch group.role {
|
|
||||||
case .creator, .admin:
|
|
||||||
optionsMap[id]!.insert(.deleteGlobally)
|
|
||||||
case .member:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if let _ = peer as? TelegramUser {
|
|
||||||
if message.id.peerId.namespace != Namespaces.Peer.SecretChat && !message.containsSecretMedia && !isAction {
|
|
||||||
optionsMap[id]!.insert(.forward)
|
|
||||||
}
|
|
||||||
optionsMap[id]!.insert(.deleteLocally)
|
|
||||||
if !message.flags.contains(.Incoming) {
|
|
||||||
if canPerformEditingActions(limits: limitsConfiguration, accountPeerId: accountPeerId, message: message) {
|
|
||||||
optionsMap[id]!.insert(.deleteGlobally)
|
optionsMap[id]!.insert(.deleteGlobally)
|
||||||
|
} else {
|
||||||
|
if channel.hasAdminRights([.canDeleteMessages]) {
|
||||||
|
optionsMap[id]!.insert(.deleteGlobally)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if let group = peer as? TelegramGroup {
|
||||||
} else if let _ = peer as? TelegramSecretChat {
|
if message.id.peerId.namespace != Namespaces.Peer.SecretChat && !message.containsSecretMedia {
|
||||||
var isNonRemovableServiceAction = false
|
if !isAction {
|
||||||
for media in message.media {
|
optionsMap[id]!.insert(.forward)
|
||||||
if let action = media as? TelegramMediaAction {
|
}
|
||||||
switch action.action {
|
}
|
||||||
case .historyScreenshot:
|
optionsMap[id]!.insert(.deleteLocally)
|
||||||
isNonRemovableServiceAction = true
|
if !message.flags.contains(.Incoming) {
|
||||||
default:
|
optionsMap[id]!.insert(.deleteGlobally)
|
||||||
|
} else {
|
||||||
|
switch group.role {
|
||||||
|
case .creator, .admin:
|
||||||
|
optionsMap[id]!.insert(.deleteGlobally)
|
||||||
|
case .member:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if let _ = peer as? TelegramUser {
|
||||||
|
if message.id.peerId.namespace != Namespaces.Peer.SecretChat && !message.containsSecretMedia && !isAction {
|
||||||
if !isNonRemovableServiceAction {
|
optionsMap[id]!.insert(.forward)
|
||||||
optionsMap[id]!.insert(.deleteGlobally)
|
}
|
||||||
|
optionsMap[id]!.insert(.deleteLocally)
|
||||||
|
if !message.flags.contains(.Incoming) {
|
||||||
|
if canPerformEditingActions(limits: limitsConfiguration, accountPeerId: accountPeerId, message: message) {
|
||||||
|
optionsMap[id]!.insert(.deleteGlobally)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if let _ = peer as? TelegramSecretChat {
|
||||||
|
var isNonRemovableServiceAction = false
|
||||||
|
for media in message.media {
|
||||||
|
if let action = media as? TelegramMediaAction {
|
||||||
|
switch action.action {
|
||||||
|
case .historyScreenshot:
|
||||||
|
isNonRemovableServiceAction = true
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isNonRemovableServiceAction {
|
||||||
|
optionsMap[id]!.insert(.deleteGlobally)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
assertionFailure()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assertionFailure()
|
optionsMap[id]!.insert(.deleteLocally)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
optionsMap[id]!.insert(.deleteLocally)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,15 +511,20 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if messages.count == 1 {
|
if messages.count == 1 {
|
||||||
var subject: ShareControllerSubject = ShareControllerSubject.messages(messages)
|
var subject: ShareControllerSubject = ShareControllerSubject.messages(messages)
|
||||||
for m in messages[0].media {
|
for m in messages[0].media {
|
||||||
if let image = m as? TelegramMediaImage {
|
if let image = m as? TelegramMediaImage {
|
||||||
subject = .image(image.representations)
|
subject = .image(image.representations)
|
||||||
} else if let webpage = m as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content, let image = content.image {
|
} else if let webpage = m as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content {
|
||||||
subject = .media(.webPage(webPage: WebpageReference(webpage), media: image))
|
if let file = content.file {
|
||||||
preferredAction = .saveToCameraRoll
|
subject = .media(.webPage(webPage: WebpageReference(webpage), media: file))
|
||||||
|
preferredAction = .saveToCameraRoll
|
||||||
|
} else if let image = content.image {
|
||||||
|
subject = .media(.webPage(webPage: WebpageReference(webpage), media: image))
|
||||||
|
preferredAction = .saveToCameraRoll
|
||||||
|
}
|
||||||
} else if let file = m as? TelegramMediaFile {
|
} else if let file = m as? TelegramMediaFile {
|
||||||
subject = .media(.message(message: MessageReference(messages[0]), media: file))
|
subject = .media(.message(message: MessageReference(messages[0]), media: file))
|
||||||
if file.isAnimated {
|
if file.isAnimated {
|
||||||
|
@ -219,7 +219,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
|
|||||||
switch action {
|
switch action {
|
||||||
case let .url(url):
|
case let .url(url):
|
||||||
var cleanUrl = url
|
var cleanUrl = url
|
||||||
let canOpenIn = true
|
let canOpenIn = !availableOpenInOptions(applicationContext: strongSelf.account.telegramApplicationContext, item: .url(url: url)).isEmpty
|
||||||
var canAddToReadingList = true
|
var canAddToReadingList = true
|
||||||
let mailtoString = "mailto:"
|
let mailtoString = "mailto:"
|
||||||
let telString = "tel:"
|
let telString = "tel:"
|
||||||
|
@ -926,9 +926,6 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa
|
|||||||
var peers: [PeerId: Peer] = view.peers
|
var peers: [PeerId: Peer] = view.peers
|
||||||
var disabledPeerIds = state.removingParticipantIds
|
var disabledPeerIds = state.removingParticipantIds
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if !state.temporaryParticipants.isEmpty {
|
if !state.temporaryParticipants.isEmpty {
|
||||||
for participant in state.temporaryParticipants {
|
for participant in state.temporaryParticipants {
|
||||||
if !existingParticipantIds.contains(participant.peer.id) {
|
if !existingParticipantIds.contains(participant.peer.id) {
|
||||||
@ -1935,9 +1932,8 @@ func handlePeerInfoAboutTextAction(account: Account, peerId: PeerId, navigateDis
|
|||||||
case .longTap:
|
case .longTap:
|
||||||
switch itemLink {
|
switch itemLink {
|
||||||
case let .url(url):
|
case let .url(url):
|
||||||
let canOpenIn = true
|
let canOpenIn = !availableOpenInOptions(applicationContext: account.telegramApplicationContext, item: .url(url: url)).isEmpty
|
||||||
let openText = canOpenIn ? presentationData.strings.Conversation_FileOpenIn : presentationData.strings.Conversation_LinkDialogOpen
|
let openText = canOpenIn ? presentationData.strings.Conversation_FileOpenIn : presentationData.strings.Conversation_LinkDialogOpen
|
||||||
|
|
||||||
let actionSheet = ActionSheetController(presentationTheme: presentationData.theme)
|
let actionSheet = ActionSheetController(presentationTheme: presentationData.theme)
|
||||||
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
|
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
|
||||||
ActionSheetTextItem(title: url),
|
ActionSheetTextItem(title: url),
|
||||||
@ -1979,7 +1975,7 @@ func handlePeerInfoAboutTextAction(account: Account, peerId: PeerId, navigateDis
|
|||||||
})
|
})
|
||||||
])])
|
])])
|
||||||
controller.present(actionSheet, in: .window(.root))
|
controller.present(actionSheet, in: .window(.root))
|
||||||
case let .hashtag(peerName, hashtag):
|
case let .hashtag(_, hashtag):
|
||||||
let actionSheet = ActionSheetController(presentationTheme: presentationData.theme)
|
let actionSheet = ActionSheetController(presentationTheme: presentationData.theme)
|
||||||
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
|
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
|
||||||
ActionSheetTextItem(title: hashtag),
|
ActionSheetTextItem(title: hashtag),
|
||||||
|
@ -611,9 +611,8 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
}
|
}
|
||||||
case .longTap:
|
case .longTap:
|
||||||
if let url = self.urlForTapLocation(location) {
|
if let url = self.urlForTapLocation(location) {
|
||||||
let canOpenIn = true
|
let canOpenIn = !availableOpenInOptions(applicationContext: self.account.telegramApplicationContext, item: .url(url: url.url)).isEmpty
|
||||||
let openText = canOpenIn ? self.strings.Conversation_FileOpenIn : self.strings.Conversation_LinkDialogOpen
|
let openText = canOpenIn ? self.strings.Conversation_FileOpenIn : self.strings.Conversation_LinkDialogOpen
|
||||||
|
|
||||||
let actionSheet = ActionSheetController(presentationTheme: self.presentationTheme)
|
let actionSheet = ActionSheetController(presentationTheme: self.presentationTheme)
|
||||||
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
|
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
|
||||||
ActionSheetTextItem(title: url.url),
|
ActionSheetTextItem(title: url.url),
|
||||||
|
@ -190,9 +190,8 @@ public class PeerMediaCollectionController: TelegramController {
|
|||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
switch content {
|
switch content {
|
||||||
case let .url(url):
|
case let .url(url):
|
||||||
let canOpenIn = true
|
let canOpenIn = !availableOpenInOptions(applicationContext: strongSelf.account.telegramApplicationContext, item: .url(url: url)).isEmpty
|
||||||
let openText = canOpenIn ? strongSelf.presentationData.strings.Conversation_FileOpenIn : strongSelf.presentationData.strings.Conversation_LinkDialogOpen
|
let openText = canOpenIn ? strongSelf.presentationData.strings.Conversation_FileOpenIn : strongSelf.presentationData.strings.Conversation_LinkDialogOpen
|
||||||
|
|
||||||
let actionSheet = ActionSheetController(presentationTheme: strongSelf.presentationData.theme)
|
let actionSheet = ActionSheetController(presentationTheme: strongSelf.presentationData.theme)
|
||||||
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
|
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
|
||||||
ActionSheetTextItem(title: url),
|
ActionSheetTextItem(title: url),
|
||||||
|
@ -99,7 +99,14 @@ final class SecureIdAuthController: ViewController {
|
|||||||
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBar.style.style
|
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBar.style.style
|
||||||
|
|
||||||
self.title = self.presentationData.strings.Passport_Title
|
self.title = self.presentationData.strings.Passport_Title
|
||||||
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Cancel, style: .plain, target: self, action: #selector(self.cancelPressed))
|
let leftButtonTitle: String
|
||||||
|
switch mode {
|
||||||
|
case .form:
|
||||||
|
leftButtonTitle = self.presentationData.strings.Common_Cancel
|
||||||
|
case .list:
|
||||||
|
leftButtonTitle = self.presentationData.strings.Common_Done
|
||||||
|
}
|
||||||
|
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: leftButtonTitle, style: .plain, target: self, action: #selector(self.cancelPressed))
|
||||||
self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationInfoIcon(self.presentationData.theme), style: .plain, target: self, action: #selector(self.infoPressed))
|
self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationInfoIcon(self.presentationData.theme), style: .plain, target: self, action: #selector(self.infoPressed))
|
||||||
|
|
||||||
self.challengeDisposable.set((twoStepAuthData(account.network)
|
self.challengeDisposable.set((twoStepAuthData(account.network)
|
||||||
|
@ -352,6 +352,9 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode {
|
|||||||
case let .passwordChallenge(hint, challengeState, _):
|
case let .passwordChallenge(hint, challengeState, _):
|
||||||
if let current = self.contentNode as? SecureIdAuthPasswordOptionContentNode {
|
if let current = self.contentNode as? SecureIdAuthPasswordOptionContentNode {
|
||||||
current.updateIsChecking(challengeState == .checking)
|
current.updateIsChecking(challengeState == .checking)
|
||||||
|
if case .invalid = challengeState {
|
||||||
|
current.updateIsInvalid()
|
||||||
|
}
|
||||||
contentNode = current
|
contentNode = current
|
||||||
} else {
|
} else {
|
||||||
let current = SecureIdAuthPasswordOptionContentNode(theme: presentationData.theme, strings: presentationData.strings, hint: hint, checkPassword: { [weak self] password in
|
let current = SecureIdAuthPasswordOptionContentNode(theme: presentationData.theme, strings: presentationData.strings, hint: hint, checkPassword: { [weak self] password in
|
||||||
@ -360,6 +363,9 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode {
|
|||||||
self?.interaction.openPasswordHelp()
|
self?.interaction.openPasswordHelp()
|
||||||
})
|
})
|
||||||
current.updateIsChecking(challengeState == .checking)
|
current.updateIsChecking(challengeState == .checking)
|
||||||
|
if case .invalid = challengeState {
|
||||||
|
current.updateIsInvalid()
|
||||||
|
}
|
||||||
contentNode = current
|
contentNode = current
|
||||||
}
|
}
|
||||||
case .noChallenge:
|
case .noChallenge:
|
||||||
@ -582,7 +588,7 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode {
|
|||||||
}
|
}
|
||||||
} else if addressDetails {
|
} else if addressDetails {
|
||||||
self.interaction.present(SecureIdDocumentFormController(account: self.account, context: context, requestedData: .address(details: addressDetails, document: nil, translations: false), primaryLanguageByCountry: encryptedFormData.primaryLanguageByCountry, values: formData.values, updatedValues: { values in
|
self.interaction.present(SecureIdDocumentFormController(account: self.account, context: context, requestedData: .address(details: addressDetails, document: nil, translations: false), primaryLanguageByCountry: encryptedFormData.primaryLanguageByCountry, values: formData.values, updatedValues: { values in
|
||||||
updatedValues([.personalDetails], values)
|
updatedValues([.address], values)
|
||||||
}), nil)
|
}), nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -616,20 +622,20 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode {
|
|||||||
let controller = SecureIdDocumentFormController(account: strongSelf.account, context: context, requestedData: requestedData, primaryLanguageByCountry: encryptedFormData.primaryLanguageByCountry, values: formData.values, updatedValues: { values in
|
let controller = SecureIdDocumentFormController(account: strongSelf.account, context: context, requestedData: requestedData, primaryLanguageByCountry: encryptedFormData.primaryLanguageByCountry, values: formData.values, updatedValues: { values in
|
||||||
var keys: [SecureIdValueKey] = []
|
var keys: [SecureIdValueKey] = []
|
||||||
switch requestedData {
|
switch requestedData {
|
||||||
case let .identity(details, document, _, _):
|
case let .identity(details, document, _, _):
|
||||||
if details != nil {
|
if details != nil {
|
||||||
keys.append(.personalDetails)
|
keys.append(.personalDetails)
|
||||||
}
|
}
|
||||||
if let document = document {
|
if let document = document {
|
||||||
keys.append(document.valueKey)
|
keys.append(document.valueKey)
|
||||||
}
|
}
|
||||||
case let .address(details, document, _):
|
case let .address(details, document, _):
|
||||||
if details {
|
if details {
|
||||||
keys.append(.address)
|
keys.append(.address)
|
||||||
}
|
}
|
||||||
if let document = document {
|
if let document = document {
|
||||||
keys.append(document.valueKey)
|
keys.append(document.valueKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updatedValues(keys, values)
|
updatedValues(keys, values)
|
||||||
})
|
})
|
||||||
|
@ -697,8 +697,10 @@ private func fieldErrorText(field: SecureIdParsedRequestedFormField, values: [Se
|
|||||||
if let _ = personalDetails, let value = findValue(values, key: .personalDetails)?.1 {
|
if let _ = personalDetails, let value = findValue(values, key: .personalDetails)?.1 {
|
||||||
if let error = value.errors[.value(.personalDetails)] {
|
if let error = value.errors[.value(.personalDetails)] {
|
||||||
return error
|
return error
|
||||||
} else if let error = value.errors.first?.value {
|
} else if let error = value.errors.first {
|
||||||
return error
|
if case .value = error.key {} else {
|
||||||
|
return error.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let document = document {
|
if let document = document {
|
||||||
@ -731,8 +733,10 @@ private func fieldErrorText(field: SecureIdParsedRequestedFormField, values: [Se
|
|||||||
if addressDetails, let value = findValue(values, key: .address)?.1 {
|
if addressDetails, let value = findValue(values, key: .address)?.1 {
|
||||||
if let error = value.errors[.value(.address)] {
|
if let error = value.errors[.value(.address)] {
|
||||||
return error
|
return error
|
||||||
} else if let error = value.errors.first?.value {
|
} else if let error = value.errors.first {
|
||||||
return error
|
if case .value = error.key {} else {
|
||||||
|
return error.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let document = document {
|
if let document = document {
|
||||||
|
@ -925,35 +925,5 @@ final class SecureIdPlaintextFormControllerNode: FormControllerNode<SecureIdPlai
|
|||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteValue() {
|
|
||||||
guard var innerState = self.innerState, let previousValue = innerState.previousValue else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
guard case .none = innerState.actionState else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
innerState.actionState = .deleting
|
|
||||||
self.updateInnerState(transition: .immediate, with: innerState)
|
|
||||||
|
|
||||||
self.actionDisposable.set((deleteSecureIdValues(network: self.account.network, keys: Set([previousValue.key]))
|
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] result in
|
|
||||||
if let strongSelf = self {
|
|
||||||
strongSelf.completedWithValue?(nil)
|
|
||||||
}
|
|
||||||
}, error: { [weak self] error in
|
|
||||||
if let strongSelf = self {
|
|
||||||
guard var innerState = strongSelf.innerState else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
guard case .deleting = innerState.actionState else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
innerState.actionState = .none
|
|
||||||
strongSelf.updateInnerState(transition: .immediate, with: innerState)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ final class ShareSearchContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
recentItemList.append(.topPeers(theme, strings))
|
recentItemList.append(.topPeers(theme, strings))
|
||||||
var index = 0
|
var index = 0
|
||||||
for peer in recentPeers {
|
for peer in recentPeers {
|
||||||
if let mainPeer = peer.peers[peer.peerId] {
|
if let mainPeer = peer.peers[peer.peerId], canSendMessagesToPeer(mainPeer) {
|
||||||
recentItemList.append(.peer(index: index, theme: theme, peer: mainPeer, associatedPeer: mainPeer.associatedPeerId.flatMap { peer.peers[$0] }, strings))
|
recentItemList.append(.peer(index: index, theme: theme, peer: mainPeer, associatedPeer: mainPeer.associatedPeerId.flatMap { peer.peers[$0] }, strings))
|
||||||
index += 1
|
index += 1
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user