Fix build

This commit is contained in:
Peter 2019-08-05 19:58:58 +03:00
parent cae277d487
commit dcd0d66c87
3 changed files with 4 additions and 263 deletions

View File

@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
D038AC5522F8969400320981 /* TelegramCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D038AC5422F8969400320981 /* TelegramCore.framework */; };
D0879C8422F8751100C4D6B3 /* PeerPresenceStatusManager.h in Headers */ = {isa = PBXBuildFile; fileRef = D0879C8222F8751100C4D6B3 /* PeerPresenceStatusManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
D0879C8B22F8754300C4D6B3 /* PeerPresenceStatusManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0879C8A22F8754300C4D6B3 /* PeerPresenceStatusManager.swift */; };
D0879C8E22F8755200C4D6B3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0879C8D22F8755200C4D6B3 /* Foundation.framework */; };
@ -15,6 +16,7 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
D038AC5422F8969400320981 /* TelegramCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TelegramCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D0879C7F22F8751100C4D6B3 /* PeerPresenceStatusManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PeerPresenceStatusManager.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D0879C8222F8751100C4D6B3 /* PeerPresenceStatusManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PeerPresenceStatusManager.h; sourceTree = "<group>"; };
D0879C8322F8751100C4D6B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@ -29,6 +31,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D038AC5522F8969400320981 /* TelegramCore.framework in Frameworks */,
D0879C9222F8756200C4D6B3 /* SwiftSignalKit.framework in Frameworks */,
D0879C9022F8755A00C4D6B3 /* Postbox.framework in Frameworks */,
D0879C8E22F8755200C4D6B3 /* Foundation.framework in Frameworks */,
@ -68,6 +71,7 @@
D0879C8C22F8755200C4D6B3 /* Frameworks */ = {
isa = PBXGroup;
children = (
D038AC5422F8969400320981 /* TelegramCore.framework */,
D0879C9122F8756200C4D6B3 /* SwiftSignalKit.framework */,
D0879C8F22F8755A00C4D6B3 /* Postbox.framework */,
D0879C8D22F8755200C4D6B3 /* Foundation.framework */,

View File

@ -1,259 +0,0 @@
import Foundation
import UIKit
import UIKit.UIGestureRecognizerSubclass
import Display
private class TapLongTapOrDoubleTapGestureRecognizerTimerTarget: NSObject {
weak var target: TapLongTapOrDoubleTapGestureRecognizer?
init(target: TapLongTapOrDoubleTapGestureRecognizer) {
self.target = target
super.init()
}
@objc func longTapEvent() {
self.target?.longTapEvent()
}
@objc func tapEvent() {
self.target?.tapEvent()
}
@objc func holdEvent() {
self.target?.holdEvent()
}
}
enum TapLongTapOrDoubleTapGesture {
case tap
case doubleTap
case longTap
case hold
}
enum TapLongTapOrDoubleTapGestureRecognizerAction {
case waitForDoubleTap
case waitForSingleTap
case waitForHold(timeout: Double, acceptTap: Bool)
case fail
}
final class TapLongTapOrDoubleTapGestureRecognizer: UIGestureRecognizer, UIGestureRecognizerDelegate {
private var touchLocationAndTimestamp: (CGPoint, Double)?
private var touchCount: Int = 0
private var tapCount: Int = 0
private var timer: Foundation.Timer?
private(set) var lastRecognizedGestureAndLocation: (TapLongTapOrDoubleTapGesture, CGPoint)?
var tapActionAtPoint: ((CGPoint) -> TapLongTapOrDoubleTapGestureRecognizerAction)?
var highlight: ((CGPoint?) -> Void)?
var hapticFeedback: HapticFeedback?
private var highlightPoint: CGPoint?
override init(target: Any?, action: Selector?) {
super.init(target: target, action: action)
self.delegate = self
}
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
if otherGestureRecognizer is UIPanGestureRecognizer {
return false
}
return false
}
override func reset() {
self.timer?.invalidate()
self.timer = nil
self.touchLocationAndTimestamp = nil
self.tapCount = 0
self.touchCount = 0
self.hapticFeedback = nil
if self.highlightPoint != nil {
self.highlightPoint = nil
self.highlight?(nil)
}
super.reset()
}
fileprivate func longTapEvent() {
self.timer?.invalidate()
self.timer = nil
if let (location, _) = self.touchLocationAndTimestamp {
self.lastRecognizedGestureAndLocation = (.longTap, location)
} else {
self.lastRecognizedGestureAndLocation = nil
}
self.state = .ended
}
fileprivate func tapEvent() {
self.timer?.invalidate()
self.timer = nil
if let (location, _) = self.touchLocationAndTimestamp {
self.lastRecognizedGestureAndLocation = (.tap, location)
} else {
self.lastRecognizedGestureAndLocation = nil
}
self.state = .ended
}
fileprivate func holdEvent() {
self.timer?.invalidate()
self.timer = nil
if let (location, _) = self.touchLocationAndTimestamp {
self.hapticFeedback?.tap()
self.lastRecognizedGestureAndLocation = (.hold, location)
} else {
self.lastRecognizedGestureAndLocation = nil
}
self.state = .began
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {
self.lastRecognizedGestureAndLocation = nil
super.touchesBegan(touches, with: event)
self.touchCount += touches.count
if let touch = touches.first {
let touchLocation = touch.location(in: self.view)
if self.highlightPoint != touchLocation {
self.highlightPoint = touchLocation
self.highlight?(touchLocation)
}
if let hitResult = self.view?.hitTest(touch.location(in: self.view), with: event), let _ = hitResult as? UIButton {
self.state = .failed
return
}
self.tapCount += 1
if self.tapCount == 2 && self.touchCount == 1 {
self.timer?.invalidate()
self.timer = nil
self.lastRecognizedGestureAndLocation = (.doubleTap, self.location(in: self.view))
self.state = .ended
} else {
let touchLocationAndTimestamp = (touch.location(in: self.view), CACurrentMediaTime())
self.touchLocationAndTimestamp = touchLocationAndTimestamp
var tapAction: TapLongTapOrDoubleTapGestureRecognizerAction = .waitForDoubleTap
if let tapActionAtPoint = self.tapActionAtPoint {
tapAction = tapActionAtPoint(touchLocationAndTimestamp.0)
}
switch tapAction {
case .waitForSingleTap, .waitForDoubleTap:
self.timer?.invalidate()
let timer = Timer(timeInterval: 0.3, target: TapLongTapOrDoubleTapGestureRecognizerTimerTarget(target: self), selector: #selector(TapLongTapOrDoubleTapGestureRecognizerTimerTarget.longTapEvent), userInfo: nil, repeats: false)
self.timer = timer
RunLoop.main.add(timer, forMode: .common)
case let .waitForHold(timeout, _):
//self.lastRecognizedGestureAndLocation = (.hold, touchLocationAndTimestamp.0)
self.hapticFeedback = HapticFeedback()
self.hapticFeedback?.prepareTap()
let timer = Timer(timeInterval: timeout, target: TapLongTapOrDoubleTapGestureRecognizerTimerTarget(target: self), selector: #selector(TapLongTapOrDoubleTapGestureRecognizerTimerTarget.holdEvent), userInfo: nil, repeats: false)
self.timer = timer
RunLoop.main.add(timer, forMode: .common)
case .fail:
self.state = .failed
}
}
}
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent) {
super.touchesMoved(touches, with: event)
guard let touch = touches.first else {
return
}
if let (gesture, _) = self.lastRecognizedGestureAndLocation, case .hold = gesture {
let location = touch.location(in: self.view)
self.lastRecognizedGestureAndLocation = (.hold, location)
self.state = .changed
return
}
if let touch = touches.first, let (touchLocation, _) = self.touchLocationAndTimestamp {
let location = touch.location(in: self.view)
let distance = CGPoint(x: location.x - touchLocation.x, y: location.y - touchLocation.y)
if distance.x * distance.x + distance.y * distance.y > 4.0 {
self.state = .cancelled
}
}
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent) {
super.touchesEnded(touches, with: event)
self.touchCount -= touches.count
if self.highlightPoint != nil {
self.highlightPoint = nil
self.highlight?(nil)
}
self.timer?.invalidate()
if let (gesture, location) = self.lastRecognizedGestureAndLocation, case .hold = gesture {
self.lastRecognizedGestureAndLocation = (.hold, location)
self.state = .ended
return
}
if self.tapCount == 1 {
var tapAction: TapLongTapOrDoubleTapGestureRecognizerAction = .waitForDoubleTap
if let tapActionAtPoint = self.tapActionAtPoint, let (touchLocation, _) = self.touchLocationAndTimestamp {
tapAction = tapActionAtPoint(touchLocation)
}
switch tapAction {
case .waitForSingleTap:
if let (touchLocation, _) = self.touchLocationAndTimestamp {
self.lastRecognizedGestureAndLocation = (.tap, touchLocation)
}
self.state = .ended
case .waitForDoubleTap:
self.state = .began
let timer = Timer(timeInterval: 0.2, target: TapLongTapOrDoubleTapGestureRecognizerTimerTarget(target: self), selector: #selector(TapLongTapOrDoubleTapGestureRecognizerTimerTarget.tapEvent), userInfo: nil, repeats: false)
self.timer = timer
RunLoop.main.add(timer, forMode: .common)
case let .waitForHold(_, acceptTap):
if let (touchLocation, _) = self.touchLocationAndTimestamp, acceptTap {
if self.state != .began {
self.lastRecognizedGestureAndLocation = (.tap, touchLocation)
self.state = .began
}
}
self.state = .ended
case .fail:
self.state = .failed
}
}
}
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent) {
super.touchesCancelled(touches, with: event)
self.touchCount -= touches.count
if self.highlightPoint != nil {
self.highlightPoint = nil
self.highlight?(nil)
}
self.state = .cancelled
}
}

View File

@ -835,7 +835,6 @@
D0EC6D2A1EB9F58800EBF1C3 /* FetchPhotoLibraryImageResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06E4AC31E84806300627D1D /* FetchPhotoLibraryImageResource.swift */; };
D0EC6D2B1EB9F58800EBF1C3 /* FileMediaResourceStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0177B831DFB095000A5083A /* FileMediaResourceStatus.swift */; };
D0EC6D2C1EB9F58800EBF1C3 /* TouchDownGestureRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69CFB1D6B87D30046BCD6 /* TouchDownGestureRecognizer.swift */; };
D0EC6D2D1EB9F58800EBF1C3 /* TapLongTapOrDoubleTapGestureRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02958011D6F0D5F00360E5E /* TapLongTapOrDoubleTapGestureRecognizer.swift */; };
D0EC6D301EB9F58800EBF1C3 /* RadialProgressNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DC41D6B89E10046BCD6 /* RadialProgressNode.swift */; };
D0EC6D311EB9F58800EBF1C3 /* RadialTimeoutNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00C7CE51E378FD00080C3D5 /* RadialTimeoutNode.swift */; };
D0EC6D321EB9F58800EBF1C3 /* TextNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F69DC21D6B89DA0046BCD6 /* TextNode.swift */; };
@ -1534,7 +1533,6 @@
D025A4221F79344500563950 /* FetchManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchManager.swift; sourceTree = "<group>"; };
D025A4251F79428E00563950 /* FetchManagerLocation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchManagerLocation.swift; sourceTree = "<group>"; };
D02660931F34CE5C000E2DC5 /* LegacyLocationVenueIconDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyLocationVenueIconDataSource.swift; sourceTree = "<group>"; };
D02958011D6F0D5F00360E5E /* TapLongTapOrDoubleTapGestureRecognizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TapLongTapOrDoubleTapGestureRecognizer.swift; sourceTree = "<group>"; };
D02B198921F1DA9E0094A764 /* SharedAccountContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedAccountContext.swift; sourceTree = "<group>"; };
D02B2B9720810DA00062476B /* StickerPaneSearchStickerItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerPaneSearchStickerItem.swift; sourceTree = "<group>"; };
D02B676220800A00001A864A /* PaneSearchBarPlaceholderItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaneSearchBarPlaceholderItem.swift; sourceTree = "<group>"; };
@ -4311,7 +4309,6 @@
isa = PBXGroup;
children = (
D0F69CFB1D6B87D30046BCD6 /* TouchDownGestureRecognizer.swift */,
D02958011D6F0D5F00360E5E /* TapLongTapOrDoubleTapGestureRecognizer.swift */,
D0C44B631FC64D0500227BE0 /* SwipeToDismissGestureRecognizer.swift */,
D056CD7B1FF3E92C00880D28 /* DirectionalPanGestureRecognizer.swift */,
);
@ -5348,7 +5345,6 @@
D0EC6D2B1EB9F58800EBF1C3 /* FileMediaResourceStatus.swift in Sources */,
D0EC6D2C1EB9F58800EBF1C3 /* TouchDownGestureRecognizer.swift in Sources */,
09DD88FA21BFD70B000766BC /* ThemedTextAlertController.swift in Sources */,
D0EC6D2D1EB9F58800EBF1C3 /* TapLongTapOrDoubleTapGestureRecognizer.swift in Sources */,
D0FA08C020483F9600DD23FC /* ExtractVideoData.swift in Sources */,
D025402522E1E00100AC0195 /* ChatSlowmodeHintController.swift in Sources */,
D008177D22B46B7E008A895F /* TGContactModel.m in Sources */,