From 31bc74698421c5ce98ba95bfa23499db36d37468 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Thu, 5 Aug 2021 01:42:59 +0200 Subject: [PATCH] Fix more warnings --- submodules/LegacyMediaPickerUI/BUILD | 2 +- .../Sources/LegacyAttachmentMenu.swift | 14 +- .../Sources/LegacyMediaPickers.swift | 2 +- .../Sources/LegacyPaintStickersContext.swift | 10 +- .../Sources/LegacySuggestionContext.swift | 18 +- submodules/LegacyUI/BUILD | 3 + .../LegacyUI/Sources/LegacyController.swift | 2 +- submodules/LightweightAccountData/BUILD | 3 + submodules/ListMessageItem/BUILD | 3 + submodules/ListSectionHeaderNode/BUILD | 3 + submodules/LiveLocationManager/BUILD | 3 + submodules/LiveLocationPositionNode/BUILD | 3 + submodules/LiveLocationTimerNode/BUILD | 3 + submodules/LocalAuth/BUILD | 3 + submodules/LocalMediaResources/BUILD | 3 + submodules/LocalizedPeerData/BUILD | 3 + submodules/LocationResources/BUILD | 3 + .../Sources/MapResources.swift | 1 - submodules/LocationUI/BUILD | 3 + .../LocationDistancePickerScreen.swift | 6 +- .../Sources/LocationInfoListItem.swift | 2 - .../LocationUI/Sources/LocationMapNode.swift | 2 +- .../Sources/LocationPickerController.swift | 4 +- .../LocationPickerControllerNode.swift | 2 +- .../Sources/LocationViewController.swift | 8 +- submodules/ManagedAnimationNode/BUILD | 3 + submodules/MapResourceToAvatarSizes/BUILD | 3 + submodules/Markdown/BUILD | 3 + submodules/MediaPlayer/BUILD | 3 + .../FFMpegMediaFrameSourceContext.swift | 7 - .../Sources/MediaPlayerAudioRenderer.swift | 10 +- .../MediaPlayer/Sources/MediaPlayerNode.swift | 5 +- .../Sources/MediaPlayerScrubbingNode.swift | 4 +- .../MediaPlayer/Sources/RingByteBuffer.swift | 5 +- .../UniversalSoftwareVideoSource.swift | 5 +- submodules/MediaResources/BUILD | 3 + submodules/MergeLists/BUILD | 3 + submodules/MosaicLayout/BUILD | 3 + .../ChatMessageBubbleMosaicLayout.swift | 1 - submodules/MusicAlbumArtResources/BUILD | 3 + submodules/NotificationMuteSettingsUI/BUILD | 3 + submodules/NotificationSoundSelectionUI/BUILD | 3 + .../Sources/NotificationSoundSelection.swift | 10 +- .../NotificationsPresentationData/BUILD | 3 + submodules/OpenInExternalAppUI/BUILD | 3 + .../Sources/OpenInActionSheetController.swift | 1 - submodules/OverlayStatusController/BUILD | 3 + submodules/PasscodeInputFieldNode/BUILD | 3 + submodules/PasscodeUI/BUILD | 3 + .../Sources/PasscodeEntryControllerNode.swift | 4 +- .../Sources/PasscodeEntryKeyboardNode.swift | 11 +- submodules/PassportUI/BUILD | 3 + .../Sources/SecureIdAuthController.swift | 10 +- .../SecureIdDocumentFormControllerNode.swift | 2 +- ...ureIdDocumentTypeSelectionController.swift | 1 - .../Sources/SecureIdLocalResource.swift | 10 +- ...SecureIdVerificationDocumentsContext.swift | 5 +- submodules/PasswordSetupUI/BUILD | 3 + .../Sources/ManagedMonkeyAnimationNode.swift | 2 +- .../Sources/ResetPasswordController.swift | 2 +- ...tupTwoStepVerificationControllerNode.swift | 2 +- submodules/Pdf/BUILD | 3 + submodules/PeerAvatarGalleryUI/BUILD | 3 + .../Sources/AvatarGalleryController.swift | 24 +- .../Sources/PeerAvatarImageGalleryItem.swift | 10 +- submodules/PeerInfoAvatarListNode/BUILD | 3 + .../Sources/PeerInfoAvatarListNode.swift | 13 +- submodules/PeerInfoUI/BUILD | 3 + .../Sources/ChannelAdminController.swift | 86 +--- .../Sources/ChannelAdminsController.swift | 38 +- .../ChannelBannedMemberController.swift | 46 +-- .../Sources/ChannelBlacklistController.swift | 14 +- ...hannelDiscussionGroupSetupController.swift | 3 - .../Sources/ChannelMembersController.swift | 26 -- .../ChannelMembersSearchContainerNode.swift | 56 +-- .../ChannelPermissionsController.swift | 5 - .../PeerInfoUI/Sources/ChatSlowmodeItem.swift | 2 +- .../ConvertToSupergroupController.swift | 6 +- .../Sources/DeviceContactInfoController.swift | 19 +- .../GroupPreHistorySetupController.swift | 8 +- .../Sources/GroupStickerPackCurrentItem.swift | 4 +- .../GroupStickerPackSetupController.swift | 13 +- .../Sources/OldChannelsController.swift | 2 +- .../Sources/PeerBanTimeoutController.swift | 1 - .../Sources/PeerReportController.swift | 4 +- .../Sources/PhoneLabelController.swift | 2 +- submodules/PeerOnlineMarkerNode/BUILD | 3 + submodules/PeerPresenceStatusManager/BUILD | 3 + submodules/PeersNearbyIconNode/BUILD | 3 + submodules/PeersNearbyUI/BUILD | 3 + .../Sources/PeersNearbyController.swift | 48 +-- submodules/PersistentStringHash/BUILD | 3 + submodules/PhoneInputNode/BUILD | 3 + .../Sources/PhoneInputNode.swift | 2 +- submodules/PhoneNumberFormat/BUILD | 3 + submodules/PhotoResources/BUILD | 3 + .../Sources/PhotoResources.swift | 7 +- submodules/PlatformRestrictionMatching/BUILD | 3 + submodules/PresentationDataUtils/BUILD | 3 + .../Sources/ItemListController.swift | 1 - submodules/ProgressNavigationButtonNode/BUILD | 3 + submodules/QrCode/BUILD | 3 + submodules/RadialStatusNode/BUILD | 3 + submodules/Reachability/BUILD | 3 + submodules/ReactionSelectionNode/BUILD | 3 + .../Sources/ReactionContextNode.swift | 11 +- .../Sources/ReactionSelectionNode.swift | 6 +- .../ReactionSwipeGestureRecognizer.swift | 2 +- submodules/SSignalKit/SSignalKit/BUILD | 3 + .../SSignalKit/Source/SSignalKit/SAtomic.h | 12 +- .../SSignalKit/Source/SSignalKit/SBag.h | 6 +- .../Source/SSignalKit/SBlockDisposable.h | 2 +- .../Source/SSignalKit/SDisposableSet.h | 4 +- .../Source/SSignalKit/SMetaDisposable.h | 2 +- .../SSignalKit/SMulticastSignalManager.h | 8 +- .../SSignalKit/Source/SSignalKit/SQueue.h | 16 +- .../Source/SSignalKit/SQueueLocalObject.m | 8 +- .../Source/SSignalKit/SSignal+Accumulate.h | 4 +- .../Source/SSignalKit/SSignal+Catch.h | 6 +- .../Source/SSignalKit/SSignal+Combine.h | 6 +- .../Source/SSignalKit/SSignal+Dispatch.h | 10 +- .../Source/SSignalKit/SSignal+Mapping.h | 6 +- .../Source/SSignalKit/SSignal+Meta.h | 18 +- .../Source/SSignalKit/SSignal+Multicast.h | 2 +- .../Source/SSignalKit/SSignal+Pipe.h | 6 +- .../Source/SSignalKit/SSignal+SideEffects.h | 14 +- .../Source/SSignalKit/SSignal+Single.h | 8 +- .../Source/SSignalKit/SSignal+Take.h | 6 +- .../Source/SSignalKit/SSignal+Timing.h | 6 +- .../SSignalKit/Source/SSignalKit/SSignal.h | 12 +- .../Source/SSignalKit/SSubscriber.h | 12 +- .../Source/SSignalKit/SThreadPool.h | 8 +- .../Source/SSignalKit/SThreadPoolQueue.h | 6 +- .../Source/SSignalKit/SThreadPoolTask.h | 2 +- .../SSignalKit/Source/SSignalKit/STimer.h | 4 +- .../SSignalKit/Source/SSignalKit/SVariable.h | 6 +- submodules/SSignalKit/SwiftSignalKit/BUILD | 3 + .../SwiftSignalKit/Source/Disposable.swift | 2 +- .../SwiftSignalKit/Source/Multicast.swift | 3 - .../Source/Signal_Materialize.swift | 1 - submodules/SaveToCameraRoll/BUILD | 3 + submodules/ScreenCaptureDetection/BUILD | 3 + submodules/SearchBarNode/BUILD | 3 + submodules/SearchPeerMembers/BUILD | 3 + submodules/SearchUI/BUILD | 3 + submodules/SectionHeaderItem/BUILD | 3 + submodules/SegmentedControlNode/BUILD | 3 + submodules/SelectablePeerNode/BUILD | 3 + submodules/SemanticStatusNode/BUILD | 3 + .../Sources/SemanticStatusNode.swift | 2 +- submodules/ShareController/BUILD | 3 + .../Sources/ShareContentContainerNode.swift | 2 +- .../Sources/ShareController.swift | 18 +- .../Sources/ShareControllerPeerGridItem.swift | 2 +- .../Sources/ShareSearchContainerNode.swift | 9 - submodules/ShareItems/BUILD | 3 + .../ShareItems/Sources/ShareItems.swift | 9 +- submodules/ShimmerEffect/BUILD | 3 + .../Sources/StickerShimmerEffectNode.swift | 3 + submodules/SinglePhoneInputNode/BUILD | 3 + submodules/SlotMachineAnimationNode/BUILD | 3 + submodules/SolidRoundedButtonNode/BUILD | 3 + submodules/Speak/BUILD | 3 + submodules/StatisticsUI/BUILD | 3 + .../Sources/StatsMessageItem.swift | 4 +- submodules/StickerPackPreviewUI/BUILD | 3 + .../StickerPackPreviewController.swift | 1 - .../StickerPackPreviewControllerNode.swift | 13 +- .../Sources/StickerPackScreen.swift | 2 +- submodules/StickerResources/BUILD | 3 + .../Sources/StickerResources.swift | 12 +- submodules/StringPluralization/BUILD | 3 + submodules/SwipeToDismissGesture/BUILD | 3 + submodules/SwitchNode/BUILD | 3 + submodules/TelegramAnimatedStickerNode/BUILD | 3 + .../Sources/AnimatedStickerUtils.swift | 13 +- submodules/TelegramAudio/BUILD | 3 + .../Sources/ManagedAudioSession.swift | 6 +- submodules/TelegramBaseController/BUILD | 3 + submodules/TelegramCallsUI/BUILD | 3 + .../Sources/CallController.swift | 2 +- .../Sources/CallControllerButton.swift | 2 +- .../Sources/CallStatusBarNode.swift | 1 - .../Sources/PresentationCall.swift | 5 +- .../Sources/PresentationGroupCall.swift | 1 - .../Sources/VoiceChatController.swift | 8 +- .../VoiceChatFullscreenParticipantItem.swift | 4 +- .../Sources/VoiceChatParticipantItem.swift | 2 +- .../Sources/VoiceChatPeerProfileNode.swift | 1 - .../VoiceChatShareScreenContextItem.swift | 1 - .../SyncCore_TelegramChatAdminRights.swift | 2 +- .../SyncCore_TelegramChatBannedRights.swift | 2 +- submodules/TelegramIntents/BUILD | 3 + submodules/TelegramNotices/BUILD | 3 + submodules/TelegramPermissions/BUILD | 3 + submodules/TelegramPermissionsUI/BUILD | 3 + submodules/TelegramPresentationData/BUILD | 3 + .../ChatControllerBackgroundNode.swift | 36 +- .../Sources/ChatMessageBubbleImages.swift | 1 - .../Sources/ChatPresentationData.swift | 1 - .../DefaultDarkPresentationTheme.swift | 1 - .../Sources/PresentationData.swift | 24 +- .../Sources/PresentationThemeCodable.swift | 28 +- .../Sources/WallpaperUtils.swift | 8 +- submodules/TelegramStringFormatting/BUILD | 3 + ...uthorizationSequenceSplashController.swift | 4 +- .../Sources/CreateChannelController.swift | 6 +- .../Sources/CreateGroupController.swift | 6 +- .../Sources/FetchVideoMediaResource.swift | 6 +- .../Sources/PeerInfo/PeerInfoScreen.swift | 6 +- submodules/TelegramUIPreferences/BUILD | 3 + .../Sources/CallListSettings.swift | 2 - .../Sources/PresentationThemeSettings.swift | 2 +- .../TelegramUniversalVideoContent/BUILD | 3 + .../Sources/OverlayVideoDecoration.swift | 45 +- .../Sources/PlatformVideoContent.swift | 4 +- .../UniversalVideoContentManager.swift | 2 +- .../Sources/VimeoEmbedImplementation.swift | 2 + .../Sources/YoutubeEmbedImplementation.swift | 3 + submodules/TelegramUpdateUI/BUILD | 3 + submodules/TelegramVoip/BUILD | 3 + .../TemporaryCachedPeerDataManager/BUILD | 3 + submodules/TextFormat/BUILD | 3 + submodules/TextSelectionNode/BUILD | 3 + .../Sources/TextSelectionNode.swift | 5 +- submodules/TinyThumbnail/BUILD | 3 + .../TinyThumbnail/Sources/TinyThumbnail.swift | 7 +- submodules/TooltipUI/BUILD | 3 + submodules/TouchDownGesture/BUILD | 3 + submodules/Tuples/BUILD | 3 + submodules/UndoUI/BUILD | 3 + submodules/UrlEscaping/BUILD | 3 + .../UrlEscaping/Sources/UrlEscaping.swift | 7 +- submodules/UrlHandling/BUILD | 3 + .../UrlHandling/Sources/UrlHandling.swift | 8 +- submodules/UrlWhitelist/BUILD | 3 + submodules/WallpaperBackgroundNode/BUILD | 1 + submodules/WallpaperResources/BUILD | 3 + .../Sources/WallpaperCache.swift | 4 +- .../Sources/WallpaperResources.swift | 386 ++++++------------ submodules/WatchBridge/BUILD | 3 + .../Sources/WatchRequestHandlers.swift | 48 +-- submodules/WatchBridgeAudio/BUILD | 3 + submodules/WebSearchUI/BUILD | 3 + .../Sources/LegacyWebSearchGallery.swift | 24 +- .../Sources/WebSearchController.swift | 1 - .../Sources/WebSearchControllerNode.swift | 8 - submodules/WebUI/BUILD | 3 + submodules/WebsiteType/BUILD | 3 + submodules/WidgetItems/BUILD | 6 + submodules/WidgetItemsUtils/BUILD | 3 + submodules/WidgetSetupScreen/BUILD | 3 + .../Sources/WidgetSetupScreen.swift | 8 +- 253 files changed, 914 insertions(+), 1063 deletions(-) diff --git a/submodules/LegacyMediaPickerUI/BUILD b/submodules/LegacyMediaPickerUI/BUILD index f148332d77..ddc196895b 100644 --- a/submodules/LegacyMediaPickerUI/BUILD +++ b/submodules/LegacyMediaPickerUI/BUILD @@ -7,7 +7,7 @@ swift_library( "Sources/**/*.swift", ]), copts = [ - #"-warnings-as-errors", + "-warnings-as-errors", ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", diff --git a/submodules/LegacyMediaPickerUI/Sources/LegacyAttachmentMenu.swift b/submodules/LegacyMediaPickerUI/Sources/LegacyAttachmentMenu.swift index 66f5c574bd..31b075faef 100644 --- a/submodules/LegacyMediaPickerUI/Sources/LegacyAttachmentMenu.swift +++ b/submodules/LegacyMediaPickerUI/Sources/LegacyAttachmentMenu.swift @@ -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}, {}) diff --git a/submodules/LegacyMediaPickerUI/Sources/LegacyMediaPickers.swift b/submodules/LegacyMediaPickerUI/Sources/LegacyMediaPickers.swift index 1ada13b310..ac2e9e55b6 100644 --- a/submodules/LegacyMediaPickerUI/Sources/LegacyMediaPickers.swift +++ b/submodules/LegacyMediaPickerUI/Sources/LegacyMediaPickers.swift @@ -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) } diff --git a/submodules/LegacyMediaPickerUI/Sources/LegacyPaintStickersContext.swift b/submodules/LegacyMediaPickerUI/Sources/LegacyPaintStickersContext.swift index e5cf7c86b8..aa9c8c692a 100644 --- a/submodules/LegacyMediaPickerUI/Sources/LegacyPaintStickersContext.swift +++ b/submodules/LegacyMediaPickerUI/Sources/LegacyPaintStickersContext.swift @@ -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) -> 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) -> Void in + data.withUnsafeBytes { buffer -> Void in + guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else { + return + } memcpy(pixelData, bytes, data.count) } } diff --git a/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift b/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift index 6c2fb3f6f8..04ae6c6b7a 100644 --- a/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift +++ b/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift @@ -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 { diff --git a/submodules/LegacyUI/BUILD b/submodules/LegacyUI/BUILD index 6ea7f61ce4..d398f76aed 100644 --- a/submodules/LegacyUI/BUILD +++ b/submodules/LegacyUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", diff --git a/submodules/LegacyUI/Sources/LegacyController.swift b/submodules/LegacyUI/Sources/LegacyController.swift index 5fdeaa4f3a..d0f0bd4dae 100644 --- a/submodules/LegacyUI/Sources/LegacyController.swift +++ b/submodules/LegacyUI/Sources/LegacyController.swift @@ -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 diff --git a/submodules/LightweightAccountData/BUILD b/submodules/LightweightAccountData/BUILD index 2531e648ad..eeda5cc3e0 100644 --- a/submodules/LightweightAccountData/BUILD +++ b/submodules/LightweightAccountData/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/ListMessageItem/BUILD b/submodules/ListMessageItem/BUILD index 79b42b21cd..a7dd3fd0d5 100644 --- a/submodules/ListMessageItem/BUILD +++ b/submodules/ListMessageItem/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/ListSectionHeaderNode/BUILD b/submodules/ListSectionHeaderNode/BUILD index ebfba2dc44..38262bee99 100644 --- a/submodules/ListSectionHeaderNode/BUILD +++ b/submodules/ListSectionHeaderNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/LiveLocationManager/BUILD b/submodules/LiveLocationManager/BUILD index 48ab44440e..9af918155c 100644 --- a/submodules/LiveLocationManager/BUILD +++ b/submodules/LiveLocationManager/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/TelegramCore:TelegramCore", diff --git a/submodules/LiveLocationPositionNode/BUILD b/submodules/LiveLocationPositionNode/BUILD index aeec919f5c..a962112384 100644 --- a/submodules/LiveLocationPositionNode/BUILD +++ b/submodules/LiveLocationPositionNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/LiveLocationTimerNode/BUILD b/submodules/LiveLocationTimerNode/BUILD index 068104c566..46781af862 100644 --- a/submodules/LiveLocationTimerNode/BUILD +++ b/submodules/LiveLocationTimerNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/LocalAuth/BUILD b/submodules/LocalAuth/BUILD index 59d5f7737f..73e432ce8e 100644 --- a/submodules/LocalAuth/BUILD +++ b/submodules/LocalAuth/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", ], diff --git a/submodules/LocalMediaResources/BUILD b/submodules/LocalMediaResources/BUILD index 25bf57a82a..297f8b73d8 100644 --- a/submodules/LocalMediaResources/BUILD +++ b/submodules/LocalMediaResources/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", diff --git a/submodules/LocalizedPeerData/BUILD b/submodules/LocalizedPeerData/BUILD index 8b68782d66..4ab6122d50 100644 --- a/submodules/LocalizedPeerData/BUILD +++ b/submodules/LocalizedPeerData/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Postbox:Postbox", diff --git a/submodules/LocationResources/BUILD b/submodules/LocationResources/BUILD index 90aa14c29d..beedfc749f 100644 --- a/submodules/LocationResources/BUILD +++ b/submodules/LocationResources/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Postbox:Postbox", diff --git a/submodules/LocationResources/Sources/MapResources.swift b/submodules/LocationResources/Sources/MapResources.swift index beaaedc854..1e699daacc 100644 --- a/submodules/LocationResources/Sources/MapResources.swift +++ b/submodules/LocationResources/Sources/MapResources.swift @@ -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 diff --git a/submodules/LocationUI/BUILD b/submodules/LocationUI/BUILD index b004206519..ace157cd67 100644 --- a/submodules/LocationUI/BUILD +++ b/submodules/LocationUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/LocationUI/Sources/LocationDistancePickerScreen.swift b/submodules/LocationUI/Sources/LocationDistancePickerScreen.swift index 05024a4b27..a10f77bf3a 100644 --- a/submodules/LocationUI/Sources/LocationDistancePickerScreen.swift +++ b/submodules/LocationUI/Sources/LocationDistancePickerScreen.swift @@ -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]) diff --git a/submodules/LocationUI/Sources/LocationInfoListItem.swift b/submodules/LocationUI/Sources/LocationInfoListItem.swift index e8dc93c045..6dc9cee3f0 100644 --- a/submodules/LocationUI/Sources/LocationInfoListItem.swift +++ b/submodules/LocationUI/Sources/LocationInfoListItem.swift @@ -230,8 +230,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 diff --git a/submodules/LocationUI/Sources/LocationMapNode.swift b/submodules/LocationUI/Sources/LocationMapNode.swift index 7b77bd64bf..5bdf3a7ef7 100644 --- a/submodules/LocationUI/Sources/LocationMapNode.swift +++ b/submodules/LocationUI/Sources/LocationMapNode.swift @@ -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) } diff --git a/submodules/LocationUI/Sources/LocationPickerController.swift b/submodules/LocationUI/Sources/LocationPickerController.swift index f72261d9ab..9219dbf559 100644 --- a/submodules/LocationUI/Sources/LocationPickerController.swift +++ b/submodules/LocationUI/Sources/LocationPickerController.swift @@ -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 diff --git a/submodules/LocationUI/Sources/LocationPickerControllerNode.swift b/submodules/LocationUI/Sources/LocationPickerControllerNode.swift index 6d0d0b47a4..2787eb5fdf 100644 --- a/submodules/LocationUI/Sources/LocationPickerControllerNode.swift +++ b/submodules/LocationUI/Sources/LocationPickerControllerNode.swift @@ -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 } diff --git a/submodules/LocationUI/Sources/LocationViewController.swift b/submodules/LocationUI/Sources/LocationViewController.swift index 0b45ccfc07..8f212aeed8 100644 --- a/submodules/LocationUI/Sources/LocationViewController.swift +++ b/submodules/LocationUI/Sources/LocationViewController.swift @@ -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() diff --git a/submodules/ManagedAnimationNode/BUILD b/submodules/ManagedAnimationNode/BUILD index a8e059252e..77b05b16f6 100644 --- a/submodules/ManagedAnimationNode/BUILD +++ b/submodules/ManagedAnimationNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Display:Display", "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", diff --git a/submodules/MapResourceToAvatarSizes/BUILD b/submodules/MapResourceToAvatarSizes/BUILD index 0aa34305f4..0db6335885 100644 --- a/submodules/MapResourceToAvatarSizes/BUILD +++ b/submodules/MapResourceToAvatarSizes/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", diff --git a/submodules/Markdown/BUILD b/submodules/Markdown/BUILD index 0faac980c6..f206072b93 100644 --- a/submodules/Markdown/BUILD +++ b/submodules/Markdown/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Source/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/MediaPlayer/BUILD b/submodules/MediaPlayer/BUILD index 8a6d60408d..a13978b14e 100644 --- a/submodules/MediaPlayer/BUILD +++ b/submodules/MediaPlayer/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Postbox:Postbox", diff --git a/submodules/MediaPlayer/Sources/FFMpegMediaFrameSourceContext.swift b/submodules/MediaPlayer/Sources/FFMpegMediaFrameSourceContext.swift index 7663542c92..fd7e2af44a 100644 --- a/submodules/MediaPlayer/Sources/FFMpegMediaFrameSourceContext.swift +++ b/submodules/MediaPlayer/Sources/FFMpegMediaFrameSourceContext.swift @@ -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()) } diff --git a/submodules/MediaPlayer/Sources/MediaPlayerAudioRenderer.swift b/submodules/MediaPlayer/Sources/MediaPlayerAudioRenderer.swift index 9a8d2b6dd3..9e6774bc75 100644 --- a/submodules/MediaPlayer/Sources/MediaPlayerAudioRenderer.swift +++ b/submodules/MediaPlayer/Sources/MediaPlayerAudioRenderer.swift @@ -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) -> 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) -> 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)) } diff --git a/submodules/MediaPlayer/Sources/MediaPlayerNode.swift b/submodules/MediaPlayer/Sources/MediaPlayerNode.swift index d56c56aee9..fb7212b121 100644 --- a/submodules/MediaPlayer/Sources/MediaPlayerNode.swift +++ b/submodules/MediaPlayer/Sources/MediaPlayerNode.swift @@ -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() diff --git a/submodules/MediaPlayer/Sources/MediaPlayerScrubbingNode.swift b/submodules/MediaPlayer/Sources/MediaPlayerScrubbingNode.swift index b97a260cb9..166d6a1b89 100644 --- a/submodules/MediaPlayer/Sources/MediaPlayerScrubbingNode.swift +++ b/submodules/MediaPlayer/Sources/MediaPlayerScrubbingNode.swift @@ -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 } } diff --git a/submodules/MediaPlayer/Sources/RingByteBuffer.swift b/submodules/MediaPlayer/Sources/RingByteBuffer.swift index 7093ce6878..293a91acbf 100644 --- a/submodules/MediaPlayer/Sources/RingByteBuffer.swift +++ b/submodules/MediaPlayer/Sources/RingByteBuffer.swift @@ -17,7 +17,10 @@ public final class RingByteBuffer { } public func enqueue(data: Data) -> Bool { - return data.withUnsafeBytes { (bytes: UnsafePointer) -> 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)) } } diff --git a/submodules/MediaPlayer/Sources/UniversalSoftwareVideoSource.swift b/submodules/MediaPlayer/Sources/UniversalSoftwareVideoSource.swift index 27a0a3f1c6..7317f7fb2e 100644 --- a/submodules/MediaPlayer/Sources/UniversalSoftwareVideoSource.swift +++ b/submodules/MediaPlayer/Sources/UniversalSoftwareVideoSource.swift @@ -48,7 +48,10 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa fetchDisposable.dispose() if let fetchedData = fetchedData { - fetchedData.withUnsafeBytes { (bytes: UnsafePointer) -> 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) diff --git a/submodules/MediaResources/BUILD b/submodules/MediaResources/BUILD index 9bfc65e6e5..16e9f6ac37 100644 --- a/submodules/MediaResources/BUILD +++ b/submodules/MediaResources/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Postbox:Postbox", diff --git a/submodules/MergeLists/BUILD b/submodules/MergeLists/BUILD index b19a43d51f..642b19176d 100644 --- a/submodules/MergeLists/BUILD +++ b/submodules/MergeLists/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/MosaicLayout/BUILD b/submodules/MosaicLayout/BUILD index 27e18bcc11..76cc9fbe05 100644 --- a/submodules/MosaicLayout/BUILD +++ b/submodules/MosaicLayout/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/MosaicLayout/Sources/ChatMessageBubbleMosaicLayout.swift b/submodules/MosaicLayout/Sources/ChatMessageBubbleMosaicLayout.swift index 02cb7925b7..a96c94f818 100644 --- a/submodules/MosaicLayout/Sources/ChatMessageBubbleMosaicLayout.swift +++ b/submodules/MosaicLayout/Sources/ChatMessageBubbleMosaicLayout.swift @@ -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) diff --git a/submodules/MusicAlbumArtResources/BUILD b/submodules/MusicAlbumArtResources/BUILD index e3ea1ddb2b..a975f21fff 100644 --- a/submodules/MusicAlbumArtResources/BUILD +++ b/submodules/MusicAlbumArtResources/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Postbox:Postbox", diff --git a/submodules/NotificationMuteSettingsUI/BUILD b/submodules/NotificationMuteSettingsUI/BUILD index df31e5c424..bb062cc530 100644 --- a/submodules/NotificationMuteSettingsUI/BUILD +++ b/submodules/NotificationMuteSettingsUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Display:Display", "//submodules/Postbox:Postbox", diff --git a/submodules/NotificationSoundSelectionUI/BUILD b/submodules/NotificationSoundSelectionUI/BUILD index 87a3bc9db2..8a0519ab3b 100644 --- a/submodules/NotificationSoundSelectionUI/BUILD +++ b/submodules/NotificationSoundSelectionUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Display:Display", diff --git a/submodules/NotificationSoundSelectionUI/Sources/NotificationSoundSelection.swift b/submodules/NotificationSoundSelectionUI/Sources/NotificationSoundSelection.swift index daa93bd1f6..f58c1f93ee 100644 --- a/submodules/NotificationSoundSelectionUI/Sources/NotificationSoundSelection.swift +++ b/submodules/NotificationSoundSelectionUI/Sources/NotificationSoundSelection.swift @@ -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) }) diff --git a/submodules/NotificationsPresentationData/BUILD b/submodules/NotificationsPresentationData/BUILD index 7bc884bb37..275798a4c3 100644 --- a/submodules/NotificationsPresentationData/BUILD +++ b/submodules/NotificationsPresentationData/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/OpenInExternalAppUI/BUILD b/submodules/OpenInExternalAppUI/BUILD index 9006bc6699..8eb226d04e 100644 --- a/submodules/OpenInExternalAppUI/BUILD +++ b/submodules/OpenInExternalAppUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/OpenInExternalAppUI/Sources/OpenInActionSheetController.swift b/submodules/OpenInExternalAppUI/Sources/OpenInActionSheetController.swift index 63d8118788..10b564aa8a 100644 --- a/submodules/OpenInExternalAppUI/Sources/OpenInActionSheetController.swift +++ b/submodules/OpenInExternalAppUI/Sources/OpenInActionSheetController.swift @@ -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 diff --git a/submodules/OverlayStatusController/BUILD b/submodules/OverlayStatusController/BUILD index e28e643223..633601d439 100644 --- a/submodules/OverlayStatusController/BUILD +++ b/submodules/OverlayStatusController/BUILD @@ -14,6 +14,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Display:Display", "//submodules/OverlayStatusController/Impl:OverlayStatusControllerImpl" diff --git a/submodules/PasscodeInputFieldNode/BUILD b/submodules/PasscodeInputFieldNode/BUILD index e44fe77ad8..c7fbc40da1 100644 --- a/submodules/PasscodeInputFieldNode/BUILD +++ b/submodules/PasscodeInputFieldNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/PasscodeUI/BUILD b/submodules/PasscodeUI/BUILD index 46648d9edb..4230fc328a 100644 --- a/submodules/PasscodeUI/BUILD +++ b/submodules/PasscodeUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/PasscodeUI/Sources/PasscodeEntryControllerNode.swift b/submodules/PasscodeUI/Sources/PasscodeEntryControllerNode.swift index 92709398a2..93cfd75f59 100644 --- a/submodules/PasscodeUI/Sources/PasscodeEntryControllerNode.swift +++ b/submodules/PasscodeUI/Sources/PasscodeEntryControllerNode.swift @@ -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) } diff --git a/submodules/PasscodeUI/Sources/PasscodeEntryKeyboardNode.swift b/submodules/PasscodeUI/Sources/PasscodeEntryKeyboardNode.swift index 83b322eb0e..7cd90fae47 100644 --- a/submodules/PasscodeUI/Sources/PasscodeEntryKeyboardNode.swift +++ b/submodules/PasscodeUI/Sources/PasscodeEntryKeyboardNode.swift @@ -124,14 +124,9 @@ 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 - } + 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() diff --git a/submodules/PassportUI/BUILD b/submodules/PassportUI/BUILD index bc03ee0145..76aba34269 100644 --- a/submodules/PassportUI/BUILD +++ b/submodules/PassportUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/PassportUI/Sources/SecureIdAuthController.swift b/submodules/PassportUI/Sources/SecureIdAuthController.swift index 429250b388..ec01a064a2 100644 --- a/submodules/PassportUI/Sources/SecureIdAuthController.swift +++ b/submodules/PassportUI/Sources/SecureIdAuthController.swift @@ -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 diff --git a/submodules/PassportUI/Sources/SecureIdDocumentFormControllerNode.swift b/submodules/PassportUI/Sources/SecureIdDocumentFormControllerNode.swift index 0746379912..e3f85c953c 100644 --- a/submodules/PassportUI/Sources/SecureIdDocumentFormControllerNode.swift +++ b/submodules/PassportUI/Sources/SecureIdDocumentFormControllerNode.swift @@ -2683,7 +2683,7 @@ final class SecureIdDocumentFormControllerNode: FormControllerNode Bool { - guard var innerState = self.innerState else { + guard let innerState = self.innerState else { return false } guard let values = innerState.makeValues(), !values.isEmpty else { diff --git a/submodules/PassportUI/Sources/SecureIdDocumentTypeSelectionController.swift b/submodules/PassportUI/Sources/SecureIdDocumentTypeSelectionController.swift index 028eab0e19..1e9f8c5a56 100644 --- a/submodules/PassportUI/Sources/SecureIdDocumentTypeSelectionController.swift +++ b/submodules/PassportUI/Sources/SecureIdDocumentTypeSelectionController.swift @@ -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 diff --git a/submodules/PassportUI/Sources/SecureIdLocalResource.swift b/submodules/PassportUI/Sources/SecureIdLocalResource.swift index dfb8a8ffce..66aaaa049b 100644 --- a/submodules/PassportUI/Sources/SecureIdLocalResource.swift +++ b/submodules/PassportUI/Sources/SecureIdLocalResource.swift @@ -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) -> 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) -> 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) } } diff --git a/submodules/PassportUI/Sources/SecureIdVerificationDocumentsContext.swift b/submodules/PassportUI/Sources/SecureIdVerificationDocumentsContext.swift index 9e60e8f3ff..f72286c482 100644 --- a/submodules/PassportUI/Sources/SecureIdVerificationDocumentsContext.swift +++ b/submodules/PassportUI/Sources/SecureIdVerificationDocumentsContext.swift @@ -55,10 +55,7 @@ final class SecureIdVerificationDocumentsContext { } } } - }, error: { [weak self] _ in - if let strongSelf = self { - - } + }, error: { _ in })) } case .remote: diff --git a/submodules/PasswordSetupUI/BUILD b/submodules/PasswordSetupUI/BUILD index cbd779be7a..a0da0b6d88 100644 --- a/submodules/PasswordSetupUI/BUILD +++ b/submodules/PasswordSetupUI/BUILD @@ -20,6 +20,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/PasswordSetupUI/Sources/ManagedMonkeyAnimationNode.swift b/submodules/PasswordSetupUI/Sources/ManagedMonkeyAnimationNode.swift index b564786ab5..028761c0b7 100644 --- a/submodules/PasswordSetupUI/Sources/ManagedMonkeyAnimationNode.swift +++ b/submodules/PasswordSetupUI/Sources/ManagedMonkeyAnimationNode.swift @@ -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) diff --git a/submodules/PasswordSetupUI/Sources/ResetPasswordController.swift b/submodules/PasswordSetupUI/Sources/ResetPasswordController.swift index 174a50aa75..4bb391d32d 100644 --- a/submodules/PasswordSetupUI/Sources/ResetPasswordController.swift +++ b/submodules/PasswordSetupUI/Sources/ResetPasswordController.swift @@ -146,7 +146,7 @@ public func resetPasswordController(context: AccountContext, emailPattern: Strin completion(false) case .declined: break - case let .error(reason): + case .error: break } }) diff --git a/submodules/PasswordSetupUI/Sources/SetupTwoStepVerificationControllerNode.swift b/submodules/PasswordSetupUI/Sources/SetupTwoStepVerificationControllerNode.swift index 2a9f9ee4b9..e3cda020c3 100644 --- a/submodules/PasswordSetupUI/Sources/SetupTwoStepVerificationControllerNode.swift +++ b/submodules/PasswordSetupUI/Sources/SetupTwoStepVerificationControllerNode.swift @@ -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 diff --git a/submodules/Pdf/BUILD b/submodules/Pdf/BUILD index cf05f0ebeb..8b0dc1e616 100644 --- a/submodules/Pdf/BUILD +++ b/submodules/Pdf/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Display:Display", ], diff --git a/submodules/PeerAvatarGalleryUI/BUILD b/submodules/PeerAvatarGalleryUI/BUILD index 347f0abd24..40dbe21520 100644 --- a/submodules/PeerAvatarGalleryUI/BUILD +++ b/submodules/PeerAvatarGalleryUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/PeerAvatarGalleryUI/Sources/AvatarGalleryController.swift b/submodules/PeerAvatarGalleryUI/Sources/AvatarGalleryController.swift index 6c3b315f8e..4d8a4370af 100644 --- a/submodules/PeerAvatarGalleryUI/Sources/AvatarGalleryController.swift +++ b/submodules/PeerAvatarGalleryUI/Sources/AvatarGalleryController.swift @@ -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() 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() 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 { diff --git a/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift b/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift index d11fa6453a..8018f2d404 100644 --- a/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift +++ b/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift @@ -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) diff --git a/submodules/PeerInfoAvatarListNode/BUILD b/submodules/PeerInfoAvatarListNode/BUILD index edff292ed4..a6cb6685e6 100644 --- a/submodules/PeerInfoAvatarListNode/BUILD +++ b/submodules/PeerInfoAvatarListNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift b/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift index 9c22371c91..3e155545cf 100644 --- a/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift +++ b/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift @@ -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 diff --git a/submodules/PeerInfoUI/BUILD b/submodules/PeerInfoUI/BUILD index 9695768934..87c4038f92 100644 --- a/submodules/PeerInfoUI/BUILD +++ b/submodules/PeerInfoUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/PeerInfoUI/Sources/ChannelAdminController.swift b/submodules/PeerInfoUI/Sources/ChannelAdminController.swift index 7ad49ac1e4..05c6b82ead 100644 --- a/submodules/PeerInfoUI/Sources/ChannelAdminController.swift +++ b/submodules/PeerInfoUI/Sources/ChannelAdminController.swift @@ -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)) } } diff --git a/submodules/PeerInfoUI/Sources/ChannelAdminsController.swift b/submodules/PeerInfoUI/Sources/ChannelAdminsController.swift index 2ce7af4502..89c10d7ade 100644 --- a/submodules/PeerInfoUI/Sources/ChannelAdminsController.swift +++ b/submodules/PeerInfoUI/Sources/ChannelAdminsController.swift @@ -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) } } @@ -826,11 +800,9 @@ public func channelAdminsController(context: AccountContext, peerId initialPeerI guard let controller = controller, let navigationController = controller.navigationController as? NavigationController else { 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 { diff --git a/submodules/PeerInfoUI/Sources/ChannelBannedMemberController.swift b/submodules/PeerInfoUI/Sources/ChannelBannedMemberController.swift index b5ef77db87..116be51446 100644 --- a/submodules/PeerInfoUI/Sources/ChannelBannedMemberController.swift +++ b/submodules/PeerInfoUI/Sources/ChannelBannedMemberController.swift @@ -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 diff --git a/submodules/PeerInfoUI/Sources/ChannelBlacklistController.swift b/submodules/PeerInfoUI/Sources/ChannelBlacklistController.swift index 16c1ce0581..190afe015c 100644 --- a/submodules/PeerInfoUI/Sources/ChannelBlacklistController.swift +++ b/submodules/PeerInfoUI/Sources/ChannelBlacklistController.swift @@ -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 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) diff --git a/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupController.swift b/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupController.swift index ba557ede27..99fbab76ff 100644 --- a/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupController.swift +++ b/submodules/PeerInfoUI/Sources/ChannelDiscussionGroupSetupController.swift @@ -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: { diff --git a/submodules/PeerInfoUI/Sources/ChannelMembersController.swift b/submodules/PeerInfoUI/Sources/ChannelMembersController.swift index aed5d89d34..d6f7991480 100644 --- a/submodules/PeerInfoUI/Sources/ChannelMembersController.swift +++ b/submodules/PeerInfoUI/Sources/ChannelMembersController.swift @@ -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 { diff --git a/submodules/PeerInfoUI/Sources/ChannelMembersSearchContainerNode.swift b/submodules/PeerInfoUI/Sources/ChannelMembersSearchContainerNode.swift index 8035635042..412bd2d7df 100644 --- a/submodules/PeerInfoUI/Sources/ChannelMembersSearchContainerNode.swift +++ b/submodules/PeerInfoUI/Sources/ChannelMembersSearchContainerNode.swift @@ -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 } } diff --git a/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift b/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift index 4af5f039cf..5d9f4a6433 100644 --- a/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift +++ b/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift @@ -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 diff --git a/submodules/PeerInfoUI/Sources/ChatSlowmodeItem.swift b/submodules/PeerInfoUI/Sources/ChatSlowmodeItem.swift index 05a4025bdc..10bbb62297 100644 --- a/submodules/PeerInfoUI/Sources/ChatSlowmodeItem.swift +++ b/submodules/PeerInfoUI/Sources/ChatSlowmodeItem.swift @@ -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) } diff --git a/submodules/PeerInfoUI/Sources/ConvertToSupergroupController.swift b/submodules/PeerInfoUI/Sources/ConvertToSupergroupController.swift index 5b4bcfe908..18fdb87649 100644 --- a/submodules/PeerInfoUI/Sources/ConvertToSupergroupController.swift +++ b/submodules/PeerInfoUI/Sources/ConvertToSupergroupController.swift @@ -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) } } diff --git a/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift b/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift index b07b78ad3e..66ab2bbe42 100644 --- a/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift +++ b/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift @@ -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() }), diff --git a/submodules/PeerInfoUI/Sources/GroupPreHistorySetupController.swift b/submodules/PeerInfoUI/Sources/GroupPreHistorySetupController.swift index 05aedd3fac..2efe6d5472 100644 --- a/submodules/PeerInfoUI/Sources/GroupPreHistorySetupController.swift +++ b/submodules/PeerInfoUI/Sources/GroupPreHistorySetupController.swift @@ -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) } } diff --git a/submodules/PeerInfoUI/Sources/GroupStickerPackCurrentItem.swift b/submodules/PeerInfoUI/Sources/GroupStickerPackCurrentItem.swift index 886357fe9e..a793692dde 100644 --- a/submodules/PeerInfoUI/Sources/GroupStickerPackCurrentItem.swift +++ b/submodules/PeerInfoUI/Sources/GroupStickerPackCurrentItem.swift @@ -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 { diff --git a/submodules/PeerInfoUI/Sources/GroupStickerPackSetupController.swift b/submodules/PeerInfoUI/Sources/GroupStickerPackSetupController.swift index b10071abf6..7dc0927e21 100644 --- a/submodules/PeerInfoUI/Sources/GroupStickerPackSetupController.swift +++ b/submodules/PeerInfoUI/Sources/GroupStickerPackSetupController.swift @@ -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) } }) } diff --git a/submodules/PeerInfoUI/Sources/OldChannelsController.swift b/submodules/PeerInfoUI/Sources/OldChannelsController.swift index 4ccdc1b042..d77fd70ac2 100644 --- a/submodules/PeerInfoUI/Sources/OldChannelsController.swift +++ b/submodules/PeerInfoUI/Sources/OldChannelsController.swift @@ -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 diff --git a/submodules/PeerInfoUI/Sources/PeerBanTimeoutController.swift b/submodules/PeerInfoUI/Sources/PeerBanTimeoutController.swift index 9b2c85082d..c5f21ceb24 100644 --- a/submodules/PeerInfoUI/Sources/PeerBanTimeoutController.swift +++ b/submodules/PeerInfoUI/Sources/PeerBanTimeoutController.swift @@ -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)) diff --git a/submodules/PeerInfoUI/Sources/PeerReportController.swift b/submodules/PeerInfoUI/Sources/PeerReportController.swift index 41d3965468..f61ca0c2d9 100644 --- a/submodules/PeerInfoUI/Sources/PeerReportController.swift +++ b/submodules/PeerInfoUI/Sources/PeerReportController.swift @@ -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() diff --git a/submodules/PeerInfoUI/Sources/PhoneLabelController.swift b/submodules/PeerInfoUI/Sources/PhoneLabelController.swift index 1b7765e3b2..22bafbf8c8 100644 --- a/submodules/PeerInfoUI/Sources/PhoneLabelController.swift +++ b/submodules/PeerInfoUI/Sources/PhoneLabelController.swift @@ -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) }) diff --git a/submodules/PeerOnlineMarkerNode/BUILD b/submodules/PeerOnlineMarkerNode/BUILD index d00d4583a4..609546dfde 100644 --- a/submodules/PeerOnlineMarkerNode/BUILD +++ b/submodules/PeerOnlineMarkerNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/PeerPresenceStatusManager/BUILD b/submodules/PeerPresenceStatusManager/BUILD index afd5f24931..f82042b8dd 100644 --- a/submodules/PeerPresenceStatusManager/BUILD +++ b/submodules/PeerPresenceStatusManager/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", diff --git a/submodules/PeersNearbyIconNode/BUILD b/submodules/PeersNearbyIconNode/BUILD index 3c1dc898a9..bcb7f6d667 100644 --- a/submodules/PeersNearbyIconNode/BUILD +++ b/submodules/PeersNearbyIconNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/PeersNearbyUI/BUILD b/submodules/PeersNearbyUI/BUILD index aae93d7ed4..2350ad063c 100644 --- a/submodules/PeersNearbyUI/BUILD +++ b/submodules/PeersNearbyUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/PeersNearbyUI/Sources/PeersNearbyController.swift b/submodules/PeersNearbyUI/Sources/PeersNearbyController.swift index f7dbecbfad..0a9d4c1e5d 100644 --- a/submodules/PeersNearbyUI/Sources/PeersNearbyController.swift +++ b/submodules/PeersNearbyUI/Sources/PeersNearbyController.swift @@ -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 } diff --git a/submodules/PersistentStringHash/BUILD b/submodules/PersistentStringHash/BUILD index 6ff7160fb5..e33565769f 100644 --- a/submodules/PersistentStringHash/BUILD +++ b/submodules/PersistentStringHash/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/PhoneInputNode/BUILD b/submodules/PhoneInputNode/BUILD index f16f32df24..3b4251f22e 100644 --- a/submodules/PhoneInputNode/BUILD +++ b/submodules/PhoneInputNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/PhoneInputNode/Sources/PhoneInputNode.swift b/submodules/PhoneInputNode/Sources/PhoneInputNode.swift index 68202bbe0a..6d9662852b 100644 --- a/submodules/PhoneInputNode/Sources/PhoneInputNode.swift +++ b/submodules/PhoneInputNode/Sources/PhoneInputNode.swift @@ -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) diff --git a/submodules/PhoneNumberFormat/BUILD b/submodules/PhoneNumberFormat/BUILD index 003cc11da5..678a034679 100644 --- a/submodules/PhoneNumberFormat/BUILD +++ b/submodules/PhoneNumberFormat/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/libphonenumber:libphonenumber", ], diff --git a/submodules/PhotoResources/BUILD b/submodules/PhotoResources/BUILD index 8fd840bad4..2a02b1e577 100644 --- a/submodules/PhotoResources/BUILD +++ b/submodules/PhotoResources/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Postbox:Postbox", diff --git a/submodules/PhotoResources/Sources/PhotoResources.swift b/submodules/PhotoResources/Sources/PhotoResources.swift index 9c719cb833..0ea1c6c498 100644 --- a/submodules/PhotoResources/Sources/PhotoResources.swift +++ b/submodules/PhotoResources/Sources/PhotoResources.swift @@ -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 diff --git a/submodules/PlatformRestrictionMatching/BUILD b/submodules/PlatformRestrictionMatching/BUILD index 38a989db14..aac02946cc 100644 --- a/submodules/PlatformRestrictionMatching/BUILD +++ b/submodules/PlatformRestrictionMatching/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", ], diff --git a/submodules/PresentationDataUtils/BUILD b/submodules/PresentationDataUtils/BUILD index 18415391b2..66b1049608 100644 --- a/submodules/PresentationDataUtils/BUILD +++ b/submodules/PresentationDataUtils/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Display:Display", "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", diff --git a/submodules/PresentationDataUtils/Sources/ItemListController.swift b/submodules/PresentationDataUtils/Sources/ItemListController.swift index e563d060a2..0da76bfc1c 100644 --- a/submodules/PresentationDataUtils/Sources/ItemListController.swift +++ b/submodules/PresentationDataUtils/Sources/ItemListController.swift @@ -4,7 +4,6 @@ import AlertUI import AccountContext import SwiftSignalKit import ItemListUI -import PresentationDataUtils public extension ItemListController { convenience init(context: AccountContext, state: Signal<(ItemListControllerState, (ItemListNodeState, ItemGenerationArguments)), NoError>, tabBarItem: Signal? = nil) { diff --git a/submodules/ProgressNavigationButtonNode/BUILD b/submodules/ProgressNavigationButtonNode/BUILD index ebf9a7e417..f6c0c21aa2 100644 --- a/submodules/ProgressNavigationButtonNode/BUILD +++ b/submodules/ProgressNavigationButtonNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Display:Display", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/QrCode/BUILD b/submodules/QrCode/BUILD index 4cba639671..7ece4c25ae 100644 --- a/submodules/QrCode/BUILD +++ b/submodules/QrCode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Display:Display", diff --git a/submodules/RadialStatusNode/BUILD b/submodules/RadialStatusNode/BUILD index e6c85db366..c759d1bc5a 100644 --- a/submodules/RadialStatusNode/BUILD +++ b/submodules/RadialStatusNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Display:Display", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/Reachability/BUILD b/submodules/Reachability/BUILD index 5e08b22c98..c6191f98c0 100644 --- a/submodules/Reachability/BUILD +++ b/submodules/Reachability/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Reachability/LegacyReachability:LegacyReachability", "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", diff --git a/submodules/ReactionSelectionNode/BUILD b/submodules/ReactionSelectionNode/BUILD index c3d3459fc4..9e1c9e099d 100644 --- a/submodules/ReactionSelectionNode/BUILD +++ b/submodules/ReactionSelectionNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Postbox:Postbox", "//submodules/TelegramCore:TelegramCore", diff --git a/submodules/ReactionSelectionNode/Sources/ReactionContextNode.swift b/submodules/ReactionSelectionNode/Sources/ReactionContextNode.swift index e0270afa8f..1018936ef4 100644 --- a/submodules/ReactionSelectionNode/Sources/ReactionContextNode.swift +++ b/submodules/ReactionSelectionNode/Sources/ReactionContextNode.swift @@ -261,15 +261,8 @@ public final class ReactionContextNode: ASDisplayNode { let row = CGFloat(rowIndex) let column = CGFloat(columnIndex) - let isHighlighted = false - - var itemSize: CGFloat = minimizedItemSize - var itemOffset: CGFloat = 0.0 - if isHighlighted { - let updatedSize = itemSize * 1.15 - itemOffset = (updatedSize - itemSize) / 2.0 - itemSize = updatedSize - } + let itemSize: CGFloat = minimizedItemSize + let itemOffset: CGFloat = 0.0 let itemFrame = CGRect(origin: CGPoint(x: sideInset + column * (minimizedItemSize + itemSpacing) - itemOffset, y: verticalInset + row * (rowHeight + rowSpacing) + floor((rowHeight - minimizedItemSize) / 2.0) - itemOffset), size: CGSize(width: itemSize, height: itemSize)) transition.updateFrame(node: self.itemNodes[i], frame: itemFrame, beginWithCurrentState: true) diff --git a/submodules/ReactionSelectionNode/Sources/ReactionSelectionNode.swift b/submodules/ReactionSelectionNode/Sources/ReactionSelectionNode.swift index b6e96b6f7f..b6f695e21c 100644 --- a/submodules/ReactionSelectionNode/Sources/ReactionSelectionNode.swift +++ b/submodules/ReactionSelectionNode/Sources/ReactionSelectionNode.swift @@ -215,7 +215,7 @@ final class ReactionSelectionNode: ASDisplayNode { } let reactionSideInset: CGFloat = 10.0 - var reactionSpacing: CGFloat = 6.0 + let reactionSpacing: CGFloat = 6.0 let minReactionSpacing: CGFloat = 2.0 let minimizedReactionSize = self.minimizedReactionSize let contentWidth: CGFloat = CGFloat(self.reactions.count) * (minimizedReactionSize) + CGFloat(self.reactions.count - 1) * reactionSpacing + reactionSideInset * 2.0 @@ -252,9 +252,7 @@ final class ReactionSelectionNode: ASDisplayNode { interReactionSpacing = reactionSpacing } - if isInitial && self.reactionNodes.isEmpty { - let availableContentWidth = constrainedSize.width //max(100.0, initialAnchorX) - + if isInitial && self.reactionNodes.isEmpty { self.shadowBlur = floor(minimizedReactionSize * 0.26) self.smallCircleSize = 14.0 diff --git a/submodules/ReactionSelectionNode/Sources/ReactionSwipeGestureRecognizer.swift b/submodules/ReactionSelectionNode/Sources/ReactionSwipeGestureRecognizer.swift index 1226d74b03..44cc887651 100644 --- a/submodules/ReactionSelectionNode/Sources/ReactionSwipeGestureRecognizer.swift +++ b/submodules/ReactionSelectionNode/Sources/ReactionSwipeGestureRecognizer.swift @@ -110,7 +110,7 @@ public final class ReactionSwipeGestureRecognizer: UIPanGestureRecognizer { strongSelf.activationTimer = nil if strongSelf.validatedGesture { let location = strongSelf.currentLocation - if !strongSelf.currentReactions.isEmpty, let reactionContainer = strongSelf.getReactionContainer?(), let localAnchorPoint = strongSelf.getAnchorPoint?() { + if !strongSelf.currentReactions.isEmpty, let reactionContainer = strongSelf.getReactionContainer?(), let _ = strongSelf.getAnchorPoint?() { strongSelf.currentContainer = reactionContainer //let reactionContainerLocation = reactionContainer.view.convert(localAnchorPoint, from: strongSelf.view) let elevate = strongSelf.shouldElevateAnchorPoint?() ?? false diff --git a/submodules/SSignalKit/SSignalKit/BUILD b/submodules/SSignalKit/SSignalKit/BUILD index 5a980e8242..e27693a320 100644 --- a/submodules/SSignalKit/SSignalKit/BUILD +++ b/submodules/SSignalKit/SSignalKit/BUILD @@ -6,6 +6,9 @@ objc_library( srcs = glob([ "Source/SSignalKit/*.m", ]), + copts = [ + "-Werror", + ], hdrs = glob([ "Source/SSignalKit/*.h", ]), diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SAtomic.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SAtomic.h index 6d3e35b4dc..3e29f89bdf 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SAtomic.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SAtomic.h @@ -2,11 +2,11 @@ @interface SAtomic : NSObject -- (instancetype)initWithValue:(id)value; -- (instancetype)initWithValue:(id)value recursive:(bool)recursive; -- (id)swap:(id)newValue; -- (id)value; -- (id)modify:(id (^)(id))f; -- (id)with:(id (^)(id))f; +- (instancetype _Nonnull)initWithValue:(id _Nullable)value; +- (instancetype _Nonnull)initWithValue:(id _Nullable)value recursive:(bool)recursive; +- (id _Nullable)swap:(id _Nullable)newValue; +- (id _Nullable)value; +- (id _Nullable)modify:(id _Nullable (^ _Nonnull)(id _Nullable))f; +- (id _Nullable)with:(id _Nullable (^ _Nonnull)(id _Nullable))f; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SBag.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SBag.h index 7b79ead30f..6d9ca7a9bd 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SBag.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SBag.h @@ -2,10 +2,10 @@ @interface SBag : NSObject -- (NSInteger)addItem:(id)item; -- (void)enumerateItems:(void (^)(id))block; +- (NSInteger)addItem:(id _Nonnull)item; +- (void)enumerateItems:(void (^ _Nonnull)(id _Nonnull))block; - (void)removeItem:(NSInteger)key; - (bool)isEmpty; -- (NSArray *)copyItems; +- (NSArray * _Nonnull)copyItems; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SBlockDisposable.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SBlockDisposable.h index 2914604cba..9bf7f5a06d 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SBlockDisposable.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SBlockDisposable.h @@ -2,6 +2,6 @@ @interface SBlockDisposable : NSObject -- (instancetype)initWithBlock:(void (^)())block; +- (instancetype _Nonnull)initWithBlock:(void (^ _Nullable)())block; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SDisposableSet.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SDisposableSet.h index 7d7515c968..e7ec5b4c4c 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SDisposableSet.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SDisposableSet.h @@ -4,7 +4,7 @@ @interface SDisposableSet : NSObject -- (void)add:(id)disposable; -- (void)remove:(id)disposable; +- (void)add:(id _Nonnull)disposable; +- (void)remove:(id _Nonnull)disposable; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SMetaDisposable.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SMetaDisposable.h index 8938f9eacb..e22e797539 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SMetaDisposable.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SMetaDisposable.h @@ -2,6 +2,6 @@ @interface SMetaDisposable : NSObject -- (void)setDisposable:(id)disposable; +- (void)setDisposable:(id _Nullable)disposable; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SMulticastSignalManager.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SMulticastSignalManager.h index 243f015a52..af2bb7ad21 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SMulticastSignalManager.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SMulticastSignalManager.h @@ -2,10 +2,10 @@ @interface SMulticastSignalManager : NSObject -- (SSignal *)multicastedSignalForKey:(NSString *)key producer:(SSignal *(^)())producer; -- (void)startStandaloneSignalIfNotRunningForKey:(NSString *)key producer:(SSignal *(^)())producer; +- (SSignal * _Nonnull)multicastedSignalForKey:(NSString * _Nonnull)key producer:(SSignal * _Nonnull (^ _Nonnull)())producer; +- (void)startStandaloneSignalIfNotRunningForKey:(NSString * _Nonnull)key producer:(SSignal * _Nonnull (^ _Nonnull)())producer; -- (SSignal *)multicastedPipeForKey:(NSString *)key; -- (void)putNext:(id)next toMulticastedPipeForKey:(NSString *)key; +- (SSignal * _Nonnull)multicastedPipeForKey:(NSString * _Nonnull)key; +- (void)putNext:(id _Nullable)next toMulticastedPipeForKey:(NSString * _Nonnull)key; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SQueue.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SQueue.h index 228334c888..9f45afd273 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SQueue.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SQueue.h @@ -2,17 +2,17 @@ @interface SQueue : NSObject -+ (SQueue *)mainQueue; -+ (SQueue *)concurrentDefaultQueue; -+ (SQueue *)concurrentBackgroundQueue; ++ (SQueue * _Nonnull)mainQueue; ++ (SQueue * _Nonnull)concurrentDefaultQueue; ++ (SQueue * _Nonnull)concurrentBackgroundQueue; -+ (SQueue *)wrapConcurrentNativeQueue:(dispatch_queue_t)nativeQueue; ++ (SQueue * _Nonnull)wrapConcurrentNativeQueue:(dispatch_queue_t _Nonnull)nativeQueue; -- (void)dispatch:(dispatch_block_t)block; -- (void)dispatchSync:(dispatch_block_t)block; -- (void)dispatch:(dispatch_block_t)block synchronous:(bool)synchronous; +- (void)dispatch:(dispatch_block_t _Nonnull)block; +- (void)dispatchSync:(dispatch_block_t _Nonnull)block; +- (void)dispatch:(dispatch_block_t _Nonnull)block synchronous:(bool)synchronous; -- (dispatch_queue_t)_dispatch_queue; +- (dispatch_queue_t _Nonnull)_dispatch_queue; - (bool)isCurrentQueue; diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SQueueLocalObject.m b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SQueueLocalObject.m index 019a50a695..0b12201362 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SQueueLocalObject.m +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SQueueLocalObject.m @@ -9,12 +9,12 @@ #import "SQueueLocalObject.h" @implementation SQueueLocalObject { - SQueue *queue; + SQueue *_queue; id valueRef; } -(id)initWithQueue:(SQueue *)queue generate:(id _Nonnull (^)(void))next { if (self = [super init]) { - self->queue = queue; + self->_queue = queue; [queue dispatch:^{ self->valueRef = next(); }]; @@ -23,7 +23,7 @@ } -(void)with:(void (^)(id object))f { - [self->queue dispatch:^{ + [self->_queue dispatch:^{ f(self->valueRef); }]; } @@ -31,7 +31,7 @@ -(void)dealloc { __block id value = self->valueRef; self->valueRef = nil; - [queue dispatch:^{ + [_queue dispatch:^{ value = nil; }]; } diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Accumulate.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Accumulate.h index 1ea8a51ed0..8c17743017 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Accumulate.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Accumulate.h @@ -2,7 +2,7 @@ @interface SSignal (Accumulate) -- (SSignal *)reduceLeft:(id)value with:(id (^)(id, id))f; -- (SSignal *)reduceLeftWithPassthrough:(id)value with:(id (^)(id, id, void (^)(id)))f; +- (SSignal * _Nonnull)reduceLeft:(id _Nullable)value with:(id _Nullable (^ _Nonnull)(id _Nullable, id _Nullable))f; +- (SSignal * _Nonnull)reduceLeftWithPassthrough:(id _Nullable)value with:(id _Nullable (^ _Nonnull)(id _Nullable, id _Nullable, void (^ _Nonnull)(id _Nullable)))f; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Catch.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Catch.h index dc8898c062..43e8029ab0 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Catch.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Catch.h @@ -2,8 +2,8 @@ @interface SSignal (Catch) -- (SSignal *)catch:(SSignal *(^)(id error))f; -- (SSignal *)restart; -- (SSignal *)retryIf:(bool (^)(id error))predicate; +- (SSignal * _Nonnull)catch:(SSignal * _Nonnull (^ _Nonnull )(id _Nullable error))f; +- (SSignal * _Nonnull)restart; +- (SSignal * _Nonnull)retryIf:(bool (^ _Nonnull)(id _Nullable error))predicate; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Combine.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Combine.h index d84e065311..2038e06e52 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Combine.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Combine.h @@ -2,9 +2,9 @@ @interface SSignal (Combine) -+ (SSignal *)combineSignals:(NSArray *)signals; -+ (SSignal *)combineSignals:(NSArray *)signals withInitialStates:(NSArray *)initialStates; ++ (SSignal * _Nonnull)combineSignals:(NSArray * _Nonnull)signals; ++ (SSignal * _Nonnull)combineSignals:(NSArray * _Nonnull)signals withInitialStates:(NSArray * _Nullable)initialStates; -+ (SSignal *)mergeSignals:(NSArray *)signals; ++ (SSignal * _Nonnull)mergeSignals:(NSArray * _Nonnull)signals; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Dispatch.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Dispatch.h index a22679b372..21d0bfb17e 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Dispatch.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Dispatch.h @@ -5,10 +5,10 @@ @interface SSignal (Dispatch) -- (SSignal *)deliverOn:(SQueue *)queue; -- (SSignal *)deliverOnThreadPool:(SThreadPool *)threadPool; -- (SSignal *)startOn:(SQueue *)queue; -- (SSignal *)startOnThreadPool:(SThreadPool *)threadPool; -- (SSignal *)throttleOn:(SQueue *)queue delay:(NSTimeInterval)delay; +- (SSignal * _Nonnull)deliverOn:(SQueue * _Nonnull)queue; +- (SSignal * _Nonnull)deliverOnThreadPool:(SThreadPool * _Nonnull)threadPool; +- (SSignal * _Nonnull)startOn:(SQueue * _Nonnull)queue; +- (SSignal * _Nonnull)startOnThreadPool:(SThreadPool * _Nonnull)threadPool; +- (SSignal * _Nonnull)throttleOn:(SQueue * _Nonnull)queue delay:(NSTimeInterval)delay; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Mapping.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Mapping.h index 81a16816e2..75fb909dea 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Mapping.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Mapping.h @@ -2,8 +2,8 @@ @interface SSignal (Mapping) -- (SSignal *)map:(id (^)(id))f; -- (SSignal *)filter:(bool (^)(id))f; -- (SSignal *)ignoreRepeated; +- (SSignal * _Nonnull)map:(id _Nullable (^ _Nonnull)(id _Nullable))f; +- (SSignal * _Nonnull)filter:(bool (^ _Nonnull)(id _Nullable))f; +- (SSignal * _Nonnull)ignoreRepeated; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Meta.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Meta.h index 2d90df13f8..0e1893fc02 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Meta.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Meta.h @@ -4,19 +4,19 @@ @interface SSignal (Meta) -- (SSignal *)switchToLatest; -- (SSignal *)mapToSignal:(SSignal *(^)(id))f; -- (SSignal *)mapToQueue:(SSignal *(^)(id))f; -- (SSignal *)mapToThrottled:(SSignal *(^)(id))f; -- (SSignal *)then:(SSignal *)signal; -- (SSignal *)queue; -- (SSignal *)throttled; -+ (SSignal *)defer:(SSignal *(^)())generator; +- (SSignal * _Nonnull)switchToLatest; +- (SSignal * _Nonnull)mapToSignal:(SSignal * _Nonnull (^ _Nonnull)(id _Nullable))f; +- (SSignal * _Nonnull)mapToQueue:(SSignal * _Nonnull (^ _Nonnull)(id _Nullable))f; +- (SSignal * _Nonnull)mapToThrottled:(SSignal * _Nonnull (^ _Nonnull)(id _Nullable))f; +- (SSignal * _Nonnull)then:(SSignal * _Nonnull)signal; +- (SSignal * _Nonnull)queue; +- (SSignal * _Nonnull)throttled; ++ (SSignal * _Nonnull)defer:(SSignal * _Nonnull(^ _Nonnull)())generator; @end @interface SSignalQueue : NSObject -- (SSignal *)enqueue:(SSignal *)signal; +- (SSignal * _Nonnull)enqueue:(SSignal * _Nonnull)signal; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Multicast.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Multicast.h index e0720cc103..817f3a77d0 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Multicast.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Multicast.h @@ -2,6 +2,6 @@ @interface SSignal (Multicast) -- (SSignal *)multicast; +- (SSignal * _Nonnull)multicast; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Pipe.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Pipe.h index 2a21ee4cf7..fa24fdf597 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Pipe.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Pipe.h @@ -2,10 +2,10 @@ @interface SPipe : NSObject -@property (nonatomic, copy, readonly) SSignal *(^signalProducer)(); -@property (nonatomic, copy, readonly) void (^sink)(id); +@property (nonatomic, copy, readonly) SSignal * _Nonnull (^ _Nonnull signalProducer)(); +@property (nonatomic, copy, readonly) void (^ _Nonnull sink)(id _Nullable); -- (instancetype)initWithReplay:(bool)replay; +- (instancetype _Nonnull)initWithReplay:(bool)replay; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+SideEffects.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+SideEffects.h index 8107fcf4cb..9c7ba05910 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+SideEffects.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+SideEffects.h @@ -2,12 +2,12 @@ @interface SSignal (SideEffects) -- (SSignal *)onStart:(void (^)())f; -- (SSignal *)onNext:(void (^)(id next))f; -- (SSignal *)afterNext:(void (^)(id next))f; -- (SSignal *)onError:(void (^)(id error))f; -- (SSignal *)onCompletion:(void (^)())f; -- (SSignal *)afterCompletion:(void (^)())f; -- (SSignal *)onDispose:(void (^)())f; +- (SSignal * _Nonnull)onStart:(void (^ _Nonnull)())f; +- (SSignal * _Nonnull)onNext:(void (^ _Nonnull)(id _Nullable next))f; +- (SSignal * _Nonnull)afterNext:(void (^ _Nonnull)(id _Nullable next))f; +- (SSignal * _Nonnull)onError:(void (^ _Nonnull)(id _Nullable error))f; +- (SSignal * _Nonnull)onCompletion:(void (^ _Nonnull)())f; +- (SSignal * _Nonnull)afterCompletion:(void (^ _Nonnull)())f; +- (SSignal * _Nonnull)onDispose:(void (^ _Nonnull)())f; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Single.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Single.h index 75f48ff569..46693c0b08 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Single.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Single.h @@ -2,9 +2,9 @@ @interface SSignal (Single) -+ (SSignal *)single:(id)next; -+ (SSignal *)fail:(id)error; -+ (SSignal *)never; -+ (SSignal *)complete; ++ (SSignal * _Nonnull)single:(id _Nullable)next; ++ (SSignal * _Nonnull)fail:(id _Nullable)error; ++ (SSignal * _Nonnull)never; ++ (SSignal * _Nonnull)complete; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Take.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Take.h index a4d1ff23eb..9128e4a7f7 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Take.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Take.h @@ -2,8 +2,8 @@ @interface SSignal (Take) -- (SSignal *)take:(NSUInteger)count; -- (SSignal *)takeLast; -- (SSignal *)takeUntilReplacement:(SSignal *)replacement; +- (SSignal * _Nonnull)take:(NSUInteger)count; +- (SSignal * _Nonnull)takeLast; +- (SSignal * _Nonnull)takeUntilReplacement:(SSignal * _Nonnull)replacement; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Timing.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Timing.h index 4b5d50c90e..ae4c7d4d2a 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Timing.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal+Timing.h @@ -4,8 +4,8 @@ @interface SSignal (Timing) -- (SSignal *)delay:(NSTimeInterval)seconds onQueue:(SQueue *)queue; -- (SSignal *)timeout:(NSTimeInterval)seconds onQueue:(SQueue *)queue orSignal:(SSignal *)signal; -- (SSignal *)wait:(NSTimeInterval)seconds; +- (SSignal * _Nonnull)delay:(NSTimeInterval)seconds onQueue:(SQueue * _Nonnull)queue; +- (SSignal * _Nonnull)timeout:(NSTimeInterval)seconds onQueue:(SQueue * _Nonnull)queue orSignal:(SSignal * _Nonnull)signal; +- (SSignal * _Nonnull)wait:(NSTimeInterval)seconds; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal.h index 46b7385d36..f80728062d 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSignal.h @@ -3,16 +3,16 @@ @interface SSignal : NSObject { @public - id (^_generator)(SSubscriber *); + id _Nullable (^ _Nonnull _generator)(SSubscriber * _Nonnull); } -- (instancetype)initWithGenerator:(id (^)(SSubscriber *))generator; +- (instancetype _Nonnull)initWithGenerator:(id _Nullable (^ _Nonnull)(SSubscriber * _Nonnull))generator; -- (id)startWithNext:(void (^)(id next))next error:(void (^)(id error))error completed:(void (^)())completed; -- (id)startWithNext:(void (^)(id next))next; -- (id)startWithNext:(void (^)(id next))next completed:(void (^)())completed; +- (id _Nullable)startWithNext:(void (^ _Nullable)(id _Nullable next))next error:(void (^ _Nullable)(id _Nullable error))error completed:(void (^ _Nullable)())completed; +- (id _Nullable)startWithNext:(void (^ _Nullable)(id _Nullable next))next; +- (id _Nullable)startWithNext:(void (^ _Nullable)(id _Nullable next))next completed:(void (^ _Nullable)())completed; -- (SSignal *)trace:(NSString *)name; +- (SSignal * _Nonnull)trace:(NSString * _Nonnull)name; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSubscriber.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSubscriber.h index ce4fee5678..fdf0460993 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSubscriber.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SSubscriber.h @@ -4,19 +4,19 @@ { } -- (instancetype)initWithNext:(void (^)(id))next error:(void (^)(id))error completed:(void (^)())completed; +- (instancetype _Nonnull)initWithNext:(void (^ _Nullable)(id _Nullable))next error:(void (^ _Nullable)(id _Nullable))error completed:(void (^ _Nullable)())completed; -- (void)_assignDisposable:(id)disposable; +- (void)_assignDisposable:(id _Nullable)disposable; - (void)_markTerminatedWithoutDisposal; -- (void)putNext:(id)next; -- (void)putError:(id)error; +- (void)putNext:(id _Nullable)next; +- (void)putError:(id _Nullable)error; - (void)putCompletion; @end @interface STracingSubscriber : SSubscriber -- (instancetype)initWithName:(NSString *)name next:(void (^)(id))next error:(void (^)(id))error completed:(void (^)())completed; +- (instancetype _Nonnull)initWithName:(NSString * _Nonnull)name next:(void (^ _Nullable)(id _Nullable))next error:(void (^ _Nullable)(id _Nullable))error completed:(void (^ _Nullable)())completed; -@end \ No newline at end of file +@end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPool.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPool.h index 69d0565938..b8978eb4f3 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPool.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPool.h @@ -5,11 +5,11 @@ @interface SThreadPool : NSObject -- (instancetype)initWithThreadCount:(NSUInteger)threadCount threadPriority:(double)threadPriority; +- (instancetype _Nonnull)initWithThreadCount:(NSUInteger)threadCount threadPriority:(double)threadPriority; -- (void)addTask:(SThreadPoolTask *)task; +- (void)addTask:(SThreadPoolTask * _Nonnull)task; -- (SThreadPoolQueue *)nextQueue; -- (void)_workOnQueue:(SThreadPoolQueue *)queue block:(void (^)())block; +- (SThreadPoolQueue * _Nonnull)nextQueue; +- (void)_workOnQueue:(SThreadPoolQueue * _Nonnull)queue block:(void (^ _Nonnull)())block; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPoolQueue.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPoolQueue.h index 3d8d53b00c..51d63009f0 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPoolQueue.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPoolQueue.h @@ -5,9 +5,9 @@ @interface SThreadPoolQueue : NSObject -- (instancetype)initWithThreadPool:(SThreadPool *)threadPool; -- (void)addTask:(SThreadPoolTask *)task; -- (SThreadPoolTask *)_popFirstTask; +- (instancetype _Nonnull)initWithThreadPool:(SThreadPool * _Nonnull)threadPool; +- (void)addTask:(SThreadPoolTask * _Nonnull)task; +- (SThreadPoolTask * _Nullable)_popFirstTask; - (bool)_hasTasks; @end diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPoolTask.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPoolTask.h index e8da985ca0..bb9f476cce 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPoolTask.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SThreadPoolTask.h @@ -2,7 +2,7 @@ @interface SThreadPoolTask : NSObject -- (instancetype)initWithBlock:(void (^)(bool (^)()))block; +- (instancetype _Nonnull)initWithBlock:(void (^ _Nonnull)(bool (^ _Nonnull)()))block; - (void)execute; - (void)cancel; diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/STimer.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/STimer.h index 621e4232b2..0ad33b4569 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/STimer.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/STimer.h @@ -4,8 +4,8 @@ @interface STimer : NSObject -- (id)initWithTimeout:(NSTimeInterval)timeout repeat:(bool)repeat completion:(dispatch_block_t)completion queue:(SQueue *)queue; -- (id)initWithTimeout:(NSTimeInterval)timeout repeat:(bool)repeat completion:(dispatch_block_t)completion nativeQueue:(dispatch_queue_t)nativeQueue; +- (instancetype _Nonnull)initWithTimeout:(NSTimeInterval)timeout repeat:(bool)repeat completion:(dispatch_block_t _Nonnull)completion queue:(SQueue * _Nonnull)queue; +- (instancetype _Nonnull)initWithTimeout:(NSTimeInterval)timeout repeat:(bool)repeat completion:(dispatch_block_t _Nonnull)completion nativeQueue:(dispatch_queue_t _Nonnull)nativeQueue; - (void)start; - (void)invalidate; diff --git a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SVariable.h b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SVariable.h index 47d51a1608..ffd3fe7a62 100644 --- a/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SVariable.h +++ b/submodules/SSignalKit/SSignalKit/Source/SSignalKit/SVariable.h @@ -4,9 +4,9 @@ @interface SVariable : NSObject -- (instancetype)init; +- (instancetype _Nonnull)init; -- (void)set:(SSignal *)signal; -- (SSignal *)signal; +- (void)set:(SSignal * _Nonnull)signal; +- (SSignal * _Nonnull)signal; @end diff --git a/submodules/SSignalKit/SwiftSignalKit/BUILD b/submodules/SSignalKit/SwiftSignalKit/BUILD index 16720552fe..b3c12dbee1 100644 --- a/submodules/SSignalKit/SwiftSignalKit/BUILD +++ b/submodules/SSignalKit/SwiftSignalKit/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Source/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/SSignalKit/SwiftSignalKit/Source/Disposable.swift b/submodules/SSignalKit/SwiftSignalKit/Source/Disposable.swift index 8a9b9ce65a..28fa733282 100644 --- a/submodules/SSignalKit/SwiftSignalKit/Source/Disposable.swift +++ b/submodules/SSignalKit/SwiftSignalKit/Source/Disposable.swift @@ -1,6 +1,6 @@ import Foundation -public protocol Disposable: class { +public protocol Disposable: AnyObject { func dispose() } diff --git a/submodules/SSignalKit/SwiftSignalKit/Source/Multicast.swift b/submodules/SSignalKit/SwiftSignalKit/Source/Multicast.swift index b1ddec5a3c..8aff97ac08 100644 --- a/submodules/SSignalKit/SwiftSignalKit/Source/Multicast.swift +++ b/submodules/SSignalKit/SwiftSignalKit/Source/Multicast.swift @@ -48,9 +48,6 @@ public final class Multicast { subscriber(next) } }, error: { _ in - self.lock.locked { - let _ = self.instances.removeValue(forKey: key) - } }, completed: { self.lock.locked { self.instances.removeValue(forKey: key) diff --git a/submodules/SSignalKit/SwiftSignalKit/Source/Signal_Materialize.swift b/submodules/SSignalKit/SwiftSignalKit/Source/Signal_Materialize.swift index 92e7a9b3c9..e0e8330dbf 100644 --- a/submodules/SSignalKit/SwiftSignalKit/Source/Signal_Materialize.swift +++ b/submodules/SSignalKit/SwiftSignalKit/Source/Signal_Materialize.swift @@ -32,7 +32,6 @@ public func materialize(signal: Signal, NoError>) -> Sig subscriber.putCompletion() } }, error: { _ in - subscriber.putCompletion() }, completed: { subscriber.putCompletion() }) diff --git a/submodules/SaveToCameraRoll/BUILD b/submodules/SaveToCameraRoll/BUILD index 7776ead2dc..d7db544f62 100644 --- a/submodules/SaveToCameraRoll/BUILD +++ b/submodules/SaveToCameraRoll/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", diff --git a/submodules/ScreenCaptureDetection/BUILD b/submodules/ScreenCaptureDetection/BUILD index 81af8cfe2a..39f82dfb7d 100644 --- a/submodules/ScreenCaptureDetection/BUILD +++ b/submodules/ScreenCaptureDetection/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", ], diff --git a/submodules/SearchBarNode/BUILD b/submodules/SearchBarNode/BUILD index 1a7e748afb..5545d3b679 100644 --- a/submodules/SearchBarNode/BUILD +++ b/submodules/SearchBarNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/SearchPeerMembers/BUILD b/submodules/SearchPeerMembers/BUILD index cb4a8fb27a..2ba9d1ef0e 100644 --- a/submodules/SearchPeerMembers/BUILD +++ b/submodules/SearchPeerMembers/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", diff --git a/submodules/SearchUI/BUILD b/submodules/SearchUI/BUILD index 6a7bb45b4c..7210ffaa38 100644 --- a/submodules/SearchUI/BUILD +++ b/submodules/SearchUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/SectionHeaderItem/BUILD b/submodules/SectionHeaderItem/BUILD index e8089be45a..8d7a15d7fc 100644 --- a/submodules/SectionHeaderItem/BUILD +++ b/submodules/SectionHeaderItem/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/SegmentedControlNode/BUILD b/submodules/SegmentedControlNode/BUILD index f85e3f63b3..ff054555a3 100644 --- a/submodules/SegmentedControlNode/BUILD +++ b/submodules/SegmentedControlNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/SelectablePeerNode/BUILD b/submodules/SelectablePeerNode/BUILD index d770eaf552..752fbcac44 100644 --- a/submodules/SelectablePeerNode/BUILD +++ b/submodules/SelectablePeerNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", diff --git a/submodules/SemanticStatusNode/BUILD b/submodules/SemanticStatusNode/BUILD index 43a601eeee..e4a4b8d840 100644 --- a/submodules/SemanticStatusNode/BUILD +++ b/submodules/SemanticStatusNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Display:Display", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/SemanticStatusNode/Sources/SemanticStatusNode.swift b/submodules/SemanticStatusNode/Sources/SemanticStatusNode.swift index 6ddd16dc37..9852a8d08c 100644 --- a/submodules/SemanticStatusNode/Sources/SemanticStatusNode.swift +++ b/submodules/SemanticStatusNode/Sources/SemanticStatusNode.swift @@ -40,7 +40,7 @@ private protocol SemanticStatusNodeStateDrawingState: NSObjectProtocol { func draw(context: CGContext, size: CGSize, foregroundColor: UIColor) } -private protocol SemanticStatusNodeStateContext: class { +private protocol SemanticStatusNodeStateContext: AnyObject { var isAnimating: Bool { get } var requestUpdate: () -> Void { get set } diff --git a/submodules/ShareController/BUILD b/submodules/ShareController/BUILD index e6fa68bd0b..16c1e671b9 100644 --- a/submodules/ShareController/BUILD +++ b/submodules/ShareController/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/ShareController/Sources/ShareContentContainerNode.swift b/submodules/ShareController/Sources/ShareContentContainerNode.swift index e3e7a612a9..8526858de6 100644 --- a/submodules/ShareController/Sources/ShareContentContainerNode.swift +++ b/submodules/ShareController/Sources/ShareContentContainerNode.swift @@ -3,7 +3,7 @@ import UIKit import Display import Postbox -public protocol ShareContentContainerNode: class { +public protocol ShareContentContainerNode: AnyObject { func activate() func deactivate() func setEnsurePeerVisibleOnLayout(_ peerId: PeerId?) diff --git a/submodules/ShareController/Sources/ShareController.swift b/submodules/ShareController/Sources/ShareController.swift index 2cbd9e67f7..62c62c5be4 100644 --- a/submodules/ShareController/Sources/ShareController.swift +++ b/submodules/ShareController/Sources/ShareController.swift @@ -748,23 +748,7 @@ public final class ShareController: ViewController { } } - var activities: [UIActivity]? - if false, #available(iOS 10.0, *), strongSelf.sharedContext.applicationBindings.canOpenUrl("instagram-stories://"), case let .messages(messages) = strongSelf.subject, let message = messages.first, let peer = message.peers[message.id.peerId] { - let shareToInstagram = ShareToInstagramActivity(action: { sharedItems in - let renderer = MessageStoryRenderer(context: strongSelf.currentContext, messages: messages) - - let layout = ContainerViewLayout(size: CGSize(width: 414.0, height: 896.0), metrics: LayoutMetrics(widthClass: .compact, heightClass: .compact), deviceMetrics: .iPhoneX, intrinsicInsets: UIEdgeInsets(), safeInsets: UIEdgeInsets(), additionalInsets: UIEdgeInsets(), statusBarHeight: 0.0, inputHeight: nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: false) - renderer.update(layout: layout) { image in - if let data = image?.pngData() { - let pasteboardItems: [[String: Any]] = [["com.instagram.sharedSticker.backgroundImage": data, - "com.instagram.sharedSticker.contentURL": "https://t.me/\(peer.addressName ?? "")/\(message.id.id)"]] - UIPasteboard.general.setItems(pasteboardItems, options: [.expirationDate: Date().addingTimeInterval(5 * 60)]) - strongSelf.sharedContext.applicationBindings.openUrl("instagram-stories://share") - } - } - }) - activities = [shareToInstagram] - } + let activities: [UIActivity]? = nil let _ = (strongSelf.didAppearPromise.get() |> filter { $0 } diff --git a/submodules/ShareController/Sources/ShareControllerPeerGridItem.swift b/submodules/ShareController/Sources/ShareControllerPeerGridItem.swift index 9e826af425..909d4ad7aa 100644 --- a/submodules/ShareController/Sources/ShareControllerPeerGridItem.swift +++ b/submodules/ShareController/Sources/ShareControllerPeerGridItem.swift @@ -164,7 +164,7 @@ final class ShareControllerPeerGridItemNode: GridItemNode { } override func updateAbsoluteRect(_ absoluteRect: CGRect, within containerSize: CGSize) { - var rect = absoluteRect + let rect = absoluteRect self.absoluteLocation = (rect, containerSize) if let shimmerNode = self.placeholderNode { shimmerNode.updateAbsoluteRect(rect, within: containerSize) diff --git a/submodules/ShareController/Sources/ShareSearchContainerNode.swift b/submodules/ShareController/Sources/ShareSearchContainerNode.swift index 6480675655..82dc40011d 100644 --- a/submodules/ShareController/Sources/ShareSearchContainerNode.swift +++ b/submodules/ShareController/Sources/ShareSearchContainerNode.swift @@ -32,15 +32,6 @@ private enum ShareSearchRecentEntryStableId: Hashable { } } } - - var hashValue: Int { - switch self { - case .topPeers: - return 0 - case let .peerId(peerId): - return peerId.hashValue - } - } } private enum ShareSearchRecentEntry: Comparable, Identifiable { diff --git a/submodules/ShareItems/BUILD b/submodules/ShareItems/BUILD index b660a08c21..313b5ce3cc 100644 --- a/submodules/ShareItems/BUILD +++ b/submodules/ShareItems/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", diff --git a/submodules/ShareItems/Sources/ShareItems.swift b/submodules/ShareItems/Sources/ShareItems.swift index 422b6a56cf..851be6db77 100644 --- a/submodules/ShareItems/Sources/ShareItems.swift +++ b/submodules/ShareItems/Sources/ShareItems.swift @@ -99,7 +99,7 @@ private func preparedShareItem(account: Account, to peerId: PeerId, value: [Stri var cropRect = CGRect(origin: CGPoint(), size: size) if abs(width - height) < CGFloat.ulpOfOne { cropRect = cropRect.insetBy(dx: 13.0, dy: 13.0) - cropRect.offsetBy(dx: 2.0, dy: 3.0) + cropRect = cropRect.offsetBy(dx: 2.0, dy: 3.0) } else { let shortestSide = min(size.width, size.height) cropRect = CGRect(x: (size.width - shortestSide) / 2.0, y: (size.height - shortestSide) / 2.0, width: shortestSide, height: shortestSide) @@ -119,7 +119,7 @@ private func preparedShareItem(account: Account, to peerId: PeerId, value: [Stri 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) } @@ -151,7 +151,10 @@ private func preparedShareItem(account: Account, to peerId: PeerId, value: [Stri if !treatAsFile, let image = UIImage(data: data) { var isGif = false if data.count > 4 { - data.withUnsafeBytes { (bytes: UnsafePointer) -> Void in + data.withUnsafeBytes { buffer -> Void in + guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else { + return + } if bytes.advanced(by: 0).pointee == 71 // G && bytes.advanced(by: 1).pointee == 73 // I && bytes.advanced(by: 2).pointee == 70 // F diff --git a/submodules/ShimmerEffect/BUILD b/submodules/ShimmerEffect/BUILD index 5ac01ccfdd..56cf4806fb 100644 --- a/submodules/ShimmerEffect/BUILD +++ b/submodules/ShimmerEffect/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/ShimmerEffect/Sources/StickerShimmerEffectNode.swift b/submodules/ShimmerEffect/Sources/StickerShimmerEffectNode.swift index af464d3222..a5b37eb8c3 100644 --- a/submodules/ShimmerEffect/Sources/StickerShimmerEffectNode.swift +++ b/submodules/ShimmerEffect/Sources/StickerShimmerEffectNode.swift @@ -330,6 +330,9 @@ private func renderPath(_ segments: [PathSegment], context: CGContext) { cubicPoint = nil quadrPoint = nil } + + let _ = initialPoint + let _ = quadrPoint for segment in segments { var data = segment.data diff --git a/submodules/SinglePhoneInputNode/BUILD b/submodules/SinglePhoneInputNode/BUILD index 444fca3d20..f2f4b9b70f 100644 --- a/submodules/SinglePhoneInputNode/BUILD +++ b/submodules/SinglePhoneInputNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/SlotMachineAnimationNode/BUILD b/submodules/SlotMachineAnimationNode/BUILD index 1d83bf32ee..9ebdcc588e 100644 --- a/submodules/SlotMachineAnimationNode/BUILD +++ b/submodules/SlotMachineAnimationNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/SolidRoundedButtonNode/BUILD b/submodules/SolidRoundedButtonNode/BUILD index a22f23414d..96b30de710 100644 --- a/submodules/SolidRoundedButtonNode/BUILD +++ b/submodules/SolidRoundedButtonNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/Speak/BUILD b/submodules/Speak/BUILD index 2cdcc0121b..face717fdb 100644 --- a/submodules/Speak/BUILD +++ b/submodules/Speak/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Display:Display", ], diff --git a/submodules/StatisticsUI/BUILD b/submodules/StatisticsUI/BUILD index 1bbd44f86b..c09203364d 100644 --- a/submodules/StatisticsUI/BUILD +++ b/submodules/StatisticsUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/StatisticsUI/Sources/StatsMessageItem.swift b/submodules/StatisticsUI/Sources/StatsMessageItem.swift index 7229f6488c..512eac52d2 100644 --- a/submodules/StatisticsUI/Sources/StatsMessageItem.swift +++ b/submodules/StatisticsUI/Sources/StatsMessageItem.swift @@ -358,8 +358,7 @@ public class StatsMessageItemNode: ListViewItemNode, ItemListItemNode { } let contentImageSize = CGSize(width: 40.0, height: 40.0) - - var contentImageNodeAppeared = false + if let dimensions = dimensions { let makeImageLayout = strongSelf.contentImageNode.asyncLayout() let imageSize = contentImageSize @@ -371,7 +370,6 @@ public class StatsMessageItemNode: ListViewItemNode, ItemListItemNode { strongSelf.contentImageNode.setSignal(updateImageSignal) if currentContentImageMedia == nil { strongSelf.contentImageNode.isHidden = false - contentImageNodeAppeared = true } } } else { diff --git a/submodules/StickerPackPreviewUI/BUILD b/submodules/StickerPackPreviewUI/BUILD index 328333dfcd..548a88134f 100644 --- a/submodules/StickerPackPreviewUI/BUILD +++ b/submodules/StickerPackPreviewUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewController.swift b/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewController.swift index d53eb66333..cfddc92382 100644 --- a/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewController.swift +++ b/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewController.swift @@ -130,7 +130,6 @@ public final class StickerPackPreviewController: ViewController, StandalonePrese return } - let account = strongSelf.context.account strongSelf.openMentionDisposable.set((strongSelf.context.engine.peers.resolvePeerByName(name: mention) |> mapToSignal { peer -> Signal in if let peer = peer { diff --git a/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewControllerNode.swift b/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewControllerNode.swift index c1e5d016ba..75671b66c8 100644 --- a/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewControllerNode.swift +++ b/submodules/StickerPackPreviewUI/Sources/StickerPackPreviewControllerNode.swift @@ -522,8 +522,7 @@ final class StickerPackPreviewControllerNode: ViewControllerTracingNode, UIScrol } @objc func installActionButtonPressed() { - let dismissOnAction = true - if let stickerPack = self.stickerPack, let stickerSettings = self.stickerSettings { + if let stickerPack = self.stickerPack, let _ = self.stickerSettings { switch stickerPack { case let .result(info, items, installed): if installed { @@ -534,19 +533,11 @@ final class StickerPackPreviewControllerNode: ViewControllerTracingNode, UIScrol } strongSelf.actionPerformed?(info, items, .remove(positionInList: positionInList)) }) - if !dismissOnAction { - self.updateStickerPack(.result(info: info, items: items, installed: false), stickerSettings: stickerSettings) - } } else { let _ = self.context.engine.stickers.addStickerPackInteractively(info: info, items: items).start() - if !dismissOnAction { - self.updateStickerPack(.result(info: info, items: items, installed: true), stickerSettings: stickerSettings) - } self.actionPerformed?(info, items, .add) } - if dismissOnAction { - self.cancelButtonPressed() - } + self.cancelButtonPressed() default: break } diff --git a/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift b/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift index aa10218b2d..598bbe8c24 100644 --- a/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift +++ b/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift @@ -412,7 +412,7 @@ private final class StickerPackContainer: ASDisplayNode { } case let .result(info, items, installed): if !items.isEmpty && self.currentStickerPack == nil { - if let (_, _, _, gridInsets) = self.validLayout, abs(self.expandScrollProgress - 1.0) < .ulpOfOne { + if let _ = self.validLayout, abs(self.expandScrollProgress - 1.0) < .ulpOfOne { scrollToItem = GridNodeScrollToItem(index: 0, position: .top(0.0), transition: .immediate, directionHint: .up, adjustForSection: false) } } diff --git a/submodules/StickerResources/BUILD b/submodules/StickerResources/BUILD index a8ed7fe661..a24e729b2e 100644 --- a/submodules/StickerResources/BUILD +++ b/submodules/StickerResources/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Postbox:Postbox", diff --git a/submodules/StickerResources/Sources/StickerResources.swift b/submodules/StickerResources/Sources/StickerResources.swift index 3bba99d499..3703f2a8c2 100644 --- a/submodules/StickerResources/Sources/StickerResources.swift +++ b/submodules/StickerResources/Sources/StickerResources.swift @@ -83,8 +83,7 @@ private func chatMessageStickerDatas(postbox: Postbox, file: TelegramMediaFile, return Tuple(thumbnailData.complete ? try? Data(contentsOf: URL(fileURLWithPath: thumbnailData.path)) : nil, fullSizeData.0, fullSizeData.1) }).start(next: { next in subscriber.putNext(next) - }, error: { error in - subscriber.putError(error) + }, error: { _ in }, completed: { subscriber.putCompletion() }) @@ -135,8 +134,7 @@ public func chatMessageAnimatedStickerDatas(postbox: Postbox, file: TelegramMedi return Tuple(thumbnailData.complete ? try? Data(contentsOf: URL(fileURLWithPath: thumbnailData.path)) : nil, fullSizeData.0, fullSizeData.1) }).start(next: { next in subscriber.putNext(next) - }, error: { error in - subscriber.putError(error) + }, error: { _ in }, completed: { subscriber.putCompletion() }) @@ -173,8 +171,7 @@ private func chatMessageStickerThumbnailData(postbox: Postbox, file: TelegramMed return thumbnailData.complete ? try? Data(contentsOf: URL(fileURLWithPath: thumbnailData.path)) : nil }).start(next: { next in subscriber.putNext(next) - }, error: { error in - subscriber.putError(error) + }, error: { _ in }, completed: { subscriber.putCompletion() }) @@ -214,8 +211,7 @@ private func chatMessageStickerPackThumbnailData(postbox: Postbox, resource: Med let fetch: Disposable? = nil let disposable = fullSizeData.start(next: { next in subscriber.putNext(next.0) - }, error: { error in - subscriber.putError(error) + }, error: { _ in }, completed: { subscriber.putCompletion() }) diff --git a/submodules/StringPluralization/BUILD b/submodules/StringPluralization/BUILD index 98fb1d6975..76103e678b 100644 --- a/submodules/StringPluralization/BUILD +++ b/submodules/StringPluralization/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/NumberPluralizationForm:NumberPluralizationForm", "//submodules/AppBundle:AppBundle", diff --git a/submodules/SwipeToDismissGesture/BUILD b/submodules/SwipeToDismissGesture/BUILD index 0e224570ac..c60d8cf192 100644 --- a/submodules/SwipeToDismissGesture/BUILD +++ b/submodules/SwipeToDismissGesture/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/SwitchNode/BUILD b/submodules/SwitchNode/BUILD index 6df0d8776a..26a8788fa1 100644 --- a/submodules/SwitchNode/BUILD +++ b/submodules/SwitchNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/TelegramAnimatedStickerNode/BUILD b/submodules/TelegramAnimatedStickerNode/BUILD index bfb4779824..f67d3887d4 100644 --- a/submodules/TelegramAnimatedStickerNode/BUILD +++ b/submodules/TelegramAnimatedStickerNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Postbox:Postbox", "//submodules/TelegramCore:TelegramCore", diff --git a/submodules/TelegramAnimatedStickerNode/Sources/AnimatedStickerUtils.swift b/submodules/TelegramAnimatedStickerNode/Sources/AnimatedStickerUtils.swift index bc5316602b..3599fc09f5 100644 --- a/submodules/TelegramAnimatedStickerNode/Sources/AnimatedStickerUtils.swift +++ b/submodules/TelegramAnimatedStickerNode/Sources/AnimatedStickerUtils.swift @@ -39,7 +39,7 @@ public func fetchCompressedLottieFirstFrameAJpeg(data: Data, size: CGSize, fitzM assert(yuvaPixelsPerAlphaRow % 2 == 0) let yuvaLength = Int(size.width) * Int(size.height) * 2 + yuvaPixelsPerAlphaRow * Int(size.height) / 2 - var yuvaFrameData = malloc(yuvaLength)! + let yuvaFrameData = malloc(yuvaLength)! memset(yuvaFrameData, 0, yuvaLength) defer { @@ -109,7 +109,6 @@ private let threadPool: ThreadPool = { return ThreadPool(threadCount: 3, threadPriority: 0.5) }() -@available(iOS 9.0, *) public func experimentalConvertCompressedLottieToCombinedMp4(data: Data, size: CGSize, fitzModifier: EmojiFitzModifier? = nil, cacheKey: String) -> Signal { return Signal({ subscriber in let cancelled = Atomic(value: false) @@ -118,8 +117,7 @@ public func experimentalConvertCompressedLottieToCombinedMp4(data: Data, size: C if cancelled.with({ $0 }) { return } - - let startTime = CACurrentMediaTime() + var drawingTime: Double = 0 var appendingTime: Double = 0 var deltaTime: Double = 0 @@ -146,7 +144,7 @@ public func experimentalConvertCompressedLottieToCombinedMp4(data: Data, size: C } func writeData(_ data: UnsafeRawPointer, length: Int) { - file.write(data, count: length) + let _ = file.write(data, count: length) } func commitData() { @@ -234,7 +232,10 @@ public func experimentalConvertCompressedLottieToCombinedMp4(data: Data, size: C deltaTime += CACurrentMediaTime() - deltaStartTime let compressionStartTime = CACurrentMediaTime() - compressedFrameData.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer) -> Void in + compressedFrameData.withUnsafeMutableBytes { buffer -> Void in + guard let bytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else { + return + } let length = compression_encode_buffer(bytes, compressedFrameDataLength, previousYuvaFrameData.assumingMemoryBound(to: UInt8.self), yuvaLength, scratchData, COMPRESSION_LZFSE) var frameLengthValue: Int32 = Int32(length) writeData(&frameLengthValue, length: 4) diff --git a/submodules/TelegramAudio/BUILD b/submodules/TelegramAudio/BUILD index 8273a42b1d..319722988c 100644 --- a/submodules/TelegramAudio/BUILD +++ b/submodules/TelegramAudio/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", ], diff --git a/submodules/TelegramAudio/Sources/ManagedAudioSession.swift b/submodules/TelegramAudio/Sources/ManagedAudioSession.swift index c1f5311f2a..b6dfdf05f6 100644 --- a/submodules/TelegramAudio/Sources/ManagedAudioSession.swift +++ b/submodules/TelegramAudio/Sources/ManagedAudioSession.swift @@ -568,7 +568,11 @@ public final class ManagedAudioSession { index += 1 } - let lastIsRecordWithOthers = false // self.holders.last?.audioSessionType == .recordWithOthers + var lastIsRecordWithOthers = false // self.holders.last?.audioSessionType == .recordWithOthers + if "".count != 0 { + // Silence warning + lastIsRecordWithOthers = true + } if !deactivating { if let activeIndex = activeIndex { var deactivate = false diff --git a/submodules/TelegramBaseController/BUILD b/submodules/TelegramBaseController/BUILD index 5dd334fcf5..1d6b6bf6f8 100644 --- a/submodules/TelegramBaseController/BUILD +++ b/submodules/TelegramBaseController/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", diff --git a/submodules/TelegramCallsUI/BUILD b/submodules/TelegramCallsUI/BUILD index 24b48b2c18..0865e3101d 100644 --- a/submodules/TelegramCallsUI/BUILD +++ b/submodules/TelegramCallsUI/BUILD @@ -46,6 +46,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], data = [ ":TelegramCallsUIBundle", ], diff --git a/submodules/TelegramCallsUI/Sources/CallController.swift b/submodules/TelegramCallsUI/Sources/CallController.swift index 0f13530122..dc1a46bbf3 100644 --- a/submodules/TelegramCallsUI/Sources/CallController.swift +++ b/submodules/TelegramCallsUI/Sources/CallController.swift @@ -14,7 +14,7 @@ import TelegramNotices import AppBundle import TooltipUI -protocol CallControllerNodeProtocol: class { +protocol CallControllerNodeProtocol: AnyObject { var isMuted: Bool { get set } var toggleMute: (() -> Void)? { get set } diff --git a/submodules/TelegramCallsUI/Sources/CallControllerButton.swift b/submodules/TelegramCallsUI/Sources/CallControllerButton.swift index e4e4be2b67..eb83d75458 100644 --- a/submodules/TelegramCallsUI/Sources/CallControllerButton.swift +++ b/submodules/TelegramCallsUI/Sources/CallControllerButton.swift @@ -369,7 +369,7 @@ final class CallControllerButtonItemNode: HighlightTrackingButtonNode { fillColor = UIColor(rgb: 0xd92326).withMultipliedBrightnessBy(0.2).withAlphaComponent(0.2) case .green: fillColor = UIColor(rgb: 0x74db58).withMultipliedBrightnessBy(0.2).withAlphaComponent(0.2) - case let .custom(color, alpha): + case let .custom(color, _): fillColor = UIColor(rgb: color).withMultipliedBrightnessBy(0.2).withAlphaComponent(0.2) } } diff --git a/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift b/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift index a1dcb9e96d..ec1a7572a7 100644 --- a/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift +++ b/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift @@ -138,7 +138,6 @@ private class CallStatusBarBackgroundNode: ASDisplayNode { } private func setupGradientAnimations() { - return if let _ = self.foregroundGradientLayer.animation(forKey: "movement") { } else { let previousValue = self.foregroundGradientLayer.startPoint diff --git a/submodules/TelegramCallsUI/Sources/PresentationCall.swift b/submodules/TelegramCallsUI/Sources/PresentationCall.swift index 5010349b73..0eed053664 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCall.swift @@ -98,7 +98,10 @@ final class PresentationCallToneRenderer { var blockBuffer: CMBlockBuffer? let bytes = malloc(frameSize)! - toneData.withUnsafeBytes { (dataBytes: UnsafePointer) -> Void in + toneData.withUnsafeBytes { dataBuffer -> Void in + guard let dataBytes = dataBuffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else { + return + } var takenCount = 0 while takenCount < frameSize { let dataOffset = (takeOffset + takenCount) % toneData.count diff --git a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift index 6ee0804dd9..3499f3dee9 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift @@ -2884,7 +2884,6 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { case generic } - let account = self.account let context = self.accountContext let currentCall: Signal if let initialCall = self.initialCall { diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift index 6d266c2837..a2578444b8 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift @@ -3522,7 +3522,7 @@ public final class VoiceChatController: ViewController { strongSelf.containerLayoutUpdated(layout, navigationHeight: navigationHeight, transition: .animated(duration: 0.4, curve: .spring)) } } - }, switchCamera: { [weak self] in + }, switchCamera: { Queue.mainQueue().after(0.1) { isFrontCamera = !isFrontCamera videoCapturer.switchVideoInput(isFront: isFrontCamera) @@ -6044,15 +6044,15 @@ public final class VoiceChatController: ViewController { } else if let url = asset as? URL, let data = try? Data(contentsOf: url, options: [.mappedRead]), let image = UIImage(data: data), let entityRenderer = entityRenderer { let durationSignal: SSignal = SSignal(generator: { subscriber in let disposable = (entityRenderer.duration()).start(next: { duration in - subscriber?.putNext(duration) - subscriber?.putCompletion() + subscriber.putNext(duration) + subscriber.putCompletion() }) return SBlockDisposable(block: { disposable.dispose() }) }) - signal = durationSignal.map(toSignal: { duration -> SSignal? in + signal = durationSignal.map(toSignal: { duration -> SSignal in if let duration = duration as? Double { return TGMediaVideoConverter.renderUIImage(image, duration: duration, adjustments: adjustments, watcher: nil, entityRenderer: entityRenderer)! } else { diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatFullscreenParticipantItem.swift b/submodules/TelegramCallsUI/Sources/VoiceChatFullscreenParticipantItem.swift index b96df15fc4..209ef94c91 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatFullscreenParticipantItem.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatFullscreenParticipantItem.swift @@ -614,7 +614,7 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode { strongSelf.containerNode.isGestureEnabled = item.contextAction != nil strongSelf.accessibilityLabel = titleAttributedString?.string - var combinedValueString = "" + let combinedValueString = "" // if let statusString = statusAttributedString?.string, !statusString.isEmpty { // combinedValueString.append(statusString) // } @@ -700,7 +700,7 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode { strongSelf.audioLevelView = audioLevelView strongSelf.offsetContainerNode.view.insertSubview(audioLevelView, at: 0) - if let item = strongSelf.item, strongSelf.videoNode != nil && !active { + if let _ = strongSelf.item, strongSelf.videoNode != nil && !active { audioLevelView.alpha = 0.0 } } diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift b/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift index 49c138b9d2..952e316641 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift @@ -937,7 +937,7 @@ class VoiceChatParticipantItemNode: ItemListRevealOptionsItemNode { strongSelf.containerNode.isGestureEnabled = item.contextAction != nil strongSelf.accessibilityLabel = titleAttributedString?.string - var combinedValueString = "" + let combinedValueString = "" // if let statusString = statusAttributedString?.string, !statusString.isEmpty { // combinedValueString.append(statusString) // } diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatPeerProfileNode.swift b/submodules/TelegramCallsUI/Sources/VoiceChatPeerProfileNode.swift index 40e0728036..5146e2c53f 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatPeerProfileNode.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatPeerProfileNode.swift @@ -440,7 +440,6 @@ final class VoiceChatPeerProfileNode: ASDisplayNode { } else if let targetNode = targetNode as? VoiceChatFullscreenParticipantItemNode { let backgroundTargetRect = targetRect - let initialSize = self.bounds self.updateInfo(size: targetRect.size, sourceSize: targetRect.size, animate: true) targetNode.avatarNode.isHidden = false diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatShareScreenContextItem.swift b/submodules/TelegramCallsUI/Sources/VoiceChatShareScreenContextItem.swift index a91ab9b17b..9b081c9a2a 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatShareScreenContextItem.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatShareScreenContextItem.swift @@ -160,7 +160,6 @@ private final class VoiceChatShareScreenContextItemNode: ASDisplayNode, ContextM self.highlightedBackgroundNode.backgroundColor = presentationData.theme.contextMenu.itemHighlightedBackgroundColor let textFont = Font.regular(presentationData.listsFontSize.baseDisplaySize) - let subtextFont = Font.regular(presentationData.listsFontSize.baseDisplaySize * 13.0 / 17.0) self.textNode.attributedText = NSAttributedString(string: self.textNode.attributedText?.string ?? "", font: textFont, textColor: presentationData.theme.contextMenu.primaryColor) } diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramChatAdminRights.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramChatAdminRights.swift index ac746b6613..2fc3af8f68 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramChatAdminRights.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramChatAdminRights.swift @@ -1,6 +1,6 @@ import Postbox -public struct TelegramChatAdminRightsFlags: OptionSet { +public struct TelegramChatAdminRightsFlags: OptionSet, Hashable { public var rawValue: Int32 public init(rawValue: Int32) { diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramChatBannedRights.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramChatBannedRights.swift index ef804d8858..1bb9f99b39 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramChatBannedRights.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramChatBannedRights.swift @@ -1,6 +1,6 @@ import Postbox -public struct TelegramChatBannedRightsFlags: OptionSet { +public struct TelegramChatBannedRightsFlags: OptionSet, Hashable { public var rawValue: Int32 public init(rawValue: Int32) { diff --git a/submodules/TelegramIntents/BUILD b/submodules/TelegramIntents/BUILD index 68285800aa..a9539a5ca1 100644 --- a/submodules/TelegramIntents/BUILD +++ b/submodules/TelegramIntents/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", diff --git a/submodules/TelegramNotices/BUILD b/submodules/TelegramNotices/BUILD index d0b8191524..351f442adf 100644 --- a/submodules/TelegramNotices/BUILD +++ b/submodules/TelegramNotices/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Postbox:Postbox", "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", diff --git a/submodules/TelegramPermissions/BUILD b/submodules/TelegramPermissions/BUILD index 8225a6d321..5c9010b5d7 100644 --- a/submodules/TelegramPermissions/BUILD +++ b/submodules/TelegramPermissions/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Postbox:Postbox", "//submodules/TelegramCore:TelegramCore", diff --git a/submodules/TelegramPermissionsUI/BUILD b/submodules/TelegramPermissionsUI/BUILD index acbc6e3dd5..ec40edd53e 100644 --- a/submodules/TelegramPermissionsUI/BUILD +++ b/submodules/TelegramPermissionsUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/TelegramPresentationData/BUILD b/submodules/TelegramPresentationData/BUILD index 9a8b2f60a5..d15b450263 100644 --- a/submodules/TelegramPresentationData/BUILD +++ b/submodules/TelegramPresentationData/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Postbox:Postbox", diff --git a/submodules/TelegramPresentationData/Sources/ChatControllerBackgroundNode.swift b/submodules/TelegramPresentationData/Sources/ChatControllerBackgroundNode.swift index 5dd0703bd0..7f339b778f 100644 --- a/submodules/TelegramPresentationData/Sources/ChatControllerBackgroundNode.swift +++ b/submodules/TelegramPresentationData/Sources/ChatControllerBackgroundNode.swift @@ -72,20 +72,20 @@ public func chatControllerBackgroundImage(theme: PresentationTheme?, wallpaper i backgroundImage = UIImage(contentsOfFile: path)?.precomposed() } } - case let .file(file): + case let .file(_, _, _, _, _, _, _, file, settings): if wallpaper.isPattern { backgroundImage = nil } else { - if file.settings.blur && composed { + if settings.blur && composed { var image: UIImage? - let _ = mediaBox.cachedResourceRepresentation(file.file.resource, representation: CachedBlurredWallpaperRepresentation(), complete: true, fetch: true, attemptSynchronously: true).start(next: { data in + let _ = mediaBox.cachedResourceRepresentation(file.resource, representation: CachedBlurredWallpaperRepresentation(), complete: true, fetch: true, attemptSynchronously: true).start(next: { data in if data.complete { image = UIImage(contentsOfFile: data.path)?.precomposed() } }) backgroundImage = image } - if backgroundImage == nil, let path = mediaBox.completedResourcePath(file.file.resource) { + if backgroundImage == nil, let path = mediaBox.completedResourcePath(file.resource) { succeed = false backgroundImage = UIImage(contentsOfFile: path)?.precomposed() } @@ -166,17 +166,17 @@ public func chatControllerBackgroundImageSignal(wallpaper: TelegramWallpaper, me } } } - case let .file(file): + case let .file(_, _, _, _, _, _, slug, file, settings): if wallpaper.isPattern { return .single((nil, true)) } else { - if file.settings.blur { + if settings.blur { let representation = CachedBlurredWallpaperRepresentation() - if FileManager.default.fileExists(atPath: mediaBox.cachedRepresentationCompletePath(file.file.resource.id, representation: representation)) { + if FileManager.default.fileExists(atPath: mediaBox.cachedRepresentationCompletePath(file.resource.id, representation: representation)) { let effectiveMediaBox = mediaBox - return effectiveMediaBox.cachedResourceRepresentation(file.file.resource, representation: representation, complete: true, fetch: true, attemptSynchronously: true) + return effectiveMediaBox.cachedResourceRepresentation(file.resource, representation: representation, complete: true, fetch: true, attemptSynchronously: true) |> map { data -> (UIImage?, Bool)? in if data.complete { return (UIImage(contentsOfFile: data.path)?.precomposed(), true) @@ -189,17 +189,17 @@ public func chatControllerBackgroundImageSignal(wallpaper: TelegramWallpaper, me } } else { return Signal { subscriber in - let fetch = fetchedMediaResource(mediaBox: accountMediaBox, reference: MediaResourceReference.wallpaper(wallpaper: WallpaperReference.slug(file.slug), resource: file.file.resource)).start() + let fetch = fetchedMediaResource(mediaBox: accountMediaBox, reference: MediaResourceReference.wallpaper(wallpaper: WallpaperReference.slug(slug), resource: file.resource)).start() var didOutputBlurred = false - let data = accountMediaBox.cachedResourceRepresentation(file.file.resource, representation: representation, complete: true, fetch: true, attemptSynchronously: true).start(next: { data in + let data = accountMediaBox.cachedResourceRepresentation(file.resource, representation: representation, complete: true, fetch: true, attemptSynchronously: true).start(next: { data in if data.complete { if let image = UIImage(contentsOfFile: data.path)?.precomposed() { - mediaBox.copyResourceData(file.file.resource.id, fromTempPath: data.path) + mediaBox.copyResourceData(file.resource.id, fromTempPath: data.path) subscriber.putNext((image, true)) } } else if !didOutputBlurred { didOutputBlurred = true - if let immediateThumbnailData = file.file.immediateThumbnailData, let decodedData = decodeTinyThumbnail(data: immediateThumbnailData) { + if let immediateThumbnailData = file.immediateThumbnailData, let decodedData = decodeTinyThumbnail(data: immediateThumbnailData) { if let image = UIImage(data: decodedData)?.precomposed() { subscriber.putNext((image, false)) } @@ -215,9 +215,9 @@ public func chatControllerBackgroundImageSignal(wallpaper: TelegramWallpaper, me } } else { var path: String? - if let maybePath = mediaBox.completedResourcePath(file.file.resource) { + if let maybePath = mediaBox.completedResourcePath(file.resource) { path = maybePath - } else if let maybePath = accountMediaBox.completedResourcePath(file.file.resource) { + } else if let maybePath = accountMediaBox.completedResourcePath(file.resource) { path = maybePath } if let path = path { @@ -227,17 +227,17 @@ public func chatControllerBackgroundImageSignal(wallpaper: TelegramWallpaper, me } } else { return Signal { subscriber in - let fetch = fetchedMediaResource(mediaBox: accountMediaBox, reference: MediaResourceReference.wallpaper(wallpaper: WallpaperReference.slug(file.slug), resource: file.file.resource)).start() + let fetch = fetchedMediaResource(mediaBox: accountMediaBox, reference: MediaResourceReference.wallpaper(wallpaper: WallpaperReference.slug(slug), resource: file.resource)).start() var didOutputBlurred = false - let data = accountMediaBox.resourceData(file.file.resource).start(next: { data in + let data = accountMediaBox.resourceData(file.resource).start(next: { data in if data.complete { if let image = UIImage(contentsOfFile: data.path)?.precomposed() { - mediaBox.copyResourceData(file.file.resource.id, fromTempPath: data.path) + mediaBox.copyResourceData(file.resource.id, fromTempPath: data.path) subscriber.putNext((image, true)) } } else if !didOutputBlurred { didOutputBlurred = true - if let immediateThumbnailData = file.file.immediateThumbnailData, let decodedData = decodeTinyThumbnail(data: immediateThumbnailData) { + if let immediateThumbnailData = file.immediateThumbnailData, let decodedData = decodeTinyThumbnail(data: immediateThumbnailData) { if let image = UIImage(data: decodedData)?.precomposed() { subscriber.putNext((image, false)) } diff --git a/submodules/TelegramPresentationData/Sources/ChatMessageBubbleImages.swift b/submodules/TelegramPresentationData/Sources/ChatMessageBubbleImages.swift index a59ae2b960..4df9b65770 100644 --- a/submodules/TelegramPresentationData/Sources/ChatMessageBubbleImages.swift +++ b/submodules/TelegramPresentationData/Sources/ChatMessageBubbleImages.swift @@ -215,7 +215,6 @@ public func messageBubbleImage(maxCornerRadius: CGFloat, minCornerRadius: CGFloa if drawTail { let outlineBottomEllipse = bottomEllipse.insetBy(dx: -borderOffset, dy: -borderOffset) let outlineInnerTopEllipse = topEllipse.insetBy(dx: borderOffset, dy: borderOffset) - let outlineTopEllipse = topEllipse.insetBy(dx: -borderOffset, dy: -borderOffset) context.setBlendMode(.copy) context.setFillColor(UIColor.clear.cgColor) diff --git a/submodules/TelegramPresentationData/Sources/ChatPresentationData.swift b/submodules/TelegramPresentationData/Sources/ChatPresentationData.swift index 1fbb5bc4bd..094d3bd857 100644 --- a/submodules/TelegramPresentationData/Sources/ChatPresentationData.swift +++ b/submodules/TelegramPresentationData/Sources/ChatPresentationData.swift @@ -2,7 +2,6 @@ import Foundation import UIKit import Display import TelegramCore -import TelegramPresentationData import TelegramUIPreferences public final class ChatPresentationThemeData: Equatable { diff --git a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift index 00da547761..cca43e6c1b 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift @@ -140,7 +140,6 @@ public func customizeDefaultDarkPresentationTheme(theme: PresentationTheme, edit var outgoingBubbleFillColor: UIColor? var outgoingBubbleFillGradientColor: UIColor? - var outgoingBubbleHighlightedFillColor: UIColor? var outgoingPrimaryTextColor: UIColor? var outgoingSecondaryTextColor: UIColor? var outgoingLinkTextColor: UIColor? diff --git a/submodules/TelegramPresentationData/Sources/PresentationData.swift b/submodules/TelegramPresentationData/Sources/PresentationData.swift index 61c25cc6c9..726ddce651 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationData.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationData.swift @@ -457,12 +457,12 @@ public func serviceColor(for wallpaper: (TelegramWallpaper, UIImage?)) -> UIColo } else { return UIColor(rgb: 0x000000, alpha: 0.3) } - case let .file(file): + case let .file(_, _, _, _, _, _, _, _, settings): if wallpaper.0.isPattern { - if file.settings.colors.count >= 1 && file.settings.colors.count <= 2 { - var mixedColor = UIColor(argb: file.settings.colors[0]) - if file.settings.colors.count >= 2 { - mixedColor = mixedColor.mixedWith(UIColor(argb: file.settings.colors[1]), alpha: 0.5) + if settings.colors.count >= 1 && settings.colors.count <= 2 { + var mixedColor = UIColor(argb: settings.colors[0]) + if settings.colors.count >= 2 { + mixedColor = mixedColor.mixedWith(UIColor(argb: settings.colors[1]), alpha: 0.5) } return serviceColor(with: mixedColor) } else { @@ -531,12 +531,12 @@ public func chatServiceBackgroundColor(wallpaper: TelegramWallpaper, mediaBox: M } else { return .single(UIColor(rgb: 0x000000, alpha: 0.3)) } - case let .file(file): + case let .file(_, _, _, _, _, _, _, file, settings): if wallpaper.isPattern { - if file.settings.colors.count >= 1 && file.settings.colors.count <= 2 { - var mixedColor = UIColor(argb: file.settings.colors[0]) - if file.settings.colors.count >= 2 { - mixedColor = mixedColor.mixedWith(UIColor(argb: file.settings.colors[1]), alpha: 0.5) + if settings.colors.count >= 1 && settings.colors.count <= 2 { + var mixedColor = UIColor(argb: settings.colors[0]) + if settings.colors.count >= 2 { + mixedColor = mixedColor.mixedWith(UIColor(argb: settings.colors[1]), alpha: 0.5) } return .single(serviceColor(with: mixedColor)) } else { @@ -544,7 +544,7 @@ public func chatServiceBackgroundColor(wallpaper: TelegramWallpaper, mediaBox: M } } else { return Signal { subscriber in - let data = serviceColor(for: mediaBox.resourceData(file.file.resource)).start(next: { next in + let data = serviceColor(for: mediaBox.resourceData(file.resource)).start(next: { next in subscriber.putNext(next) }, completed: { subscriber.putCompletion() @@ -625,7 +625,7 @@ public func updatedPresentationData(accountManager: AccountManager, applicationI switch effectiveChatWallpaper { case .builtin, .color, .gradient: effectiveChatWallpaper = themeValue.chat.defaultWallpaper - case let .file(file): + case .file: if effectiveChatWallpaper.isPattern { effectiveChatWallpaper = themeValue.chat.defaultWallpaper } diff --git a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift index 0fcd1a94aa..a9a4a31a22 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift @@ -132,33 +132,33 @@ extension TelegramWallpaper: Codable { components.append("blur") } try container.encode(components.joined(separator: " ")) - case let .file(file): + case let .file(_, _, _, _, _, _, slug, _, settings): var components: [String] = [] - components.append(file.slug) + components.append(slug) if self.isPattern { - if file.settings.colors.count >= 1 { - components.append(String(format: "%06x", file.settings.colors[0])) + if settings.colors.count >= 1 { + components.append(String(format: "%06x", settings.colors[0])) } - if let intensity = file.settings.intensity { + if let intensity = settings.intensity { components.append("\(intensity)") } - if file.settings.colors.count >= 2 { - components.append(String(format: "%06x", file.settings.colors[1])) + if settings.colors.count >= 2 { + components.append(String(format: "%06x", settings.colors[1])) } - if file.settings.colors.count >= 3 { - components.append(String(format: "%06x", file.settings.colors[2])) + if settings.colors.count >= 3 { + components.append(String(format: "%06x", settings.colors[2])) } - if file.settings.colors.count >= 4 { - components.append(String(format: "%06x", file.settings.colors[3])) + if settings.colors.count >= 4 { + components.append(String(format: "%06x", settings.colors[3])) } - if let rotation = file.settings.rotation, rotation != 0 { + if let rotation = settings.rotation, rotation != 0 { components.append("\(rotation)") } } - if file.settings.motion { + if settings.motion { components.append("motion") } - if file.settings.blur { + if settings.blur { components.append("blur") } try container.encode(components.joined(separator: " ")) diff --git a/submodules/TelegramPresentationData/Sources/WallpaperUtils.swift b/submodules/TelegramPresentationData/Sources/WallpaperUtils.swift index cb821727cc..e2e8423c67 100644 --- a/submodules/TelegramPresentationData/Sources/WallpaperUtils.swift +++ b/submodules/TelegramPresentationData/Sources/WallpaperUtils.swift @@ -31,8 +31,8 @@ public extension TelegramWallpaper { var isPattern: Bool { switch self { - case let .file(file): - return file.isPattern || file.file.mimeType == "application/x-tgwallpattern" + case let .file(_, _, _, _, isPattern, _, _, file, _): + return isPattern || file.mimeType == "application/x-tgwallpattern" default: return false } @@ -48,8 +48,8 @@ public extension TelegramWallpaper { } var dimensions: CGSize? { - if case let .file(file) = self { - return file.file.dimensions?.cgSize + if case let .file(_, _, _, _, _, _, _, file, _) = self { + return file.dimensions?.cgSize } else { return nil } diff --git a/submodules/TelegramStringFormatting/BUILD b/submodules/TelegramStringFormatting/BUILD index d0e98b73dd..9c917401d3 100644 --- a/submodules/TelegramStringFormatting/BUILD +++ b/submodules/TelegramStringFormatting/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Postbox:Postbox", diff --git a/submodules/TelegramUI/Sources/AuthorizationSequenceSplashController.swift b/submodules/TelegramUI/Sources/AuthorizationSequenceSplashController.swift index 5b344155b8..b0acbe208f 100644 --- a/submodules/TelegramUI/Sources/AuthorizationSequenceSplashController.swift +++ b/submodules/TelegramUI/Sources/AuthorizationSequenceSplashController.swift @@ -57,10 +57,10 @@ final class AuthorizationSequenceSplashController: ViewController { if let available = localization.availableLocalizations.first, available.languageCode != "en" { let value = TGSuggestedLocalization(info: TGAvailableLocalization(title: available.title, localizedTitle: available.localizedTitle, code: available.languageCode), continueWithLanguageString: continueWithLanguageString, chooseLanguageString: "Choose Language", chooseLanguageOtherString: "Choose Language", englishLanguageNameString: "English") - subscriber?.putNext(value) + subscriber.putNext(value) } }, completed: { - subscriber?.putCompletion() + subscriber.putCompletion() }) return SBlockDisposable(block: { diff --git a/submodules/TelegramUI/Sources/CreateChannelController.swift b/submodules/TelegramUI/Sources/CreateChannelController.swift index e7dd59bb0c..78f87fadb4 100644 --- a/submodules/TelegramUI/Sources/CreateChannelController.swift +++ b/submodules/TelegramUI/Sources/CreateChannelController.swift @@ -369,15 +369,15 @@ public func createChannelController(context: AccountContext) -> ViewController { } else if let url = asset as? URL, let data = try? Data(contentsOf: url, options: [.mappedRead]), let image = UIImage(data: data), let entityRenderer = entityRenderer { let durationSignal: SSignal = SSignal(generator: { subscriber in let disposable = (entityRenderer.duration()).start(next: { duration in - subscriber?.putNext(duration) - subscriber?.putCompletion() + subscriber.putNext(duration) + subscriber.putCompletion() }) return SBlockDisposable(block: { disposable.dispose() }) }) - signal = durationSignal.map(toSignal: { duration -> SSignal? in + signal = durationSignal.map(toSignal: { duration -> SSignal in if let duration = duration as? Double { return TGMediaVideoConverter.renderUIImage(image, duration: duration, adjustments: adjustments, watcher: nil, entityRenderer: entityRenderer)! } else { diff --git a/submodules/TelegramUI/Sources/CreateGroupController.swift b/submodules/TelegramUI/Sources/CreateGroupController.swift index 250104849b..56219133fd 100644 --- a/submodules/TelegramUI/Sources/CreateGroupController.swift +++ b/submodules/TelegramUI/Sources/CreateGroupController.swift @@ -617,15 +617,15 @@ public func createGroupControllerImpl(context: AccountContext, peerIds: [PeerId] } else if let url = asset as? URL, let data = try? Data(contentsOf: url, options: [.mappedRead]), let image = UIImage(data: data), let entityRenderer = entityRenderer { let durationSignal: SSignal = SSignal(generator: { subscriber in let disposable = (entityRenderer.duration()).start(next: { duration in - subscriber?.putNext(duration) - subscriber?.putCompletion() + subscriber.putNext(duration) + subscriber.putCompletion() }) return SBlockDisposable(block: { disposable.dispose() }) }) - signal = durationSignal.map(toSignal: { duration -> SSignal? in + signal = durationSignal.map(toSignal: { duration -> SSignal in if let duration = duration as? Double { return TGMediaVideoConverter.renderUIImage(image, duration: duration, adjustments: adjustments, watcher: nil, entityRenderer: entityRenderer)! } else { diff --git a/submodules/TelegramUI/Sources/FetchVideoMediaResource.swift b/submodules/TelegramUI/Sources/FetchVideoMediaResource.swift index 5404666e0d..a9b3b6855a 100644 --- a/submodules/TelegramUI/Sources/FetchVideoMediaResource.swift +++ b/submodules/TelegramUI/Sources/FetchVideoMediaResource.swift @@ -357,8 +357,8 @@ func fetchLocalFileVideoMediaResource(account: Account, resource: LocalFileVideo if let data = try? Data(contentsOf: URL(fileURLWithPath: filteredPath), options: [.mappedRead]), let image = UIImage(data: data) { let durationSignal: SSignal = SSignal(generator: { subscriber in let disposable = (entityRenderer.duration()).start(next: { duration in - subscriber?.putNext(duration) - subscriber?.putCompletion() + subscriber.putNext(duration) + subscriber.putCompletion() }) return SBlockDisposable(block: { @@ -366,7 +366,7 @@ func fetchLocalFileVideoMediaResource(account: Account, resource: LocalFileVideo }) }) - signal = durationSignal.map(toSignal: { duration -> SSignal? in + signal = durationSignal.map(toSignal: { duration -> SSignal in if let duration = duration as? Double { return TGMediaVideoConverter.renderUIImage(image, duration: duration, adjustments: adjustments, watcher: VideoConversionWatcher(update: { path, size in var value = stat() diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index fa26a84218..cd13d41ad4 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -5093,15 +5093,15 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD } else if let url = asset as? URL, let data = try? Data(contentsOf: url, options: [.mappedRead]), let image = UIImage(data: data), let entityRenderer = entityRenderer { let durationSignal: SSignal = SSignal(generator: { subscriber in let disposable = (entityRenderer.duration()).start(next: { duration in - subscriber?.putNext(duration) - subscriber?.putCompletion() + subscriber.putNext(duration) + subscriber.putCompletion() }) return SBlockDisposable(block: { disposable.dispose() }) }) - signal = durationSignal.map(toSignal: { duration -> SSignal? in + signal = durationSignal.map(toSignal: { duration -> SSignal in if let duration = duration as? Double { return TGMediaVideoConverter.renderUIImage(image, duration: duration, adjustments: adjustments, watcher: nil, entityRenderer: entityRenderer)! } else { diff --git a/submodules/TelegramUIPreferences/BUILD b/submodules/TelegramUIPreferences/BUILD index e3fafaf5a0..d3a5d7b5b1 100644 --- a/submodules/TelegramUIPreferences/BUILD +++ b/submodules/TelegramUIPreferences/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Postbox:Postbox", diff --git a/submodules/TelegramUIPreferences/Sources/CallListSettings.swift b/submodules/TelegramUIPreferences/Sources/CallListSettings.swift index 991b7e6ddf..e40d334a9b 100644 --- a/submodules/TelegramUIPreferences/Sources/CallListSettings.swift +++ b/submodules/TelegramUIPreferences/Sources/CallListSettings.swift @@ -34,9 +34,7 @@ public struct CallListSettings: PreferencesEntry, Equatable { } public init(decoder: PostboxDecoder) { - var defaultValue = CallListSettings.defaultSettings.showTab if let alternativeDefaultValue = decoder.decodeOptionalInt32ForKey("defaultShowTab") { - defaultValue = alternativeDefaultValue != 0 self.defaultShowTab = alternativeDefaultValue != 0 } if let value = decoder.decodeOptionalInt32ForKey("showTab") { diff --git a/submodules/TelegramUIPreferences/Sources/PresentationThemeSettings.swift b/submodules/TelegramUIPreferences/Sources/PresentationThemeSettings.swift index 6f88ddf8f3..1e6418db67 100644 --- a/submodules/TelegramUIPreferences/Sources/PresentationThemeSettings.swift +++ b/submodules/TelegramUIPreferences/Sources/PresentationThemeSettings.swift @@ -242,7 +242,7 @@ public enum PresentationThemeReference: PostboxCoding, Equatable { public func coloredThemeIndex(reference: PresentationThemeReference, accentColor: PresentationThemeAccentColor?) -> Int64 { if let accentColor = accentColor { - if case let .builtin(theme) = reference { + if case .builtin = reference { return reference.index * 1000 &+ Int64(accentColor.index) } else { return reference.index &+ Int64(accentColor.index) diff --git a/submodules/TelegramUniversalVideoContent/BUILD b/submodules/TelegramUniversalVideoContent/BUILD index 1bdd85e6a7..65030fcbf1 100644 --- a/submodules/TelegramUniversalVideoContent/BUILD +++ b/submodules/TelegramUniversalVideoContent/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/TelegramUniversalVideoContent/Sources/OverlayVideoDecoration.swift b/submodules/TelegramUniversalVideoContent/Sources/OverlayVideoDecoration.swift index e14bfd80ad..0f5b97e1b9 100644 --- a/submodules/TelegramUniversalVideoContent/Sources/OverlayVideoDecoration.swift +++ b/submodules/TelegramUniversalVideoContent/Sources/OverlayVideoDecoration.swift @@ -230,32 +230,27 @@ final class OverlayVideoDecoration: UniversalVideoDecoration { } let effect: UIBlurEffect? = edge != nil ? UIBlurEffect(style: .light) : nil - if true { - if let edge = edge { - self.minimizedBlurView?.isHidden = false - - switch edge { - case .left: - break - case .right: - break + + if let edge = edge { + self.minimizedBlurView?.isHidden = false + + switch edge { + case .left: + break + case .right: + break + } + } + + UIView.animate(withDuration: 0.35, animations: { + self.minimizedBlurView?.effect = effect + self.minimizedArrowView?.alpha = edge != nil ? 1.0 : 0.0; + }, completion: { [weak self] finished in + if let strongSelf = self { + if finished && edge == nil { + strongSelf.minimizedBlurView?.isHidden = true } } - - UIView.animate(withDuration: 0.35, animations: { - self.minimizedBlurView?.effect = effect - self.minimizedArrowView?.alpha = edge != nil ? 1.0 : 0.0; - }, completion: { [weak self] finished in - if let strongSelf = self { - if finished && edge == nil { - strongSelf.minimizedBlurView?.isHidden = true - } - } - }) - } else { - self.minimizedBlurView?.effect = effect; - self.minimizedBlurView?.isHidden = edge == nil - self.minimizedArrowView?.alpha = edge != nil ? 1.0 : 0.0 - } + }) } } diff --git a/submodules/TelegramUniversalVideoContent/Sources/PlatformVideoContent.swift b/submodules/TelegramUniversalVideoContent/Sources/PlatformVideoContent.swift index 091cac7ffc..7f9466a28f 100644 --- a/submodules/TelegramUniversalVideoContent/Sources/PlatformVideoContent.swift +++ b/submodules/TelegramUniversalVideoContent/Sources/PlatformVideoContent.swift @@ -343,7 +343,7 @@ private final class PlatformVideoContentNode: ASDisplayNode, UniversalVideoConte self.statusValue = MediaPlayerStatus(generationTimestamp: 0.0, duration: Double(self.approximateDuration), dimensions: CGSize(), timestamp: 0.0, baseRate: 1.0, seekId: 0, status: status, soundEnabled: true) self._status.set(self.statusValue) } else if keyPath == "status" { - if let playerItem = self.playerItem, false { + /*if let playerItem = self.playerItem, false { switch playerItem.status { case .failed: switch self.content { @@ -356,7 +356,7 @@ private final class PlatformVideoContentNode: ASDisplayNode, UniversalVideoConte default: break } - } + }*/ } } diff --git a/submodules/TelegramUniversalVideoContent/Sources/UniversalVideoContentManager.swift b/submodules/TelegramUniversalVideoContent/Sources/UniversalVideoContentManager.swift index 1f65bbf906..3939b2f85a 100644 --- a/submodules/TelegramUniversalVideoContent/Sources/UniversalVideoContentManager.swift +++ b/submodules/TelegramUniversalVideoContent/Sources/UniversalVideoContentManager.swift @@ -154,7 +154,7 @@ public final class UniversalVideoManagerImpl: UniversalVideoManager { if let current = self.holders[content.id] { holder = current } else { - var foundHolder: UniversalVideoContentHolder? + let foundHolder: UniversalVideoContentHolder? = nil for (_, current) in self.holders { if current.content.isEqual(to: content) { //foundHolder = current diff --git a/submodules/TelegramUniversalVideoContent/Sources/VimeoEmbedImplementation.swift b/submodules/TelegramUniversalVideoContent/Sources/VimeoEmbedImplementation.swift index f5b911b5a0..f03ec1d5c0 100644 --- a/submodules/TelegramUniversalVideoContent/Sources/VimeoEmbedImplementation.swift +++ b/submodules/TelegramUniversalVideoContent/Sources/VimeoEmbedImplementation.swift @@ -216,6 +216,8 @@ final class VimeoEmbedImplementation: WebEmbedImplementation { } } } + + let _ = download if let position = position { if let ticksToIgnore = self.ignorePosition { diff --git a/submodules/TelegramUniversalVideoContent/Sources/YoutubeEmbedImplementation.swift b/submodules/TelegramUniversalVideoContent/Sources/YoutubeEmbedImplementation.swift index 6df3c2227c..454ea52507 100644 --- a/submodules/TelegramUniversalVideoContent/Sources/YoutubeEmbedImplementation.swift +++ b/submodules/TelegramUniversalVideoContent/Sources/YoutubeEmbedImplementation.swift @@ -285,6 +285,9 @@ final class YoutubeEmbedImplementation: WebEmbedImplementation { } } } + + let _ = download + let _ = failed if let position = position { if self.ignoreEarlierTimestamps { diff --git a/submodules/TelegramUpdateUI/BUILD b/submodules/TelegramUpdateUI/BUILD index a86c8f314f..cea001af4c 100644 --- a/submodules/TelegramUpdateUI/BUILD +++ b/submodules/TelegramUpdateUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/TelegramVoip/BUILD b/submodules/TelegramVoip/BUILD index 662a872426..0e8a8cec3c 100644 --- a/submodules/TelegramVoip/BUILD +++ b/submodules/TelegramVoip/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/TelegramCore:TelegramCore", diff --git a/submodules/TemporaryCachedPeerDataManager/BUILD b/submodules/TemporaryCachedPeerDataManager/BUILD index d3795aa6d3..ecb048b8a6 100644 --- a/submodules/TemporaryCachedPeerDataManager/BUILD +++ b/submodules/TemporaryCachedPeerDataManager/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramStringFormatting:TelegramStringFormatting", "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", diff --git a/submodules/TextFormat/BUILD b/submodules/TextFormat/BUILD index 42516f84ee..2585c4f6cd 100644 --- a/submodules/TextFormat/BUILD +++ b/submodules/TextFormat/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Display:Display", diff --git a/submodules/TextSelectionNode/BUILD b/submodules/TextSelectionNode/BUILD index 0795ef338f..05e706d364 100644 --- a/submodules/TextSelectionNode/BUILD +++ b/submodules/TextSelectionNode/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/TextSelectionNode/Sources/TextSelectionNode.swift b/submodules/TextSelectionNode/Sources/TextSelectionNode.swift index 0cd411fbad..f57f7c1c16 100644 --- a/submodules/TextSelectionNode/Sources/TextSelectionNode.swift +++ b/submodules/TextSelectionNode/Sources/TextSelectionNode.swift @@ -389,10 +389,7 @@ public final class TextSelectionNode: ASDisplayNode { } let point = CGPoint(x: (1.0 - progress) * startPoint.x + progress * endPoint.x, y: (1.0 - progress) * startPoint.y + progress * endPoint.y) strongSelf.recognizer?.moveKnob?(.right, point) - }, completion: { [weak self] in - guard let strongSelf = self else { - return - } + }, completion: { }) self.displayLinkAnimator = displayLinkAnimator } diff --git a/submodules/TinyThumbnail/BUILD b/submodules/TinyThumbnail/BUILD index 390a77b9fe..cbedb8d1e9 100644 --- a/submodules/TinyThumbnail/BUILD +++ b/submodules/TinyThumbnail/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/TinyThumbnail/Sources/TinyThumbnail.swift b/submodules/TinyThumbnail/Sources/TinyThumbnail.swift index 4d3777c448..4bceb3e819 100644 --- a/submodules/TinyThumbnail/Sources/TinyThumbnail.swift +++ b/submodules/TinyThumbnail/Sources/TinyThumbnail.swift @@ -24,9 +24,12 @@ public func decodeTinyThumbnail(data: Data) -> Data? { resultData.append(tinyThumbnailHeaderPattern) resultData.append(data.subdata(in: 3 ..< data.count)) resultData.append(tinyThumbnailFooterPattern) - resultData.withUnsafeMutableBytes({ (resultBytes: UnsafeMutablePointer) -> Void in + resultData.withUnsafeMutableBytes { buffer -> Void in + guard let resultBytes = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else { + return + } resultBytes[164] = width resultBytes[166] = height - }) + } return resultData } diff --git a/submodules/TooltipUI/BUILD b/submodules/TooltipUI/BUILD index 59c221f744..fe81ac954d 100644 --- a/submodules/TooltipUI/BUILD +++ b/submodules/TooltipUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/TouchDownGesture/BUILD b/submodules/TouchDownGesture/BUILD index 04e076cb47..13657370f2 100644 --- a/submodules/TouchDownGesture/BUILD +++ b/submodules/TouchDownGesture/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/Tuples/BUILD b/submodules/Tuples/BUILD index b9e8a036dc..a1390c56ea 100644 --- a/submodules/Tuples/BUILD +++ b/submodules/Tuples/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/UndoUI/BUILD b/submodules/UndoUI/BUILD index 22bb401273..c3a6d09fe4 100644 --- a/submodules/UndoUI/BUILD +++ b/submodules/UndoUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/UrlEscaping/BUILD b/submodules/UrlEscaping/BUILD index 9e665e590d..ac14d9b3ff 100644 --- a/submodules/UrlEscaping/BUILD +++ b/submodules/UrlEscaping/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/UrlEscaping/Sources/UrlEscaping.swift b/submodules/UrlEscaping/Sources/UrlEscaping.swift index 59f89b869b..a4cb5d97bb 100644 --- a/submodules/UrlEscaping/Sources/UrlEscaping.swift +++ b/submodules/UrlEscaping/Sources/UrlEscaping.swift @@ -47,10 +47,9 @@ public func explicitUrl(_ url: String) -> String { public func urlEncodedStringFromString(_ string: String) -> String { var nsString: NSString = string as NSString - if let value = nsString.replacingPercentEscapes(using: String.Encoding.utf8.rawValue) { + if let value = nsString.removingPercentEncoding { nsString = value as NSString } - - let result = CFURLCreateStringByAddingPercentEscapes(nil, nsString as CFString, nil, "?!@#$^&%*+=,:;'\"`<>()[]{}/\\|~ " as CFString, CFStringConvertNSStringEncodingToEncoding(String.Encoding.utf8.rawValue))! - return result as String + + return nsString.addingPercentEncoding(withAllowedCharacters: CharacterSet(charactersIn: "?!@#$^&%*+=,:;'\"`<>()[]{}/\\|~ ")) ?? "" } diff --git a/submodules/UrlHandling/BUILD b/submodules/UrlHandling/BUILD index 9da093721e..4d6dcfb0a7 100644 --- a/submodules/UrlHandling/BUILD +++ b/submodules/UrlHandling/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", diff --git a/submodules/UrlHandling/Sources/UrlHandling.swift b/submodules/UrlHandling/Sources/UrlHandling.swift index 82c7c9a4cc..fe9b8aefdf 100644 --- a/submodules/UrlHandling/Sources/UrlHandling.swift +++ b/submodules/UrlHandling/Sources/UrlHandling.swift @@ -475,15 +475,15 @@ public func parseProxyUrl(_ url: String) -> (host: String, port: Int32, username for scheme in schemes { let basePrefix = scheme + basePath + "/" if url.lowercased().hasPrefix(basePrefix) { - if let internalUrl = parseInternalUrl(query: String(url[basePrefix.endIndex...])), case let .proxy(proxy) = internalUrl { - return (proxy.host, proxy.port, proxy.username, proxy.password, proxy.secret) + if let internalUrl = parseInternalUrl(query: String(url[basePrefix.endIndex...])), case let .proxy(host, port, username, password, secret) = internalUrl { + return (host, port, username, password, secret) } } } } if let parsedUrl = URL(string: url), parsedUrl.scheme == "tg", let host = parsedUrl.host, let query = parsedUrl.query { - if let internalUrl = parseInternalUrl(query: host + "?" + query), case let .proxy(proxy) = internalUrl { - return (proxy.host, proxy.port, proxy.username, proxy.password, proxy.secret) + if let internalUrl = parseInternalUrl(query: host + "?" + query), case let .proxy(host, port, username, password, secret) = internalUrl { + return (host, port, username, password, secret) } } diff --git a/submodules/UrlWhitelist/BUILD b/submodules/UrlWhitelist/BUILD index dadbd3e80a..c68f3d9b49 100644 --- a/submodules/UrlWhitelist/BUILD +++ b/submodules/UrlWhitelist/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/WallpaperBackgroundNode/BUILD b/submodules/WallpaperBackgroundNode/BUILD index 2d047a9c80..1dbe792985 100644 --- a/submodules/WallpaperBackgroundNode/BUILD +++ b/submodules/WallpaperBackgroundNode/BUILD @@ -7,6 +7,7 @@ swift_library( "Sources/**/*.swift", ]), copts = [ + "-warnings-as-errors", ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/WallpaperResources/BUILD b/submodules/WallpaperResources/BUILD index bb2ec51701..50a52d3bdd 100644 --- a/submodules/WallpaperResources/BUILD +++ b/submodules/WallpaperResources/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", "//submodules/Postbox:Postbox", diff --git a/submodules/WallpaperResources/Sources/WallpaperCache.swift b/submodules/WallpaperResources/Sources/WallpaperCache.swift index f5e5d10ba1..fd4f6bef3e 100644 --- a/submodules/WallpaperResources/Sources/WallpaperCache.swift +++ b/submodules/WallpaperResources/Sources/WallpaperCache.swift @@ -71,12 +71,12 @@ public func cachedWallpaper(account: Account, slug: String, settings: WallpaperS } public func updateCachedWallpaper(account: Account, wallpaper: TelegramWallpaper) { - guard case let .file(file) = wallpaper, file.id != 0 else { + guard case let .file(id, _, _, _, _, _, slug, _, _) = wallpaper, id != 0 else { return } let _ = (account.postbox.transaction { transaction in let key = ValueBoxKey(length: 8) - key.setInt64(0, value: Int64(bitPattern: file.slug.persistentHashValue)) + key.setInt64(0, value: Int64(bitPattern: slug.persistentHashValue)) let id = ItemCacheEntryId(collectionId: ApplicationSpecificItemCacheCollectionId.cachedWallpapers, key: key) transaction.putItemCacheEntry(id: id, entry: CachedWallpaper(wallpaper: wallpaper), collectionSpec: collectionSpec) }).start() diff --git a/submodules/WallpaperResources/Sources/WallpaperResources.swift b/submodules/WallpaperResources/Sources/WallpaperResources.swift index 26425f5752..84466da289 100644 --- a/submodules/WallpaperResources/Sources/WallpaperResources.swift +++ b/submodules/WallpaperResources/Sources/WallpaperResources.swift @@ -87,28 +87,21 @@ public func wallpaperDatas(account: Account, accountManager: AccountManager, fil } } else { let fetchedThumbnail: Signal - if let _ = decodedThumbnailData, false { - fetchedThumbnail = .complete() - } else { - fetchedThumbnail = fetchedMediaResource(mediaBox: account.postbox.mediaBox, reference: representations[smallestIndex].reference) - } + fetchedThumbnail = fetchedMediaResource(mediaBox: account.postbox.mediaBox, reference: representations[smallestIndex].reference) let fetchedFullSize = fetchedMediaResource(mediaBox: account.postbox.mediaBox, reference: representations[largestIndex].reference) let thumbnailData: Signal - if let decodedThumbnailData = decodedThumbnailData, false { - thumbnailData = .single(decodedThumbnailData) - } else { - thumbnailData = Signal { subscriber in - let fetchedDisposable = fetchedThumbnail.start() - let thumbnailDisposable = account.postbox.mediaBox.resourceData(smallestRepresentation.resource).start(next: { next in - subscriber.putNext(next.size == 0 ? nil : try? Data(contentsOf: URL(fileURLWithPath: next.path), options: [])) - }, error: subscriber.putError, completed: subscriber.putCompletion) - - return ActionDisposable { - fetchedDisposable.dispose() - thumbnailDisposable.dispose() - } + + thumbnailData = Signal { subscriber in + let fetchedDisposable = fetchedThumbnail.start() + let thumbnailDisposable = account.postbox.mediaBox.resourceData(smallestRepresentation.resource).start(next: { next in + subscriber.putNext(next.size == 0 ? nil : try? Data(contentsOf: URL(fileURLWithPath: next.path), options: [])) + }, error: subscriber.putError, completed: subscriber.putCompletion) + + return ActionDisposable { + fetchedDisposable.dispose() + thumbnailDisposable.dispose() } } @@ -889,8 +882,7 @@ public func telegramThemeData(account: Account, accountManager: AccountManager, accountManager.mediaBox.storeResourceData(reference.resource.id, data: data) } subscriber.putNext(next) - }, error: { error in - subscriber.putError(error) + }, error: { _ in }, completed: { subscriber.putCompletion() }) @@ -943,8 +935,8 @@ public func drawThemeImage(context c: CGContext, theme: PresentationTheme, wallp let gradient = CGGradient(colorsSpace: colorSpace, colors: gradientColors, locations: &locations)! c.drawLinearGradient(gradient, start: CGPoint(x: 0.0, y: drawingRect.height), end: CGPoint(x: 0.0, y: 0.0), options: [.drawsBeforeStartLocation, .drawsAfterEndLocation]) } - case let .file(file): - if file.isPattern, let intensity = file.settings.intensity, intensity < 0 { + case let .file(_, _, _, _, isPattern, _, _, _, settings): + if isPattern, let intensity = settings.intensity, intensity < 0 { c.setFillColor(UIColor.black.cgColor) c.fill(CGRect(origin: CGPoint(), size: size)) } else { @@ -1119,8 +1111,7 @@ public func themeImage(account: Account, accountManager: AccountManager, source: accountManager.mediaBox.storeResourceData(reference.resource.id, data: data) } subscriber.putNext(next) - }, error: { error in - subscriber.putError(error) + }, error: { _ in }, completed: { subscriber.putCompletion() }) @@ -1152,31 +1143,31 @@ public func themeImage(account: Account, accountManager: AccountManager, source: let data = theme |> mapToSignal { (theme, thumbnailData) -> Signal<(PresentationTheme?, WallpaperImage?, Data?), NoError> in if let theme = theme { - if case let .file(file) = theme.chat.defaultWallpaper { - return cachedWallpaper(account: account, slug: file.slug, settings: file.settings) + if case let .file(_, _, _, _, _, _, slug, _, settings) = theme.chat.defaultWallpaper { + return cachedWallpaper(account: account, slug: slug, settings: settings) |> mapToSignal { wallpaper -> Signal<(PresentationTheme?, WallpaperImage?, Data?), NoError> in - if let wallpaper = wallpaper, case let .file(file) = wallpaper.wallpaper { + if let wallpaper = wallpaper, case let .file(_, _, _, _, _, _, slug, file, settings) = wallpaper.wallpaper { var convertedRepresentations: [ImageRepresentationWithReference] = [] - convertedRepresentations.append(ImageRepresentationWithReference(representation: TelegramMediaImageRepresentation(dimensions: PixelDimensions(width: 100, height: 100), resource: file.file.resource, progressiveSizes: [], immediateThumbnailData: nil), reference: .wallpaper(wallpaper: .slug(file.slug), resource: file.file.resource))) - return wallpaperDatas(account: account, accountManager: accountManager, fileReference: .standalone(media: file.file), representations: convertedRepresentations, alwaysShowThumbnailFirst: false, thumbnail: false, onlyFullSize: true, autoFetchFullSize: true, synchronousLoad: false) + convertedRepresentations.append(ImageRepresentationWithReference(representation: TelegramMediaImageRepresentation(dimensions: PixelDimensions(width: 100, height: 100), resource: file.resource, progressiveSizes: [], immediateThumbnailData: nil), reference: .wallpaper(wallpaper: .slug(slug), resource: file.resource))) + return wallpaperDatas(account: account, accountManager: accountManager, fileReference: .standalone(media: file), representations: convertedRepresentations, alwaysShowThumbnailFirst: false, thumbnail: false, onlyFullSize: true, autoFetchFullSize: true, synchronousLoad: false) |> mapToSignal { _, fullSizeData, complete -> Signal<(PresentationTheme?, WallpaperImage?, Data?), NoError> in guard complete, let fullSizeData = fullSizeData else { return .complete() } - accountManager.mediaBox.storeResourceData(file.file.resource.id, data: fullSizeData) - let _ = accountManager.mediaBox.cachedResourceRepresentation(file.file.resource, representation: CachedScaledImageRepresentation(size: CGSize(width: 720.0, height: 720.0), mode: .aspectFit), complete: true, fetch: true).start() + accountManager.mediaBox.storeResourceData(file.resource.id, data: fullSizeData) + let _ = accountManager.mediaBox.cachedResourceRepresentation(file.resource, representation: CachedScaledImageRepresentation(size: CGSize(width: 720.0, height: 720.0), mode: .aspectFit), complete: true, fetch: true).start() - if wallpaper.wallpaper.isPattern, !file.settings.colors.isEmpty, let intensity = file.settings.intensity { - return accountManager.mediaBox.resourceData(file.file.resource) + if wallpaper.wallpaper.isPattern, !settings.colors.isEmpty, let intensity = settings.intensity { + return accountManager.mediaBox.resourceData(file.resource) |> mapToSignal { data in if data.complete, let imageData = try? Data(contentsOf: URL(fileURLWithPath: data.path)) { - return .single((theme, .pattern(data: imageData, colors: file.settings.colors, intensity: intensity), thumbnailData)) + return .single((theme, .pattern(data: imageData, colors: settings.colors, intensity: intensity), thumbnailData)) } else { return .complete() } } - } else if file.settings.blur { - return accountManager.mediaBox.cachedResourceRepresentation(file.file.resource, representation: CachedBlurredWallpaperRepresentation(), complete: true, fetch: true) + } else if settings.blur { + return accountManager.mediaBox.cachedResourceRepresentation(file.resource, representation: CachedBlurredWallpaperRepresentation(), complete: true, fetch: true) |> mapToSignal { data in if data.complete, let data = try? Data(contentsOf: URL(fileURLWithPath: data.path)), let image = UIImage(data: data) { return .single((theme, .image(image), thumbnailData)) @@ -1290,244 +1281,133 @@ public func themeImage(account: Account, accountManager: AccountManager, source: public func themeIconImage(account: Account, accountManager: AccountManager, theme: PresentationThemeReference, color: PresentationThemeAccentColor?, wallpaper: TelegramWallpaper? = nil) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { let colorsSignal: Signal<((UIColor, UIColor?, [UInt32]), (UIColor, UIColor), (UIColor, UIColor), UIImage?, Int32?), NoError> - if false, case let .builtin(theme) = theme { - let incomingColor: UIColor - let outgoingColor: (UIColor, UIColor) - var accentColor = color?.color - var bubbleColors = color?.plainBubbleColors - var topBackgroundColor: UIColor - var bottomBackgroundColor: UIColor? - switch theme { - case .dayClassic: - incomingColor = UIColor(rgb: 0xffffff) - if let accentColor = accentColor { - if let wallpaper = wallpaper, case let .file(file) = wallpaper { - topBackgroundColor = file.settings.colors.first.flatMap { UIColor(rgb: $0) } ?? UIColor(rgb: 0xd6e2ee) - if file.settings.colors.count >= 2 { - bottomBackgroundColor = UIColor(rgb: file.settings.colors[1]) - } - } else { - if let bubbleColors = bubbleColors { - topBackgroundColor = UIColor(rgb: 0xd6e2ee) - } else { - topBackgroundColor = accentColor.withMultiplied(hue: 1.019, saturation: 0.867, brightness: 0.965) - } - } - if let bubbleColors = bubbleColors { - topBackgroundColor = UIColor(rgb: 0xd6e2ee) - outgoingColor = bubbleColors - } else { - topBackgroundColor = accentColor.withMultiplied(hue: 1.019, saturation: 0.867, brightness: 0.965) - let hsb = accentColor.hsb - let bubbleColor = UIColor(hue: hsb.0, saturation: hsb.2 > 0.0 ? 0.14 : 0.0, brightness: 0.79 + hsb.2 * 0.21, alpha: 1.0) - outgoingColor = (bubbleColor, bubbleColor) - } - } else { - if let wallpaper = wallpaper, case let .file(file) = wallpaper { - topBackgroundColor = file.settings.colors.first.flatMap { UIColor(rgb: $0) } ?? UIColor(rgb: 0xd6e2ee) - if file.settings.colors.count >= 2 { - bottomBackgroundColor = UIColor(rgb: file.settings.colors[1]) - } - } else if let wallpaper = wallpaper, case let .gradient(_, colors, _) = wallpaper { - topBackgroundColor = colors.first.flatMap { UIColor(rgb: $0) } ?? UIColor(rgb: 0xd6e2ee) - if colors.count >= 2 { - bottomBackgroundColor = UIColor(rgb: colors[1]) - } - } else { - topBackgroundColor = defaultBuiltinWallpaperGradientColors[0] - bottomBackgroundColor = defaultBuiltinWallpaperGradientColors[1] - } - outgoingColor = (UIColor(rgb: 0xe1ffc7), UIColor(rgb: 0xe1ffc7)) - } - case .day: - topBackgroundColor = UIColor(rgb: 0xffffff) - incomingColor = UIColor(rgb: 0xd5dde6) - if accentColor == nil { - accentColor = UIColor(rgb: 0x007aff) - } - outgoingColor = bubbleColors ?? (accentColor!, accentColor!) - case .night: - topBackgroundColor = UIColor(rgb: 0x000000) - incomingColor = UIColor(rgb: 0x1f1f1f) - if accentColor == nil || accentColor?.rgb == 0xffffff { - accentColor = UIColor(rgb: 0x313131) - } - outgoingColor = bubbleColors ?? (accentColor!, accentColor!) - case .nightAccent: - let accentColor = accentColor ?? UIColor(rgb: 0x007aff) - topBackgroundColor = accentColor.withMultiplied(hue: 1.024, saturation: 0.573, brightness: 0.18) - incomingColor = accentColor.withMultiplied(hue: 1.024, saturation: 0.585, brightness: 0.25) - let accentBubbleColor = accentColor.withMultiplied(hue: 1.019, saturation: 0.731, brightness: 0.59) - outgoingColor = bubbleColors ?? (accentBubbleColor, accentBubbleColor) - } - var colors: [UInt32] = [] - var rotation: Int32? - if let wallpaper = wallpaper { + var reference: MediaResourceReference? + if case let .local(theme) = theme { + reference = .standalone(resource: theme.resource) + } else if case let .cloud(theme) = theme, let resource = theme.theme.file?.resource { + reference = .theme(theme: .slug(theme.theme.slug), resource: resource) + } + + let themeSignal: Signal + if case let .builtin(theme) = theme { + themeSignal = .single(makeDefaultPresentationTheme(reference: theme, serviceBackgroundColor: nil)) + } else if case let .cloud(theme) = theme, let settings = theme.theme.settings { + themeSignal = Signal { subscriber in + let theme = makePresentationTheme(mediaBox: accountManager.mediaBox, themeReference: .builtin(PresentationBuiltinThemeReference(baseTheme: settings.baseTheme)), accentColor: UIColor(argb: settings.accentColor), backgroundColors: [], bubbleColors: settings.messageColors.flatMap { (UIColor(argb: $0.top), UIColor(argb: $0.bottom)) }, wallpaper: settings.wallpaper, serviceBackgroundColor: nil, preview: false) + subscriber.putNext(theme) + subscriber.putCompletion() + + return EmptyDisposable + } + } else if let reference = reference { + themeSignal = telegramThemeData(account: account, accountManager: accountManager, reference: reference, synchronousLoad: false) + |> map { data -> PresentationTheme? in + if let data = data, let theme = makePresentationTheme(data: data) { + return theme + } else { + return nil + } + } + } else { + themeSignal = .never() + } + + colorsSignal = themeSignal + |> mapToSignal { theme -> Signal<((UIColor, UIColor?, [UInt32]), (UIColor, UIColor), (UIColor, UIColor), UIImage?, Int32?), NoError> in + if let theme = theme { + var wallpaperSignal: Signal<((UIColor, UIColor?, [UInt32]), (UIColor, UIColor), (UIColor, UIColor), UIImage?, Int32?), NoError> = .complete() + var rotation: Int32? + var backgroundColor: (UIColor, UIColor?, [UInt32]) + let incomingColor = (theme.chat.message.incoming.bubble.withoutWallpaper.fill, theme.chat.message.incoming.bubble.withoutWallpaper.gradientFill) + let outgoingColor = (theme.chat.message.outgoing.bubble.withoutWallpaper.fill, theme.chat.message.outgoing.bubble.withoutWallpaper.gradientFill) + let wallpaper = wallpaper ?? theme.chat.defaultWallpaper switch wallpaper { + case .builtin: + backgroundColor = (UIColor(rgb: 0xd6e2ee), nil, []) case let .color(color): - colors = [color] - topBackgroundColor = UIColor(rgb: color) - case let .gradient(_, colorsValue, settings): - colors = colorsValue - if colors.count >= 1 { - topBackgroundColor = UIColor(rgb: colors[0]) - } + backgroundColor = (UIColor(rgb: color), nil, []) + case let .gradient(_, colors, settings): if colors.count >= 2 { - bottomBackgroundColor = UIColor(rgb: colors[1]) + backgroundColor = (UIColor(rgb: colors[0]), UIColor(rgb: colors[1]), colors) + } else { + backgroundColor = (.white, nil, []) } rotation = settings.rotation - case let .file(file): - if file.isPattern, let intensity = file.settings.intensity, intensity < 0 { - colors = [0x000000] - topBackgroundColor = .black - bottomBackgroundColor = .black - } else { - colors = file.settings.colors - if !file.settings.colors.isEmpty { - topBackgroundColor = UIColor(rgb: file.settings.colors[0]) - if file.settings.colors.count >= 2 { - bottomBackgroundColor = UIColor(rgb: file.settings.colors[1]) - } - } - rotation = file.settings.rotation - } - default: - colors = [0xd6e2ee] - topBackgroundColor = UIColor(rgb: 0xd6e2ee) - } - } else { - colors = defaultBuiltinWallpaperGradientColors.map(\.rgb) - } - - colorsSignal = .single(((topBackgroundColor, bottomBackgroundColor, colors), (incomingColor, incomingColor), outgoingColor, nil, rotation)) - } else { - var reference: MediaResourceReference? - if case let .local(theme) = theme { - reference = .standalone(resource: theme.resource) - } else if case let .cloud(theme) = theme, let resource = theme.theme.file?.resource { - reference = .theme(theme: .slug(theme.theme.slug), resource: resource) - } - - let themeSignal: Signal - if case let .builtin(theme) = theme { - themeSignal = .single(makeDefaultPresentationTheme(reference: theme, serviceBackgroundColor: nil)) - } else if case let .cloud(theme) = theme, let settings = theme.theme.settings { - themeSignal = Signal { subscriber in - let theme = makePresentationTheme(mediaBox: accountManager.mediaBox, themeReference: .builtin(PresentationBuiltinThemeReference(baseTheme: settings.baseTheme)), accentColor: UIColor(argb: settings.accentColor), backgroundColors: [], bubbleColors: settings.messageColors.flatMap { (UIColor(argb: $0.top), UIColor(argb: $0.bottom)) }, wallpaper: settings.wallpaper, serviceBackgroundColor: nil, preview: false) - subscriber.putNext(theme) - subscriber.putCompletion() - - return EmptyDisposable - } - } else if let reference = reference { - themeSignal = telegramThemeData(account: account, accountManager: accountManager, reference: reference, synchronousLoad: false) - |> map { data -> PresentationTheme? in - if let data = data, let theme = makePresentationTheme(data: data) { - return theme - } else { - return nil - } - } - } else { - themeSignal = .never() - } - - colorsSignal = themeSignal - |> mapToSignal { theme -> Signal<((UIColor, UIColor?, [UInt32]), (UIColor, UIColor), (UIColor, UIColor), UIImage?, Int32?), NoError> in - if let theme = theme { - var wallpaperSignal: Signal<((UIColor, UIColor?, [UInt32]), (UIColor, UIColor), (UIColor, UIColor), UIImage?, Int32?), NoError> = .complete() - var rotation: Int32? - var backgroundColor: (UIColor, UIColor?, [UInt32]) - let incomingColor = (theme.chat.message.incoming.bubble.withoutWallpaper.fill, theme.chat.message.incoming.bubble.withoutWallpaper.gradientFill) - let outgoingColor = (theme.chat.message.outgoing.bubble.withoutWallpaper.fill, theme.chat.message.outgoing.bubble.withoutWallpaper.gradientFill) - let wallpaper = wallpaper ?? theme.chat.defaultWallpaper - switch wallpaper { - case .builtin: - backgroundColor = (UIColor(rgb: 0xd6e2ee), nil, []) - case let .color(color): - backgroundColor = (UIColor(rgb: color), nil, []) - case let .gradient(_, colors, settings): - if colors.count >= 2 { - backgroundColor = (UIColor(rgb: colors[0]), UIColor(rgb: colors[1]), colors) - } else { - backgroundColor = (.white, nil, []) - } - rotation = settings.rotation - case .image: + case .image: + backgroundColor = (.black, nil, []) + case let .file(_, _, _, _, isPattern, _, slug, _, settings): + rotation = settings.rotation + if isPattern, let intensity = settings.intensity, intensity < 0 { backgroundColor = (.black, nil, []) - case let .file(file): - rotation = file.settings.rotation - if file.isPattern, let intensity = file.settings.intensity, intensity < 0 { - backgroundColor = (.black, nil, []) - } else if !file.settings.colors.isEmpty { - var bottomColor: UIColor? - if file.settings.colors.count >= 2 { - bottomColor = UIColor(rgb: file.settings.colors[1]) - } - backgroundColor = (UIColor(rgb: file.settings.colors[0]), bottomColor, file.settings.colors) - } else { - backgroundColor = (theme.chatList.backgroundColor, nil, []) + } else if !settings.colors.isEmpty { + var bottomColor: UIColor? + if settings.colors.count >= 2 { + bottomColor = UIColor(rgb: settings.colors[1]) } - wallpaperSignal = cachedWallpaper(account: account, slug: file.slug, settings: file.settings) - |> mapToSignal { wallpaper in - if let wallpaper = wallpaper, case let .file(file) = wallpaper.wallpaper { - var effectiveBackgroundColor = backgroundColor - if !file.settings.colors.isEmpty { - var bottomColor: UIColor? - if file.settings.colors.count >= 2 { - bottomColor = UIColor(rgb: file.settings.colors[1]) - } - effectiveBackgroundColor = (UIColor(rgb: file.settings.colors[0]), bottomColor, file.settings.colors) + backgroundColor = (UIColor(rgb: settings.colors[0]), bottomColor, settings.colors) + } else { + backgroundColor = (theme.chatList.backgroundColor, nil, []) + } + wallpaperSignal = cachedWallpaper(account: account, slug: slug, settings: settings) + |> mapToSignal { wallpaper in + if let wallpaper = wallpaper, case let .file(_, _, _, _, _, _, _, file, settings) = wallpaper.wallpaper { + var effectiveBackgroundColor = backgroundColor + if !settings.colors.isEmpty { + var bottomColor: UIColor? + if settings.colors.count >= 2 { + bottomColor = UIColor(rgb: settings.colors[1]) } + effectiveBackgroundColor = (UIColor(rgb: settings.colors[0]), bottomColor, settings.colors) + } + + var convertedRepresentations: [ImageRepresentationWithReference] = [] + convertedRepresentations.append(ImageRepresentationWithReference(representation: TelegramMediaImageRepresentation(dimensions: PixelDimensions(width: 100, height: 100), resource: file.resource, progressiveSizes: [], immediateThumbnailData: nil), reference: .wallpaper(wallpaper: .slug(slug), resource: file.resource))) + return wallpaperDatas(account: account, accountManager: accountManager, fileReference: .standalone(media: file), representations: convertedRepresentations, alwaysShowThumbnailFirst: false, thumbnail: false, onlyFullSize: true, autoFetchFullSize: true, synchronousLoad: false) + |> mapToSignal { _, fullSizeData, complete -> Signal<((UIColor, UIColor?, [UInt32]), (UIColor, UIColor), (UIColor, UIColor), UIImage?, Int32?), NoError> in + guard complete, let fullSizeData = fullSizeData else { + return .complete() + } + accountManager.mediaBox.storeResourceData(file.resource.id, data: fullSizeData) + let _ = accountManager.mediaBox.cachedResourceRepresentation(file.resource, representation: CachedScaledImageRepresentation(size: CGSize(width: 720.0, height: 720.0), mode: .aspectFit), complete: true, fetch: true).start() - var convertedRepresentations: [ImageRepresentationWithReference] = [] - convertedRepresentations.append(ImageRepresentationWithReference(representation: TelegramMediaImageRepresentation(dimensions: PixelDimensions(width: 100, height: 100), resource: file.file.resource, progressiveSizes: [], immediateThumbnailData: nil), reference: .wallpaper(wallpaper: .slug(file.slug), resource: file.file.resource))) - return wallpaperDatas(account: account, accountManager: accountManager, fileReference: .standalone(media: file.file), representations: convertedRepresentations, alwaysShowThumbnailFirst: false, thumbnail: false, onlyFullSize: true, autoFetchFullSize: true, synchronousLoad: false) - |> mapToSignal { _, fullSizeData, complete -> Signal<((UIColor, UIColor?, [UInt32]), (UIColor, UIColor), (UIColor, UIColor), UIImage?, Int32?), NoError> in - guard complete, let fullSizeData = fullSizeData else { - return .complete() - } - accountManager.mediaBox.storeResourceData(file.file.resource.id, data: fullSizeData) - let _ = accountManager.mediaBox.cachedResourceRepresentation(file.file.resource, representation: CachedScaledImageRepresentation(size: CGSize(width: 720.0, height: 720.0), mode: .aspectFit), complete: true, fetch: true).start() - - if wallpaper.wallpaper.isPattern { - if !file.settings.colors.isEmpty, let intensity = file.settings.intensity { - if intensity < 0 { - return .single(((.black, nil, []), incomingColor, outgoingColor, nil, rotation)) - } else { - return .single((effectiveBackgroundColor, incomingColor, outgoingColor, nil, rotation)) - } + if wallpaper.wallpaper.isPattern { + if !settings.colors.isEmpty, let intensity = settings.intensity { + if intensity < 0 { + return .single(((.black, nil, []), incomingColor, outgoingColor, nil, rotation)) } else { - return .complete() + return .single((effectiveBackgroundColor, incomingColor, outgoingColor, nil, rotation)) } - } else if file.settings.blur { - return accountManager.mediaBox.cachedResourceRepresentation(file.file.resource, representation: CachedBlurredWallpaperRepresentation(), complete: true, fetch: true) - |> mapToSignal { _ in - if let image = UIImage(data: fullSizeData) { - return .single((backgroundColor, incomingColor, outgoingColor, image, rotation)) - } else { - return .complete() - } - } - } else if let image = UIImage(data: fullSizeData) { - return .single((backgroundColor, incomingColor, outgoingColor, image, rotation)) } else { return .complete() } + } else if settings.blur { + return accountManager.mediaBox.cachedResourceRepresentation(file.resource, representation: CachedBlurredWallpaperRepresentation(), complete: true, fetch: true) + |> mapToSignal { _ in + if let image = UIImage(data: fullSizeData) { + return .single((backgroundColor, incomingColor, outgoingColor, image, rotation)) + } else { + return .complete() + } + } + } else if let image = UIImage(data: fullSizeData) { + return .single((backgroundColor, incomingColor, outgoingColor, image, rotation)) + } else { + return .complete() } - } else { - return .complete() } + } else { + return .complete() } - } - return .single((backgroundColor, incomingColor, outgoingColor, nil, rotation)) - |> then(wallpaperSignal) - } else { - return .complete() + } } + return .single((backgroundColor, incomingColor, outgoingColor, nil, rotation)) + |> then(wallpaperSignal) + } else { + return .complete() } } + return colorsSignal |> map { colors in return { arguments in diff --git a/submodules/WatchBridge/BUILD b/submodules/WatchBridge/BUILD index 515c17984f..5766afcb8f 100644 --- a/submodules/WatchBridge/BUILD +++ b/submodules/WatchBridge/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/SSignalKit/SSignalKit:SSignalKit", diff --git a/submodules/WatchBridge/Sources/WatchRequestHandlers.swift b/submodules/WatchBridge/Sources/WatchRequestHandlers.swift index e9b97e3698..dca4e0f729 100644 --- a/submodules/WatchBridge/Sources/WatchRequestHandlers.swift +++ b/submodules/WatchBridge/Sources/WatchRequestHandlers.swift @@ -60,7 +60,7 @@ final class WatchChatListHandler: WatchRequestHandler { users = users.merging(chatUsers, uniquingKeysWith: { (_, last) in last }) } } - subscriber?.putNext([ TGBridgeChatsArrayKey: chats, TGBridgeUsersDictionaryKey: users ]) + subscriber.putNext([ TGBridgeChatsArrayKey: chats, TGBridgeUsersDictionaryKey: users ]) }) return SBlockDisposable { @@ -108,7 +108,7 @@ final class WatchChatMessagesHandler: WatchRequestHandler { users = users.merging(messageUsers, uniquingKeysWith: { (_, last) in last }) } } - subscriber?.putNext([ TGBridgeMessagesArrayKey: messages, TGBridgeUsersDictionaryKey: users ]) + subscriber.putNext([ TGBridgeMessagesArrayKey: messages, TGBridgeUsersDictionaryKey: users ]) }) return SBlockDisposable { @@ -128,9 +128,9 @@ final class WatchChatMessagesHandler: WatchRequestHandler { } }) let disposable = signal.start(next: { _ in - subscriber?.putNext(true) + subscriber.putNext(true) }, completed: { - subscriber?.putCompletion() + subscriber.putCompletion() }) return SBlockDisposable { @@ -163,9 +163,9 @@ final class WatchChatMessagesHandler: WatchRequestHandler { if peerId.namespace != Namespaces.Peer.CloudUser { response[TGBridgeChatKey] = peers[makeBridgeIdentifier(peerId)] } - subscriber?.putNext(response) + subscriber.putNext(response) } - subscriber?.putCompletion() + subscriber.putCompletion() }) return SBlockDisposable { disposable.dispose() @@ -237,9 +237,9 @@ final class WatchSendMessageHandler: WatchRequestHandler { }) let disposable = signal.start(next: { _ in - subscriber?.putNext(true) + subscriber.putNext(true) }, completed: { - subscriber?.putCompletion() + subscriber.putCompletion() }) return SBlockDisposable { @@ -272,9 +272,9 @@ final class WatchPeerInfoHandler: WatchRequestHandler { }) let disposable = signal.start(next: { view in if let user = makeBridgeUser(peerViewMainPeer(view), presence: view.peerPresences[view.peerId], cachedData: view.cachedData) { - subscriber?.putNext([user.identifier: user]) + subscriber.putNext([user.identifier: user]) } else { - subscriber?.putCompletion() + subscriber.putCompletion() } }) @@ -295,7 +295,7 @@ final class WatchPeerInfoHandler: WatchRequestHandler { }) let disposable = signal.start(next: { view in let (chat, users) = makeBridgeChat(peerViewMainPeer(view), view: view) - subscriber?.putNext([ TGBridgeChatKey: chat, TGBridgeUsersDictionaryKey: users ]) + subscriber.putNext([ TGBridgeChatKey: chat, TGBridgeUsersDictionaryKey: users ]) }) return SBlockDisposable { @@ -430,9 +430,9 @@ final class WatchMediaHandler: WatchRequestHandler { if let image = image, let imageData = image.jpegData(compressionQuality: compressionRate) { sendData(manager: manager, data: imageData, key: key, ext: ".jpg", type: TGBridgeIncomingFileTypeImage, forceAsData: true) } - subscriber?.putNext(key) + subscriber.putNext(key) }, completed: { - subscriber?.putCompletion() + subscriber.putCompletion() }) return SBlockDisposable { @@ -497,9 +497,9 @@ final class WatchMediaHandler: WatchRequestHandler { if let image = image, let imageData = image.jpegData(compressionQuality: 0.2) { sendData(manager: manager, data: imageData, key: key, ext: ".jpg", type: TGBridgeIncomingFileTypeImage, forceAsData: args.notification) } - subscriber?.putNext(key) + subscriber.putNext(key) }, completed: { - subscriber?.putCompletion() + subscriber.putCompletion() }) return SBlockDisposable { @@ -582,9 +582,9 @@ final class WatchMediaHandler: WatchRequestHandler { if let image = image, let imageData = image.jpegData(compressionQuality: 0.5) { sendData(manager: manager, data: imageData, key: key, ext: ".jpg", type: TGBridgeIncomingFileTypeImage, forceAsData: args.notification) } - subscriber?.putNext(key) + subscriber.putNext(key) }, completed: { - subscriber?.putCompletion() + subscriber.putCompletion() }) return SBlockDisposable { @@ -634,7 +634,7 @@ final class WatchStickersHandler: WatchRequestHandler { } } } - subscriber?.putNext(stickers) + subscriber.putNext(stickers) }) return SBlockDisposable { @@ -693,9 +693,9 @@ final class WatchAudioHandler: WatchRequestHandler { let disposable = signal.start(next: { path in let _ = manager.sendFile(url: URL(fileURLWithPath: path), metadata: [TGBridgeIncomingFileTypeKey: TGBridgeIncomingFileTypeAudio, TGBridgeIncomingFileIdentifierKey: key]).start() - subscriber?.putNext(key) + subscriber.putNext(key) }, completed: { - subscriber?.putCompletion() + subscriber.putCompletion() }) return SBlockDisposable { @@ -780,7 +780,7 @@ final class WatchLocationHandler: WatchRequestHandler { venues.append(venue) } } - subscriber?.putNext(venues) + subscriber.putNext(venues) }) return SBlockDisposable { @@ -824,7 +824,7 @@ final class WatchPeerSettingsHandler: WatchRequestHandler { blocked = cachedData.isBlocked } - subscriber?.putNext([ "muted": muted, "blocked": blocked ]) + subscriber.putNext([ "muted": muted, "blocked": blocked ]) }) return SBlockDisposable { @@ -858,9 +858,9 @@ final class WatchPeerSettingsHandler: WatchRequestHandler { }) let disposable = signal.start(next: { _ in - subscriber?.putNext(true) + subscriber.putNext(true) }, completed: { - subscriber?.putCompletion() + subscriber.putCompletion() }) return SBlockDisposable { diff --git a/submodules/WatchBridgeAudio/BUILD b/submodules/WatchBridgeAudio/BUILD index 27b6b76576..e3994dc62d 100644 --- a/submodules/WatchBridgeAudio/BUILD +++ b/submodules/WatchBridgeAudio/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/WatchBridgeAudio/Impl:WatchBridgeAudioImpl", diff --git a/submodules/WebSearchUI/BUILD b/submodules/WebSearchUI/BUILD index d93aa711a6..358bc24569 100644 --- a/submodules/WebSearchUI/BUILD +++ b/submodules/WebSearchUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/WebSearchUI/Sources/LegacyWebSearchGallery.swift b/submodules/WebSearchUI/Sources/LegacyWebSearchGallery.swift index 47a58c964e..6c9362e217 100644 --- a/submodules/WebSearchUI/Sources/LegacyWebSearchGallery.swift +++ b/submodules/WebSearchUI/Sources/LegacyWebSearchGallery.swift @@ -55,8 +55,8 @@ class LegacyWebSearchItem: NSObject, TGMediaEditableItem, TGMediaSelectableItem func thumbnailImageSignal() -> SSignal! { return SSignal(generator: { subscriber -> SDisposable? in let disposable = self.thumbnailImage.start(next: { image in - subscriber?.putNext(image) - subscriber?.putCompletion() + subscriber.putNext(image) + subscriber.putCompletion() }) return SBlockDisposable(block: { @@ -69,17 +69,17 @@ class LegacyWebSearchItem: NSObject, TGMediaEditableItem, TGMediaSelectableItem return SSignal { subscriber in let imageDisposable = self.originalImage.start(next: { image in if !image.degraded() { - subscriber?.putNext(1.0) + subscriber.putNext(1.0) } - subscriber?.putNext(image) + subscriber.putNext(image) if !image.degraded() { - subscriber?.putCompletion() + subscriber.putCompletion() } }) let progressDisposable = (self.progress |> deliverOnMainQueue).start(next: { next in - subscriber?.putNext(next) + subscriber.putNext(next) }) return SBlockDisposable { @@ -96,9 +96,9 @@ class LegacyWebSearchItem: NSObject, TGMediaEditableItem, TGMediaSelectableItem func originalImageSignal(_ position: TimeInterval) -> SSignal! { return SSignal(generator: { subscriber -> SDisposable? in let disposable = self.originalImage.start(next: { image in - subscriber?.putNext(image) + subscriber.putNext(image) if !image.degraded() { - subscriber?.putCompletion() + subscriber.putCompletion() } }) @@ -149,7 +149,7 @@ private class LegacyWebSearchGalleryItem: TGModernGalleryImageItem, TGModernGall } private class LegacyWebSearchGalleryItemView: TGModernGalleryImageItemView, TGModernGalleryEditableItemView { - private let readyForTransition = SVariable()! + private let readyForTransition = SVariable() @objc func setHiddenAsBeingEdited(_ hidden: Bool) { self.imageView.isHidden = hidden @@ -162,7 +162,7 @@ private class LegacyWebSearchGalleryItemView: TGModernGalleryImageItemView, TGMo } override func readyForTransitionIn() -> SSignal! { - return self.readyForTransition.signal()!.take(1) + return self.readyForTransition.signal().take(1) } override func setItem(_ item: TGModernGalleryItem!, synchronously: Bool) { @@ -170,7 +170,7 @@ private class LegacyWebSearchGalleryItemView: TGModernGalleryImageItemView, TGMo self._setItem(item) self.imageSize = TGFitSize(item.editableMediaItem().originalSize!, CGSize(width: 1600, height: 1600)) - let signal = item.editingContext.imageSignal(for: item.editableMediaItem())?.map(toSignal: { result -> SSignal? in + let signal = item.editingContext.imageSignal(for: item.editableMediaItem())?.map(toSignal: { result -> SSignal in if let image = result as? UIImage { return SSignal.single(image) } else if result == nil, let mediaItem = item.editableMediaItem() as? LegacyWebSearchItem { @@ -180,7 +180,7 @@ private class LegacyWebSearchGalleryItemView: TGModernGalleryImageItemView, TGMo } }) - self.imageView.setSignal(signal?.deliver(on: SQueue.main())?.afterNext({ [weak self] next in + self.imageView.setSignal(signal?.deliver(on: SQueue.main()).afterNext({ [weak self] next in if let strongSelf = self, let image = next as? UIImage { strongSelf.imageSize = image.size strongSelf.reset() diff --git a/submodules/WebSearchUI/Sources/WebSearchController.swift b/submodules/WebSearchUI/Sources/WebSearchController.swift index ff2cfd27da..7652ef49a9 100644 --- a/submodules/WebSearchUI/Sources/WebSearchController.swift +++ b/submodules/WebSearchUI/Sources/WebSearchController.swift @@ -443,7 +443,6 @@ public final class WebSearchController: ViewController { return .single({ _ in return .contextRequestResult(nil, nil) }) } - let account = self.context.account let context = self.context let contextBot = self.context.engine.peers.resolvePeerByName(name: name) |> mapToSignal { peer -> Signal in diff --git a/submodules/WebSearchUI/Sources/WebSearchControllerNode.swift b/submodules/WebSearchUI/Sources/WebSearchControllerNode.swift index f913b8a3ad..16043dee6f 100644 --- a/submodules/WebSearchUI/Sources/WebSearchControllerNode.swift +++ b/submodules/WebSearchUI/Sources/WebSearchControllerNode.swift @@ -73,14 +73,6 @@ private func gridNodeLayoutForContainerLayout(size: CGSize) -> GridNodeLayoutTyp private struct WebSearchRecentQueryStableId: Hashable { let query: String - - var hashValue: Int { - return query.hashValue - } - - static func ==(lhs: WebSearchRecentQueryStableId, rhs: WebSearchRecentQueryStableId) -> Bool { - return lhs.query == rhs.query - } } private struct WebSearchRecentQueryEntry: Comparable, Identifiable { diff --git a/submodules/WebUI/BUILD b/submodules/WebUI/BUILD index a07198be9e..bbd1827908 100644 --- a/submodules/WebUI/BUILD +++ b/submodules/WebUI/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/AsyncDisplayKit:AsyncDisplayKit", "//submodules/Display:Display", diff --git a/submodules/WebsiteType/BUILD b/submodules/WebsiteType/BUILD index 6ede6cadc4..27297a6dcf 100644 --- a/submodules/WebsiteType/BUILD +++ b/submodules/WebsiteType/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/TelegramCore:TelegramCore", ], diff --git a/submodules/WidgetItems/BUILD b/submodules/WidgetItems/BUILD index 1a1cff6024..97cf2126e7 100644 --- a/submodules/WidgetItems/BUILD +++ b/submodules/WidgetItems/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], @@ -17,6 +20,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], visibility = [ "//visibility:public", ], diff --git a/submodules/WidgetItemsUtils/BUILD b/submodules/WidgetItemsUtils/BUILD index 3dca4cc574..95ae41d81e 100644 --- a/submodules/WidgetItemsUtils/BUILD +++ b/submodules/WidgetItemsUtils/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", "//submodules/Postbox:Postbox", diff --git a/submodules/WidgetSetupScreen/BUILD b/submodules/WidgetSetupScreen/BUILD index 29632e76f3..2eac6be9de 100644 --- a/submodules/WidgetSetupScreen/BUILD +++ b/submodules/WidgetSetupScreen/BUILD @@ -6,6 +6,9 @@ swift_library( srcs = glob([ "Sources/**/*.swift", ]), + copts = [ + "-warnings-as-errors", + ], deps = [ "//submodules/Display:Display", "//submodules/AsyncDisplayKit:AsyncDisplayKit", diff --git a/submodules/WidgetSetupScreen/Sources/WidgetSetupScreen.swift b/submodules/WidgetSetupScreen/Sources/WidgetSetupScreen.swift index e29cdbadb7..622b8cde32 100644 --- a/submodules/WidgetSetupScreen/Sources/WidgetSetupScreen.swift +++ b/submodules/WidgetSetupScreen/Sources/WidgetSetupScreen.swift @@ -206,8 +206,7 @@ public func widgetSetupScreen(context: AccountContext) -> ViewController { let updateState: ((WidgetSetupScreenControllerState) -> WidgetSetupScreenControllerState) -> Void = { f in statePromise.set(stateValue.modify { f($0) }) } - - var dismissImpl: (() -> Void)? + var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)? var pushControllerImpl: ((ViewController) -> Void)? @@ -372,11 +371,6 @@ public func widgetSetupScreen(context: AccountContext) -> ViewController { } let controller = ItemListController(context: context, state: signal) - dismissImpl = { [weak controller] in - if let controller = controller, let navigationController = controller.navigationController as? NavigationController { - navigationController.filterController(controller, animated: true) - } - } presentControllerImpl = { [weak controller] c, p in if let controller = controller { controller.present(c, in: .window(.root), with: p)