Various fixes

This commit is contained in:
Ilya Laktyushin 2022-06-11 18:31:10 +04:00
parent 75f7d3e2fb
commit d8f7f18652
5 changed files with 22 additions and 18 deletions

View File

@ -36,7 +36,7 @@ float text(float2 uvIn,
float2 uv = fmod(uvIn, 1.0 / count) * count; float2 uv = fmod(uvIn, 1.0 / count) * count;
float2 block = uvIn * count - uv; float2 block = uvIn * count - uv;
uv = uv * 0.8 + 0.1; uv = uv * 0.8;
uv += floor(noiseTexture.sample(textureSampler, block / noiseResolution + time * .00025).xy * 256.); uv += floor(noiseTexture.sample(textureSampler, block / noiseResolution + time * .00025).xy * 256.);
uv *= -1.0; uv *= -1.0;

View File

@ -80,7 +80,7 @@ final class StickersCarouselComponent: Component {
} }
} }
private let itemSize = CGSize(width: 200.0, height: 200.0) private let itemSize = CGSize(width: 220.0, height: 220.0)
private class StickerNode: ASDisplayNode { private class StickerNode: ASDisplayNode {
private let context: AccountContext private let context: AccountContext

View File

@ -2310,7 +2310,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
credibilityIcon = .scam credibilityIcon = .scam
} else if peer.isVerified { } else if peer.isVerified {
credibilityIcon = .verified credibilityIcon = .verified
} else if peer.isPremium && !premiumConfiguration.isPremiumDisabled { } else if peer.isPremium && !premiumConfiguration.isPremiumDisabled && peer.id != self.context.account.peerId {
credibilityIcon = .premium credibilityIcon = .premium
} else { } else {
credibilityIcon = .none credibilityIcon = .none

View File

@ -6291,39 +6291,43 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
case .username: case .username:
push(usernameSetupController(context: self.context)) push(usernameSetupController(context: self.context))
case .addAccount: case .addAccount:
if let data = self.data { let _ = (activeAccountsAndPeers(context: context)
|> take(1)
|> deliverOnMainQueue
).start(next: { [weak self] accountAndPeer, accountsAndPeers in
guard let strongSelf = self else {
return
}
var maximumAvailableAccounts: Int = 3 var maximumAvailableAccounts: Int = 3
if data.peer?.isPremium == true && !self.context.account.testingEnvironment { if accountAndPeer?.1.isPremium == true && !strongSelf.context.account.testingEnvironment {
maximumAvailableAccounts = 4 maximumAvailableAccounts = 4
} }
var count: Int = 1 var count: Int = 1
if let settings = data.globalSettings { for (accountContext, peer, _) in accountsAndPeers {
for (accountContext, peer, _) in settings.accountsAndPeers { if !accountContext.account.testingEnvironment {
if !accountContext.account.testingEnvironment { if peer.isPremium {
if peer.isPremium { maximumAvailableAccounts = 4
maximumAvailableAccounts = 4
}
count += 1
} }
count += 1
} }
} }
if count >= maximumAvailableAccounts { if count >= maximumAvailableAccounts {
let context = self.context
var replaceImpl: ((ViewController) -> Void)? var replaceImpl: ((ViewController) -> Void)?
let controller = PremiumLimitScreen(context: context, subject: .accounts, count: Int32(count), action: { let controller = PremiumLimitScreen(context: strongSelf.context, subject: .accounts, count: Int32(count), action: {
let controller = PremiumIntroScreen(context: context, source: .accounts) let controller = PremiumIntroScreen(context: strongSelf.context, source: .accounts)
replaceImpl?(controller) replaceImpl?(controller)
}) })
replaceImpl = { [weak controller] c in replaceImpl = { [weak controller] c in
controller?.replace(with: c) controller?.replace(with: c)
} }
if let navigationController = context.sharedContext.mainWindow?.viewController as? NavigationController { if let navigationController = strongSelf.context.sharedContext.mainWindow?.viewController as? NavigationController {
navigationController.pushViewController(controller) navigationController.pushViewController(controller)
} }
} else { } else {
self.context.sharedContext.beginNewAuth(testingEnvironment: self.context.account.testingEnvironment) strongSelf.context.sharedContext.beginNewAuth(testingEnvironment: strongSelf.context.account.testingEnvironment)
} }
} })
case .logout: case .logout:
if let user = self.data?.peer as? TelegramUser, let phoneNumber = user.phone { if let user = self.data?.peer as? TelegramUser, let phoneNumber = user.phone {
if let controller = self.controller, let navigationController = controller.navigationController as? NavigationController { if let controller = self.controller, let navigationController = controller.navigationController as? NavigationController {