mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-26 14:01:24 +00:00
Various fixes
This commit is contained in:
@@ -772,7 +772,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
}
|
||||
self.avatarNode.setPeer(context: item.context, theme: item.presentationData.theme, peer: peer, overrideImage: overrideImage, emptyColor: item.presentationData.theme.list.mediaPlaceholderColor, synchronousLoad: synchronousLoads, displayDimensions: CGSize(width: 60.0, height: 60.0))
|
||||
|
||||
if peer.isPremium {
|
||||
if peer.isPremium && peer.id != item.context.account.peerId {
|
||||
let context = item.context
|
||||
self.cachedDataDisposable.set((context.account.postbox.peerView(id: peer.id)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] peerView in
|
||||
|
||||
@@ -84,7 +84,12 @@ final class IncreaseLimitFooterItemNode: ItemListControllerFooterItemNode {
|
||||
let icon: UIImage?
|
||||
if self.item.colorful {
|
||||
textColor = .white
|
||||
backgroundColors = [UIColor(rgb: 0x407af0), UIColor(rgb: 0x9551e8), UIColor(rgb: 0xbf499a), UIColor(rgb: 0xf17b30)]
|
||||
backgroundColors = [
|
||||
UIColor(rgb: 0x0077ff),
|
||||
UIColor(rgb: 0x6b93ff),
|
||||
UIColor(rgb: 0x8878ff),
|
||||
UIColor(rgb: 0xe46ace)
|
||||
]
|
||||
icon = UIImage(bundleImageName: "Premium/X2")
|
||||
} else {
|
||||
textColor = self.item.theme.list.itemCheckColors.foregroundColor
|
||||
|
||||
@@ -154,7 +154,7 @@ class IncreaseLimitHeaderItemNode: ListViewItemNode {
|
||||
],
|
||||
inactiveTitle: item.strings.Premium_Free,
|
||||
inactiveValue: "",
|
||||
inactiveTitleColor: .black,
|
||||
inactiveTitleColor: item.theme.list.itemPrimaryTextColor,
|
||||
activeTitle: item.strings.Premium_Premium,
|
||||
activeValue: "\(item.premiumCount)",
|
||||
activeTitleColor: .white,
|
||||
|
||||
@@ -322,14 +322,19 @@ public func oldChannelsController(context: AccountContext, updatedPresentationDa
|
||||
buttonText = presentationData.strings.Premium_IncreaseLimit
|
||||
colorful = true
|
||||
}
|
||||
let footerItem = IncreaseLimitFooterItem(theme: presentationData.theme, title: buttonText, colorful: colorful, action: {
|
||||
if state.selectedPeers.count > 0 {
|
||||
leaveActionImpl?()
|
||||
} else {
|
||||
let controller = PremiumIntroScreen(context: context, source: .groupsAndChannels)
|
||||
pushImpl?(controller)
|
||||
}
|
||||
})
|
||||
let footerItem: IncreaseLimitFooterItem?
|
||||
if state.isSearching && state.selectedPeers.count == 0 {
|
||||
footerItem = nil
|
||||
} else {
|
||||
footerItem = IncreaseLimitFooterItem(theme: presentationData.theme, title: buttonText, colorful: colorful, action: {
|
||||
if state.selectedPeers.count > 0 {
|
||||
leaveActionImpl?()
|
||||
} else {
|
||||
let controller = PremiumIntroScreen(context: context, source: .groupsAndChannels)
|
||||
pushImpl?(controller)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: oldChannelsEntries(presentationData: presentationData, state: state, limit: limits.maxChannelsCount, premiumLimit: premiumLimits.maxChannelsCount, peers: peers, intent: intent), style: .blocks, emptyStateItem: emptyStateItem, searchItem: searchItem, footerItem: footerItem, initialScrollToItem: ListViewScrollToItem(index: 0, position: .top(-navigationBarSearchContentHeight), animated: false, curve: .Default(duration: 0.0), directionHint: .Up), crossfadeState: peersAreEmptyUpdated, animateChanges: false)
|
||||
|
||||
@@ -353,7 +358,7 @@ public func oldChannelsController(context: AccountContext, updatedPresentationDa
|
||||
let ensureStoredPeersSignal: Signal<Never, NoError> = context.engine.peers.ensurePeersAreLocallyAvailable(peers: ensureStoredPeers.map(EnginePeer.init))
|
||||
|
||||
return ensureStoredPeersSignal
|
||||
|> then(context.engine.peers.removePeerChats(peerIds: Array(peers.map(\.peer.id))))
|
||||
|> then(context.engine.peers.removePeerChats(peerIds: Array(ensureStoredPeers.map(\.id))))
|
||||
}
|
||||
|> deliverOnMainQueue).start(completed: {
|
||||
completed(true)
|
||||
|
||||
@@ -202,7 +202,9 @@ private class PremiumLimitAnimationComponent: Component {
|
||||
rotateAnimation.timingFunction = CAMediaTimingFunction(name: .easeOut)
|
||||
|
||||
Queue.mainQueue().after(0.5, {
|
||||
self.hapticFeedback.impact(.light)
|
||||
if !self.badgeView.isHidden {
|
||||
self.hapticFeedback.impact(.light)
|
||||
}
|
||||
})
|
||||
|
||||
let returnAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
|
||||
@@ -736,7 +738,7 @@ private final class LimitSheetContent: CombinedComponent {
|
||||
} else {
|
||||
badgePosition = CGFloat(component.count) / CGFloat(premiumLimit)
|
||||
}
|
||||
buttonIconName = "Premium/AddOne"
|
||||
buttonIconName = "Premium/PlusOne"
|
||||
}
|
||||
var reachedMaximumLimit = badgePosition >= 1.0
|
||||
if case .folders = subject, !state.isPremium {
|
||||
|
||||
@@ -242,27 +242,27 @@ private enum Limit: CaseIterable {
|
||||
}
|
||||
}
|
||||
|
||||
func limit(_ configuration: EngineConfiguration.UserLimits) -> String {
|
||||
func limit(_ configuration: EngineConfiguration.UserLimits, isPremium: Bool) -> String {
|
||||
let value: Int32
|
||||
switch self {
|
||||
case .groups:
|
||||
value = configuration.maxChannelsCount
|
||||
case .pins:
|
||||
value = configuration.maxPinnedChatCount
|
||||
value = configuration.maxPinnedChatCount
|
||||
case .publicLinks:
|
||||
value = configuration.maxPublicLinksCount
|
||||
value = configuration.maxPublicLinksCount
|
||||
case .savedGifs:
|
||||
value = configuration.maxSavedGifCount
|
||||
value = configuration.maxSavedGifCount
|
||||
case .favedStickers:
|
||||
value = configuration.maxFavedStickerCount
|
||||
value = configuration.maxFavedStickerCount
|
||||
case .captions:
|
||||
value = configuration.maxCaptionLength
|
||||
value = configuration.maxCaptionLength
|
||||
case .folders:
|
||||
value = configuration.maxFoldersCount
|
||||
value = configuration.maxFoldersCount
|
||||
case .chatsPerFolder:
|
||||
value = configuration.maxFolderChatsCount
|
||||
value = configuration.maxFolderChatsCount
|
||||
case .account:
|
||||
value = 3
|
||||
value = isPremium ? 4 : 3
|
||||
}
|
||||
return "\(value)"
|
||||
}
|
||||
@@ -355,11 +355,11 @@ private final class PremimLimitsListScreenComponent: CombinedComponent {
|
||||
inactiveColor: theme.list.itemBlocksSeparatorColor.withAlphaComponent(0.5),
|
||||
inactiveTextColor: theme.list.itemPrimaryTextColor,
|
||||
inactiveTitle: strings.Premium_Free,
|
||||
inactiveValue: value.limit(state.limits),
|
||||
inactiveValue: value.limit(state.limits, isPremium: false),
|
||||
activeColor: colors[index],
|
||||
activeTextColor: .white,
|
||||
activeTitle: strings.Premium_Premium,
|
||||
activeValue: value.limit(state.premiumLimits)
|
||||
activeValue: value.limit(state.premiumLimits, isPremium: true)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user