mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-06-08 19:13:56 +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:
@@ -410,7 +410,7 @@ public final class CombinedComponentContext<ComponentType: Component> {
|
||||
public let component: ComponentType
|
||||
public let availableSize: CGSize
|
||||
public let transition: ComponentTransition
|
||||
private let addImpl: (_ updatedComponent: _UpdatedChildComponent) -> Void
|
||||
private let addImpl: (_ updatedComponent: _UpdatedChildComponent, _ container: UIView?) -> Void
|
||||
|
||||
public var environment: Environment<ComponentType.EnvironmentType> {
|
||||
return self.context.environment
|
||||
@@ -425,7 +425,7 @@ public final class CombinedComponentContext<ComponentType: Component> {
|
||||
component: ComponentType,
|
||||
availableSize: CGSize,
|
||||
transition: ComponentTransition,
|
||||
add: @escaping (_ updatedComponent: _UpdatedChildComponent) -> Void
|
||||
add: @escaping (_ updatedComponent: _UpdatedChildComponent, _ container: UIView?) -> Void
|
||||
) {
|
||||
self.context = context
|
||||
self.view = view
|
||||
@@ -436,7 +436,11 @@ public final class CombinedComponentContext<ComponentType: Component> {
|
||||
}
|
||||
|
||||
public func add(_ updatedComponent: _UpdatedChildComponent) {
|
||||
self.addImpl(updatedComponent)
|
||||
self.addImpl(updatedComponent, nil)
|
||||
}
|
||||
|
||||
public func addWithExternalContainer(_ updatedComponent: _UpdatedChildComponent, container: UIView) {
|
||||
self.addImpl(updatedComponent, container)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -671,7 +675,7 @@ public extension CombinedComponent {
|
||||
component: self,
|
||||
availableSize: availableSize,
|
||||
transition: transition,
|
||||
add: { updatedChild in
|
||||
add: { updatedChild, optionalContainer in
|
||||
if !addedChildIds.insert(updatedChild.id).inserted {
|
||||
preconditionFailure("Child component can only be added once")
|
||||
}
|
||||
@@ -692,7 +696,11 @@ public extension CombinedComponent {
|
||||
context.childViewIndices.remove(at: previousView.index)
|
||||
context.childViewIndices.insert(updatedChild.id, at: index)
|
||||
previousView.index = index
|
||||
view.insertSubview(previousView.view, at: index)
|
||||
if let optionalContainer {
|
||||
optionalContainer.addSubview(previousView.view)
|
||||
} else {
|
||||
view.insertSubview(previousView.view, at: index)
|
||||
}
|
||||
}
|
||||
|
||||
previousView.updateGestures(updatedChild.gestures)
|
||||
@@ -715,7 +723,11 @@ public extension CombinedComponent {
|
||||
childView.transition = updatedChild.transitionDisappear
|
||||
childView.transitionWithGuide = updatedChild.transitionDisappearWithGuide
|
||||
|
||||
view.insertSubview(updatedChild.view, at: index)
|
||||
if let optionalContainer {
|
||||
optionalContainer.addSubview(updatedChild.view)
|
||||
} else {
|
||||
view.insertSubview(updatedChild.view, at: index)
|
||||
}
|
||||
|
||||
updatedChild.view.layer.anchorPoint = updatedChild._anchorPoint ?? CGPoint(x: 0.5, y: 0.5)
|
||||
|
||||
|
||||
@@ -489,7 +489,25 @@ public struct ComponentTransition {
|
||||
}
|
||||
|
||||
public func setAlpha(view: UIView, alpha: CGFloat, delay: Double = 0.0, completion: ((Bool) -> Void)? = nil) {
|
||||
self.setAlpha(layer: view.layer, alpha: alpha, delay: delay, completion: completion)
|
||||
if view.alpha == alpha {
|
||||
completion?(true)
|
||||
return
|
||||
}
|
||||
switch self.animation {
|
||||
case .none:
|
||||
view.alpha = alpha
|
||||
view.layer.removeAnimation(forKey: "opacity")
|
||||
completion?(true)
|
||||
case .curve:
|
||||
let previousAlpha: Float
|
||||
if view.layer.animation(forKey: "opacity") != nil {
|
||||
previousAlpha = view.layer.presentation()?.opacity ?? Float(view.alpha)
|
||||
} else {
|
||||
previousAlpha = Float(view.alpha)
|
||||
}
|
||||
view.alpha = alpha
|
||||
self.animateAlpha(layer: view.layer, from: CGFloat(previousAlpha), to: alpha, delay: delay, completion: completion)
|
||||
}
|
||||
}
|
||||
|
||||
public func setAlpha(layer: CALayer, alpha: CGFloat, delay: Double = 0.0, completion: ((Bool) -> Void)? = nil) {
|
||||
@@ -1335,6 +1353,41 @@ public struct ComponentTransition {
|
||||
completion: completion
|
||||
)
|
||||
}
|
||||
|
||||
public func setBlur(layer: CALayer, radius: CGFloat, completion: ((Bool) -> Void)? = nil) {
|
||||
var currentRadius: CGFloat = 0.0
|
||||
if let currentFilters = layer.filters {
|
||||
for filter in currentFilters {
|
||||
if let filter = filter as? NSObject, filter.description.contains("gaussianBlur") {
|
||||
currentRadius = filter.value(forKey: "inputRadius") as? CGFloat ?? 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if currentRadius == radius {
|
||||
completion?(true)
|
||||
return
|
||||
}
|
||||
|
||||
if let blurFilter = CALayer.blur() {
|
||||
blurFilter.setValue(radius as NSNumber, forKey: "inputRadius")
|
||||
layer.filters = [blurFilter]
|
||||
switch self.animation {
|
||||
case .none:
|
||||
completion?(true)
|
||||
case let .curve(duration, curve):
|
||||
layer.animate(from: currentRadius as NSNumber, to: radius as NSNumber, keyPath: "filters.gaussianBlur.inputRadius", duration: duration, delay: 0.0, curve: curve, removeOnCompletion: true, additive: false,completion: { [weak layer] flag in
|
||||
if let layer {
|
||||
if radius <= 0.0 {
|
||||
layer.filters = nil
|
||||
}
|
||||
}
|
||||
|
||||
completion?(flag)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func animateBlur(layer: CALayer, fromRadius: CGFloat, toRadius: CGFloat, delay: Double = 0.0, removeOnCompletion: Bool = true, completion: ((Bool) -> Void)? = nil) {
|
||||
let duration: Double
|
||||
@@ -1359,4 +1412,23 @@ public struct ComponentTransition {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
public func animateMeshTransform(layer: CALayer, from fromValue: NSObject, to toValue: NSObject, delay: Double = 0.0, removeOnCompletion: Bool = true, completion: ((Bool) -> Void)? = nil) {
|
||||
switch self.animation {
|
||||
case .none:
|
||||
completion?(true)
|
||||
case let .curve(duration, curve):
|
||||
layer.animate(
|
||||
from: fromValue,
|
||||
to: toValue,
|
||||
keyPath: "meshTransform",
|
||||
duration: duration,
|
||||
delay: delay,
|
||||
curve: curve,
|
||||
removeOnCompletion: removeOnCompletion,
|
||||
additive: false,
|
||||
completion: completion
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user