mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-06-08 11:03:55 +02:00
Update Ghostgram features
This commit is contained in:
@@ -1,15 +1,24 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
sgsrc = [
|
||||
"//Swiftgram/SGAppBadgeOffset:SGAppBadgeOffset"
|
||||
]
|
||||
|
||||
sgdeps = [
|
||||
"//submodules/Utils/DeviceModel",
|
||||
"//Swiftgram/SGSimpleSettings:SGSimpleSettings",
|
||||
]
|
||||
|
||||
swift_library(
|
||||
name = "Display",
|
||||
module_name = "Display",
|
||||
srcs = glob([
|
||||
srcs = sgsrc + glob([
|
||||
"Source/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
deps = sgdeps + [
|
||||
"//submodules/ObjCRuntimeUtils:ObjCRuntimeUtils",
|
||||
"//submodules/UIKitRuntimeUtils:UIKitRuntimeUtils",
|
||||
"//submodules/AppBundle:AppBundle",
|
||||
|
||||
@@ -410,9 +410,6 @@ public enum DeviceMetrics: CaseIterable, Equatable {
|
||||
}
|
||||
|
||||
public var showAppBadge: Bool {
|
||||
if case .iPhoneX = self {
|
||||
return false
|
||||
}
|
||||
return self.hasTopNotch
|
||||
return self.sgShowAppBadge
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import SGSimpleSettings
|
||||
|
||||
private struct WindowLayout: Equatable {
|
||||
let size: CGSize
|
||||
@@ -264,7 +265,7 @@ public class Window1 {
|
||||
public let hostView: WindowHostView
|
||||
public let badgeView: UIImageView
|
||||
|
||||
private var deviceMetrics: DeviceMetrics
|
||||
private(set) var deviceMetrics: DeviceMetrics
|
||||
|
||||
public let statusBarHost: StatusBarHost?
|
||||
private let keyboardManager: KeyboardManager?
|
||||
@@ -348,7 +349,11 @@ public class Window1 {
|
||||
public init(hostView: WindowHostView, statusBarHost: StatusBarHost?) {
|
||||
self.hostView = hostView
|
||||
self.badgeView = UIImageView()
|
||||
if SGSimpleSettings.shared.status > 1, let image = UIImage(bundleImageName: SGSimpleSettings.shared.customAppBadge) {
|
||||
self.badgeView.image = image
|
||||
} else {
|
||||
self.badgeView.image = UIImage(bundleImageName: "Components/AppBadge")
|
||||
}
|
||||
self.badgeView.isHidden = true
|
||||
|
||||
self.systemUserInterfaceStyle = hostView.systemUserInterfaceStyle
|
||||
@@ -1253,7 +1258,7 @@ public class Window1 {
|
||||
|
||||
if let image = self.badgeView.image {
|
||||
self.updateBadgeVisibility()
|
||||
self.badgeView.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((self.windowLayout.size.width - image.size.width) / 2.0), y: 5.0), size: image.size)
|
||||
self.badgeView.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((self.windowLayout.size.width - image.size.width) / 2.0), y: self.deviceMetrics.sgAppBadgeOffset()), size: image.size)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user