forked from TelegramMessenger/Telegram-iOS
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
275 additions
and
1,350 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
prod | ||
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import UIKit | ||
|
||
private let nicegramViewIds = ["AiShortcutsView"] | ||
|
||
extension UIGestureRecognizer { | ||
func isNicegramExclusiveGesture() -> Bool { | ||
view?.superviewSequence().contains { | ||
if let accessibilityIdentifier = $0.accessibilityIdentifier { | ||
nicegramViewIds.contains(accessibilityIdentifier) | ||
} else { | ||
false | ||
} | ||
} ?? false | ||
} | ||
} | ||
|
||
// MARK: - Helpers | ||
|
||
private extension UIView { | ||
func superviewSequence() -> some Sequence<UIView> { | ||
RecursiveSequence(value: self, nextValue: \.superview) | ||
} | ||
} | ||
|
||
private struct RecursiveSequence<T>: Sequence { | ||
let value: T | ||
let nextValue: (T) -> T? | ||
|
||
func makeIterator() -> RecursiveIterator<T> { | ||
RecursiveIterator(value: value, nextValue: nextValue) | ||
} | ||
} | ||
|
||
private struct RecursiveIterator<T>: IteratorProtocol { | ||
var value: T? | ||
let nextValue: (T) -> T? | ||
|
||
mutating func next() -> T? { | ||
guard let value else { | ||
return nil | ||
} | ||
|
||
self.value = nextValue(value) | ||
return value | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.