Removed some unneeded imports
# Conflicts: # SessionMessagingKit/Jobs/Types/AttachmentUploadJob.swift # SessionMessagingKit/Jobs/Types/MessageSendJob.swift # SessionShareExtension/SAEScreenLockViewController.swift # SessionSnodeKit/Models/SnodeBatchRequest.swift
This commit is contained in:
parent
8ac6b25ced
commit
8b37002d89
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import AVFoundation
|
import AVFoundation
|
||||||
import PromiseKit
|
|
||||||
import SessionUIKit
|
import SessionUIKit
|
||||||
import SessionUtilitiesKit
|
import SessionUtilitiesKit
|
||||||
import SessionSnodeKit
|
import SessionSnodeKit
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import PromiseKit
|
|
||||||
import SessionUIKit
|
import SessionUIKit
|
||||||
import SessionMessagingKit
|
import SessionMessagingKit
|
||||||
import SessionSnodeKit
|
import SessionSnodeKit
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import PromiseKit
|
|
||||||
import SessionUIKit
|
import SessionUIKit
|
||||||
|
|
||||||
// The initial presentation is intended to be indistinguishable from the Launch Screen.
|
// The initial presentation is intended to be indistinguishable from the Launch Screen.
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import Combine
|
||||||
import GRDB
|
import GRDB
|
||||||
import PromiseKit
|
import SignalCoreKit
|
||||||
import SessionUtilitiesKit
|
import SessionUtilitiesKit
|
||||||
|
|
||||||
public enum AttachmentUploadJob: JobExecutor {
|
public enum AttachmentUploadJob: JobExecutor {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import GRDB
|
import GRDB
|
||||||
import PromiseKit
|
|
||||||
import SessionUtilitiesKit
|
import SessionUtilitiesKit
|
||||||
|
|
||||||
public enum MessageReceiveJob: JobExecutor {
|
public enum MessageReceiveJob: JobExecutor {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import Combine
|
||||||
import GRDB
|
import GRDB
|
||||||
import PromiseKit
|
import SignalCoreKit
|
||||||
import SessionUtilitiesKit
|
import SessionUtilitiesKit
|
||||||
import SessionSnodeKit
|
import SessionSnodeKit
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import Combine
|
||||||
import GRDB
|
import GRDB
|
||||||
import PromiseKit
|
|
||||||
import SessionUtilitiesKit
|
import SessionUtilitiesKit
|
||||||
|
|
||||||
public enum SendReadReceiptsJob: JobExecutor {
|
public enum SendReadReceiptsJob: JobExecutor {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import PromiseKit
|
import SignalCoreKit
|
||||||
import SignalUtilitiesKit
|
import SignalUtilitiesKit
|
||||||
import SessionUIKit
|
import SessionUIKit
|
||||||
import SessionUtilitiesKit
|
import SessionUtilitiesKit
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import SessionUtilitiesKit
|
||||||
|
|
||||||
|
internal extension SnodeAPI {
|
||||||
|
struct BatchRequest: Encodable {
|
||||||
|
let requests: [Child]
|
||||||
|
|
||||||
|
init(requests: [Info]) {
|
||||||
|
self.requests = requests.map { $0.child }
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - BatchRequest.Info
|
||||||
|
|
||||||
|
struct Info {
|
||||||
|
public let responseType: Codable.Type
|
||||||
|
fileprivate let child: Child
|
||||||
|
|
||||||
|
public init<T: Encodable, R: Codable>(request: SnodeRequest<T>, responseType: R.Type) {
|
||||||
|
self.child = Child(request: request)
|
||||||
|
self.responseType = HTTP.BatchSubResponse<R>.self
|
||||||
|
}
|
||||||
|
|
||||||
|
public init<T: Encodable>(request: SnodeRequest<T>) {
|
||||||
|
self.init(
|
||||||
|
request: request,
|
||||||
|
responseType: NoResponse.self
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - BatchRequest.Child
|
||||||
|
|
||||||
|
struct Child: Encodable {
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case method
|
||||||
|
case params
|
||||||
|
}
|
||||||
|
|
||||||
|
let endpoint: SnodeAPI.Endpoint
|
||||||
|
|
||||||
|
/// The `jsonBodyEncoder` is used to avoid having to make `BatchSubRequest` a generic type (haven't found
|
||||||
|
/// a good way to keep `BatchSubRequest` encodable using protocols unfortunately so need this work around)
|
||||||
|
private let jsonBodyEncoder: ((inout KeyedEncodingContainer<CodingKeys>, CodingKeys) throws -> ())?
|
||||||
|
|
||||||
|
init<T: Encodable>(request: SnodeRequest<T>) {
|
||||||
|
self.endpoint = request.endpoint
|
||||||
|
|
||||||
|
self.jsonBodyEncoder = { [body = request.body] container, key in
|
||||||
|
try container.encode(body, forKey: key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container: KeyedEncodingContainer<CodingKeys> = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
|
try container.encode(endpoint.rawValue, forKey: .method)
|
||||||
|
try jsonBodyEncoder?(&container, .params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||||
|
|
||||||
import PromiseKit
|
import Foundation
|
||||||
import SessionUtilitiesKit
|
import SessionUtilitiesKit
|
||||||
|
|
||||||
public final class SnodeMessage: Codable {
|
public final class SnodeMessage: Codable {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import PromiseKit
|
|
||||||
import SessionUIKit
|
import SessionUIKit
|
||||||
|
|
||||||
// MARK: - GalleryRailItem
|
// MARK: - GalleryRailItem
|
||||||
|
|
Loading…
Reference in New Issue