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:
@@ -3,6 +3,7 @@ import UIKit
|
||||
|
||||
public final class Button: Component {
|
||||
public let content: AnyComponent<Empty>
|
||||
public let contentInsets: UIEdgeInsets
|
||||
public let minSize: CGSize?
|
||||
public let hitTestEdgeInsets: UIEdgeInsets?
|
||||
public let tag: AnyObject?
|
||||
@@ -15,6 +16,7 @@ public final class Button: Component {
|
||||
|
||||
convenience public init(
|
||||
content: AnyComponent<Empty>,
|
||||
contentInsets: UIEdgeInsets = UIEdgeInsets(),
|
||||
isEnabled: Bool = true,
|
||||
automaticHighlight: Bool = true,
|
||||
action: @escaping () -> Void,
|
||||
@@ -22,6 +24,7 @@ public final class Button: Component {
|
||||
) {
|
||||
self.init(
|
||||
content: content,
|
||||
contentInsets: contentInsets,
|
||||
minSize: nil,
|
||||
hitTestEdgeInsets: nil,
|
||||
tag: nil,
|
||||
@@ -35,6 +38,7 @@ public final class Button: Component {
|
||||
|
||||
private init(
|
||||
content: AnyComponent<Empty>,
|
||||
contentInsets: UIEdgeInsets = UIEdgeInsets(),
|
||||
minSize: CGSize? = nil,
|
||||
hitTestEdgeInsets: UIEdgeInsets? = nil,
|
||||
tag: AnyObject? = nil,
|
||||
@@ -46,6 +50,7 @@ public final class Button: Component {
|
||||
highlightedAction: ActionSlot<Bool>?
|
||||
) {
|
||||
self.content = content
|
||||
self.contentInsets = contentInsets
|
||||
self.minSize = minSize
|
||||
self.hitTestEdgeInsets = hitTestEdgeInsets
|
||||
self.tag = tag
|
||||
@@ -60,6 +65,7 @@ public final class Button: Component {
|
||||
public func minSize(_ minSize: CGSize?) -> Button {
|
||||
return Button(
|
||||
content: self.content,
|
||||
contentInsets: self.contentInsets,
|
||||
minSize: minSize,
|
||||
hitTestEdgeInsets: self.hitTestEdgeInsets,
|
||||
tag: self.tag,
|
||||
@@ -75,6 +81,7 @@ public final class Button: Component {
|
||||
public func withHitTestEdgeInsets(_ hitTestEdgeInsets: UIEdgeInsets?) -> Button {
|
||||
return Button(
|
||||
content: self.content,
|
||||
contentInsets: self.contentInsets,
|
||||
minSize: self.minSize,
|
||||
hitTestEdgeInsets: hitTestEdgeInsets,
|
||||
tag: self.tag,
|
||||
@@ -90,6 +97,7 @@ public final class Button: Component {
|
||||
public func withIsExclusive(_ isExclusive: Bool) -> Button {
|
||||
return Button(
|
||||
content: self.content,
|
||||
contentInsets: self.contentInsets,
|
||||
minSize: self.minSize,
|
||||
hitTestEdgeInsets: self.hitTestEdgeInsets,
|
||||
tag: self.tag,
|
||||
@@ -106,6 +114,7 @@ public final class Button: Component {
|
||||
public func withHoldAction(_ holdAction: ((UIView) -> Void)?) -> Button {
|
||||
return Button(
|
||||
content: self.content,
|
||||
contentInsets: self.contentInsets,
|
||||
minSize: self.minSize,
|
||||
hitTestEdgeInsets: self.hitTestEdgeInsets,
|
||||
tag: self.tag,
|
||||
@@ -121,6 +130,7 @@ public final class Button: Component {
|
||||
public func tagged(_ tag: AnyObject) -> Button {
|
||||
return Button(
|
||||
content: self.content,
|
||||
contentInsets: self.contentInsets,
|
||||
minSize: self.minSize,
|
||||
hitTestEdgeInsets: self.hitTestEdgeInsets,
|
||||
tag: tag,
|
||||
@@ -137,6 +147,9 @@ public final class Button: Component {
|
||||
if lhs.content != rhs.content {
|
||||
return false
|
||||
}
|
||||
if lhs.contentInsets != rhs.contentInsets {
|
||||
return false
|
||||
}
|
||||
if lhs.minSize != rhs.minSize {
|
||||
return false
|
||||
}
|
||||
@@ -318,6 +331,8 @@ public final class Button: Component {
|
||||
size.width = max(size.width, minSize.width)
|
||||
size.height = max(size.height, minSize.height)
|
||||
}
|
||||
size.width += component.contentInsets.left + component.contentInsets.right
|
||||
size.height += component.contentInsets.top + component.contentInsets.bottom
|
||||
|
||||
self.component = component
|
||||
|
||||
|
||||
@@ -6,17 +6,20 @@ public final class Image: Component {
|
||||
public let tintColor: UIColor?
|
||||
public let size: CGSize?
|
||||
public let contentMode: UIImageView.ContentMode
|
||||
public let cornerRadius: CGFloat
|
||||
|
||||
public init(
|
||||
image: UIImage?,
|
||||
tintColor: UIColor? = nil,
|
||||
size: CGSize? = nil,
|
||||
contentMode: UIImageView.ContentMode = .scaleToFill
|
||||
contentMode: UIImageView.ContentMode = .scaleToFill,
|
||||
cornerRadius: CGFloat = 0.0
|
||||
) {
|
||||
self.image = image
|
||||
self.tintColor = tintColor
|
||||
self.size = size
|
||||
self.contentMode = contentMode
|
||||
self.cornerRadius = cornerRadius
|
||||
}
|
||||
|
||||
public static func ==(lhs: Image, rhs: Image) -> Bool {
|
||||
@@ -32,6 +35,9 @@ public final class Image: Component {
|
||||
if lhs.contentMode != rhs.contentMode {
|
||||
return false
|
||||
}
|
||||
if lhs.cornerRadius != rhs.cornerRadius {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -47,7 +53,9 @@ public final class Image: Component {
|
||||
func update(component: Image, availableSize: CGSize, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
self.image = component.image
|
||||
self.contentMode = component.contentMode
|
||||
|
||||
self.clipsToBounds = component.cornerRadius > 0.0
|
||||
|
||||
transition.setCornerRadius(layer: self.layer, cornerRadius: component.cornerRadius)
|
||||
transition.setTintColor(view: self, color: component.tintColor ?? .white)
|
||||
|
||||
switch component.contentMode {
|
||||
|
||||
Reference in New Issue
Block a user