Various fixes

This commit is contained in:
Ilya Laktyushin 2026-03-12 15:53:10 +01:00
parent dca6b5f145
commit 246b97ce8e
6 changed files with 42 additions and 27 deletions

View file

@ -683,7 +683,8 @@ final class AttachmentContainer: ASDisplayNode, ASGestureRecognizerDelegate {
if view.description.contains("WKChildScroll") {
return nil
} else if view is UITextView {
} else {
} else if view.frame.height > 0.0 && view.frame.width / view.frame.height > 2.5 {
} else {
return (view, nil)
}
}

View file

@ -112,8 +112,18 @@ final class ComposePollScreenComponent: Component {
}
}
private final class ScrollView: UIScrollView {
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
return super.hitTest(point, with: event)
}
override func touchesShouldCancel(in view: UIView) -> Bool {
return true
}
}
final class View: UIView, UIScrollViewDelegate {
private let scrollView: UIScrollView
private let scrollView: ScrollView
private var reactionInput: ComponentView<Empty>?
private let pollTextSection = ComponentView<Empty>()
@ -176,7 +186,7 @@ final class ComposePollScreenComponent: Component {
private var reorderingItem: (id: AnyHashable, snapshotView: UIView, backgroundView: UIView, initialPosition: CGPoint, position: CGPoint)?
override init(frame: CGRect) {
self.scrollView = UIScrollView()
self.scrollView = ScrollView()
self.scrollView.showsVerticalScrollIndicator = true
self.scrollView.showsHorizontalScrollIndicator = false
self.scrollView.scrollsToTop = false

View file

@ -956,13 +956,12 @@
bool isHighQualityPhoto = editingContext.isHighQualityPhoto;
NSNumber *price;
bool hasAnyTimers = false;
if (editingContext != nil || grouping)
{
for (TGMediaAsset *asset in selectedItems)
{
if ([editingContext timerForItem:asset] != nil) {
hasAnyTimers = true;
grouping = false;
}
if (price == nil) {
price = [editingContext priceForItem:asset];
@ -977,6 +976,9 @@
if (adjustments.paintingData.hasAnimation) {
grouping = false;
}
if ([editingContext livePhotoModeForItem:asset] != TGMediaLivePhotoModeOff) {
grouping = false;
}
}
}
@ -1072,7 +1074,7 @@
if (timer != nil)
dict[@"timer"] = timer;
else if (groupedId != nil && !hasAnyTimers)
else if (groupedId != nil)
dict[@"groupedId"] = groupedId;
if (price != nil)
@ -1212,7 +1214,7 @@
dict[@"stickers"] = adjustments.paintingData.stickers;
if (timer != nil)
dict[@"timer"] = timer;
else if (groupedId != nil && !hasAnyTimers)
else if (groupedId != nil)
dict[@"groupedId"] = groupedId;
if (price != nil)
@ -1272,7 +1274,7 @@
if (timer != nil)
dict[@"timer"] = timer;
else if (groupedId != nil && !hasAnyTimers)
else if (groupedId != nil)
dict[@"groupedId"] = groupedId;
if (price != nil)
@ -1398,7 +1400,7 @@
if (timer != nil)
dict[@"timer"] = timer;
else if (groupedId != nil && !hasAnyTimers)
else if (groupedId != nil)
dict[@"groupedId"] = groupedId;
if (price != nil)
@ -1525,13 +1527,12 @@
NSInteger num = 0;
bool grouping = selectionContext.grouping;
bool hasAnyTimers = false;
if (editingContext != nil || grouping)
{
for (id<TGMediaEditableItem> asset in selectedItems)
{
if ([editingContext timerForItem:asset] != nil) {
hasAnyTimers = true;
grouping = false;
}
id<TGMediaEditAdjustments> adjustments = [editingContext adjustmentsForItem:asset];
if ([adjustments isKindOfClass:[TGVideoEditAdjustments class]]) {
@ -1543,6 +1544,9 @@
if (adjustments.paintingData.hasAnimation) {
grouping = false;
}
if ([editingContext livePhotoModeForItem:asset] != TGMediaLivePhotoModeOff) {
grouping = false;
}
}
}
@ -1597,7 +1601,7 @@
if (timer != nil)
dict[@"timer"] = timer;
if (groupedId != nil && !hasAnyTimers)
if (groupedId != nil)
dict[@"groupedId"] = groupedId;
if (spoiler) {
@ -1648,7 +1652,7 @@
if (timer != nil)
dict[@"timer"] = timer;
if (groupedId != nil && !hasAnyTimers)
if (groupedId != nil)
dict[@"groupedId"] = groupedId;
if (spoiler) {
@ -1728,7 +1732,7 @@
dict[@"stickers"] = adjustments.paintingData.stickers;
if (timer != nil)
dict[@"timer"] = timer;
else if (groupedId != nil && !hasAnyTimers)
else if (groupedId != nil)
dict[@"groupedId"] = groupedId;
if (spoiler) {

View file

@ -1042,7 +1042,7 @@ final class DataUsageScreenComponent: Component {
transition: transition,
component: AnyComponent(StoragePeerTypeItemComponent(
theme: environment.theme,
iconName: self.selectedStats == .mobile ? "Settings/Menu/Cellular" : "Settings/Menu/WiFi",
icon: self.selectedStats == .mobile ? PresentationResourcesSettings.cellular! : PresentationResourcesSettings.wifi!,
title: environment.strings.DataUsage_AutoDownloadSettings,
subtitle: stringForAutoDownloadSetting(strings: environment.strings, decimalSeparator: environment.dateTimeFormat.decimalSeparator, settings: self.mediaAutoDownloadSettings, isCellular: self.selectedStats == .mobile),
value: "",

View file

@ -21,7 +21,7 @@ final class StoragePeerTypeItemComponent: Component {
}
let theme: PresentationTheme
let iconName: String
let icon: UIImage
let title: String
let subtitle: String?
let value: String
@ -30,7 +30,7 @@ final class StoragePeerTypeItemComponent: Component {
init(
theme: PresentationTheme,
iconName: String,
icon: UIImage,
title: String,
subtitle: String?,
value: String,
@ -38,7 +38,7 @@ final class StoragePeerTypeItemComponent: Component {
action: @escaping (View) -> Void
) {
self.theme = theme
self.iconName = iconName
self.icon = icon
self.title = title
self.subtitle = subtitle
self.value = value
@ -50,7 +50,7 @@ final class StoragePeerTypeItemComponent: Component {
if lhs.theme !== rhs.theme {
return false
}
if lhs.iconName != rhs.iconName {
if lhs.icon !== rhs.icon {
return false
}
if lhs.title != rhs.title {
@ -252,9 +252,9 @@ final class StoragePeerTypeItemComponent: Component {
labelView.bounds = CGRect(origin: CGPoint(), size: labelFrame.size)
}
if themeUpdated || previousComponent?.iconName != component.iconName {
if themeUpdated || previousComponent?.icon !== component.icon {
self.separatorLayer.backgroundColor = component.theme.list.itemBlocksSeparatorColor.cgColor
self.iconView.image = UIImage(bundleImageName: component.iconName)
self.iconView.image = component.icon
if component.value.isEmpty {
self.arrowIconView.image = PresentationResourcesItemList.disclosureArrowImage(component.theme)

View file

@ -1830,23 +1830,23 @@ final class StorageUsageScreenComponent: Component {
let mappedCategory: CacheStorageSettings.PeerStorageCategory
let iconName: String
let icon: UIImage?
let title: String
switch i {
case 0:
iconName = "Settings/Menu/EditProfile"
icon = PresentationResourcesSettings.privateChats
title = environment.strings.Notifications_PrivateChats
mappedCategory = .privateChats
case 1:
iconName = "Settings/Menu/GroupChats"
icon = PresentationResourcesSettings.groups
title = environment.strings.Notifications_GroupChats
mappedCategory = .groups
case 3:
iconName = "Settings/Menu/Stories"
icon = PresentationResourcesSettings.stories
title = environment.strings.Notifications_Stories
mappedCategory = .stories
default:
iconName = "Settings/Menu/Channels"
icon = PresentationResourcesSettings.channels
title = environment.strings.Notifications_Channels
mappedCategory = .channels
}
@ -1870,7 +1870,7 @@ final class StorageUsageScreenComponent: Component {
transition: transition,
component: AnyComponent(StoragePeerTypeItemComponent(
theme: environment.theme,
iconName: iconName,
icon: icon!,
title: title,
subtitle: subtitle,
value: optionText,