mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Folder improvements
This commit is contained in:
parent
705651e028
commit
0e3fbeb08b
@ -2751,19 +2751,25 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
}
|
||||
|
||||
if case let .filter(_, title, _, data) = filter, data.isShared {
|
||||
let _ = (self.context.engine.data.get(
|
||||
let _ = (combineLatest(
|
||||
self.context.engine.data.get(
|
||||
EngineDataList(data.includePeers.peers.map(TelegramEngine.EngineData.Item.Peer.Peer.init(id:)))
|
||||
),
|
||||
self.context.engine.peers.getExportedChatFolderLinks(id: id)
|
||||
)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] peers in
|
||||
|> deliverOnMainQueue).start(next: { [weak self] peers, links in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
|
||||
let presentationData = self.presentationData
|
||||
|
||||
//TODO:localize
|
||||
self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: "Delete Folder", text: "Are you sure you want to delete this folder? This will also deactivate all the invite links used to share this folder.", actions: [
|
||||
TextAlertAction(type: .destructiveAction, title: presentationData.strings.Common_Delete, action: { [weak self] in
|
||||
var hasLinks = false
|
||||
if let links, !links.isEmpty {
|
||||
hasLinks = true
|
||||
}
|
||||
|
||||
let confirmDeleteFolder: () -> Void = { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
@ -2794,10 +2800,20 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
}
|
||||
)
|
||||
self.push(previewScreen)
|
||||
}
|
||||
|
||||
if hasLinks {
|
||||
//TODO:localize
|
||||
self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: "Delete Folder", text: "Are you sure you want to delete this folder? This will also deactivate all the invite links used to share this folder.", actions: [
|
||||
TextAlertAction(type: .destructiveAction, title: presentationData.strings.Common_Delete, action: {
|
||||
confirmDeleteFolder()
|
||||
}),
|
||||
TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {
|
||||
})
|
||||
]), in: .window(.root))
|
||||
} else {
|
||||
confirmDeleteFolder()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
let actionSheet = ActionSheetController(presentationData: self.presentationData)
|
||||
|
@ -391,15 +391,21 @@ public func chatListFilterPresetListController(context: AccountContext, mode: Ch
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
if case let .filter(_, title, _, data) = filter, data.isShared {
|
||||
let _ = (context.engine.data.get(
|
||||
let _ = (combineLatest(
|
||||
context.engine.data.get(
|
||||
EngineDataList(data.includePeers.peers.map(TelegramEngine.EngineData.Item.Peer.Peer.init(id:)))
|
||||
),
|
||||
context.engine.peers.getExportedChatFolderLinks(id: id)
|
||||
)
|
||||
|> deliverOnMainQueue).start(next: { peers in
|
||||
|> deliverOnMainQueue).start(next: { peers, links in
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
//TODO:localize
|
||||
presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: "Delete Folder", text: "Are you sure you want to delete this folder? This will also deactivate all the invite links used to share this folder.", actions: [
|
||||
TextAlertAction(type: .destructiveAction, title: presentationData.strings.Common_Delete, action: {
|
||||
var hasLinks = false
|
||||
if let links, !links.isEmpty {
|
||||
hasLinks = true
|
||||
}
|
||||
|
||||
let confirmDeleteFolder: () -> Void = {
|
||||
let previewScreen = ChatFolderLinkPreviewScreen(
|
||||
context: context,
|
||||
subject: .remove(folderId: id),
|
||||
@ -417,10 +423,20 @@ public func chatListFilterPresetListController(context: AccountContext, mode: Ch
|
||||
)
|
||||
)
|
||||
pushControllerImpl?(previewScreen)
|
||||
}
|
||||
|
||||
if hasLinks {
|
||||
//TODO:localize
|
||||
presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: "Delete Folder", text: "Are you sure you want to delete this folder? This will also deactivate all the invite links used to share this folder.", actions: [
|
||||
TextAlertAction(type: .destructiveAction, title: presentationData.strings.Common_Delete, action: {
|
||||
confirmDeleteFolder()
|
||||
}),
|
||||
TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {
|
||||
})
|
||||
]))
|
||||
} else {
|
||||
confirmDeleteFolder()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
let actionSheet = ActionSheetController(presentationData: presentationData)
|
||||
|
@ -840,6 +840,9 @@ public final class SolidRoundedButtonNode: ASDisplayNode {
|
||||
self.subtitleNode.alpha = 0.0
|
||||
self.subtitleNode.layer.animateAlpha(from: 0.55, to: 0.0, duration: 0.2)
|
||||
|
||||
self.badgeNode?.alpha = 0.0
|
||||
self.badgeNode?.layer.animateAlpha(from: 0.55, to: 0.0, duration: 0.2)
|
||||
|
||||
self.shimmerView?.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
||||
self.borderShimmerView?.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
||||
}
|
||||
@ -873,6 +876,9 @@ public final class SolidRoundedButtonNode: ASDisplayNode {
|
||||
self.subtitleNode.alpha = 1.0
|
||||
self.subtitleNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
|
||||
self.badgeNode?.alpha = 1.0
|
||||
self.badgeNode?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
|
||||
self.shimmerView?.layer.removeAllAnimations()
|
||||
self.shimmerView?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
self.borderShimmerView?.layer.removeAllAnimations()
|
||||
@ -1282,6 +1288,9 @@ public final class SolidRoundedButtonView: UIView {
|
||||
self.subtitleNode.alpha = 0.0
|
||||
self.subtitleNode.layer.animateAlpha(from: 0.55, to: 0.0, duration: 0.2)
|
||||
|
||||
self.badgeNode?.alpha = 0.0
|
||||
self.badgeNode?.layer.animateAlpha(from: 0.55, to: 0.0, duration: 0.2)
|
||||
|
||||
self.shimmerView?.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
||||
self.borderShimmerView?.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
||||
}
|
||||
@ -1315,6 +1324,9 @@ public final class SolidRoundedButtonView: UIView {
|
||||
self.subtitleNode.alpha = 1.0
|
||||
self.subtitleNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
|
||||
self.badgeNode?.alpha = 1.0
|
||||
self.badgeNode?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
|
||||
self.shimmerView?.layer.removeAllAnimations()
|
||||
self.shimmerView?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
self.borderShimmerView?.layer.removeAllAnimations()
|
||||
@ -1475,6 +1487,7 @@ public final class SolidRoundedButtonView: UIView {
|
||||
badgeNode = current
|
||||
} else {
|
||||
badgeNode = BadgeNode(fillColor: self.theme.foregroundColor, strokeColor: .clear, textColor: self.theme.backgroundColor)
|
||||
badgeNode.alpha = self.titleNode.alpha
|
||||
self.badgeNode = badgeNode
|
||||
self.addSubnode(badgeNode)
|
||||
}
|
||||
|
@ -12,6 +12,10 @@ public func canShareLinkToPeer(peer: EnginePeer) -> Bool {
|
||||
} else if channel.username != nil {
|
||||
isEnabled = true
|
||||
}
|
||||
case let .legacyGroup(group):
|
||||
if !group.hasBannedPermission(.banAddMembers) {
|
||||
isEnabled = true
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user