mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
• Tweaked some notification log details • Fixed an issue where unread message request push notifications would incorrectly increment the app badge number • Fixed an issue with the unread count was being miscalculated in some cases • Fixed an issue where dedupe records and messages could be saved under incorrect paths • Fixed an issue where conversation display pictures containing avatars would not correctly update when the users avatar was changed • Fixed an issue where manually updating features wouldn't trigger observations • Fixed an issue where the 'isTrusted' state wouldn't properly update all messages in a currently open conversation • Fixed an issue where query logic for screens using the updated observation system was incorrectly running on the main thread • Fixed a thread deadlock which could occur on launch
80 lines
2.6 KiB
Swift
80 lines
2.6 KiB
Swift
// Copyright © 2025 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import UIKit
|
|
|
|
public class NavBarSessionIcon: UIView {
|
|
// MARK: - Initialization
|
|
|
|
public init(
|
|
showDebugUI: Bool = false,
|
|
serviceNetworkTitle: String = "",
|
|
isMainnet: Bool = true,
|
|
isOffline: Bool = false
|
|
) {
|
|
super.init(frame: .zero)
|
|
|
|
clipsToBounds = false
|
|
|
|
let logoImageView = UIImageView()
|
|
logoImageView.image = #imageLiteral(resourceName: "SessionGreen32")
|
|
logoImageView.contentMode = .scaleAspectFit
|
|
logoImageView.set(.width, to: 32)
|
|
logoImageView.set(.height, to: 32)
|
|
|
|
addSubview(logoImageView)
|
|
logoImageView.pin(to: self)
|
|
|
|
if showDebugUI {
|
|
setupNetworkUI(serviceNetworkTitle: serviceNetworkTitle, isMainnet: isMainnet, isOffline: isOffline)
|
|
}
|
|
}
|
|
|
|
required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
|
|
// MARK: - Functions
|
|
|
|
private func setupNetworkUI(
|
|
serviceNetworkTitle: String,
|
|
isMainnet: Bool,
|
|
isOffline: Bool
|
|
) {
|
|
let labelStackView: UIStackView = UIStackView()
|
|
labelStackView.axis = .vertical
|
|
addSubview(labelStackView)
|
|
labelStackView.center(in: self)
|
|
labelStackView.transform = CGAffineTransform.identity.rotated(by: -(CGFloat.pi / 6))
|
|
|
|
if !isMainnet {
|
|
let testnetLabel: UILabel = UILabel()
|
|
testnetLabel.font = Fonts.boldSpaceMono(ofSize: 14)
|
|
testnetLabel.themeAttributedText = ThemedAttributedString(
|
|
string: serviceNetworkTitle,
|
|
attributes: [
|
|
.themeForegroundColor: ThemeValue.textPrimary,
|
|
.themeStrokeColor: ThemeValue.backgroundPrimary,
|
|
.strokeWidth: -3
|
|
]
|
|
)
|
|
testnetLabel.textAlignment = .center
|
|
labelStackView.addArrangedSubview(testnetLabel)
|
|
}
|
|
|
|
if isOffline {
|
|
let offlineLabel: UILabel = UILabel()
|
|
offlineLabel.font = Fonts.boldSpaceMono(ofSize: 14)
|
|
offlineLabel.themeAttributedText = ThemedAttributedString(
|
|
string: "Offline", // stringlint:ignore
|
|
attributes: [
|
|
.themeForegroundColor: ThemeValue.textPrimary,
|
|
.themeStrokeColor: ThemeValue.backgroundPrimary,
|
|
.strokeWidth: -3
|
|
]
|
|
)
|
|
offlineLabel.textAlignment = .center
|
|
labelStackView.addArrangedSubview(offlineLabel)
|
|
}
|
|
}
|
|
}
|