mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
5229c1666c
commit
14627e2986
@ -7533,3 +7533,6 @@ Sorry for the inconvenience.";
|
|||||||
"StickerPack.PremiumStickers_any" = "+%@ PREMIUM STICKERS";
|
"StickerPack.PremiumStickers_any" = "+%@ PREMIUM STICKERS";
|
||||||
|
|
||||||
"Stickers.PremiumStickers" = "Premium Stickers";
|
"Stickers.PremiumStickers" = "Premium Stickers";
|
||||||
|
|
||||||
|
"Channel.AddUserKickedError" = "Sorry, you can't add this user because they are on the list of Removed Users and you can't unban them.";
|
||||||
|
"Channel.AddAdminKickedError" = "Sorry, you can't add this user as an admin because they are in the Removed Users list and you can't unban them.";
|
||||||
|
@ -1217,7 +1217,7 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
|
|||||||
|
|
||||||
strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.Checkout_LiabilityAlertTitle, text: paymentText, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: { }), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {
|
strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.Checkout_LiabilityAlertTitle, text: paymentText, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: { }), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let _ = ApplicationSpecificNotice.setBotPaymentLiability(accountManager: strongSelf.context.sharedContext.accountManager, peerId: strongSelf.messageId.peerId).start()
|
let _ = ApplicationSpecificNotice.setBotPaymentLiability(accountManager: strongSelf.context.sharedContext.accountManager, peerId: paymentForm.paymentBotId).start()
|
||||||
strongSelf.pay(savedCredentialsToken: savedCredentialsToken, liabilityNoticeAccepted: true)
|
strongSelf.pay(savedCredentialsToken: savedCredentialsToken, liabilityNoticeAccepted: true)
|
||||||
}
|
}
|
||||||
})]), nil)
|
})]), nil)
|
||||||
|
@ -2327,7 +2327,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
strongSelf.chatListDisplayNode.containerNode.updateState({ state in
|
strongSelf.chatListDisplayNode.containerNode.updateState(onlyCurrent: false, { state in
|
||||||
var state = state
|
var state = state
|
||||||
for peerId in peerIds {
|
for peerId in peerIds {
|
||||||
state.pendingRemovalPeerIds.insert(peerId)
|
state.pendingRemovalPeerIds.insert(peerId)
|
||||||
@ -2365,7 +2365,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
let _ = (signal
|
let _ = (signal
|
||||||
|> deliverOnMainQueue).start()
|
|> deliverOnMainQueue).start()
|
||||||
|
|
||||||
strongSelf.chatListDisplayNode.containerNode.updateState({ state in
|
strongSelf.chatListDisplayNode.containerNode.updateState(onlyCurrent: false, { state in
|
||||||
var state = state
|
var state = state
|
||||||
for peerId in peerIds {
|
for peerId in peerIds {
|
||||||
state.selectedPeerIds.remove(peerId)
|
state.selectedPeerIds.remove(peerId)
|
||||||
@ -2376,7 +2376,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
return true
|
return true
|
||||||
} else if value == .undo {
|
} else if value == .undo {
|
||||||
strongSelf.chatListDisplayNode.containerNode.currentItemNode.setCurrentRemovingPeerId(peerIds.first!)
|
strongSelf.chatListDisplayNode.containerNode.currentItemNode.setCurrentRemovingPeerId(peerIds.first!)
|
||||||
strongSelf.chatListDisplayNode.containerNode.updateState({ state in
|
strongSelf.chatListDisplayNode.containerNode.updateState(onlyCurrent: false, { state in
|
||||||
var state = state
|
var state = state
|
||||||
for peerId in peerIds {
|
for peerId in peerIds {
|
||||||
state.pendingRemovalPeerIds.remove(peerId)
|
state.pendingRemovalPeerIds.remove(peerId)
|
||||||
|
@ -778,17 +778,21 @@ final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateState(_ f: (ChatListNodeState) -> ChatListNodeState) {
|
func updateState(onlyCurrent: Bool = true, _ f: (ChatListNodeState) -> ChatListNodeState) {
|
||||||
self.currentItemNode.updateState(f)
|
self.currentItemNode.updateState(f)
|
||||||
let updatedState = self.currentItemNode.currentState
|
let updatedState = self.currentItemNode.currentState
|
||||||
for (id, itemNode) in self.itemNodes {
|
for (id, itemNode) in self.itemNodes {
|
||||||
if id != self.selectedId {
|
if id != self.selectedId {
|
||||||
|
if onlyCurrent {
|
||||||
itemNode.listNode.updateState { state in
|
itemNode.listNode.updateState { state in
|
||||||
var state = state
|
var state = state
|
||||||
state.editing = updatedState.editing
|
state.editing = updatedState.editing
|
||||||
state.selectedPeerIds = updatedState.selectedPeerIds
|
state.selectedPeerIds = updatedState.selectedPeerIds
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
itemNode.listNode.updateState(f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1313,6 +1313,8 @@ public func channelAdminController(context: AccountContext, updatedPresentationD
|
|||||||
text = presentationData.strings.Privacy_GroupsAndChannels_InviteToGroupError(EnginePeer(admin).compactDisplayTitle, EnginePeer(admin).compactDisplayTitle).string
|
text = presentationData.strings.Privacy_GroupsAndChannels_InviteToGroupError(EnginePeer(admin).compactDisplayTitle, EnginePeer(admin).compactDisplayTitle).string
|
||||||
} else if case .tooMuchJoined = error {
|
} else if case .tooMuchJoined = error {
|
||||||
text = presentationData.strings.Invite_ChannelsTooMuch
|
text = presentationData.strings.Invite_ChannelsTooMuch
|
||||||
|
} else if case .kicked = error {
|
||||||
|
text = presentationData.strings.Channel_AddAdminKickedError
|
||||||
}
|
}
|
||||||
presentControllerImpl?(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
|
presentControllerImpl?(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
|
||||||
} else if case .adminsTooMuch = error {
|
} else if case .adminsTooMuch = error {
|
||||||
|
@ -479,6 +479,8 @@ public func channelMembersController(context: AccountContext, updatedPresentatio
|
|||||||
text = presentationData.strings.Channel_BotDoesntSupportGroups
|
text = presentationData.strings.Channel_BotDoesntSupportGroups
|
||||||
case .tooMuchBots:
|
case .tooMuchBots:
|
||||||
text = presentationData.strings.Channel_TooMuchBots
|
text = presentationData.strings.Channel_TooMuchBots
|
||||||
|
case .kicked:
|
||||||
|
text = presentationData.strings.Channel_AddUserKickedError
|
||||||
}
|
}
|
||||||
presentControllerImpl?(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
|
presentControllerImpl?(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
|
||||||
contactsController?.dismiss()
|
contactsController?.dismiss()
|
||||||
|
@ -1346,6 +1346,8 @@ public final class VoiceChatControllerImpl: ViewController, VoiceChatController
|
|||||||
text = presentationData.strings.Channel_TooMuchBots
|
text = presentationData.strings.Channel_TooMuchBots
|
||||||
case .bot:
|
case .bot:
|
||||||
text = presentationData.strings.Login_UnknownError
|
text = presentationData.strings.Login_UnknownError
|
||||||
|
case .kicked:
|
||||||
|
text = presentationData.strings.Channel_AddUserKickedError
|
||||||
}
|
}
|
||||||
strongSelf.controller?.present(textAlertController(context: strongSelf.context, forceTheme: strongSelf.darkTheme, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
strongSelf.controller?.present(textAlertController(context: strongSelf.context, forceTheme: strongSelf.darkTheme, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||||
}, completed: {
|
}, completed: {
|
||||||
|
@ -76,6 +76,7 @@ public enum AddChannelMemberError {
|
|||||||
case bot(PeerId)
|
case bot(PeerId)
|
||||||
case botDoesntSupportGroups
|
case botDoesntSupportGroups
|
||||||
case tooMuchBots
|
case tooMuchBots
|
||||||
|
case kicked
|
||||||
}
|
}
|
||||||
|
|
||||||
func _internal_addChannelMember(account: Account, peerId: PeerId, memberId: PeerId) -> Signal<(ChannelParticipant?, RenderedChannelParticipant), AddChannelMemberError> {
|
func _internal_addChannelMember(account: Account, peerId: PeerId, memberId: PeerId) -> Signal<(ChannelParticipant?, RenderedChannelParticipant), AddChannelMemberError> {
|
||||||
@ -110,6 +111,8 @@ func _internal_addChannelMember(account: Account, peerId: PeerId, memberId: Peer
|
|||||||
return .fail(.botDoesntSupportGroups)
|
return .fail(.botDoesntSupportGroups)
|
||||||
case "BOTS_TOO_MUCH":
|
case "BOTS_TOO_MUCH":
|
||||||
return .fail(.tooMuchBots)
|
return .fail(.tooMuchBots)
|
||||||
|
case "USER_KICKED":
|
||||||
|
return .fail(.kicked)
|
||||||
default:
|
default:
|
||||||
return .fail(.generic)
|
return .fail(.generic)
|
||||||
}
|
}
|
||||||
@ -204,6 +207,8 @@ func _internal_addChannelMembers(account: Account, peerId: PeerId, memberIds: [P
|
|||||||
return .notMutualContact
|
return .notMutualContact
|
||||||
case "USERS_TOO_MUCH":
|
case "USERS_TOO_MUCH":
|
||||||
return .limitExceeded
|
return .limitExceeded
|
||||||
|
case "USER_KICKED":
|
||||||
|
return .kicked
|
||||||
default:
|
default:
|
||||||
return .generic
|
return .generic
|
||||||
}
|
}
|
||||||
|
@ -8541,14 +8541,58 @@ func presentAddMembers(context: AccountContext, updatedPresentationData: (initia
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let addMember: (ContactListPeer) -> Signal<Void, NoError> = { memberPeer -> Signal<Void, NoError> in
|
let addMember: (ContactListPeer) -> Signal<Void, NoError> = { [weak contactsController] memberPeer -> Signal<Void, NoError> in
|
||||||
if case let .peer(selectedPeer, _, _) = memberPeer {
|
if case let .peer(selectedPeer, _, _) = memberPeer {
|
||||||
let memberId = selectedPeer.id
|
let memberId = selectedPeer.id
|
||||||
if groupPeer.id.namespace == Namespaces.Peer.CloudChannel {
|
if groupPeer.id.namespace == Namespaces.Peer.CloudChannel {
|
||||||
return context.peerChannelMemberCategoriesContextsManager.addMember(engine: context.engine, peerId: groupPeer.id, memberId: memberId)
|
return context.peerChannelMemberCategoriesContextsManager.addMember(engine: context.engine, peerId: groupPeer.id, memberId: memberId)
|
||||||
|> map { _ -> Void in
|
|> map { _ -> Void in
|
||||||
}
|
}
|
||||||
|> `catch` { _ -> Signal<Void, NoError> in
|
|> `catch` { error -> Signal<Void, NoError> in
|
||||||
|
let text: String
|
||||||
|
switch error {
|
||||||
|
case .limitExceeded:
|
||||||
|
text = presentationData.strings.Channel_ErrorAddTooMuch
|
||||||
|
case .tooMuchJoined:
|
||||||
|
text = presentationData.strings.Invite_ChannelsTooMuch
|
||||||
|
case .generic:
|
||||||
|
text = presentationData.strings.Login_UnknownError
|
||||||
|
case .restricted:
|
||||||
|
text = presentationData.strings.Channel_ErrorAddBlocked
|
||||||
|
case .notMutualContact:
|
||||||
|
if let peer = groupPeer as? TelegramChannel, case .broadcast = peer.info {
|
||||||
|
text = presentationData.strings.Channel_AddUserLeftError
|
||||||
|
} else {
|
||||||
|
text = presentationData.strings.GroupInfo_AddUserLeftError
|
||||||
|
}
|
||||||
|
case let .bot(memberId):
|
||||||
|
guard let peer = groupPeer as? TelegramChannel else {
|
||||||
|
parentController?.present(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||||
|
contactsController?.dismiss()
|
||||||
|
return .complete()
|
||||||
|
}
|
||||||
|
|
||||||
|
if peer.hasPermission(.addAdmins) {
|
||||||
|
parentController?.present(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: presentationData.strings.Channel_AddBotErrorHaveRights, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Channel_AddBotAsAdmin, action: {
|
||||||
|
contactsController?.dismiss()
|
||||||
|
|
||||||
|
parentController?.push(channelAdminController(context: context, updatedPresentationData: updatedPresentationData, peerId: groupPeer.id, adminId: memberId, initialParticipant: nil, updated: { _ in
|
||||||
|
}, upgradedToSupergroup: { _, f in f () }, transferedOwnership: { _ in }))
|
||||||
|
})]), in: .window(.root))
|
||||||
|
} else {
|
||||||
|
parentController?.present(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: presentationData.strings.Channel_AddBotErrorHaveRights, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||||
|
}
|
||||||
|
|
||||||
|
contactsController?.dismiss()
|
||||||
|
return .complete()
|
||||||
|
case .botDoesntSupportGroups:
|
||||||
|
text = presentationData.strings.Channel_BotDoesntSupportGroups
|
||||||
|
case .tooMuchBots:
|
||||||
|
text = presentationData.strings.Channel_TooMuchBots
|
||||||
|
case .kicked:
|
||||||
|
text = presentationData.strings.Channel_AddUserKickedError
|
||||||
|
}
|
||||||
|
parentController?.present(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: text, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||||
return .complete()
|
return .complete()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -8702,6 +8746,8 @@ func presentAddMembers(context: AccountContext, updatedPresentationData: (initia
|
|||||||
parentController?.present(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: text, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
parentController?.present(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: text, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||||
} else if case .tooMuchJoined = error {
|
} else if case .tooMuchJoined = error {
|
||||||
parentController?.present(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: presentationData.strings.Invite_ChannelsTooMuch, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
parentController?.present(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: presentationData.strings.Invite_ChannelsTooMuch, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||||
|
} else if peers.count == 1, case .kicked = error {
|
||||||
|
parentController?.present(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: presentationData.strings.Channel_AddUserKickedError, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||||
}
|
}
|
||||||
|
|
||||||
contactsController?.dismiss()
|
contactsController?.dismiss()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user