Merge branch 'beta'

This commit is contained in:
Ali 2019-12-19 00:46:19 +04:00
commit f9529bc7d1
9 changed files with 2435 additions and 2423 deletions

View File

@ -5206,7 +5206,8 @@ Any member of this group will be able to see messages in the channel.";
"OldChannels.NoticeCreateText" = "Sorry, you are member of too many groups and channels.\nPlease leave some before creating a new one.";
"OldChannels.NoticeUpgradeText" = "Sorry, you are a member of too many groups and channels.\nFor technical reasons, you need to leave some first before changing this setting in your groups.";
"OldChannels.ChannelsHeader" = "MOST INACTIVE";
"OldChannels.Leave" = "Leave";
"OldChannels.Leave_1" = "Leave %@ Chat";
"OldChannels.Leave_any" = "Leave %@ Chats";
"OldChannels.ChannelFormat" = "channel, ";
"OldChannels.GroupEmptyFormat" = "group, ";

View File

@ -867,14 +867,9 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
existingPeerIds.removeAll()
let localExpandType: ChatListSearchSectionExpandType
let localExpandType: ChatListSearchSectionExpandType = .none
let globalExpandType: ChatListSearchSectionExpandType
if totalNumberOfLocalPeers > 5 {
localExpandType = searchState.expandLocalSearch ? .collapse : .expand
} else {
localExpandType = .none
}
if totalNumberOfGlobalPeers > 5 {
if totalNumberOfGlobalPeers > 3 {
globalExpandType = searchState.expandGlobalSearch ? .collapse : .expand
} else {
globalExpandType = .none
@ -925,7 +920,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
var numberOfGlobalPeers = 0
index = 0
for peer in foundRemotePeers.1 {
if case .expand = globalExpandType, numberOfGlobalPeers >= 5 {
if case .expand = globalExpandType, numberOfGlobalPeers >= 3 {
break
}

View File

@ -1148,6 +1148,10 @@ public func channelAdminController(context: AccountContext, peerId: PeerId, admi
})
}
}, error: { error in
updateState { current in
return current.withUpdatedUpdating(false)
}
if case let .addMemberError(error) = error {
var text = presentationData.strings.Login_UnknownError
if case .restricted = error, let admin = adminView.peers[adminView.peerId] {

View File

@ -732,6 +732,14 @@ public func channelPermissionsController(context: AccountContext, peerId origina
|> mapError { error -> UpdateChannelSlowModeError in
switch error {
case .tooManyChannels:
Queue.mainQueue().async {
updateState { state in
var state = state
state.modifiedSlowmodeTimeout = nil
return state
}
resetSlowmodeVisualValueImpl?()
}
return .tooManyChannels
default:
return .generic
@ -753,12 +761,6 @@ public func channelPermissionsController(context: AccountContext, peerId origina
progress?.dismiss()
}, error: { [weak progress] error in
progress?.dismiss()
updateState { state in
var state = state
state.modifiedSlowmodeTimeout = nil
return state
}
resetSlowmodeVisualValueImpl?()
switch error {
case .tooManyChannels:

View File

@ -212,12 +212,12 @@ private func oldChannelsEntries(presentationData: PresentationData, state: OldCh
private final class OldChannelsActionPanelNode: ASDisplayNode {
private let separatorNode: ASDisplayNode
private let buttonNode: SolidRoundedButtonNode
let buttonNode: SolidRoundedButtonNode
init(presentationData: ItemListPresentationData, leaveAction: @escaping () -> Void) {
self.separatorNode = ASDisplayNode()
self.separatorNode.backgroundColor = presentationData.theme.rootController.navigationBar.separatorColor
self.buttonNode = SolidRoundedButtonNode(title: presentationData.strings.OldChannels_Leave, icon: nil, theme: SolidRoundedButtonTheme(theme: presentationData.theme), height: 50.0, cornerRadius: 10.0, gloss: false)
self.buttonNode = SolidRoundedButtonNode(title: "", icon: nil, theme: SolidRoundedButtonTheme(theme: presentationData.theme), height: 50.0, cornerRadius: 10.0, gloss: false)
super.init()
@ -258,11 +258,14 @@ private final class OldChannelsControllerImpl: ItemListController {
private var displayPanel: Bool = false
private var validLayout: ContainerViewLayout?
private var presentationData: ItemListPresentationData
private var presentationDataDisposable: Disposable?
var leaveAction: (() -> Void)?
override init<ItemGenerationArguments>(presentationData: ItemListPresentationData, updatedPresentationData: Signal<ItemListPresentationData, NoError>, state: Signal<(ItemListControllerState, (ItemListNodeState, ItemGenerationArguments)), NoError>, tabBarItem: Signal<ItemListControllerTabBarItem, NoError>?) {
self.presentationData = presentationData
var leaveActionImpl: (() -> Void)?
self.panelNode = OldChannelsActionPanelNode(presentationData: presentationData, leaveAction: {
leaveActionImpl?()
@ -275,6 +278,7 @@ private final class OldChannelsControllerImpl: ItemListController {
guard let strongSelf = self else {
return
}
strongSelf.presentationData = presentationData
strongSelf.panelNode.updatePresentationData(presentationData)
})
@ -316,9 +320,11 @@ private final class OldChannelsControllerImpl: ItemListController {
transition.updateFrame(node: self.panelNode, frame: CGRect(origin: CGPoint(x: 0.0, y: self.displayPanel ? (layout.size.height - panelHeight) : layout.size.height), size: CGSize(width: layout.size.width, height: panelHeight)), beginWithCurrentState: true)
}
func updateDisplayPanel(_ value: Bool) {
if self.displayPanel != value {
self.displayPanel = value
func updatePanelPeerCount(_ value: Int) {
self.panelNode.buttonNode.title = self.presentationData.strings.OldChannels_Leave(Int32(value))
if self.displayPanel != (value != 0) {
self.displayPanel = (value != 0)
if let layout = self.validLayout {
self.containerLayoutUpdated(layout, transition: .animated(duration: 0.3, curve: .spring))
}
@ -340,7 +346,7 @@ public func oldChannelsController(context: AccountContext, intent: OldChannelsCo
statePromise.set(stateValue.modify { f($0) })
}
var updateHasSelectedPeersImpl: ((Bool) -> Void)?
var updateSelectedPeersImpl: ((Int) -> Void)?
var dismissImpl: (() -> Void)?
var setDisplayNavigationBarImpl: ((Bool) -> Void)?
@ -352,7 +358,7 @@ public func oldChannelsController(context: AccountContext, intent: OldChannelsCo
let arguments = OldChannelsItemArguments(
context: context,
togglePeer: { peerId, ensureVisible in
var hasSelectedPeers = false
var selectedPeerCount = 0
var didSelect = false
updateState { state in
var state = state
@ -362,10 +368,10 @@ public func oldChannelsController(context: AccountContext, intent: OldChannelsCo
state.selectedPeers.insert(peerId)
didSelect = true
}
hasSelectedPeers = !state.selectedPeers.isEmpty
selectedPeerCount = state.selectedPeers.count
return state
}
updateHasSelectedPeersImpl?(hasSelectedPeers)
updateSelectedPeersImpl?(selectedPeerCount)
if didSelect && ensureVisible {
ensurePeerVisibleImpl?(peerId)
}
@ -441,8 +447,8 @@ public func oldChannelsController(context: AccountContext, intent: OldChannelsCo
let controller = OldChannelsControllerImpl(context: context, state: signal)
controller.navigationPresentation = .modal
updateHasSelectedPeersImpl = { [weak controller] value in
controller?.updateDisplayPanel(value)
updateSelectedPeersImpl = { [weak controller] value in
controller?.updatePanelPeerCount(value)
}
controller.leaveAction = {

View File

@ -448,12 +448,12 @@ public final class WalletStrings: Equatable {
public var Wallet_SecureStorageReset_Title: String { return self._s[218]! }
public var Wallet_Receive_CommentHeader: String { return self._s[219]! }
public var Wallet_Info_ReceiveGrams: String { return self._s[220]! }
public func Wallet_Updated_MinutesAgo(_ value: Int32) -> String {
public func Wallet_Updated_HoursAgo(_ value: Int32) -> String {
let form = getPluralizationForm(self.lc, value)
let stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
return String(format: self._ps[0 * 6 + Int(form.rawValue)]!, stringValue)
}
public func Wallet_Updated_HoursAgo(_ value: Int32) -> String {
public func Wallet_Updated_MinutesAgo(_ value: Int32) -> String {
let form = getPluralizationForm(self.lc, value)
let stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
return String(format: self._ps[1 * 6 + Int(form.rawValue)]!, stringValue)