From 40736ca677353b6233fca87897d1a8f3eb28d97f Mon Sep 17 00:00:00 2001 From: Ali <> Date: Tue, 7 Sep 2021 15:09:12 +0400 Subject: [PATCH] Coding fixes --- Telegram/BUILD | 1 + Telegram/NotificationService/BUILD | 2 ++ .../NotificationService/Sources/NotificationService.swift | 5 ++--- submodules/Postbox/Sources/Coding.swift | 2 ++ .../Sources/Utils/Decoder/AdaptedPostboxDecoder.swift | 4 ++++ .../Sources/Utils/Encoder/AdaptedPostboxEncoder.swift | 4 ++++ 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Telegram/BUILD b/Telegram/BUILD index 1e41387b9b..803f6deadc 100644 --- a/Telegram/BUILD +++ b/Telegram/BUILD @@ -1623,6 +1623,7 @@ ios_extension( ":MtProtoKitFramework", ":SwiftSignalKitFramework", ":PostboxFramework", + ":TelegramCoreFramework", ], ) diff --git a/Telegram/NotificationService/BUILD b/Telegram/NotificationService/BUILD index 4c124fb09d..25a2d700ca 100644 --- a/Telegram/NotificationService/BUILD +++ b/Telegram/NotificationService/BUILD @@ -7,6 +7,8 @@ swift_library( "Sources/*.swift", ]), deps = [ + "//submodules/Postbox:Postbox", + "//submodules/TelegramCore:TelegramCore", "//submodules/BuildConfig:BuildConfig", "//submodules/MtProtoKit:MtProtoKit", "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit", diff --git a/Telegram/NotificationService/Sources/NotificationService.swift b/Telegram/NotificationService/Sources/NotificationService.swift index a00e09cf1b..c6311cfccb 100644 --- a/Telegram/NotificationService/Sources/NotificationService.swift +++ b/Telegram/NotificationService/Sources/NotificationService.swift @@ -2,6 +2,8 @@ import Foundation import UserNotifications import SwiftSignalKit import NotificationServiceObjC +import Postbox +import TelegramCore private let queue = Queue() @@ -18,9 +20,6 @@ final class NotificationService: UNNotificationServiceExtension { f() } }, countIncomingMessage: { rootPath, accountId, encryptionParameters, peerId, messageId in - /*SyncProviderImpl.addIncomingMessage(queue: queue, withRootPath: rootPath, accountId: accountId, encryptionParameters: encryptionParameters, peerId: peerId, messageId: messageId, completion: { count in - completion?(count) - })*/ completion?(0) }, isLocked: { rootPath in return SyncProviderImpl.isLocked(withRootPath: rootPath) diff --git a/submodules/Postbox/Sources/Coding.swift b/submodules/Postbox/Sources/Coding.swift index 8e1c769ddf..0aaa7d87bc 100644 --- a/submodules/Postbox/Sources/Coding.swift +++ b/submodules/Postbox/Sources/Coding.swift @@ -779,6 +779,8 @@ public final class PostboxDecoder { offset += 1 if keyLength != Int(readKeyLength) { + /*let keyString = String(data: Data(bytes: bytes + (offset - Int(readKeyLength) - 1), count: Int(readKeyLength)), encoding: .utf8) + print("\(String(describing: keyString))")*/ skipValue(bytes, offset: &offset, length: length, valueType: ValueType(rawValue: readValueType)!) continue } diff --git a/submodules/Postbox/Sources/Utils/Decoder/AdaptedPostboxDecoder.swift b/submodules/Postbox/Sources/Utils/Decoder/AdaptedPostboxDecoder.swift index 4f25acfd9c..3552f98c79 100644 --- a/submodules/Postbox/Sources/Utils/Decoder/AdaptedPostboxDecoder.swift +++ b/submodules/Postbox/Sources/Utils/Decoder/AdaptedPostboxDecoder.swift @@ -19,6 +19,10 @@ final public class AdaptedPostboxDecoder { self.data = data self.typeHash = typeHash } + + public init(from decoder: Decoder) throws { + preconditionFailure() + } } public init() { diff --git a/submodules/Postbox/Sources/Utils/Encoder/AdaptedPostboxEncoder.swift b/submodules/Postbox/Sources/Utils/Encoder/AdaptedPostboxEncoder.swift index 3851657b9e..2e0854f5d0 100644 --- a/submodules/Postbox/Sources/Utils/Encoder/AdaptedPostboxEncoder.swift +++ b/submodules/Postbox/Sources/Utils/Encoder/AdaptedPostboxEncoder.swift @@ -10,6 +10,10 @@ public class AdaptedPostboxEncoder { self.typeHash = typeHash self.data = data } + + public func encode(to encoder: Encoder) throws { + preconditionFailure() + } } public init() {