mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Add stories count limit tooltip
This commit is contained in:
parent
61c795b95b
commit
a9f4258c3e
@ -2535,9 +2535,28 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func openStoryCamera(fromList: Bool) {
|
fileprivate func openStoryCamera(fromList: Bool) {
|
||||||
|
var reachedCountLimit = false
|
||||||
|
var premiumNeeded = false
|
||||||
|
|
||||||
|
let storiesCountLimit = self.context.userLimits.maxExpiringStoriesCount
|
||||||
|
if let rawStorySubscriptions = self.rawStorySubscriptions, let accountItem = rawStorySubscriptions.accountItem {
|
||||||
|
if accountItem.storyCount >= self.context.userLimits.maxExpiringStoriesCount {
|
||||||
|
reachedCountLimit = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch self.storyPostingAvailability {
|
switch self.storyPostingAvailability {
|
||||||
case .premium:
|
case .premium:
|
||||||
guard self.isPremium else {
|
if !self.isPremium {
|
||||||
|
premiumNeeded = true
|
||||||
|
}
|
||||||
|
case .disabled:
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if reachedCountLimit || premiumNeeded {
|
||||||
if let componentView = self.chatListHeaderView() {
|
if let componentView = self.chatListHeaderView() {
|
||||||
var sourceFrame: CGRect?
|
var sourceFrame: CGRect?
|
||||||
if fromList {
|
if fromList {
|
||||||
@ -2552,11 +2571,21 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
if let sourceFrame {
|
if let sourceFrame {
|
||||||
let context = self.context
|
let context = self.context
|
||||||
let location = CGRect(origin: CGPoint(x: sourceFrame.midX, y: sourceFrame.maxY), size: CGSize())
|
let location = CGRect(origin: CGPoint(x: sourceFrame.midX, y: sourceFrame.maxY), size: CGSize())
|
||||||
|
|
||||||
|
let text: String
|
||||||
|
if premiumNeeded {
|
||||||
|
text = "Posting stories is currently available only\nto subscribers of [Telegram Premium]()."
|
||||||
|
} else if reachedCountLimit {
|
||||||
|
text = "You can't post more than **\(storiesCountLimit)** stories in **24 hours**."
|
||||||
|
} else {
|
||||||
|
text = ""
|
||||||
|
}
|
||||||
|
|
||||||
let tooltipController = TooltipScreen(
|
let tooltipController = TooltipScreen(
|
||||||
context: context,
|
context: context,
|
||||||
account: context.account,
|
account: context.account,
|
||||||
sharedContext: context.sharedContext,
|
sharedContext: context.sharedContext,
|
||||||
text: .markdown(text: "Posting stories is currently available only\nto subscribers of [Telegram Premium]()."),
|
text: .markdown(text: text),
|
||||||
style: .customBlur(UIColor(rgb: 0x2a2a2a), 2.0),
|
style: .customBlur(UIColor(rgb: 0x2a2a2a), 2.0),
|
||||||
icon: .none,
|
icon: .none,
|
||||||
location: .point(location, .top),
|
location: .point(location, .top),
|
||||||
@ -2575,11 +2604,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case .disabled:
|
|
||||||
return
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
var cameraTransitionIn: StoryCameraTransitionIn?
|
var cameraTransitionIn: StoryCameraTransitionIn?
|
||||||
if let componentView = self.chatListHeaderView() {
|
if let componentView = self.chatListHeaderView() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user