mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-07-09 17:38:35 +02:00
Update Ghostgram features
This commit is contained in:
+19
-2
@@ -1,3 +1,4 @@
|
||||
import SGSimpleSettings
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Display
|
||||
@@ -305,6 +306,8 @@ public final class HorizontalTabsComponent: Component {
|
||||
private var tabSwitchFraction: CGFloat = 0.0
|
||||
private var isDraggingTabs: Bool = false
|
||||
private var temporaryLiftTimer: Foundation.Timer?
|
||||
private var didTapOnAnItem: Bool = false
|
||||
private var didTapOnAnItemTimer: Foundation.Timer?
|
||||
|
||||
private var tapRecognizer: UITapGestureRecognizer?
|
||||
|
||||
@@ -531,6 +534,14 @@ public final class HorizontalTabsComponent: Component {
|
||||
for (id, itemView) in self.itemViews {
|
||||
if self.scrollView.convert(itemView.selectionFrame, to: self).contains(point) {
|
||||
if let tab = component.tabs.first(where: { $0.id == id }) {
|
||||
self.didTapOnAnItem = true
|
||||
self.didTapOnAnItemTimer?.invalidate()
|
||||
self.didTapOnAnItemTimer = Foundation.Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false, block: { [weak self] _ in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.didTapOnAnItem = false
|
||||
})
|
||||
tab.action()
|
||||
}
|
||||
}
|
||||
@@ -609,7 +620,7 @@ public final class HorizontalTabsComponent: Component {
|
||||
self.temporaryLiftTimer?.invalidate()
|
||||
self.temporaryLiftTimer = nil
|
||||
|
||||
if !transition.animation.isImmediate {
|
||||
if !transition.animation.isImmediate && self.didTapOnAnItem {
|
||||
self.temporaryLiftTimer = Foundation.Timer.scheduledTimer(withTimeInterval: 0.3, repeats: false, block: { [weak self] _ in
|
||||
guard let self else {
|
||||
return
|
||||
@@ -627,6 +638,12 @@ public final class HorizontalTabsComponent: Component {
|
||||
self.component = component
|
||||
self.state = state
|
||||
|
||||
self.didTapOnAnItem = false
|
||||
if let didTapOnAnItemTimer = self.didTapOnAnItemTimer {
|
||||
self.didTapOnAnItemTimer = nil
|
||||
didTapOnAnItemTimer.invalidate()
|
||||
}
|
||||
|
||||
self.reorderingGesture?.isEnabled = component.isEditing
|
||||
|
||||
let sizeHeight: CGFloat = availableSize.height
|
||||
@@ -1059,7 +1076,7 @@ private final class ItemComponent: Component {
|
||||
self.containerView.isGestureEnabled = component.editing == nil
|
||||
self.tapRecognizer?.isEnabled = component.editing == nil
|
||||
|
||||
let sideInset: CGFloat = 16.0
|
||||
let sideInset: CGFloat = 16.0 / (SGSimpleSettings.shared.compactFolderNames ? 2.0 : 1.0)
|
||||
let badgeSpacing: CGFloat = 5.0
|
||||
|
||||
var size = CGSize(width: sideInset, height: availableSize.height)
|
||||
|
||||
Reference in New Issue
Block a user