Merge commit '4251ee2c1b931c83f35625f6818c89bcc3c99e3e'

This commit is contained in:
Ali 2022-06-09 22:45:56 +04:00
commit 79e3d73334
8 changed files with 61 additions and 21 deletions

View File

@ -7550,12 +7550,15 @@ Sorry for the inconvenience.";
"Premium.AppIcons.Proceed" = "Unlock Premium Icons";
"Premium.NoAds.Proceed" = "About Telegram Premium";
"AccessDenied.LocationPreciseDenied" = "To share your specific location in this chat, please go to Settings > Privacy > Location Services > Telegram and set Precise Location to On.";
"Chat.MultipleTypingPair" = "%@ and %@";
"Chat.MultipleTypingMore" = "%@ and %@ others";
"Group.Username.RemoveExistingUsernamesOrExtendInfo" = "You have reserved too many public links. Try revoking a link from an older group or channel, or upgrade to **Telegram Premium** to double the limit to **%@** public links.";
"Group.Username.RemoveExistingUsernamesNoPremiumInfo" = "You have reserved too many public links. Try revoking the link from an older group or channel. We are working to let you increase this limit in the future.";
"Group.Username.RemoveExistingUsernamesFinalInfo" = "You have reserved too many public links. Try revoking the link from an older group or channel, or create a private one instead.";
"OldChannels.TooManyCommunitiesText" = "You are a member of **%@** groups and channels. Please leave some before joining a new one or upgrade to **Telegram Premium** to double the limit to **%@** groups and channels.";
@ -7623,11 +7626,13 @@ Sorry for the inconvenience.";
"Premium.NoAds" = "No Ads";
"Premium.NoAdsInfo" = "No more ads in public channels where Telegram sometimes shows ads.";
"Premium.NoAdsStandaloneInfo" = "Remove ads such as this by subscribing to **Telegram Premium**.";
"Premium.Reactions" = "Unique Reactions";
"Premium.ReactionsInfo" = "Additional animated reactions on messages, available only to the Premium subscribers.";
"Premium.ReactionsStandalone" = "Additional Reactions";
"Premium.ReactionsStandaloneInfo" = "Unlock a wider range of reactions by subscribing to **Telegram Premium**.";
"Premium.ReactionsStandaloneInfo" = "Unlock a wider range of reactions on messages by subscribing to **Telegram Premium**.";
"Premium.Stickers" = "Premium Stickers";
"Premium.StickersInfo" = "Exclusive enlarged stickers featuring additional effects, updated monthly.";

View File

