Merge pull request #2835 from omnivore-app/fix/ios-gesture

iOS17 swipe gesture + library contrast
This commit is contained in:
Jackson Harper
2023-10-03 13:15:42 +08:00
committed by GitHub
2 changed files with 9 additions and 9 deletions

View File

@ -80,15 +80,14 @@
@objc func handlePanGesture(_ panGesture: UIPanGestureRecognizer) {
// if the parentNavigationControllerToUse has a width value, use that because it's more accurate. Otherwise use this view's width as a backup
let total = parentNavigationControllerToUse?.view.frame.width ?? view.frame.width
let percent = max(panGesture.translation(in: view).x, 0) / total
let amount = max(panGesture.translation(in: view).x, 0)
let percent = amount / total
let velocity = panGesture.velocity(in: view).x
switch panGesture.state {
case .began:
if lazyPopContent?.isEnabled == true {
parentNavigationControllerToUse?.delegate = self
if let pop = self.pop {
pop()
}
}
case .changed:
@ -97,10 +96,11 @@
}
case .ended:
let velocity = panGesture.velocity(in: view).x
// Continue if drag more than 50% of screen width or velocity is higher than 100
if percent > 0.5 || velocity > 100 {
// Continue if drag more than 20% of screen width or velocity is higher than 1000
if percent > 0.2 || velocity > 1000 {
if let pop = self.pop {
pop()
}
percentDrivenInteractiveTransition?.finish()
} else {
percentDrivenInteractiveTransition?.cancel()

View File

@ -203,7 +203,7 @@ public struct LibraryItemCard: View {
var byLine: some View {
Text(bylineStr)
.font(.caption2)
.foregroundColor(Color.isDarkMode ? Color.themeLightGray : Color.themeLightestGray)
.foregroundColor(Color.isDarkMode ? Color.themeDarkWhiteGray : Color.themeMiddleGray)
.frame(maxWidth: .infinity, alignment: .leading)
.lineLimit(1)
}