Fix error

This commit is contained in:
Ali 2023-03-30 21:02:34 +04:00
parent 0e3fbeb08b
commit 075fde12f7
2 changed files with 15 additions and 11 deletions

View File

@ -1575,15 +1575,18 @@ func openCreateChatListFolderLink(context: AccountContext, folderId: Int32, chec
switch error {
case .generic:
text = "An error occurred"
case let .limitExceeded(limit, premiumLimit):
if limit < premiumLimit {
let limitController = context.sharedContext.makePremiumLimitController(context: context, subject: .linksPerSharedFolder, count: limit, action: {
})
pushController(limitController)
return
}
text = "You can't create more links."
case let .sharedFolderLimitExceeded(limit, _):
let limitController = context.sharedContext.makePremiumLimitController(context: context, subject: .membershipInSharedFolders, count: limit, action: {
})
pushController(limitController)
return
case let .limitExceeded(limit, _):
let limitController = context.sharedContext.makePremiumLimitController(context: context, subject: .linksPerSharedFolder, count: limit, action: {
})
pushController(limitController)
return
}
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
presentController(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]))

View File

@ -24,6 +24,7 @@ public func canShareLinkToPeer(peer: EnginePeer) -> Bool {
public enum ExportChatFolderError {
case generic
case sharedFolderLimitExceeded(limit: Int32, premiumLimit: Int32)
case limitExceeded(limit: Int32, premiumLimit: Int32)
}
@ -75,9 +76,9 @@ func _internal_exportChatFolder(account: Account, filterId: Int32, title: String
if error.errorDescription == "COMMUNITIES_TOO_MUCH" {
if isPremium {
return .fail(.limitExceeded(limit: userPremiumLimits.maxSharedFolderJoin, premiumLimit: userPremiumLimits.maxSharedFolderJoin))
return .fail(.sharedFolderLimitExceeded(limit: userPremiumLimits.maxSharedFolderJoin, premiumLimit: userPremiumLimits.maxSharedFolderJoin))
} else {
return .fail(.limitExceeded(limit: userDefaultLimits.maxSharedFolderJoin, premiumLimit: userPremiumLimits.maxSharedFolderJoin))
return .fail(.sharedFolderLimitExceeded(limit: userDefaultLimits.maxSharedFolderJoin, premiumLimit: userPremiumLimits.maxSharedFolderJoin))
}
} else {
if isPremium {