mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-08-30 09:30:36 +02:00
chore: migrate to new version + fixed several critical bugs
- Migrated project to latest Telegram iOS base (v12.3.2+) - Fixed circular dependency between GhostModeManager and MiscSettingsManager - Fixed multiple Bazel build configuration errors (select() default conditions) - Fixed duplicate type definitions in PeerInfoScreen - Fixed swiftmodule directory resolution in build scripts - Added Ghostgram Settings tab in main Settings menu with all 5 features - Cleared sensitive credentials from config.json (template-only now) - Excluded bazel-cache from version control
This commit is contained in:
@@ -1679,34 +1679,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
self.newPerksDisposable = combineLatest(
|
||||
queue: Queue.mainQueue(),
|
||||
ApplicationSpecificNotice.dismissedBusinessBadge(accountManager: context.sharedContext.accountManager),
|
||||
ApplicationSpecificNotice.dismissedBusinessLinksBadge(accountManager: context.sharedContext.accountManager),
|
||||
ApplicationSpecificNotice.dismissedBusinessIntroBadge(accountManager: context.sharedContext.accountManager),
|
||||
ApplicationSpecificNotice.dismissedBusinessChatbotsBadge(accountManager: context.sharedContext.accountManager)
|
||||
).startStrict(next: { [weak self] dismissedBusinessBadge, dismissedBusinessLinksBadge, dismissedBusinessIntroBadge, dismissedBusinessChatbotsBadge in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
var newPerks: [String] = []
|
||||
if !dismissedBusinessBadge {
|
||||
newPerks.append(PremiumPerk.business.identifier)
|
||||
}
|
||||
if !dismissedBusinessLinksBadge {
|
||||
newPerks.append(PremiumPerk.businessLinks.identifier)
|
||||
}
|
||||
if !dismissedBusinessIntroBadge {
|
||||
newPerks.append(PremiumPerk.businessIntro.identifier)
|
||||
}
|
||||
if !dismissedBusinessChatbotsBadge {
|
||||
newPerks.append(PremiumPerk.businessChatBots.identifier)
|
||||
}
|
||||
self.newPerks = newPerks
|
||||
self.updated()
|
||||
})
|
||||
|
||||
|
||||
self.adsEnabledDisposable = (context.engine.data.subscribe(TelegramEngine.EngineData.Item.Peer.AdsEnabled(id: context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self] adsEnabled in
|
||||
guard let self else {
|
||||
@@ -2219,7 +2192,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
||||
demoSubject = .todo
|
||||
case .business:
|
||||
demoSubject = .business
|
||||
let _ = ApplicationSpecificNotice.setDismissedBusinessBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
|
||||
default:
|
||||
demoSubject = .doubleLimits
|
||||
}
|
||||
@@ -2418,7 +2390,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
||||
}
|
||||
push(accountContext.sharedContext.makeChatbotSetupScreen(context: accountContext, initialData: initialData))
|
||||
})
|
||||
let _ = ApplicationSpecificNotice.setDismissedBusinessChatbotsBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
|
||||
case .businessIntro:
|
||||
let _ = (accountContext.sharedContext.makeBusinessIntroSetupScreenInitialData(context: accountContext)
|
||||
|> take(1)
|
||||
@@ -2428,7 +2399,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
||||
}
|
||||
push(accountContext.sharedContext.makeBusinessIntroSetupScreen(context: accountContext, initialData: initialData))
|
||||
})
|
||||
let _ = ApplicationSpecificNotice.setDismissedBusinessIntroBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
|
||||
case .businessLinks:
|
||||
let _ = (accountContext.sharedContext.makeBusinessLinksSetupScreenInitialData(context: accountContext)
|
||||
|> take(1)
|
||||
@@ -2438,7 +2408,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
||||
}
|
||||
push(accountContext.sharedContext.makeBusinessLinksSetupScreen(context: accountContext, initialData: initialData))
|
||||
})
|
||||
let _ = ApplicationSpecificNotice.setDismissedBusinessLinksBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
|
||||
default:
|
||||
fatalError()
|
||||
}
|
||||
@@ -2457,13 +2426,10 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
||||
demoSubject = .businessAwayMessage
|
||||
case .businessChatBots:
|
||||
demoSubject = .businessChatBots
|
||||
let _ = ApplicationSpecificNotice.setDismissedBusinessChatbotsBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
|
||||
case .businessIntro:
|
||||
demoSubject = .businessIntro
|
||||
let _ = ApplicationSpecificNotice.setDismissedBusinessIntroBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
|
||||
case .businessLinks:
|
||||
demoSubject = .businessLinks
|
||||
let _ = ApplicationSpecificNotice.setDismissedBusinessLinksBadge(accountManager: accountContext.sharedContext.accountManager).startStandalone()
|
||||
default:
|
||||
fatalError()
|
||||
}
|
||||
@@ -2960,6 +2926,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
|
||||
private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
typealias EnvironmentType = ViewControllerComponentContainer.Environment
|
||||
|
||||
let overNavigationContainer: UIView
|
||||
let screenContext: PremiumIntroScreen.ScreenContext
|
||||
let mode: PremiumIntroScreen.Mode
|
||||
let source: PremiumSource
|
||||
@@ -2972,7 +2939,8 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
let copyLink: (String) -> Void
|
||||
let shareLink: (String) -> Void
|
||||
|
||||
init(screenContext: PremiumIntroScreen.ScreenContext, mode: PremiumIntroScreen.Mode, source: PremiumSource, forceDark: Bool, forceHasPremium: Bool, updateInProgress: @escaping (Bool) -> Void, present: @escaping (ViewController) -> Void, push: @escaping (ViewController) -> Void, completion: @escaping () -> Void, copyLink: @escaping (String) -> Void, shareLink: @escaping (String) -> Void) {
|
||||
init(overNavigationContainer: UIView, screenContext: PremiumIntroScreen.ScreenContext, mode: PremiumIntroScreen.Mode, source: PremiumSource, forceDark: Bool, forceHasPremium: Bool, updateInProgress: @escaping (Bool) -> Void, present: @escaping (ViewController) -> Void, push: @escaping (ViewController) -> Void, completion: @escaping () -> Void, copyLink: @escaping (String) -> Void, shareLink: @escaping (String) -> Void) {
|
||||
self.overNavigationContainer = overNavigationContainer
|
||||
self.screenContext = screenContext
|
||||
self.mode = mode
|
||||
self.source = source
|
||||
@@ -3415,8 +3383,6 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
let star = Child(PremiumStarComponent.self)
|
||||
let emoji = Child(EmojiHeaderComponent.self)
|
||||
let coin = Child(PremiumCoinComponent.self)
|
||||
let topPanel = Child(BlurredBackgroundComponent.self)
|
||||
let topSeparator = Child(Rectangle.self)
|
||||
let title = Child(MultilineTextComponent.self)
|
||||
let secondaryTitle = Child(MultilineTextWithEntitiesComponent.self)
|
||||
let bottomEdgeEffect = Child(EdgeEffectComponent.self)
|
||||
@@ -3504,22 +3470,6 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
)
|
||||
}
|
||||
|
||||
let topPanel = topPanel.update(
|
||||
component: BlurredBackgroundComponent(
|
||||
color: environment.theme.rootController.navigationBar.blurredBackgroundColor
|
||||
),
|
||||
availableSize: CGSize(width: context.availableSize.width, height: environment.navigationHeight),
|
||||
transition: context.transition
|
||||
)
|
||||
|
||||
let topSeparator = topSeparator.update(
|
||||
component: Rectangle(
|
||||
color: environment.theme.rootController.navigationBar.separatorColor
|
||||
),
|
||||
availableSize: CGSize(width: context.availableSize.width, height: UIScreenPixel),
|
||||
transition: context.transition
|
||||
)
|
||||
|
||||
let titleString: String
|
||||
if case .premiumGift = context.component.source {
|
||||
titleString = environment.strings.Premium_PremiumGift_Title
|
||||
@@ -3743,14 +3693,12 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
.position(CGPoint(x: context.availableSize.width / 2.0, y: context.availableSize.height / 2.0))
|
||||
)
|
||||
|
||||
let topPanelAlpha: CGFloat
|
||||
let titleOffset: CGFloat
|
||||
let titleScale: CGFloat
|
||||
let titleOffsetDelta = (topInset + 160.0) - (environment.statusBarHeight + (environment.navigationHeight - environment.statusBarHeight) / 2.0)
|
||||
let titleAlpha: CGFloat
|
||||
|
||||
if let topContentOffset = state.topContentOffset {
|
||||
topPanelAlpha = min(20.0, max(0.0, topContentOffset - 95.0)) / 20.0
|
||||
let topContentOffset = topContentOffset + max(0.0, min(1.0, topContentOffset / titleOffsetDelta)) * 10.0
|
||||
titleOffset = topContentOffset
|
||||
let fraction = max(0.0, min(1.0, titleOffset / titleOffsetDelta))
|
||||
@@ -3762,36 +3710,29 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
|
||||
titleAlpha = 1.0
|
||||
}
|
||||
} else {
|
||||
topPanelAlpha = 0.0
|
||||
titleScale = 1.0
|
||||
titleOffset = 0.0
|
||||
titleAlpha = state.otherPeerName != nil ? 0.0 : 1.0
|
||||
}
|
||||
|
||||
context.add(header
|
||||
context.addWithExternalContainer(header
|
||||
.position(CGPoint(x: context.availableSize.width / 2.0, y: topInset + header.size.height / 2.0 - 30.0 - titleOffset * titleScale))
|
||||
.scale(titleScale)
|
||||
.scale(titleScale),
|
||||
container: context.component.overNavigationContainer
|
||||
)
|
||||
|
||||
context.add(topPanel
|
||||
.position(CGPoint(x: context.availableSize.width / 2.0, y: topPanel.size.height / 2.0))
|
||||
.opacity(topPanelAlpha)
|
||||
)
|
||||
context.add(topSeparator
|
||||
.position(CGPoint(x: context.availableSize.width / 2.0, y: topPanel.size.height))
|
||||
.opacity(topPanelAlpha)
|
||||
)
|
||||
|
||||
context.add(title
|
||||
context.addWithExternalContainer(title
|
||||
.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(titleAlpha)
|
||||
.opacity(titleAlpha),
|
||||
container: context.component.overNavigationContainer
|
||||
)
|
||||
|
||||
context.add(secondaryTitle
|
||||
context.addWithExternalContainer(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(max(0.0, 1.0 - titleAlpha * 1.8))
|
||||
.opacity(max(0.0, 1.0 - titleAlpha * 1.8)),
|
||||
container: context.component.overNavigationContainer
|
||||
)
|
||||
|
||||
var isUnusedGift = false
|
||||
@@ -3989,6 +3930,8 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
|
||||
public weak var containerView: UIView?
|
||||
public var animationColor: UIColor?
|
||||
|
||||
private let overNavigationContainer: UIView
|
||||
|
||||
public convenience init(context: AccountContext, mode: Mode = .premium, source: PremiumSource, modal: Bool = true, forceDark: Bool = false, forceHasPremium: Bool = false) {
|
||||
self.init(screenContext: .accountContext(context), mode: mode, source: source, modal: modal, forceDark: forceDark, forceHasPremium: forceHasPremium)
|
||||
}
|
||||
@@ -4005,7 +3948,11 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
|
||||
var completionImpl: (() -> Void)?
|
||||
var copyLinkImpl: ((String) -> Void)?
|
||||
var shareLinkImpl: ((String) -> Void)?
|
||||
|
||||
self.overNavigationContainer = UIView()
|
||||
|
||||
super.init(component: PremiumIntroScreenComponent(
|
||||
overNavigationContainer: self.overNavigationContainer,
|
||||
screenContext: screenContext,
|
||||
mode: mode,
|
||||
source: source,
|
||||
@@ -4029,11 +3976,11 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
|
||||
shareLink: { link in
|
||||
shareLinkImpl?(link)
|
||||
}
|
||||
), navigationBarAppearance: .transparent, presentationMode: modal ? .modal : .default, theme: forceDark ? .dark : .default, updatedPresentationData: screenContext.updatedPresentationData)
|
||||
), navigationBarAppearance: .default, presentationMode: modal ? .modal : .default, theme: forceDark ? .dark : .default, updatedPresentationData: screenContext.updatedPresentationData)
|
||||
|
||||
self._hasGlassStyle = true
|
||||
|
||||
if modal {
|
||||
let cancelItem = UIBarButtonItem(title: presentationData.strings.Common_Close, style: .plain, target: self, action: #selector(self.cancelPressed))
|
||||
self.navigationItem.setLeftBarButton(cancelItem, animated: false)
|
||||
self.navigationPresentation = .modal
|
||||
} else {
|
||||
self.navigationPresentation = .modalInLargeLayout
|
||||
@@ -4107,12 +4054,20 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
|
||||
context.account.viewTracker.keepQuickRepliesApproximatelyUpdated()
|
||||
context.account.viewTracker.keepBusinessLinksApproximatelyUpdated()
|
||||
}
|
||||
|
||||
if let navigationBar = self.navigationBar {
|
||||
navigationBar.view.insertSubview(self.overNavigationContainer, aboveSubview: navigationBar.backgroundView)
|
||||
}
|
||||
}
|
||||
|
||||
required public init(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
override public func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
}
|
||||
|
||||
public override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
self.dismissAllTooltips()
|
||||
@@ -4145,10 +4100,10 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
|
||||
super.containerLayoutUpdated(layout, transition: transition)
|
||||
|
||||
if !self.didSetReady {
|
||||
if let view = self.node.hostView.findTaggedView(tag: PremiumCoinComponent.View.Tag()) as? PremiumCoinComponent.View {
|
||||
if let view = findTaggedComponentViewImpl(view: self.view, tag: PremiumCoinComponent.View.Tag()) as? PremiumCoinComponent.View {
|
||||
self.didSetReady = true
|
||||
self._ready.set(view.ready)
|
||||
} else if let view = self.node.hostView.findTaggedView(tag: PremiumStarComponent.View.Tag()) as? PremiumStarComponent.View {
|
||||
} else if let view = findTaggedComponentViewImpl(view: self.view, tag: PremiumStarComponent.View.Tag()) as? PremiumStarComponent.View {
|
||||
self.didSetReady = true
|
||||
self._ready.set(view.ready)
|
||||
|
||||
@@ -4161,7 +4116,7 @@ public final class PremiumIntroScreen: ViewControllerComponentContainer {
|
||||
self.containerView = nil
|
||||
self.animationColor = nil
|
||||
}
|
||||
} else if let view = self.node.hostView.findTaggedView(tag: EmojiHeaderComponent.View.Tag()) as? EmojiHeaderComponent.View {
|
||||
} else if let view = findTaggedComponentViewImpl(view: self.view, tag: EmojiHeaderComponent.View.Tag()) as? EmojiHeaderComponent.View {
|
||||
self.didSetReady = true
|
||||
self._ready.set(view.ready)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user