mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Various improvements
This commit is contained in:
parent
55ff4563f7
commit
927f7786a0
@ -351,7 +351,7 @@ public func generateGradientTintedImage(image: UIImage?, colors: [UIColor]) -> U
|
||||
let t = CGFloat(i) / CGFloat(colors.count - 1)
|
||||
locations.append(t)
|
||||
}
|
||||
let colorSpace = CGColorSpaceCreateDeviceRGB()
|
||||
let colorSpace = DeviceGraphicsContextSettings.shared.colorSpace
|
||||
let gradient = CGGradient(colorsSpace: colorSpace, colors: gradientColors, locations: &locations)!
|
||||
|
||||
context.drawLinearGradient(gradient, start: CGPoint(x: 0.0, y: imageRect.height), end: CGPoint(x: 0.0, y: 0.0), options: CGGradientDrawingOptions())
|
||||
@ -381,7 +381,7 @@ public func generateGradientImage(size: CGSize, colors: [UIColor], locations: [C
|
||||
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
|
||||
if let context = UIGraphicsGetCurrentContext() {
|
||||
let gradientColors = colors.map { $0.cgColor } as CFArray
|
||||
let colorSpace = CGColorSpaceCreateDeviceRGB()
|
||||
let colorSpace = DeviceGraphicsContextSettings.shared.colorSpace
|
||||
|
||||
var locations = locations
|
||||
let gradient = CGGradient(colorsSpace: colorSpace, colors: gradientColors, locations: &locations)!
|
||||
@ -403,7 +403,7 @@ public func generateGradientFilledCircleImage(diameter: CGFloat, colors: NSArray
|
||||
context.clip()
|
||||
|
||||
var locations: [CGFloat] = [0.0, 1.0]
|
||||
let colorSpace = CGColorSpaceCreateDeviceRGB()
|
||||
let colorSpace = DeviceGraphicsContextSettings.shared.colorSpace
|
||||
let gradient = CGGradient(colorsSpace: colorSpace, colors: colors, locations: &locations)!
|
||||
|
||||
context.drawLinearGradient(gradient, start: CGPoint(), end: CGPoint(x: 0.0, y: bounds.size.height), options: CGGradientDrawingOptions())
|
||||
|
@ -1190,6 +1190,7 @@ open class NavigationBar: ASDisplayNode {
|
||||
|
||||
self.badgeNode.updateTheme(fillColor: self.presentationData.theme.buttonColor, strokeColor: self.presentationData.theme.buttonColor, textColor: self.presentationData.theme.badgeTextColor)
|
||||
|
||||
self.updateLeftButton(animated: false)
|
||||
self.requestLayout()
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ private final class MediaGroupsGridAlbumItemNode : ListViewItemNode {
|
||||
override func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
self.imageNode.cornerRadius = 10.0
|
||||
self.imageNode.cornerRadius = 5.0
|
||||
if #available(iOS 13.0, *) {
|
||||
self.imageNode.layer.cornerCurve = .continuous
|
||||
}
|
||||
@ -221,11 +221,11 @@ private func preparedTransition(action: @escaping (PHAssetCollection) -> Void, f
|
||||
}
|
||||
|
||||
final class MediaGroupsAlbumGridItem: ListViewItem {
|
||||
let presentationData: ItemListPresentationData
|
||||
let presentationData: PresentationData
|
||||
let collections: [PHAssetCollection]
|
||||
let action: (PHAssetCollection) -> Void
|
||||
|
||||
public init(presentationData: ItemListPresentationData, collections: [PHAssetCollection], action: @escaping (PHAssetCollection) -> Void) {
|
||||
public init(presentationData: PresentationData, collections: [PHAssetCollection], action: @escaping (PHAssetCollection) -> Void) {
|
||||
self.presentationData = presentationData
|
||||
self.collections = collections
|
||||
self.action = action
|
||||
@ -347,7 +347,8 @@ private class MediaGroupsAlbumGridItemNode: ListViewItemNode {
|
||||
firstItem = result.firstObject
|
||||
}
|
||||
if let firstItem = firstItem {
|
||||
entries.append(MediaGroupsGridAlbumEntry(theme: item.presentationData.theme, index: index, collection: collection, firstItem: firstItem, count: presentationStringsFormattedNumber(Int32(result.count))))
|
||||
let count = presentationStringsFormattedNumber(Int32(result.count), item.presentationData.dateTimeFormat.groupingSeparator)
|
||||
entries.append(MediaGroupsGridAlbumEntry(theme: item.presentationData.theme, index: index, collection: collection, firstItem: firstItem, count: count))
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ private enum MediaGroupsEntry: Comparable, Identifiable {
|
||||
case let .albumsHeader(_, text), let .smartAlbumsHeader(_, text):
|
||||
return MediaGroupsHeaderItem(presentationData: ItemListPresentationData(presentationData), title: text)
|
||||
case let .albums(_, collections):
|
||||
return MediaGroupsAlbumGridItem(presentationData: ItemListPresentationData(presentationData), collections: collections, action: { collection in
|
||||
return MediaGroupsAlbumGridItem(presentationData: presentationData, collections: collections, action: { collection in
|
||||
openGroup(collection)
|
||||
})
|
||||
case let .smartAlbum(_, _, collection, count):
|
||||
|
@ -612,7 +612,18 @@ final class LocalizationListControllerNode: ViewControllerTracingNode {
|
||||
}
|
||||
|
||||
func updatePresentationData(_ presentationData: PresentationData) {
|
||||
let stringsUpdated = self.presentationData.strings !== presentationData.strings
|
||||
self.presentationData = presentationData
|
||||
|
||||
if stringsUpdated {
|
||||
if let snapshotView = self.view.snapshotView(afterScreenUpdates: false) {
|
||||
self.view.addSubview(snapshotView)
|
||||
snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak snapshotView] _ in
|
||||
snapshotView?.removeFromSuperview()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
self.presentationDataValue.set(.single(presentationData))
|
||||
self.backgroundColor = presentationData.theme.list.blocksBackgroundColor
|
||||
self.listNode.keepTopItemOverscrollBackground = ListViewKeepTopItemOverscrollBackground(color: presentationData.theme.list.blocksBackgroundColor, direction: true)
|
||||
|
@ -319,6 +319,7 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
|
||||
|
||||
let launchIconSize = CGSize(width: 99.0, height: 99.0)
|
||||
let launchIconView = UIImageView(image: UIImage(bundleImageName: "Components/LaunchLogo"))
|
||||
launchIconView.autoresizingMask = [.flexibleTopMargin, .flexibleLeftMargin, .flexibleRightMargin, .flexibleBottomMargin]
|
||||
launchIconView.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((hostView.containerView.frame.width - launchIconSize.width) / 2.0), y: floorToScreenPixels((hostView.containerView.frame.height - launchIconSize.height) / 2.0)), size: launchIconSize)
|
||||
hostView.containerView.addSubview(launchIconView)
|
||||
|
||||
|
@ -735,7 +735,7 @@ private final class TranslationLanguagesContextMenuContent: ContextControllerIte
|
||||
}
|
||||
|
||||
func update(presentationData: PresentationData, constrainedWidth: CGFloat, maxHeight: CGFloat, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) -> (cleanSize: CGSize, apparentHeight: CGFloat) {
|
||||
let constrainedSize = CGSize(width: min(260.0, constrainedWidth), height: min(604.0, maxHeight))
|
||||
let constrainedSize = CGSize(width: min(220.0, constrainedWidth), height: min(604.0, maxHeight))
|
||||
|
||||
var topContentHeight: CGFloat = 0.0
|
||||
if let backButtonNode = self.backButtonNode {
|
||||
|
@ -245,9 +245,9 @@ class WebSearchControllerNode: ASDisplayNode {
|
||||
self.addSubnode(self.segmentedContainerNode)
|
||||
self.segmentedContainerNode.addSubnode(self.segmentedBackgroundNode)
|
||||
self.segmentedContainerNode.addSubnode(self.segmentedSeparatorNode)
|
||||
if case .media = mode {
|
||||
self.segmentedContainerNode.addSubnode(self.segmentedControlNode)
|
||||
}
|
||||
// if case .media = mode {
|
||||
// self.segmentedContainerNode.addSubnode(self.segmentedControlNode)
|
||||
// }
|
||||
if !attachment {
|
||||
self.addSubnode(self.toolbarBackgroundNode)
|
||||
self.addSubnode(self.toolbarSeparatorNode)
|
||||
|
Loading…
x
Reference in New Issue
Block a user