@ -910,7 +910,6 @@ open class NavigationController: UINavigationController, ContainableController,
visibleRootModalDismissProgress = effectiveRootModalDismissProgress
additionalModalFrameProgress = 1.0 - topModalDismissProgress
} else {
// effectiveRootModalDismissProgress = ((topModalIsFlat && !topFlatModalHasProgress) || isLandscape) ? 1.0 : topModalDismissProgress
effectiveRootModalDismissProgress = topModalDismissProgress
visibleRootModalDismissProgress = effectiveRootModalDismissProgress
additionalModalFrameProgress = 0.0

View File

@ -15,7 +15,6 @@
+ (TGMenuSheetController *)presentInParentController:(TGViewController *)parentController context:(id<LegacyComponentsContext>)context images:(NSArray *)images allowGrouping:(bool)allowGrouping hasCaption:(bool)hasCaption hasTimer:(bool)hasTimer hasSilentPosting:(bool)hasSilentPosting hasSchedule:(bool)hasSchedule reminder:(bool)reminder recipientName:(NSString *)recipientName stickersContext:(id<TGPhotoPaintStickersContext>)stickersContext presentScheduleController:(void (^)(void(^)(int32_t)))presentScheduleController presentTimerController:(void (^)(void(^)(int32_t)))presentTimerController completed:(void (^)(TGMediaSelectionContext *selectionContext, TGMediaEditingContext *editingContext, id<TGMediaSelectableItem> currentItem, bool silentPosting, int32_t scheduleTime))completed dismissed:(void (^)(void))dismissed sourceView:(UIView *)sourceView sourceRect:(CGRect (^)(void))sourceRect;
+ (NSArray *)resultSignalsForSelectionContext:(TGMediaSelectionContext *)selectionContext editingContext:(TGMediaEditingContext *)editingContext currentItem:(id<TGMediaSelectableItem>)currentItem descriptionGenerator:(id (^)(id, NSAttributedString *,
NSString *))descriptionGenerator;
+ (NSArray *)resultSignalsForSelectionContext:(TGMediaSelectionContext *)selectionContext editingContext:(TGMediaEditingContext *)editingContext currentItem:(id<TGMediaSelectableItem>)currentItem descriptionGenerator:(id (^)(id, NSAttributedString *, NSString *))descriptionGenerator;
@end

View File

@ -730,7 +730,19 @@ private func channelVisibilityControllerEntries(presentationData: PresentationDa
if case .revokeNames = mode {
let count = Int32(publicChannelsToRevoke?.count ?? 0)
entries.append(.linksLimitInfo(presentationData.theme, presentationData.strings.Group_Username_RemoveExistingUsernamesOrExtendInfo("\(premiumLimits.maxPublicLinksCount)").string, count, limits.maxPublicLinksCount, premiumLimits.maxPublicLinksCount, isPremiumDisabled))
let text: String
if count >= premiumLimits.maxPublicLinksCount {
text = presentationData.strings.Group_Username_RemoveExistingUsernamesFinalInfo
} else {
if isPremiumDisabled {
text = presentationData.strings.Group_Username_RemoveExistingUsernamesNoPremiumInfo
} else {
text = presentationData.strings.Group_Username_RemoveExistingUsernamesOrExtendInfo("\(premiumLimits.maxPublicLinksCount)").string
}
}
entries.append(.linksLimitInfo(presentationData.theme, text, count, limits.maxPublicLinksCount, premiumLimits.maxPublicLinksCount, isPremiumDisabled))
if let publicChannelsToRevoke = publicChannelsToRevoke {
var index: Int32 = 0
@ -1419,7 +1431,8 @@ public func channelVisibilityController(context: AccountContext, updatedPresenta
var rightNavigationButton: ItemListNavigationButton?
if case .revokeNames = mode {
if !premiumConfiguration.isPremiumDisabled {
let count = Int32(publicChannelsToRevoke?.count ?? 0)
if !premiumConfiguration.isPremiumDisabled && count < premiumLimits.maxPublicLinksCount {
footerItem = IncreaseLimitFooterItem(theme: presentationData.theme, title: presentationData.strings.Premium_IncreaseLimit, colorful: true, action: {
let controller = PremiumIntroScreen(context: context, source: .publicLinks)
pushControllerImpl?(controller)

View File

@ -780,7 +780,7 @@ private final class DemoSheetContent: CombinedComponent {
videoFile: configuration.videos["no_ads"]
)),
title: strings.Premium_NoAds,
text: strings.Premium_NoAdsInfo,
text: isStandalone ? strings.Premium_NoAdsStandaloneInfo : strings.Premium_NoAdsInfo,
textColor: textColor
)
)
@ -950,6 +950,7 @@ private final class DemoSheetContent: CombinedComponent {
)
let buttonText: String
var buttonAnimationName: String?
if state.isPremium == true {
buttonText = strings.Common_OK
} else {
@ -957,16 +958,21 @@ private final class DemoSheetContent: CombinedComponent {
case let .intro(price):
buttonText = strings.Premium_SubscribeFor(price ?? "").string
case .other:
switch component.subject {
case .uniqueReactions:
buttonText = strings.Premium_Reactions_Proceed
case .premiumStickers:
buttonText = strings.Premium_Stickers_Proceed
case .appIcons:
buttonText = strings.Premium_AppIcons_Proceed
default:
buttonText = strings.Common_OK
}
switch component.subject {
case .uniqueReactions:
buttonText = strings.Premium_Reactions_Proceed
buttonAnimationName = "premium_unlock"
case .premiumStickers:
buttonText = strings.Premium_Stickers_Proceed
buttonAnimationName = "premium_unlock"
case .appIcons:
buttonText = strings.Premium_AppIcons_Proceed
buttonAnimationName = "premium_unlock"
case .noAds:
buttonText = strings.Premium_NoAds_Proceed
default:
buttonText = strings.Common_OK
}
}
}
@ -988,7 +994,7 @@ private final class DemoSheetContent: CombinedComponent {
height: 50.0,
cornerRadius: 11.0,
gloss: state.isPremium != true,
animationName: isStandalone && component.subject == .uniqueReactions ? "premium_unlock" : nil,
animationName: isStandalone ? buttonAnimationName : nil,
iconPosition: .right,
iconSpacing: 4.0,
action: { [weak component, weak state] in

View File

@ -1624,7 +1624,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
titleScale = 1.0 - fraction * 0.36
if state.otherPeerName != nil {
titleAlpha = min(1.0, fraction * 1.5)
titleAlpha = min(1.0, fraction * 1.1)
} else {
titleAlpha = 1.0
}
@ -1658,7 +1658,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
context.add(secondaryTitle
.position(CGPoint(x: context.availableSize.width / 2.0, y: max(topInset + 160.0 - titleOffset, environment.statusBarHeight + (environment.navigationHeight - environment.statusBarHeight) / 2.0)))
.scale(titleScale)
.opacity(1.0 - titleAlpha)
.opacity(max(0.0, 1.0 - titleAlpha * 1.8))
)
if state.isPremium == true {

View File

@ -281,9 +281,11 @@ class PremiumStarComponent: Component {
}
private func maybeAnimateIn() {
guard let scene = self.sceneView.scene, let node = scene.rootNode.childNode(withName: "star", recursively: false), let animateFrom = self.animateFrom, let containerView = self.containerView else {
guard let scene = self.sceneView.scene, let node = scene.rootNode.childNode(withName: "star", recursively: false), let animateFrom = self.animateFrom, var containerView = self.containerView else {
return
}
containerView = containerView.subviews[2].subviews[1]
if let animationColor = self.animationColor {
let newNode = node.clone()
@ -323,6 +325,9 @@ class PremiumStarComponent: Component {
self.sceneView.layer.animatePosition(from: sourcePosition, to: targetPosition, duration: 1.0, timingFunction: kCAMediaTimingFunctionSpring, completion: { _ in
self.addSubview(self.sceneView)
self.sceneView.center = initialPosition
})
Queue.mainQueue().after(0.4, {
animateFrom.alpha = 1.0
})

View File

@ -77,6 +77,7 @@ import ChatSendMessageActionUI
import ChatTextLinkEditUI
import WebUI
import PremiumUI
import ImageTransparency
#if DEBUG
import os.signpost
@ -15253,6 +15254,18 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
let images = imageItems as! [UIImage]
strongSelf.chatDisplayNode.updateDropInteraction(isActive: false)
if images.count == 1, let image = images.first, let cgImage = image.cgImage {
let maxSide = max(image.size.width, image.size.height)
if maxSide.isZero {
return
}
let aspectRatio = min(image.size.width, image.size.height) / maxSide
if (imageHasTransparency(cgImage) && aspectRatio > 0.2) {
strongSelf.enqueueStickerImage(image, isMemoji: false)
return
}
}
strongSelf.chatDisplayNode.updateDropInteraction(isActive: false)
strongSelf.displayPasteMenu(images)
}