mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix more warnings
This commit is contained in:
parent
194f25d4e4
commit
31bc746984
@ -7,7 +7,7 @@ swift_library(
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
#"-warnings-as-errors",
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
|
@ -102,11 +102,15 @@ public func legacyMediaEditor(context: AccountContext, peer: Peer, media: AnyMed
|
||||
|
||||
present(legacyController, nil)
|
||||
|
||||
TGPhotoVideoEditor.present(with: legacyController.context, controller: emptyController, caption: initialCaption, entities: [], withItem: item, paint: true, recipientName: recipientName, stickersContext: paintStickersContext, snapshots: snapshots as? [Any], immediate: transitionCompletion != nil, appeared: {
|
||||
TGPhotoVideoEditor.present(with: legacyController.context, controller: emptyController, caption: initialCaption, entities: [], withItem: item, paint: true, recipientName: recipientName, stickersContext: paintStickersContext, snapshots: snapshots as [Any], immediate: transitionCompletion != nil, appeared: {
|
||||
transitionCompletion?()
|
||||
}, completion: { result, editingContext in
|
||||
let nativeGenerator = legacyAssetPickerItemGenerator()
|
||||
let signals = TGCameraController.resultSignals(for: nil, editingContext: editingContext, currentItem: result as! TGMediaSelectableItem, storeAssets: false, saveEditedPhotos: false, descriptionGenerator: { _1, _2, _3, _4 in
|
||||
var selectableResult: TGMediaSelectableItem?
|
||||
if let result = result {
|
||||
selectableResult = unsafeDowncast(result, to: TGMediaSelectableItem.self)
|
||||
}
|
||||
let signals = TGCameraController.resultSignals(for: nil, editingContext: editingContext, currentItem: selectableResult, storeAssets: false, saveEditedPhotos: false, descriptionGenerator: { _1, _2, _3, _4 in
|
||||
nativeGenerator(_1, _2, _3, _4, nil)
|
||||
})
|
||||
sendMessagesWithSignals(signals, false, 0)
|
||||
@ -319,7 +323,11 @@ public func legacyAttachmentMenu(context: AccountContext, peer: Peer, chatLocati
|
||||
TGPhotoVideoEditor.present(with: legacyController.context, controller: emptyController, caption: "", entities: [], withItem: item, paint: false, recipientName: recipientName, stickersContext: paintStickersContext, snapshots: [], immediate: false, appeared: {
|
||||
}, completion: { result, editingContext in
|
||||
let nativeGenerator = legacyAssetPickerItemGenerator()
|
||||
let signals = TGCameraController.resultSignals(for: nil, editingContext: editingContext, currentItem: result as! TGMediaSelectableItem, storeAssets: false, saveEditedPhotos: false, descriptionGenerator: { _1, _2, _3, _4 in
|
||||
var selectableResult: TGMediaSelectableItem?
|
||||
if let result = result {
|
||||
selectableResult = unsafeDowncast(result, to: TGMediaSelectableItem.self)
|
||||
}
|
||||
let signals = TGCameraController.resultSignals(for: nil, editingContext: editingContext, currentItem: selectableResult, storeAssets: false, saveEditedPhotos: false, descriptionGenerator: { _1, _2, _3, _4 in
|
||||
nativeGenerator(_1, _2, _3, _4, nil)
|
||||
})
|
||||
sendMessagesWithSignals(signals, false, 0, { _ in nil}, {})
|
||||
|
@ -504,7 +504,7 @@ public func legacyAssetPickerEnqueueMessages(account: Account, signals: [Any]) -
|
||||
finalDuration = adjustments.trimEndValue - adjustments.trimStartValue
|
||||
}
|
||||
|
||||
let adjustmentsData = MemoryBuffer(data: NSKeyedArchiver.archivedData(withRootObject: adjustments.dictionary()))
|
||||
let adjustmentsData = MemoryBuffer(data: NSKeyedArchiver.archivedData(withRootObject: adjustments.dictionary()!))
|
||||
let digest = MemoryBuffer(data: adjustmentsData.md5Digest())
|
||||
resourceAdjustments = VideoMediaResourceAdjustments(data: adjustmentsData, digest: digest)
|
||||
}
|
||||
|
@ -26,11 +26,17 @@ private func render(width: Int, height: Int, bytesPerRow: Int, data: Data, type:
|
||||
let image = generateImagePixel(CGSize(width: CGFloat(width), height: CGFloat(height)), scale: 1.0, pixelGenerator: { _, pixelData, bytesPerRow in
|
||||
switch type {
|
||||
case .yuva:
|
||||
data.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
||||
data.withUnsafeBytes { buffer -> Void in
|
||||
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||
return
|
||||
}
|
||||
decodeYUVAToRGBA(bytes, pixelData, Int32(width), Int32(height), Int32(bytesPerRow))
|
||||
}
|
||||
case .argb:
|
||||
data.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
||||
data.withUnsafeBytes { buffer -> Void in
|
||||
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||
return
|
||||
}
|
||||
memcpy(pixelData, bytes, data.count)
|
||||
}
|
||||
}
|
||||
|
@ -29,16 +29,16 @@ public func legacySuggestionContext(context: AccountContext, peerId: PeerId, cha
|
||||
}
|
||||
}
|
||||
|
||||
subscriber?.putNext(users)
|
||||
subscriber?.putCompletion()
|
||||
subscriber.putNext(users)
|
||||
subscriber.putCompletion()
|
||||
})
|
||||
|
||||
return SBlockDisposable {
|
||||
disposable.dispose()
|
||||
}
|
||||
} else {
|
||||
subscriber?.putNext(NSArray())
|
||||
subscriber?.putCompletion()
|
||||
subscriber.putNext(NSArray())
|
||||
subscriber.putCompletion()
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@ -59,8 +59,8 @@ public func legacySuggestionContext(context: AccountContext, peerId: PeerId, cha
|
||||
}
|
||||
|> take(1)
|
||||
|> deliverOnMainQueue).start(next: { hashtags in
|
||||
subscriber?.putNext(hashtags)
|
||||
subscriber?.putCompletion()
|
||||
subscriber.putNext(hashtags)
|
||||
subscriber.putCompletion()
|
||||
})
|
||||
|
||||
return SBlockDisposable {
|
||||
@ -83,10 +83,10 @@ public func legacySuggestionContext(context: AccountContext, peerId: PeerId, cha
|
||||
}
|
||||
return result
|
||||
}).start(next: { result in
|
||||
subscriber?.putNext(result)
|
||||
subscriber?.putCompletion()
|
||||
subscriber.putNext(result)
|
||||
subscriber.putCompletion()
|
||||
}, error: nil, completed: {
|
||||
subscriber?.putCompletion()
|
||||
subscriber.putCompletion()
|
||||
})
|
||||
|
||||
return SBlockDisposable {
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
|
@ -332,7 +332,7 @@ open class LegacyController: ViewController, PresentableController {
|
||||
private let sizeClass: SVariable = SVariable()
|
||||
public var enableSizeClassSignal: Bool = false
|
||||
public var sizeClassSignal: SSignal {
|
||||
return self.sizeClass.signal()!
|
||||
return self.sizeClass.signal()
|
||||
}
|
||||
private var enableContainerLayoutUpdates = false
|
||||
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
],
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/Postbox:Postbox",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/Postbox:Postbox",
|
||||
|
@ -160,7 +160,6 @@ public func chatMapSnapshotImage(account: Account, resource: MapSnapshotMediaRes
|
||||
let context = DrawingContext(size: arguments.drawingSize, clear: true)
|
||||
|
||||
var fullSizeImage: CGImage?
|
||||
var imageOrientation: UIImage.Orientation = .up
|
||||
if let fullSizeData = fullSizeData {
|
||||
let options = NSMutableDictionary()
|
||||
options[kCGImageSourceShouldCache as NSString] = false as NSNumber
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
|
@ -90,7 +90,7 @@ final class LocationDistancePickerScreen: ViewController {
|
||||
self?.dismiss()
|
||||
}
|
||||
|
||||
self.controllerNode.update()
|
||||
let _ = self.controllerNode.update()
|
||||
}
|
||||
|
||||
override public func loadView() {
|
||||
@ -463,7 +463,7 @@ class LocationDistancePickerScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
pickerView.selectRow(1, inComponent: 1, animated: true)
|
||||
}
|
||||
self.updateDoneButtonTitle()
|
||||
self.update()
|
||||
let _ = self.update()
|
||||
}
|
||||
|
||||
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
|
||||
@ -601,7 +601,7 @@ class LocationDistancePickerScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
}
|
||||
|
||||
func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
var hadValidLayout = self.containerLayout != nil
|
||||
let hadValidLayout = self.containerLayout != nil
|
||||
self.containerLayout = (layout, navigationBarHeight)
|
||||
|
||||
var insets = layout.insets(options: [.statusBar, .input])
|
||||
|
@ -231,8 +231,6 @@ final class LocationInfoListItemNode: ListViewItemNode {
|
||||
let subtitleFrame = CGRect(origin: CGPoint(x: leftInset, y: verticalInset + titleLayout.size.height + titleSpacing), size: subtitleLayout.size)
|
||||
subtitleNode.frame = subtitleFrame
|
||||
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
let iconNodeFrame = CGRect(origin: CGPoint(x: params.leftInset + inset, y: 10.0), size: CGSize(width: iconSize, height: iconSize))
|
||||
strongSelf.venueIconNode.frame = iconNodeFrame
|
||||
|
||||
|
@ -178,7 +178,7 @@ final class LocationMapNode: ASDisplayNode, MKMapViewDelegate {
|
||||
var proximityDimView = UIImageView()
|
||||
var proximityIndicatorRadius: Double? {
|
||||
didSet {
|
||||
if let radius = self.proximityIndicatorRadius, let mapView = self.mapView {
|
||||
if let _ = self.proximityIndicatorRadius, let mapView = self.mapView {
|
||||
if self.proximityDimView.image == nil {
|
||||
proximityDimView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public final class LocationPickerController: ViewController {
|
||||
strongSelf.present(c, in: .window(.root), with: a)
|
||||
}, openSettings: {
|
||||
strongSelf.context.sharedContext.applicationBindings.openSettings()
|
||||
}) { [weak self] authorized in
|
||||
}, { [weak self] authorized in
|
||||
guard let strongSelf = self, authorized else {
|
||||
return
|
||||
}
|
||||
@ -160,7 +160,7 @@ public final class LocationPickerController: ViewController {
|
||||
])
|
||||
])
|
||||
strongSelf.present(controller, in: .window(.root))
|
||||
}
|
||||
})
|
||||
}, sendVenue: { [weak self] venue in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
|
@ -514,7 +514,7 @@ final class LocationPickerControllerNode: ViewControllerTracingNode, CLLocationM
|
||||
entries.append(.attribution(presentationData.theme, attribution))
|
||||
}
|
||||
} else {
|
||||
for i in 0 ..< 8 {
|
||||
for _ in 0 ..< 8 {
|
||||
entries.append(.venue(presentationData.theme, nil, index))
|
||||
index += 1
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public final class LocationViewController: ViewController {
|
||||
strongSelf.present(c, in: .window(.root), with: a)
|
||||
}, openSettings: {
|
||||
context.sharedContext.applicationBindings.openSettings()
|
||||
}) { [weak self] authorized in
|
||||
}, { [weak self] authorized in
|
||||
guard let strongSelf = self, authorized else {
|
||||
return
|
||||
}
|
||||
@ -311,7 +311,7 @@ public final class LocationViewController: ViewController {
|
||||
})
|
||||
strongSelf.present(controller, in: .window(.root))
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}, updateSendActionHighlight: { [weak self] highlighted in
|
||||
guard let strongSelf = self else {
|
||||
@ -326,7 +326,7 @@ public final class LocationViewController: ViewController {
|
||||
strongSelf.present(c, in: .window(.root), with: a)
|
||||
}, openSettings: {
|
||||
context.sharedContext.applicationBindings.openSettings()
|
||||
}) { [weak self] authorized in
|
||||
}, { [weak self] authorized in
|
||||
guard let strongSelf = self, authorized else {
|
||||
return
|
||||
}
|
||||
@ -415,7 +415,7 @@ public final class LocationViewController: ViewController {
|
||||
strongSelf.present(controller, in: .window(.root))
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}, stopLiveLocation: { [weak self] in
|
||||
params.stopLiveLocation(nil)
|
||||
self?.dismiss()
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Source/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/Postbox:Postbox",
|
||||
|
@ -336,13 +336,6 @@ final class FFMpegMediaFrameSourceContext: NSObject {
|
||||
self.fetchAutomatically = fetchAutomatically
|
||||
self.maximumFetchSize = maximumFetchSize
|
||||
|
||||
var preferSoftwareAudioDecoding = false
|
||||
if case let .media(media, _) = resourceReference, let file = media.media as? TelegramMediaFile {
|
||||
if file.isInstantVideo {
|
||||
preferSoftwareAudioDecoding = true
|
||||
}
|
||||
}
|
||||
|
||||
if self.tempFilePath == nil {
|
||||
self.keepDataDisposable.set(postbox.mediaBox.keepResource(id: resourceReference.resource.id).start())
|
||||
}
|
||||
|
@ -690,7 +690,10 @@ private final class AudioPlayerRendererContext {
|
||||
strongSelf.bufferContext.with { context in
|
||||
let copyOffset = context.overflowData.count
|
||||
context.overflowData.count += dataLength - takeLength
|
||||
context.overflowData.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
|
||||
context.overflowData.withUnsafeMutableBytes { buffer -> Void in
|
||||
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||
return
|
||||
}
|
||||
CMBlockBufferCopyDataBytes(dataBuffer, atOffset: takeLength, dataLength: dataLength - takeLength, destination: bytes.advanced(by: copyOffset))
|
||||
}
|
||||
}
|
||||
@ -727,7 +730,10 @@ private final class AudioPlayerRendererContext {
|
||||
|
||||
self.bufferContext.with { context in
|
||||
let bytesToCopy = min(context.buffer.size - context.buffer.availableBytes, data.count)
|
||||
data.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
||||
data.withUnsafeBytes { buffer -> Void in
|
||||
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||
return
|
||||
}
|
||||
let _ = context.buffer.enqueue(UnsafeRawPointer(bytes), count: bytesToCopy)
|
||||
context.bufferMaxChannelSampleIndex = sampleIndex + Int64(data.count / (2 * 2))
|
||||
}
|
||||
|
@ -147,9 +147,8 @@ public final class MediaPlayerNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
private func poll(completion: @escaping (PollStatus) -> Void) {
|
||||
if let (takeFrameQueue, takeFrame) = self.takeFrameAndQueue, let videoLayer = self.videoLayer, let (timebase, _, _, _) = self.state {
|
||||
if let (takeFrameQueue, takeFrame) = self.takeFrameAndQueue, let _ = self.videoLayer, let (timebase, _, _, _) = self.state {
|
||||
let layerTime = CMTimeGetSeconds(CMTimebaseGetTime(timebase))
|
||||
let rate = CMTimebaseGetRate(timebase)
|
||||
|
||||
struct PollState {
|
||||
var numFrames: Int
|
||||
@ -403,7 +402,7 @@ public final class MediaPlayerNode: ASDisplayNode {
|
||||
assert(Queue.mainQueue().isCurrent())
|
||||
self.videoLayer?.removeFromSuperlayer()
|
||||
|
||||
if let (takeFrameQueue, _) = self.takeFrameAndQueue {
|
||||
if let _ = self.takeFrameAndQueue {
|
||||
if let videoLayer = self.videoLayer {
|
||||
videoLayer.flushAndRemoveImage()
|
||||
|
||||
|
@ -53,7 +53,7 @@ private final class MediaPlayerScrubbingNodeButton: ASDisplayNode, UIGestureReco
|
||||
}
|
||||
|
||||
override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
guard let gestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer else {
|
||||
guard let _ = gestureRecognizer as? UIPanGestureRecognizer else {
|
||||
return !self.verticalPanEnabled
|
||||
}
|
||||
return true
|
||||
@ -570,7 +570,7 @@ public final class MediaPlayerScrubbingNode: ASDisplayNode {
|
||||
}
|
||||
handleNodeContainer.updateMultiplier = { [weak self] multiplier in
|
||||
if let strongSelf = self {
|
||||
if let statusValue = strongSelf.statusValue, let scrubbingBeginTimestamp = strongSelf.scrubbingBeginTimestamp, Double(0.0).isLess(than: statusValue.duration) {
|
||||
if let statusValue = strongSelf.statusValue, let _ = strongSelf.scrubbingBeginTimestamp, Double(0.0).isLess(than: statusValue.duration) {
|
||||
strongSelf.scrubbingBeginTimestamp = strongSelf.scrubbingTimestampValue
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,10 @@ public final class RingByteBuffer {
|
||||
}
|
||||
|
||||
public func enqueue(data: Data) -> Bool {
|
||||
return data.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Bool in
|
||||
return data.withUnsafeBytes { buffer -> Bool in
|
||||
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||
return false
|
||||
}
|
||||
return TPCircularBufferProduceBytes(&self.buffer, UnsafeRawPointer(bytes), Int32(data.count))
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,10 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
|
||||
fetchDisposable.dispose()
|
||||
|
||||
if let fetchedData = fetchedData {
|
||||
fetchedData.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Void in
|
||||
fetchedData.withUnsafeBytes { byteBuffer -> Void in
|
||||
guard let bytes = byteBuffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||
return
|
||||
}
|
||||
memcpy(buffer, bytes, fetchedData.count)
|
||||
}
|
||||
let fetchedCount = Int32(fetchedData.count)
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/Postbox:Postbox",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
|
@ -8,7 +8,6 @@ public struct MosaicItemPosition: OptionSet {
|
||||
self.rawValue = rawValue
|
||||
}
|
||||
|
||||
public static let none = MosaicItemPosition(rawValue: 0)
|
||||
public static let top = MosaicItemPosition(rawValue: 1)
|
||||
public static let bottom = MosaicItemPosition(rawValue: 2)
|
||||
public static let left = MosaicItemPosition(rawValue: 4)
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/Postbox:Postbox",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/Postbox:Postbox",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Display:Display",
|
||||
|
@ -127,19 +127,19 @@ private enum NotificationSoundSelectionEntry: ItemListNodeEntry {
|
||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! NotificationSoundSelectionArguments
|
||||
switch self {
|
||||
case let.modernHeader(theme, text):
|
||||
case let.modernHeader(_, text):
|
||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||
case let .classicHeader(theme, text):
|
||||
case let .classicHeader(_, text):
|
||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||
case let .none(_, theme, text, selected):
|
||||
case let .none(_, _, text, selected):
|
||||
return ItemListCheckboxItem(presentationData: presentationData, title: text, style: .left, checked: selected, zeroSeparatorInsets: true, sectionId: self.section, action: {
|
||||
arguments.selectSound(.none)
|
||||
})
|
||||
case let .default(_, theme, text, selected):
|
||||
case let .default(_, _, text, selected):
|
||||
return ItemListCheckboxItem(presentationData: presentationData, title: text, style: .left, checked: selected, zeroSeparatorInsets: false, sectionId: self.section, action: {
|
||||
arguments.selectSound(.default)
|
||||
})
|
||||
case let .sound(_, _, theme, text, sound, selected):
|
||||
case let .sound(_, _, _, text, sound, selected):
|
||||
return ItemListCheckboxItem(presentationData: presentationData, title: text, style: .left, checked: selected, zeroSeparatorInsets: false, sectionId: self.section, action: {
|
||||
arguments.selectSound(sound)
|
||||
})
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
|
@ -136,7 +136,6 @@ private final class OpenInActionSheetItemNode: ActionSheetItemNode {
|
||||
self.strings = strings
|
||||
|
||||
let titleFont = Font.medium(floor(theme.baseFontSize * 20.0 / 17.0))
|
||||
let textFont = Font.regular(floor(theme.baseFontSize * 11.0 / 17.0))
|
||||
|
||||
self.titleNode = ASTextNode()
|
||||
self.titleNode.isUserInteractionEnabled = false
|
||||
|
@ -14,6 +14,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/OverlayStatusController/Impl:OverlayStatusControllerImpl"
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
|
@ -234,8 +234,8 @@ final class PasscodeEntryControllerNode: ASDisplayNode {
|
||||
if let image = chatControllerBackgroundImage(theme: self.theme, wallpaper: self.wallpaper, mediaBox: self.accountManager.mediaBox, composed: false, knockoutMode: false) {
|
||||
self.background = ImageBasedPasscodeBackground(image: image, size: size)
|
||||
} else {
|
||||
if case let .file(file) = self.wallpaper, !file.settings.colors.isEmpty {
|
||||
self.background = CustomPasscodeBackground(size: size, colors: file.settings.colors.compactMap { UIColor(rgb: $0) }, inverted: (file.settings.intensity ?? 0) < 0)
|
||||
if case let .file(_, _, _, _, _, _, _, _, settings) = self.wallpaper, !settings.colors.isEmpty {
|
||||
self.background = CustomPasscodeBackground(size: size, colors: settings.colors.compactMap { UIColor(rgb: $0) }, inverted: (settings.intensity ?? 0) < 0)
|
||||
} else {
|
||||
self.background = GradientPasscodeBackground(size: size, backgroundColors: self.theme.passcode.backgroundColors.colors, buttonColor: self.theme.passcode.buttonColor)
|
||||
}
|
||||
|
@ -124,15 +124,10 @@ final class PasscodeEntryButtonNode: HighlightTrackingButtonNode {
|
||||
self.subtitle = subtitle
|
||||
|
||||
if let background = background as? CustomPasscodeBackground {
|
||||
if false, background.inverted {
|
||||
let gradientBackgroundNode = background.makeForegroundNode(backgroundNode: background.makeBackgroundNode())
|
||||
self.gradientBackgroundNode = gradientBackgroundNode as? GradientBackgroundNode.CloneNode
|
||||
} else {
|
||||
let blurredBackgroundColor = (background.inverted ? UIColor(rgb: 0xffffff, alpha: 0.1) : UIColor(rgb: 0x000000, alpha: 0.2), dateFillNeedsBlur(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper))
|
||||
let blurredBackgroundNode = NavigationBackgroundNode(color: blurredBackgroundColor.0, enableBlur: blurredBackgroundColor.1)
|
||||
self.blurredBackgroundNode = blurredBackgroundNode
|
||||
}
|
||||
}
|
||||
|
||||
self.backgroundNode = ASImageNode()
|
||||
self.backgroundNode.displaysAsynchronously = false
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
|
@ -224,7 +224,7 @@ public final class SecureIdAuthController: ViewController, StandalonePresentable
|
||||
let primaryLanguageByCountry = configuration.nativeLanguageByCountry
|
||||
return .single(SecureIdEncryptedFormData(form: form, primaryLanguageByCountry: primaryLanguageByCountry, accountPeer: accountPeer, servicePeer: servicePeer))
|
||||
}
|
||||
|> mapError { _ in return RequestSecureIdFormError.generic }
|
||||
|> castError(RequestSecureIdFormError.self)
|
||||
|> switchToLatest
|
||||
}
|
||||
|> deliverOnMainQueue).start(next: { [weak self] formData in
|
||||
@ -252,7 +252,7 @@ public final class SecureIdAuthController: ViewController, StandalonePresentable
|
||||
|
||||
return .single(accountPeer)
|
||||
}
|
||||
|> mapError { _ in return GetAllSecureIdValuesError.generic }
|
||||
|> castError(GetAllSecureIdValuesError.self)
|
||||
|> switchToLatest)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] values, configuration, accountPeer in
|
||||
if let strongSelf = self {
|
||||
@ -496,17 +496,17 @@ public final class SecureIdAuthController: ViewController, StandalonePresentable
|
||||
}
|
||||
|
||||
private func openPasswordHelp() {
|
||||
guard let verificationState = self.state.verificationState, case let .passwordChallenge(passwordChallenge) = verificationState else {
|
||||
guard let verificationState = self.state.verificationState, case let .passwordChallenge(_, state, hasRecoveryEmail) = verificationState else {
|
||||
return
|
||||
}
|
||||
switch passwordChallenge.state {
|
||||
switch state {
|
||||
case .checking:
|
||||
return
|
||||
case .none, .invalid:
|
||||
break
|
||||
}
|
||||
|
||||
if passwordChallenge.hasRecoveryEmail {
|
||||
if hasRecoveryEmail {
|
||||
self.present(textAlertController(context: self.context, title: self.presentationData.strings.Passport_ForgottenPassword, text: self.presentationData.strings.Passport_PasswordReset, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Login_ResetAccountProtected_Reset, action: { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
|
@ -2683,7 +2683,7 @@ final class SecureIdDocumentFormControllerNode: FormControllerNode<SecureIdDocum
|
||||
}
|
||||
|
||||
func hasUnsavedData() -> Bool {
|
||||
guard var innerState = self.innerState else {
|
||||
guard let innerState = self.innerState else {
|
||||
return false
|
||||
}
|
||||
guard let values = innerState.makeValues(), !values.isEmpty else {
|
||||
|
@ -83,7 +83,6 @@ final class SecureIdDocumentTypeSelectionController: ActionSheetController {
|
||||
|
||||
init(context: AccountContext, field: SecureIdParsedRequestedFormField, currentValues: [SecureIdValueWithContext], completion: @escaping (SecureIdDocumentFormRequestedData) -> Void) {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let theme = presentationData.theme
|
||||
let strings = presentationData.strings
|
||||
|
||||
self.completion = completion
|
||||
|
@ -110,7 +110,10 @@ public func fetchSecureIdLocalImageResource(postbox: Postbox, resource: SecureId
|
||||
if buffer.data.count < range.count {
|
||||
buffer.data.count = range.count
|
||||
}
|
||||
buffer.data.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
|
||||
buffer.data.withUnsafeMutableBytes { buffer -> Void in
|
||||
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||
return
|
||||
}
|
||||
data.copyBytes(to: bytes, from: range)
|
||||
}
|
||||
}
|
||||
@ -119,7 +122,10 @@ public func fetchSecureIdLocalImageResource(postbox: Postbox, resource: SecureId
|
||||
if buffer.data.count < resourceOffset + range.count {
|
||||
buffer.data.count = resourceOffset + range.count
|
||||
}
|
||||
buffer.data.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
|
||||
buffer.data.withUnsafeMutableBytes { buffer -> Void in
|
||||
guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
||||
return
|
||||
}
|
||||
data.copyBytes(to: bytes.advanced(by: resourceOffset), from: range)
|
||||
}
|
||||
}
|
||||
|
@ -55,10 +55,7 @@ final class SecureIdVerificationDocumentsContext {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, error: { [weak self] _ in
|
||||
if let strongSelf = self {
|
||||
|
||||
}
|
||||
}, error: { _ in
|
||||
}))
|
||||
}
|
||||
case .remote:
|
||||
|
@ -20,6 +20,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
|
@ -111,7 +111,7 @@ final class ManagedMonkeyAnimationNode: ManagedAnimationNode {
|
||||
}
|
||||
|
||||
switch previousState {
|
||||
case let .idle(previousIdle):
|
||||
case .idle:
|
||||
switch monkeyState {
|
||||
case let .idle(idle):
|
||||
self.enqueueIdle(idle)
|
||||
|
@ -146,7 +146,7 @@ public func resetPasswordController(context: AccountContext, emailPattern: Strin
|
||||
completion(false)
|
||||
case .declined:
|
||||
break
|
||||
case let .error(reason):
|
||||
case .error:
|
||||
break
|
||||
}
|
||||
})
|
||||
|
@ -428,7 +428,7 @@ final class SetupTwoStepVerificationControllerNode: ViewControllerTracingNode {
|
||||
return
|
||||
}
|
||||
var inplicitelyActivateNextAction = false
|
||||
if case let .confirmEmail(confirmEmail)? = strongSelf.innerState.data.state, let codeLength = confirmEmail.codeLength, confirmEmail.code.count != codeLength, text.count == codeLength {
|
||||
if case let .confirmEmail(_, _, codeLength?, code)? = strongSelf.innerState.data.state, code.count != codeLength, text.count == codeLength {
|
||||
inplicitelyActivateNextAction = true
|
||||
}
|
||||
strongSelf.updateState({ state in
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/Display:Display",
|
||||
],
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
|
@ -227,8 +227,8 @@ public func fetchedAvatarGalleryEntries(engine: TelegramEngine, account: Account
|
||||
if [Namespaces.Peer.CloudGroup, Namespaces.Peer.CloudChannel].contains(peer.id.namespace) {
|
||||
var initialMediaIds = Set<MediaId>()
|
||||
for entry in initialEntries {
|
||||
if case let .image(image) = entry {
|
||||
initialMediaIds.insert(image.0)
|
||||
if case let .image(mediaId, _, _, _, _, _, _, _, _, _) = entry {
|
||||
initialMediaIds.insert(mediaId)
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,8 +239,8 @@ public func fetchedAvatarGalleryEntries(engine: TelegramEngine, account: Account
|
||||
photosCount += 1
|
||||
for entry in initialEntries {
|
||||
let indexData = GalleryItemIndexData(position: index, totalCount: Int32(photosCount))
|
||||
if case let .image(image) = entry {
|
||||
result.append(.image(image.0, image.1, image.2, image.3, image.4, nil, indexData, nil, image.8, nil))
|
||||
if case let .image(mediaId, imageReference, representations, videoRepresentations, peer, _, _, _, thumbnailData, _) = entry {
|
||||
result.append(.image(mediaId, imageReference, representations, videoRepresentations, peer, nil, indexData, nil, thumbnailData, nil))
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
@ -284,8 +284,8 @@ public func fetchedAvatarGalleryEntries(engine: TelegramEngine, account: Account
|
||||
if [Namespaces.Peer.CloudGroup, Namespaces.Peer.CloudChannel].contains(peer.id.namespace) {
|
||||
var initialMediaIds = Set<MediaId>()
|
||||
for entry in initialEntries {
|
||||
if case let .image(image) = entry {
|
||||
initialMediaIds.insert(image.0)
|
||||
if case let .image(mediaId, _, _, _, _, _, _, _, _, _) = entry {
|
||||
initialMediaIds.insert(mediaId)
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,8 +298,8 @@ public func fetchedAvatarGalleryEntries(engine: TelegramEngine, account: Account
|
||||
photosCount += 1
|
||||
for entry in initialEntries {
|
||||
let indexData = GalleryItemIndexData(position: index, totalCount: Int32(photosCount))
|
||||
if case let .image(image) = entry {
|
||||
result.append(.image(image.0, image.1, image.2, image.3, image.4, nil, indexData, nil, image.8, nil))
|
||||
if case let .image(mediaId, imageReference, representations, videoRepresentations, peer, _, _, _, thumbnailData, _) = entry {
|
||||
result.append(.image(mediaId, imageReference, representations, videoRepresentations, peer, nil, indexData, nil, thumbnailData, nil))
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
@ -429,8 +429,8 @@ public class AvatarGalleryController: ViewController, StandalonePresentableContr
|
||||
let isFirstTime = strongSelf.entries.isEmpty
|
||||
|
||||
var entries = entries
|
||||
if !isFirstTime, let updated = entries.first, case let .image(image) = updated, !image.3.isEmpty, let previous = strongSelf.entries.first, case let .topImage(topImage) = previous {
|
||||
let firstEntry = AvatarGalleryEntry.image(image.0, image.1, topImage.0, image.3, image.4, image.5, image.6, image.7, image.8, image.9)
|
||||
if !isFirstTime, let updated = entries.first, case let .image(mediaId, imageReference, _, videoRepresentations, peer, index, indexData, messageId, thumbnailData, caption) = updated, !videoRepresentations.isEmpty, let previous = strongSelf.entries.first, case let .topImage(representations, _, _, _, _, _) = previous {
|
||||
let firstEntry = AvatarGalleryEntry.image(mediaId, imageReference, representations, videoRepresentations, peer, index, indexData, messageId, thumbnailData, caption)
|
||||
entries.remove(at: 0)
|
||||
entries.insert(firstEntry, at: 0)
|
||||
}
|
||||
@ -749,8 +749,8 @@ public class AvatarGalleryController: ViewController, StandalonePresentableContr
|
||||
if let reference = reference {
|
||||
let _ = (self.context.engine.accountData.updatePeerPhotoExisting(reference: reference)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] photo in
|
||||
if let strongSelf = self, let photo = photo, let firstEntry = strongSelf.entries.first, case let .image(image) = firstEntry {
|
||||
let updatedEntry = AvatarGalleryEntry.image(photo.imageId, photo.reference, photo.representations.map({ ImageRepresentationWithReference(representation: $0, reference: MediaResourceReference.avatar(peer: peerReference, resource: $0.resource)) }), photo.videoRepresentations.map({ VideoRepresentationWithReference(representation: $0, reference: MediaResourceReference.avatarList(peer: peerReference, resource: $0.resource)) }), strongSelf.peer, image.5, image.6, image.7, photo.immediateThumbnailData, image.9)
|
||||
if let strongSelf = self, let photo = photo, let firstEntry = strongSelf.entries.first, case let .image(_, _, _, _, _, index, indexData, messageId, _, caption) = firstEntry {
|
||||
let updatedEntry = AvatarGalleryEntry.image(photo.imageId, photo.reference, photo.representations.map({ ImageRepresentationWithReference(representation: $0, reference: MediaResourceReference.avatar(peer: peerReference, resource: $0.resource)) }), photo.videoRepresentations.map({ VideoRepresentationWithReference(representation: $0, reference: MediaResourceReference.avatarList(peer: peerReference, resource: $0.resource)) }), strongSelf.peer, index, indexData, messageId, photo.immediateThumbnailData, caption)
|
||||
|
||||
for (lhs, rhs) in zip(firstEntry.representations, updatedEntry.representations) {
|
||||
if lhs.representation.dimensions == rhs.representation.dimensions {
|
||||
|
@ -252,9 +252,9 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
||||
|
||||
var id: Int64
|
||||
var category: String?
|
||||
if case let .image(image) = entry {
|
||||
id = image.0.id
|
||||
category = image.9
|
||||
if case let .image(mediaId, _, _, _, _, _, _, _, _, categoryValue) = entry {
|
||||
id = mediaId.id
|
||||
category = categoryValue
|
||||
} else {
|
||||
id = Int64(entry.peer?.id.id._internalGetInt32Value() ?? 0)
|
||||
if let resource = entry.videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource {
|
||||
@ -462,7 +462,6 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
||||
var positionCompleted = false
|
||||
var boundsCompleted = false
|
||||
var copyCompleted = false
|
||||
var surfaceCopyCompleted = false
|
||||
|
||||
let (maybeCopyView, copyViewBackground) = node.2()
|
||||
copyViewBackground?.alpha = 1.0
|
||||
@ -508,11 +507,8 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
||||
surfaceCopyView.layer.animatePosition(from: CGPoint(x: transformedSurfaceCopyViewInitialFrame.midX, y: transformedSurfaceCopyViewInitialFrame.midY), to: CGPoint(x: transformedSurfaceFrame.midX, y: transformedSurfaceFrame.midY), duration: 0.25 * durationFactor, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false)
|
||||
let scale = CGSize(width: transformedSurfaceCopyViewInitialFrame.size.width / transformedSurfaceFrame.size.width, height: transformedSurfaceCopyViewInitialFrame.size.height / transformedSurfaceFrame.size.height)
|
||||
surfaceCopyView.layer.animate(from: NSValue(caTransform3D: CATransform3DMakeScale(scale.width, scale.height, 1.0)), to: NSValue(caTransform3D: CATransform3DIdentity), keyPath: "transform", timingFunction: kCAMediaTimingFunctionSpring, duration: 0.25 * durationFactor, removeOnCompletion: false, completion: { _ in
|
||||
surfaceCopyCompleted = true
|
||||
intermediateCompletion()
|
||||
})
|
||||
} else {
|
||||
surfaceCopyCompleted = true
|
||||
}
|
||||
|
||||
copyView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.1 * durationFactor, removeOnCompletion: false)
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
|
@ -846,7 +846,6 @@ public final class PeerInfoAvatarListContainerNode: ASDisplayNode {
|
||||
self.updateItems(size: size, transition: .animated(duration: 0.3, curve: .spring), stripTransition: .animated(duration: 0.3, curve: .spring))
|
||||
}
|
||||
case .cancelled, .ended:
|
||||
let translation = recognizer.translation(in: self.view)
|
||||
let velocity = recognizer.velocity(in: self.view)
|
||||
var directionIsToRight: Bool?
|
||||
if abs(velocity.x) > 10.0 {
|
||||
@ -879,7 +878,7 @@ public final class PeerInfoAvatarListContainerNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
func setMainItem(_ item: PeerInfoAvatarListItem) {
|
||||
guard case let .image(image) = item else {
|
||||
guard case let .image(imageReference, _, _, _) = item else {
|
||||
return
|
||||
}
|
||||
var items: [PeerInfoAvatarListItem] = []
|
||||
@ -893,7 +892,7 @@ public final class PeerInfoAvatarListContainerNode: ASDisplayNode {
|
||||
if representations.isEmpty {
|
||||
continue
|
||||
}
|
||||
if image.0 == reference {
|
||||
if imageReference == reference {
|
||||
entries.insert(entry, at: 0)
|
||||
items.insert(.image(reference, representations, videoRepresentations, immediateThumbnailData), at: 0)
|
||||
} else {
|
||||
@ -917,7 +916,7 @@ public final class PeerInfoAvatarListContainerNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
public func deleteItem(_ item: PeerInfoAvatarListItem) -> Bool {
|
||||
guard case let .image(image) = item else {
|
||||
guard case let .image(imageReference, _, _, _) = item else {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -936,7 +935,7 @@ public final class PeerInfoAvatarListContainerNode: ASDisplayNode {
|
||||
if representations.isEmpty {
|
||||
continue
|
||||
}
|
||||
if image.0 != reference {
|
||||
if imageReference != reference {
|
||||
entries.append(entry)
|
||||
items.append(.image(reference, representations, videoRepresentations, immediateThumbnailData))
|
||||
} else {
|
||||
@ -1004,8 +1003,8 @@ public final class PeerInfoAvatarListContainerNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
var synchronous = false
|
||||
if !strongSelf.galleryEntries.isEmpty, let updated = entries.first, case let .image(image) = updated, !image.3.isEmpty, let previous = strongSelf.galleryEntries.first, case let .topImage(topImage) = previous {
|
||||
let firstEntry = AvatarGalleryEntry.image(image.0, image.1, topImage.0, image.3, image.4, image.5, image.6, image.7, image.8, image.9)
|
||||
if !strongSelf.galleryEntries.isEmpty, let updated = entries.first, case let .image(mediaId, reference, _, videoRepresentations, peer, index, indexData, messageId, thumbnailData, caption) = updated, !videoRepresentations.isEmpty, let previous = strongSelf.galleryEntries.first, case let .topImage(representations, _, _, _, _, _) = previous {
|
||||
let firstEntry = AvatarGalleryEntry.image(mediaId, reference, representations, videoRepresentations, peer, index, indexData, messageId, thumbnailData, caption)
|
||||
entries.remove(at: 0)
|
||||
entries.insert(firstEntry, at: 0)
|
||||
synchronous = true
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
|
@ -70,88 +70,6 @@ private enum ChannelAdminEntryStableId: Hashable {
|
||||
case addAdminsInfo
|
||||
case transfer
|
||||
case dismiss
|
||||
|
||||
var hashValue: Int {
|
||||
switch self {
|
||||
case .info:
|
||||
return 0
|
||||
case .rankTitle:
|
||||
return 1
|
||||
case .rank:
|
||||
return 2
|
||||
case .rankInfo:
|
||||
return 3
|
||||
case .rightsTitle:
|
||||
return 4
|
||||
case .addAdminsInfo:
|
||||
return 5
|
||||
case .dismiss:
|
||||
return 6
|
||||
case .transfer:
|
||||
return 7
|
||||
case let .right(flags):
|
||||
return flags.rawValue.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
static func ==(lhs: ChannelAdminEntryStableId, rhs: ChannelAdminEntryStableId) -> Bool {
|
||||
switch lhs {
|
||||
case .info:
|
||||
if case .info = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case .rankTitle:
|
||||
if case .rankTitle = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case .rank:
|
||||
if case .rank = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case .rankInfo:
|
||||
if case .rankInfo = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case .rightsTitle:
|
||||
if case .rightsTitle = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let right(flags):
|
||||
if case .right(flags) = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case .addAdminsInfo:
|
||||
if case .addAdminsInfo = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case .transfer:
|
||||
if case .transfer = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case .dismiss:
|
||||
if case .dismiss = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum ChannelAdminEntry: ItemListNodeEntry {
|
||||
@ -691,7 +609,7 @@ private func channelAdminControllerEntries(presentationData: PresentationData, s
|
||||
canTransfer = true
|
||||
}
|
||||
|
||||
if let initialParticipant = initialParticipant, case let .member(_, _, adminInfoValue, _, _) = initialParticipant, let adminInfo = adminInfoValue, admin.id != accountPeerId {
|
||||
if let initialParticipant = initialParticipant, case .member = initialParticipant, admin.id != accountPeerId {
|
||||
if channel.flags.contains(.isCreator) {
|
||||
canDismiss = true
|
||||
} else {
|
||||
@ -812,7 +730,7 @@ private func channelAdminControllerEntries(presentationData: PresentationData, s
|
||||
entries.append(.rankTitle(presentationData.theme, presentationData.strings.Group_EditAdmin_RankTitle.uppercased(), rankEnabled && state.focusedOnRank ? Int32(currentRank?.count ?? 0) : nil, rankMaxLength))
|
||||
entries.append(.rank(presentationData.theme, presentationData.strings, isCreator ? presentationData.strings.Group_EditAdmin_RankOwnerPlaceholder : presentationData.strings.Group_EditAdmin_RankAdminPlaceholder, currentRank ?? "", rankEnabled))
|
||||
|
||||
if let initialParticipant = initialParticipant, case let .member(participant) = initialParticipant, let adminInfo = participant.adminInfo, admin.id != accountPeerId {
|
||||
if let initialParticipant = initialParticipant, case .member = initialParticipant, admin.id != accountPeerId {
|
||||
entries.append(.dismiss(presentationData.theme, presentationData.strings.Channel_Moderator_AccessLevelRevoke))
|
||||
}
|
||||
}
|
||||
|
@ -43,32 +43,6 @@ private enum ChannelAdminsSection: Int32 {
|
||||
private enum ChannelAdminsEntryStableId: Hashable {
|
||||
case index(Int32)
|
||||
case peer(PeerId)
|
||||
|
||||
var hashValue: Int {
|
||||
switch self {
|
||||
case let .index(index):
|
||||
return index.hashValue
|
||||
case let .peer(peerId):
|
||||
return peerId.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
static func ==(lhs: ChannelAdminsEntryStableId, rhs: ChannelAdminsEntryStableId) -> Bool {
|
||||
switch lhs {
|
||||
case let .index(index):
|
||||
if case .index(index) = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .peer(peerId):
|
||||
if case .peer(peerId) = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum ChannelAdminsEntry: ItemListNodeEntry {
|
||||
@ -203,13 +177,13 @@ private enum ChannelAdminsEntry: ItemListNodeEntry {
|
||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! ChannelAdminsControllerArguments
|
||||
switch self {
|
||||
case let .recentActions(theme, text):
|
||||
case let .recentActions(_, text):
|
||||
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: "", sectionId: self.section, style: .blocks, action: {
|
||||
arguments.openRecentActions()
|
||||
})
|
||||
case let .adminsHeader(theme, title):
|
||||
case let .adminsHeader(_, title):
|
||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: title, sectionId: self.section)
|
||||
case let .adminPeerItem(theme, strings, dateTimeFormat, nameDisplayOrder, _, _, participant, editing, enabled, hasAction):
|
||||
case let .adminPeerItem(_, strings, dateTimeFormat, nameDisplayOrder, _, _, participant, editing, enabled, hasAction):
|
||||
let peerText: String
|
||||
var action: (() -> Void)?
|
||||
switch participant.participant {
|
||||
@ -244,7 +218,7 @@ private enum ChannelAdminsEntry: ItemListNodeEntry {
|
||||
return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.addPersonIcon(theme), title: text, sectionId: self.section, editing: editing, action: {
|
||||
arguments.addAdmin()
|
||||
})
|
||||
case let .adminsInfo(theme, text):
|
||||
case let .adminsInfo(_, text):
|
||||
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
||||
}
|
||||
}
|
||||
@ -827,10 +801,8 @@ public func channelAdminsController(context: AccountContext, peerId initialPeerI
|
||||
return
|
||||
}
|
||||
|
||||
var replacedSelf = false
|
||||
rebuildControllerStackAfterSupergroupUpgrade(controller: controller, navigationController: navigationController, replace: { c in
|
||||
if c === controller {
|
||||
replacedSelf = true
|
||||
return channelAdminsController(context: context, peerId: upgradedPeerId, loadCompleted: {
|
||||
})
|
||||
} else {
|
||||
|
@ -44,23 +44,6 @@ private enum ChannelBannedMemberEntryStableId: Hashable {
|
||||
case timeout
|
||||
case exceptionInfo
|
||||
case delete
|
||||
|
||||
var hashValue: Int {
|
||||
switch self {
|
||||
case .info:
|
||||
return 0
|
||||
case .rightsHeader:
|
||||
return 1
|
||||
case .timeout:
|
||||
return 2
|
||||
case .exceptionInfo:
|
||||
return 3
|
||||
case .delete:
|
||||
return 4
|
||||
case let .right(flags):
|
||||
return flags.rawValue.hashValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum ChannelBannedMemberEntry: ItemListNodeEntry {
|
||||
@ -223,25 +206,25 @@ private enum ChannelBannedMemberEntry: ItemListNodeEntry {
|
||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! ChannelBannedMemberControllerArguments
|
||||
switch self {
|
||||
case let .info(theme, strings, dateTimeFormat, peer, presence):
|
||||
case let .info(_, _, dateTimeFormat, peer, presence):
|
||||
return ItemListAvatarAndNameInfoItem(accountContext: arguments.context, presentationData: presentationData, dateTimeFormat: dateTimeFormat, mode: .generic, peer: peer, presence: presence, cachedData: nil, state: ItemListAvatarAndNameInfoItemState(), sectionId: self.section, style: .blocks(withTopInset: true, withExtendedBottomInset: false), editingNameUpdated: { _ in
|
||||
}, avatarTapped: {
|
||||
})
|
||||
case let .rightsHeader(theme, text):
|
||||
case let .rightsHeader(_, text):
|
||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||
case let .rightItem(theme, _, text, right, value, enabled):
|
||||
case let .rightItem(_, _, text, right, value, enabled):
|
||||
return ItemListSwitchItem(presentationData: presentationData, title: text, value: value, type: .icon, enableInteractiveChanges: enabled, enabled: enabled, sectionId: self.section, style: .blocks, updated: { value in
|
||||
arguments.toggleRight(right, value)
|
||||
}, activatedWhileDisabled: {
|
||||
arguments.toggleRightWhileDisabled(right)
|
||||
})
|
||||
case let .timeout(theme, text, value):
|
||||
case let .timeout(_, text, value):
|
||||
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .blocks, action: {
|
||||
arguments.openTimeout()
|
||||
})
|
||||
case let .exceptionInfo(theme, text):
|
||||
case let .exceptionInfo(_, text):
|
||||
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
||||
case let .delete(theme, text):
|
||||
case let .delete(_, text):
|
||||
return ItemListActionItem(presentationData: presentationData, title: text, kind: .destructive, alignment: .center, sectionId: self.section, style: .blocks, action: {
|
||||
arguments.delete()
|
||||
})
|
||||
@ -316,7 +299,7 @@ private func channelBannedMemberControllerEntries(presentationData: Presentation
|
||||
|
||||
entries.append(.timeout(presentationData.theme, presentationData.strings.GroupPermission_Duration, currentTimeoutString))
|
||||
|
||||
if let initialParticipant = initialParticipant, case let .member(member) = initialParticipant, let banInfo = member.banInfo, let initialBannedBy = initialBannedBy {
|
||||
if let initialParticipant = initialParticipant, case let .member(_, _, _, banInfo?, _) = initialParticipant, let initialBannedBy = initialBannedBy {
|
||||
entries.append(.exceptionInfo(presentationData.theme, presentationData.strings.GroupPermission_AddedInfo(initialBannedBy.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), stringForRelativeSymbolicTimestamp(strings: presentationData.strings, relativeTimestamp: banInfo.timestamp, relativeTo: state.referenceTimestamp, dateTimeFormat: presentationData.dateTimeFormat)).string))
|
||||
entries.append(.delete(presentationData.theme, presentationData.strings.GroupPermission_Delete))
|
||||
}
|
||||
@ -362,7 +345,7 @@ private func channelBannedMemberControllerEntries(presentationData: Presentation
|
||||
|
||||
entries.append(.timeout(presentationData.theme, presentationData.strings.GroupPermission_Duration, currentTimeoutString))
|
||||
|
||||
if let initialParticipant = initialParticipant, case let .member(member) = initialParticipant, let banInfo = member.banInfo, let initialBannedBy = initialBannedBy {
|
||||
if let initialParticipant = initialParticipant, case let .member(_, _, _, banInfo?, _) = initialParticipant, let initialBannedBy = initialBannedBy {
|
||||
entries.append(.exceptionInfo(presentationData.theme, presentationData.strings.GroupPermission_AddedInfo(initialBannedBy.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), stringForRelativeSymbolicTimestamp(strings: presentationData.strings, relativeTimestamp: banInfo.timestamp, relativeTo: state.referenceTimestamp, dateTimeFormat: presentationData.dateTimeFormat)).string))
|
||||
entries.append(.delete(presentationData.theme, presentationData.strings.GroupPermission_Delete))
|
||||
}
|
||||
@ -413,7 +396,7 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
|
||||
var effectiveRightsFlags: TelegramChatBannedRightsFlags
|
||||
if let updatedFlags = state.updatedFlags {
|
||||
effectiveRightsFlags = updatedFlags
|
||||
} else if let initialParticipant = initialParticipant, case let .member(member) = initialParticipant, let banInfo = member.banInfo {
|
||||
} else if let initialParticipant = initialParticipant, case let .member(_, _, _, banInfo?, _) = initialParticipant {
|
||||
effectiveRightsFlags = banInfo.rights.flags
|
||||
} else {
|
||||
effectiveRightsFlags = defaultBannedRightsFlags
|
||||
@ -630,8 +613,8 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
|
||||
}
|
||||
|
||||
var previousRights: TelegramChatBannedRights?
|
||||
if let initialParticipant = initialParticipant, case let .member(member) = initialParticipant, member.banInfo != nil {
|
||||
previousRights = member.banInfo?.rights
|
||||
if let initialParticipant = initialParticipant, case let .member(_, _, _, banInfo, _) = initialParticipant, banInfo != nil {
|
||||
previousRights = banInfo?.rights
|
||||
}
|
||||
|
||||
if let resolvedRights = resolvedRights, previousRights != resolvedRights {
|
||||
@ -692,11 +675,6 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
|
||||
}
|
||||
}
|
||||
}, error: { _ in
|
||||
updateState { current in
|
||||
var current = current
|
||||
current.updating = false
|
||||
return current
|
||||
}
|
||||
}))
|
||||
} else {
|
||||
updateRightsDisposable.set((context.peerChannelMemberCategoriesContextsManager.updateMemberBannedRights(engine: context.engine, peerId: peerId, memberId: memberId, bannedRights: cleanResolvedRights)
|
||||
@ -736,7 +714,7 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
|
||||
}
|
||||
|
||||
let title: String
|
||||
if let initialParticipant = initialParticipant, case let .member(member) = initialParticipant, member.banInfo != nil {
|
||||
if let initialParticipant = initialParticipant, case let .member(_, _, _, banInfo, _) = initialParticipant, banInfo != nil {
|
||||
title = presentationData.strings.GroupPermission_Title
|
||||
} else {
|
||||
title = presentationData.strings.GroupPermission_NewTitle
|
||||
|
@ -324,9 +324,7 @@ public func channelBlacklistController(context: AccountContext, peerId: PeerId)
|
||||
let progress = OverlayStatusController(theme: presentationData.theme, type: .loading(cancelled: nil))
|
||||
presentControllerImpl?(progress, nil)
|
||||
removePeerDisposable.set((context.peerChannelMemberCategoriesContextsManager.updateMemberBannedRights(engine: context.engine, peerId: peerId, memberId: peer.id, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: Int32.max))
|
||||
|> deliverOnMainQueue).start(error: { [weak progress] _ in
|
||||
progress?.dismiss()
|
||||
dismissController?()
|
||||
|> deliverOnMainQueue).start(error: { _ in
|
||||
}, completed: { [weak progress] in
|
||||
progress?.dismiss()
|
||||
dismissController?()
|
||||
@ -343,9 +341,6 @@ public func channelBlacklistController(context: AccountContext, peerId: PeerId)
|
||||
}
|
||||
|
||||
removePeerDisposable.set((context.peerChannelMemberCategoriesContextsManager.updateMemberBannedRights(engine: context.engine, peerId: peerId, memberId: memberId, bannedRights: nil) |> deliverOnMainQueue).start(error: { _ in
|
||||
updateState {
|
||||
return $0.withUpdatedRemovingPeerId(nil)
|
||||
}
|
||||
}, completed: {
|
||||
updateState {
|
||||
return $0.withUpdatedRemovingPeerId(nil)
|
||||
@ -392,7 +387,6 @@ public func channelBlacklistController(context: AccountContext, peerId: PeerId)
|
||||
|> then(
|
||||
context.peerChannelMemberCategoriesContextsManager.addMember(engine: context.engine, peerId: peerId, memberId: memberId)
|
||||
|> map { _ -> Void in
|
||||
return Void()
|
||||
}
|
||||
|> `catch` { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
@ -400,9 +394,6 @@ public func channelBlacklistController(context: AccountContext, peerId: PeerId)
|
||||
|> ignoreValues
|
||||
)
|
||||
removePeerDisposable.set((signal |> deliverOnMainQueue).start(error: { _ in
|
||||
updateState {
|
||||
return $0.withUpdatedRemovingPeerId(nil)
|
||||
}
|
||||
}, completed: {
|
||||
updateState {
|
||||
return $0.withUpdatedRemovingPeerId(nil)
|
||||
@ -418,9 +409,6 @@ public func channelBlacklistController(context: AccountContext, peerId: PeerId)
|
||||
}
|
||||
|
||||
removePeerDisposable.set((context.peerChannelMemberCategoriesContextsManager.updateMemberBannedRights(engine: context.engine, peerId: peerId, memberId: memberId, bannedRights: nil) |> deliverOnMainQueue).start(error: { _ in
|
||||
updateState {
|
||||
return $0.withUpdatedRemovingPeerId(nil)
|
||||
}
|
||||
}, completed: {
|
||||
updateState {
|
||||
return $0.withUpdatedRemovingPeerId(nil)
|
||||
|
@ -406,9 +406,6 @@ public func channelDiscussionGroupSetupController(context: AccountContext, peerI
|
||||
state.searching = false
|
||||
return state
|
||||
}
|
||||
case .hasNotPermissions:
|
||||
//TODO process error
|
||||
break
|
||||
case .groupHistoryIsCurrentlyPrivate:
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(textAlertController(context: context, title: nil, text: presentationData.strings.Channel_DiscussionGroup_MakeHistoryPublic, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Channel_DiscussionGroup_MakeHistoryPublicProceed, action: {
|
||||
|
@ -40,32 +40,6 @@ private enum ChannelMembersSection: Int32 {
|
||||
private enum ChannelMembersEntryStableId: Hashable {
|
||||
case index(Int32)
|
||||
case peer(PeerId)
|
||||
|
||||
var hashValue: Int {
|
||||
switch self {
|
||||
case let .index(index):
|
||||
return index.hashValue
|
||||
case let .peer(peerId):
|
||||
return peerId.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
static func ==(lhs: ChannelMembersEntryStableId, rhs: ChannelMembersEntryStableId) -> Bool {
|
||||
switch lhs {
|
||||
case let .index(index):
|
||||
if case .index(index) = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .peer(peerId):
|
||||
if case .peer(peerId) = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum ChannelMembersEntry: ItemListNodeEntry {
|
||||
|
@ -779,8 +779,8 @@ public final class ChannelMembersSearchContainerNode: SearchDisplayControllerCon
|
||||
switch participant.participant {
|
||||
case .creator:
|
||||
label = presentationData.strings.Channel_Management_LabelOwner
|
||||
case let .member(member):
|
||||
if member.adminInfo != nil {
|
||||
case let .member(_, _, adminInfo, _, _):
|
||||
if adminInfo != nil {
|
||||
label = presentationData.strings.Channel_Management_LabelEditor
|
||||
}
|
||||
}
|
||||
@ -930,7 +930,7 @@ public final class ChannelMembersSearchContainerNode: SearchDisplayControllerCon
|
||||
|
||||
return entries
|
||||
}
|
||||
} else if let group = peerView.peers[peerId] as? TelegramGroup, let cachedData = peerView.cachedData as? CachedGroupData {
|
||||
} else if let _ = peerView.peers[peerId] as? TelegramGroup, let cachedData = peerView.cachedData as? CachedGroupData {
|
||||
updateActivity(true)
|
||||
let foundGroupMembers: Signal<[RenderedChannelParticipant], NoError>
|
||||
let foundMembers: Signal<[RenderedChannelParticipant], NoError>
|
||||
@ -1043,39 +1043,6 @@ public final class ChannelMembersSearchContainerNode: SearchDisplayControllerCon
|
||||
section = .none
|
||||
}
|
||||
|
||||
var canPromote: Bool = false
|
||||
var canRestrict: Bool = false
|
||||
/*switch participant.participant {
|
||||
case .creator:
|
||||
canPromote = false
|
||||
canRestrict = false
|
||||
case let .member(_, _, adminRights, bannedRights):
|
||||
if channel.hasPermission(.addAdmins) {
|
||||
canPromote = true
|
||||
} else {
|
||||
canPromote = false
|
||||
}
|
||||
if channel.hasPermission(.banMembers) {
|
||||
canRestrict = true
|
||||
} else {
|
||||
canRestrict = false
|
||||
}
|
||||
if canPromote {
|
||||
if let bannedRights = bannedRights {
|
||||
if bannedRights.restrictedBy != account.peerId && !channel.flags.contains(.isCreator) {
|
||||
canPromote = false
|
||||
}
|
||||
}
|
||||
}
|
||||
if canRestrict {
|
||||
if let adminRights = adminRights {
|
||||
if adminRights.promotedBy != account.peerId && !channel.flags.contains(.isCreator) {
|
||||
canRestrict = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
var label: String?
|
||||
var enabled = true
|
||||
if case .banAndPromoteActions = mode {
|
||||
@ -1087,8 +1054,8 @@ public final class ChannelMembersSearchContainerNode: SearchDisplayControllerCon
|
||||
switch participant.participant {
|
||||
case .creator:
|
||||
label = presentationData.strings.Channel_Management_LabelOwner
|
||||
case let .member(member):
|
||||
if member.adminInfo != nil {
|
||||
case let .member(_, _, adminInfo, _, _):
|
||||
if adminInfo != nil {
|
||||
label = presentationData.strings.Channel_Management_LabelEditor
|
||||
}
|
||||
}
|
||||
@ -1098,17 +1065,6 @@ public final class ChannelMembersSearchContainerNode: SearchDisplayControllerCon
|
||||
enabled = false
|
||||
}
|
||||
|
||||
var peerActions: [ParticipantRevealAction] = []
|
||||
/*if case .searchMembers = mode {
|
||||
if canPromote {
|
||||
peerActions.append(ParticipantRevealAction(type: .neutral, title: presentationData.strings.GroupInfo_ActionPromote, action: .promote))
|
||||
}
|
||||
if canRestrict {
|
||||
peerActions.append(ParticipantRevealAction(type: .warning, title: presentationData.strings.GroupInfo_ActionRestrict, action: .restrict))
|
||||
peerActions.append(ParticipantRevealAction(type: .destructive, title: presentationData.strings.Common_Delete, action: .remove))
|
||||
}
|
||||
}*/
|
||||
|
||||
switch mode {
|
||||
case .searchAdmins:
|
||||
switch participant.participant {
|
||||
@ -1155,7 +1111,7 @@ public final class ChannelMembersSearchContainerNode: SearchDisplayControllerCon
|
||||
default:
|
||||
break
|
||||
}
|
||||
entries.append(ChannelMembersSearchEntry(index: index, content: .participant(participant: participant, label: label, revealActions: peerActions, revealed: state.revealedPeerId == RevealedPeerId(peerId: participant.peer.id, section: section), enabled: enabled), section: section, dateTimeFormat: presentationData.dateTimeFormat))
|
||||
entries.append(ChannelMembersSearchEntry(index: index, content: .participant(participant: participant, label: label, revealActions: [], revealed: state.revealedPeerId == RevealedPeerId(peerId: participant.peer.id, section: section), enabled: enabled), section: section, dateTimeFormat: presentationData.dateTimeFormat))
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
|
@ -680,11 +680,6 @@ public func channelPermissionsController(context: AccountContext, peerId origina
|
||||
|
||||
removePeerDisposable.set((context.peerChannelMemberCategoriesContextsManager.updateMemberBannedRights(engine: context.engine, peerId: peerId, memberId: memberId, bannedRights: nil)
|
||||
|> deliverOnMainQueue).start(error: { _ in
|
||||
updateState { state in
|
||||
var state = state
|
||||
state.removingPeerId = nil
|
||||
return state
|
||||
}
|
||||
}, completed: {
|
||||
updateState { state in
|
||||
var state = state
|
||||
|
@ -251,7 +251,7 @@ class ChatSlowmodeItemNode: ListViewItemNode {
|
||||
let _ = apply()
|
||||
}
|
||||
|
||||
var textNodes: [(TextNode, CGSize)] = textLayoutAndApply.map { layout, apply -> (TextNode, CGSize) in
|
||||
let textNodes: [(TextNode, CGSize)] = textLayoutAndApply.map { layout, apply -> (TextNode, CGSize) in
|
||||
let node = apply()
|
||||
return (node, layout.size)
|
||||
}
|
||||
|
@ -79,13 +79,13 @@ private enum ConvertToSupergroupEntry: ItemListNodeEntry {
|
||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! ConvertToSupergroupArguments
|
||||
switch self {
|
||||
case let .info(theme, text):
|
||||
case let .info(_, text):
|
||||
return ItemListTextItem(presentationData: presentationData, text: .markdown(text), sectionId: self.section)
|
||||
case let .action(theme, title):
|
||||
case let .action(_, title):
|
||||
return ItemListActionItem(presentationData: presentationData, title: title, kind: .generic, alignment: .natural, sectionId: self.section, style: .blocks, action: {
|
||||
arguments.convert()
|
||||
})
|
||||
case let .actionInfo(theme, text):
|
||||
case let .actionInfo(_, text):
|
||||
return ItemListTextItem(presentationData: presentationData, text: .markdown(text), sectionId: self.section)
|
||||
}
|
||||
}
|
||||
|
@ -312,8 +312,8 @@ private enum DeviceContactInfoEntry: ItemListNodeEntry {
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .address(lhsIndex, lhsCatIndex, lhsTheme, lhsTitle, lhsValue, lhsImageSignal, lhsSelected):
|
||||
if case let .address(rhsIndex, rhsCatIndex, rhsTheme, rhsTitle, rhsValue, rhsImageSignal, rhsSelected) = rhs, lhsIndex == rhsIndex, lhsCatIndex == rhsCatIndex, lhsTheme === rhsTheme, lhsTitle == rhsTitle, lhsValue == rhsValue, lhsSelected == rhsSelected {
|
||||
case let .address(lhsIndex, lhsCatIndex, lhsTheme, lhsTitle, lhsValue, _, lhsSelected):
|
||||
if case let .address(rhsIndex, rhsCatIndex, rhsTheme, rhsTitle, rhsValue, _, rhsSelected) = rhs, lhsIndex == rhsIndex, lhsCatIndex == rhsCatIndex, lhsTheme === rhsTheme, lhsTitle == rhsTitle, lhsValue == rhsValue, lhsSelected == rhsSelected {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@ -439,7 +439,7 @@ private enum DeviceContactInfoEntry: ItemListNodeEntry {
|
||||
})
|
||||
case let .phoneNumberShareViaExceptionInfo(_, _, text):
|
||||
return ItemListTextItem(presentationData: presentationData, text: .markdown(text), sectionId: self.section)
|
||||
case let .editingPhoneNumber(_, _, strings, id, title, label, value, hasActiveRevealControls):
|
||||
case let .editingPhoneNumber(_, _, _, id, title, label, value, hasActiveRevealControls):
|
||||
return UserInfoEditingPhoneItem(presentationData: presentationData, id: id, label: title, value: value, editing: UserInfoEditingPhoneItemEditing(editable: true, hasActiveRevealControls: hasActiveRevealControls), sectionId: self.section, setPhoneIdWithRevealedOptions: { lhs, rhs in
|
||||
arguments.setPhoneIdWithRevealedOptions(lhs, rhs)
|
||||
}, updated: { value in
|
||||
@ -1002,11 +1002,6 @@ public func deviceContactInfoController(context: AccountContext, subject: Device
|
||||
case .createContact:
|
||||
pushControllerImpl?(deviceContactInfoController(context: context, subject: .create(peer: subject.peer, contactData: subject.contactData, isSharing: false, shareViaException: false, completion: { peer, stableId, contactData in
|
||||
dismissImpl?(false)
|
||||
if let peer = peer {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}), completed: nil, cancelled: nil))
|
||||
case .addToExisting:
|
||||
addToExistingImpl?()
|
||||
@ -1139,7 +1134,6 @@ public func deviceContactInfoController(context: AccountContext, subject: Device
|
||||
if share, let peer = peer {
|
||||
return context.engine.contacts.addContactInteractively(peerId: peer.id, firstName: composedContactData.basicData.firstName, lastName: composedContactData.basicData.lastName, phoneNumber: filteredPhoneNumbers.first?.value ?? "", addToPrivacyExceptions: shareViaException && addToPrivacyExceptions)
|
||||
|> mapToSignal { _ -> Signal<(DeviceContactStableId, DeviceContactExtendedData, Peer?)?, AddContactError> in
|
||||
return .complete()
|
||||
}
|
||||
|> then(
|
||||
context.account.postbox.transaction { transaction -> (DeviceContactStableId, DeviceContactExtendedData, Peer?)? in
|
||||
@ -1401,12 +1395,7 @@ func addContactOptionsController(context: AccountContext, peer: Peer?, contactDa
|
||||
controller.setItemGroups([
|
||||
ActionSheetItemGroup(items: [
|
||||
ActionSheetButtonItem(title: presentationData.strings.Profile_CreateNewContact, action: { [weak controller] in
|
||||
controller?.present(context.sharedContext.makeDeviceContactInfoController(context: context, subject: .create(peer: peer, contactData: contactData, isSharing: peer != nil, shareViaException: false, completion: { peer, stableId, contactData in
|
||||
if let peer = peer {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
controller?.present(context.sharedContext.makeDeviceContactInfoController(context: context, subject: .create(peer: peer, contactData: contactData, isSharing: peer != nil, shareViaException: false, completion: { _, _, _ in
|
||||
}), completed: nil, cancelled: nil), in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||
dismissAction()
|
||||
}),
|
||||
|
@ -80,17 +80,17 @@ private enum GroupPreHistorySetupEntry: ItemListNodeEntry {
|
||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! GroupPreHistorySetupArguments
|
||||
switch self {
|
||||
case let .header(theme, text):
|
||||
case let .header(_, text):
|
||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||
case let .visible(theme, text, value):
|
||||
case let .visible(_, text, value):
|
||||
return ItemListCheckboxItem(presentationData: presentationData, title: text, style: .left, checked: value, zeroSeparatorInsets: false, sectionId: self.section, action: {
|
||||
arguments.toggle(true)
|
||||
})
|
||||
case let .hidden(theme, text, value):
|
||||
case let .hidden(_, text, value):
|
||||
return ItemListCheckboxItem(presentationData: presentationData, title: text, style: .left, checked: value, zeroSeparatorInsets: false, sectionId: self.section, action: {
|
||||
arguments.toggle(false)
|
||||
})
|
||||
case let .info(theme, text):
|
||||
case let .info(_, text):
|
||||
return ItemListTextItem(presentationData: presentationData, text: .markdown(text), sectionId: self.section)
|
||||
}
|
||||
}
|
||||
|
@ -182,8 +182,8 @@ class GroupStickerPackCurrentItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
var file: TelegramMediaFile?
|
||||
var previousFile: TelegramMediaFile?
|
||||
if let currentItem = currentItem, case let .found(found) = currentItem.content {
|
||||
previousFile = found.topItem?.file
|
||||
if let currentItem = currentItem, case let .found(_, topItem, _) = currentItem.content {
|
||||
previousFile = topItem?.file
|
||||
}
|
||||
|
||||
switch item.content {
|
||||
|
@ -38,15 +38,6 @@ private enum GroupStickerPackEntryId: Hashable {
|
||||
case index(Int32)
|
||||
case pack(ItemCollectionId)
|
||||
|
||||
var hashValue: Int {
|
||||
switch self {
|
||||
case let .index(index):
|
||||
return index.hashValue
|
||||
case let .pack(id):
|
||||
return id.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
static func ==(lhs: GroupStickerPackEntryId, rhs: GroupStickerPackEntryId) -> Bool {
|
||||
switch lhs {
|
||||
case let .index(index):
|
||||
@ -240,8 +231,8 @@ private enum GroupStickerPackEntry: ItemListNodeEntry {
|
||||
})
|
||||
case let .currentPack(_, theme, strings, content):
|
||||
return GroupStickerPackCurrentItem(theme: theme, strings: strings, account: arguments.account, content: content, sectionId: self.section, action: {
|
||||
if case let .found(found) = content {
|
||||
arguments.openStickerPack(found.packInfo)
|
||||
if case let .found(packInfo, _, _) = content {
|
||||
arguments.openStickerPack(packInfo)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ private final class OldChannelsActionPanelNode: ASDisplayNode {
|
||||
|
||||
transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: layout.size.width, height: UIScreenPixel)))
|
||||
|
||||
self.buttonNode.updateLayout(width: layout.size.width - sideInset * 2.0, transition: transition)
|
||||
let _ = self.buttonNode.updateLayout(width: layout.size.width - sideInset * 2.0, transition: transition)
|
||||
transition.updateFrame(node: self.buttonNode, frame: CGRect(origin: CGPoint(x: sideInset, y: verticalInset), size: CGSize(width: layout.size.width, height: buttonHeight)))
|
||||
|
||||
return buttonHeight + verticalInset * 2.0 + insets.bottom
|
||||
|
@ -20,7 +20,6 @@ final class PeerBanTimeoutController: ActionSheetController {
|
||||
|
||||
init(context: AccountContext, currentValue: Int32, applyValue: @escaping (Int32?) -> Void) {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let theme = presentationData.theme
|
||||
let strings = presentationData.strings
|
||||
|
||||
super.init(theme: ActionSheetControllerTheme(presentationData: presentationData))
|
||||
|
@ -117,7 +117,7 @@ public func presentPeerReportOptions(context: AccountContext, parent: ViewContro
|
||||
displaySuccess()
|
||||
completion(nil, false)
|
||||
})
|
||||
case let .profilePhoto(peerId, photoId):
|
||||
case let .profilePhoto(peerId, _):
|
||||
let _ = (context.engine.peers.reportPeerPhoto(peerId: peerId, reason: reportReason, message: "")
|
||||
|> deliverOnMainQueue).start(completed: {
|
||||
displaySuccess()
|
||||
@ -243,7 +243,7 @@ public func peerReportOptionsController(context: AccountContext, subject: PeerRe
|
||||
displaySuccess()
|
||||
completion(nil, true)
|
||||
})
|
||||
case let .profilePhoto(peerId, photoId):
|
||||
case let .profilePhoto(peerId, _):
|
||||
let _ = (context.engine.peers.reportPeerPhoto(peerId: peerId, reason: reportReason, message: message)
|
||||
|> deliverOnMainQueue).start(completed: {
|
||||
displaySuccess()
|
||||
|
@ -59,7 +59,7 @@ private enum PhoneLabelEntry: ItemListNodeEntry {
|
||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! PhoneLabelArguments
|
||||
switch self {
|
||||
case let .label(_, theme, value, text, selected):
|
||||
case let .label(_, _, value, text, selected):
|
||||
return ItemListCheckboxItem(presentationData: presentationData, title: text, style: .left, checked: selected, zeroSeparatorInsets: false, sectionId: self.section, action: {
|
||||
arguments.selectLabel(value)
|
||||
})
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
|
@ -387,52 +387,8 @@ private final class ContextControllerContentSourceImpl: ContextControllerContent
|
||||
}
|
||||
|
||||
private func peerNearbyContextMenuItems(context: AccountContext, peerId: PeerId, present: @escaping (ViewController) -> Void) -> Signal<[ContextMenuItem], NoError> {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with({ $0 })
|
||||
return context.account.postbox.transaction { transaction -> [ContextMenuItem] in
|
||||
var items: [ContextMenuItem] = []
|
||||
//
|
||||
// let peer = transaction.getPeer(peerId)
|
||||
//
|
||||
// if let peer = peer as? TelegramUser {
|
||||
// items.append(.action(ContextMenuActionItem(text: presentationData.strings.ChatList_Context_AddToContacts, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Add"), color: theme.contextMenu.primaryColor) }, action: { _, f in
|
||||
// f(.default)
|
||||
// })))
|
||||
// } else {
|
||||
// items.append(.action(ContextMenuActionItem(text: presentationData.strings.PeopleNearby_Context_JoinGroup, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Add"), color: theme.contextMenu.primaryColor) }, action: { _, f in
|
||||
// let _ = (joinChannel(account: context.account, peerId: peerId) |> deliverOnMainQueue).start(next: { participant in
|
||||
// f(.default)
|
||||
// }, error: { error in
|
||||
//// if let strongSelf = self {
|
||||
//// if case .tooMuchJoined = error {
|
||||
//// if let parentNavigationController = strongSelf.parentNavigationController {
|
||||
//// let context = strongSelf.context
|
||||
//// let link = strongSelf.link
|
||||
//// let navigateToPeer = strongSelf.navigateToPeer
|
||||
//// let resolvedState = strongSelf.resolvedState
|
||||
//// parentNavigationController.pushViewController(oldChannelsController(context: strongSelf.context, intent: .join, completed: { [weak parentNavigationController] value in
|
||||
//// if value {
|
||||
//// (parentNavigationController?.viewControllers.last as? ViewController)?.present(JoinLinkPreviewController(context: context, link: link, navigateToPeer: navigateToPeer, parentNavigationController: parentNavigationController, resolvedState: resolvedState), in: .window(.root))
|
||||
//// }
|
||||
//// }))
|
||||
//// } else {
|
||||
//// strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.Join_ChannelsTooMuch, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||
//// }
|
||||
//// strongSelf.dismiss()
|
||||
//// }
|
||||
//// }
|
||||
// })
|
||||
// })))
|
||||
//
|
||||
// items.append(.action(ContextMenuActionItem(text: presentationData.strings.PeopleNearby_Context_UnrelatedLocation, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Report"), color: theme.contextMenu.primaryColor) }, action: { _, f in
|
||||
// let _ = (TelegramCore.reportPeer(account: context.account, peerId: peerId, reason: .irrelevantLocation)
|
||||
// |> deliverOnMainQueue).start(completed: {
|
||||
// let _ = ApplicationSpecificNotice.setIrrelevantPeerGeoReport(postbox: context.account.postbox, peerId: peerId).start()
|
||||
//
|
||||
// present(textAlertController(context: context, title: nil, text: presentationData.strings.ReportPeer_AlertSuccess, actions: [TextAlertAction(type: TextAlertActionType.defaultAction, title: presentationData.strings.Common_OK, action: {})]))
|
||||
// })
|
||||
// f(.default)
|
||||
// })))
|
||||
// }
|
||||
return context.account.postbox.transaction { _ -> [ContextMenuItem] in
|
||||
let items: [ContextMenuItem] = []
|
||||
|
||||
return items
|
||||
}
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
|
@ -82,7 +82,7 @@ extension String {
|
||||
var pureNumber = self.replacingOccurrences( of: "[^0-9]", with: "", options: .regularExpression)
|
||||
for index in 0 ..< pattern.count {
|
||||
guard index < pureNumber.count else { return pureNumber }
|
||||
let stringIndex = String.Index(encodedOffset: index)
|
||||
let stringIndex = pattern.index(pattern.startIndex, offsetBy: index)
|
||||
let patternCharacter = pattern[stringIndex]
|
||||
guard patternCharacter != replacementCharacter else { continue }
|
||||
pureNumber.insert(patternCharacter, at: stringIndex)
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/libphonenumber:libphonenumber",
|
||||
],
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/Postbox:Postbox",
|
||||
|
@ -1745,8 +1745,7 @@ public func chatWebpageSnippetFileData(account: Account, fileReference: FileMedi
|
||||
let disposable = DisposableSet()
|
||||
disposable.add(resourceData.start(next: { data in
|
||||
subscriber.putNext(data)
|
||||
}, error: { error in
|
||||
subscriber.putError(error)
|
||||
}, error: { _ in
|
||||
}, completed: {
|
||||
subscriber.putCompletion()
|
||||
}))
|
||||
@ -1766,8 +1765,7 @@ public func chatWebpageSnippetPhotoData(account: Account, photoReference: ImageM
|
||||
let disposable = DisposableSet()
|
||||
disposable.add(resourceData.start(next: { data in
|
||||
subscriber.putNext(data)
|
||||
}, error: { error in
|
||||
subscriber.putError(error)
|
||||
}, error: { _ in
|
||||
}, completed: {
|
||||
subscriber.putCompletion()
|
||||
}))
|
||||
@ -2186,7 +2184,6 @@ public func chatMessageImageFile(account: Account, fileReference: FileMediaRefer
|
||||
public func instantPageImageFile(account: Account, fileReference: FileMediaReference, fetched: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> {
|
||||
return chatMessageFileDatas(account: account, fileReference: fileReference, progressive: false, fetched: fetched)
|
||||
|> map { value in
|
||||
let thumbnailData = value._0
|
||||
let fullSizePath = value._1
|
||||
let fullSizeComplete = value._2
|
||||
return { arguments in
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
],
|
||||
|
@ -6,6 +6,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
|
@ -4,7 +4,6 @@ import AlertUI
|
||||
import AccountContext
|
||||
import SwiftSignalKit
|
||||
import ItemListUI
|
||||
import PresentationDataUtils
|
||||
|
||||
public extension ItemListController {
|
||||
convenience init<ItemGenerationArguments>(context: AccountContext, state: Signal<(ItemListControllerState, (ItemListNodeState, ItemGenerationArguments)), NoError>, tabBarItem: Signal<ItemListControllerTabBarItem, NoError>? = nil) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user