Skip to content

Commit

Permalink
Update ParseInstallation.swift
Browse files Browse the repository at this point in the history
adding callback queue on all methods
  • Loading branch information
lsmilek1 committed Feb 11, 2024
1 parent 0bf1add commit 8127eb0
Show file tree
Hide file tree
Showing 29 changed files with 88 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Sources/ParseSwift/API/API.swift
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,5 @@ public struct API {
ParseConstants.sdk+ParseConstants.version
}
}

// swiftlint:enable line_length
2 changes: 1 addition & 1 deletion Sources/ParseSwift/API/BatchUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typealias RESTBatchCommandNoBodyType<T> = API.NonParseBodyCommand<ParseObjectBat

typealias ParseObjectBatchCommandEncodablePointer<T> = BatchChildCommand<T, PointerType> where T: Encodable
typealias ParseObjectBatchResponseEncodablePointer<U> = [(Result<PointerType, ParseError>)]
// swiftlint:disable line_length

typealias RESTBatchCommandTypeEncodablePointer<T> = API.NonParseBodyCommand<ParseObjectBatchCommandEncodablePointer<T>, ParseObjectBatchResponseEncodablePointer<Encodable>> where T: Encodable
// swiftlint:enable line_length

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,5 @@ public extension ParseUser {
Self.apple
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,5 @@ public extension ParseUser {
Self.facebook
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,5 @@ public extension ParseUser {
Self.github
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,5 @@ public extension ParseUser {
Self.google
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,5 @@ public extension ParseUser {
Self.instagram
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,5 @@ public extension ParseUser {
Self.ldap
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,5 @@ public extension ParseUser {
Self.linkedin
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,5 @@ public extension ParseUser {
Self.spotify
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,5 @@ public extension ParseUser {
Self.twitter
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,5 @@ public extension ParseUser {
}
}
}

// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Sources/ParseSwift/Coding/AnyCodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ struct AnyCodable: Codable {
}
}

// swiftlint:disable type_name
extension AnyCodable: _AnyEncodable, _AnyDecodable {}
// swiftlint:enable type_name

extension AnyCodable: Equatable {
static func == (lhs: AnyCodable, rhs: AnyCodable) -> Bool { // swiftlint:disable:this cyclomatic_complexity line_length
Expand Down
2 changes: 2 additions & 0 deletions Sources/ParseSwift/Coding/AnyDecodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct AnyDecodable: Decodable {
}
}

// swiftlint:disable type_name
protocol _AnyDecodable {
var value: Any { get }
init<T>(_ value: T?)
Expand Down Expand Up @@ -72,6 +73,7 @@ extension _AnyDecodable {
}
}
}
// swiftlint:enable type_name

extension AnyDecodable: Equatable {
static func == (lhs: AnyDecodable, rhs: AnyDecodable) -> Bool {
Expand Down
5 changes: 5 additions & 0 deletions Sources/ParseSwift/Coding/AnyEncodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct AnyEncodable: Encodable {
}
}

// swiftlint:disable type_name
@usableFromInline
protocol _AnyEncodable {

Expand All @@ -49,6 +50,7 @@ extension AnyEncodable: _AnyEncodable {}
// MARK: - Encodable

extension _AnyEncodable {
// swiftlint:enable type_name
// swiftlint:disable:next cyclomatic_complexity function_body_length
func encode(to encoder: Encoder) throws {

Expand Down Expand Up @@ -232,6 +234,7 @@ extension AnyEncodable: ExpressibleByStringInterpolation {}
extension AnyEncodable: ExpressibleByArrayLiteral {}
extension AnyEncodable: ExpressibleByDictionaryLiteral {}

// swiftlint:disable type_name
extension _AnyEncodable {
init(nilLiteral _: ()) {
self.init(nil as Any?)
Expand Down Expand Up @@ -264,3 +267,5 @@ extension _AnyEncodable {
self.init([AnyHashable: Any](elements, uniquingKeysWith: { (first, _) in first }))
}
}

// swiftlint:enable type_name
40 changes: 30 additions & 10 deletions Sources/ParseSwift/Coding/ParseEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
//
//===----------------------------------------------------------------------===//

// This rule does not allow types with underscores in their names.
// swiftlint:disable type_name
// swiftlint:disable colon
// swiftlint:disable force_cast
// swiftlint:disable line_length
// swiftlint:disable return_arrow_whitespace
// swiftlint:disable file_length
// swiftlint:disable redundant_discardable_let
// swiftlint:disable cyclomatic_complexity

import Foundation

/// A marker protocol used to determine whether a value is a `String`-keyed `Dictionary`
Expand All @@ -34,16 +44,6 @@ private protocol _JSONStringDictionaryEncodableMarker { }
#endif
extension Dictionary: _JSONStringDictionaryEncodableMarker where Key == String, Value: Encodable { }

// This rule does not allow types with underscores in their names.
// swiftlint:disable type_name
// swiftlint:disable colon
// swiftlint:disable force_cast
// swiftlint:disable line_length
// swiftlint:disable return_arrow_whitespace
// swiftlint:disable file_length
// swiftlint:disable redundant_discardable_let
// swiftlint:disable cyclomatic_complexity

// MARK: ParseEncoder
/** An object that encodes Parse instances of a data type as JSON objects.
- note: `JSONEncoder` facilitates the encoding of `Encodable` values into JSON.
Expand Down Expand Up @@ -170,6 +170,7 @@ public struct ParseEncoder {
objectsSavedBeforeThisOne: objectsSavedBeforeThisOne,
filesSavedBeforeThisOne: filesSavedBeforeThisOne)
}
// swiftlint:enable large_tuple

// swiftlint:disable large_tuple
internal func encode(_ value: ParseEncodable,
Expand Down Expand Up @@ -197,6 +198,7 @@ public struct ParseEncoder {
objectsSavedBeforeThisOne: objectsSavedBeforeThisOne,
filesSavedBeforeThisOne: filesSavedBeforeThisOne)
}
// swiftlint:enable large_tuple
}

// MARK: _ParseEncoder
Expand Down Expand Up @@ -260,6 +262,7 @@ internal class _ParseEncoder: JSONEncoder, Encoder {
message: "This method should not be used. Either use the JSONEncoder or if you are encoding a ParseObject use \"encodeObject\"")
}

// swiftlint:disable large_tuple
func encodeObject(_ value: Encodable,
batching: Bool = false,
collectChildren: Bool,
Expand Down Expand Up @@ -294,6 +297,7 @@ internal class _ParseEncoder: JSONEncoder, Encoder {
EncodingError.Context(codingPath: [], debugDescription: "Unable to encode the given top-level value to JSON.", underlyingError: error))
}
}
// swiftlint:enable large_tuple

func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> where Key: CodingKey {

Expand Down Expand Up @@ -757,6 +761,7 @@ extension _ParseEncoder : SingleValueEncodingContainer {
try self.storage.push(container: self.box(value))
}
}
// swiftlint:enable force_cast

// MARK: - Concrete Value Representations
// swiftlint:disable force_cast
Expand Down Expand Up @@ -846,6 +851,7 @@ extension _ParseEncoder {
} catch {
// If the value pushed a container before throwing, pop it back off to restore state.
if self.storage.count > depth {
// swiftlint:disable:next unused_optional_binding

Check warning on line 854 in Sources/ParseSwift/Coding/ParseEncoder.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ParseSwift/Coding/ParseEncoder.swift#L854

Added line #L854 was not covered by tests
let _ = self.storage.popContainer()
}

Expand Down Expand Up @@ -875,6 +881,7 @@ extension _ParseEncoder {
// If the value pushed a container before throwing, pop it back off to restore state.
// This should not be possible for Data (which encodes as an array of bytes), but it cannot hurt to catch a failure.
if self.storage.count > depth {
// swiftlint:disable:next unused_optional_binding

Check warning on line 884 in Sources/ParseSwift/Coding/ParseEncoder.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ParseSwift/Coding/ParseEncoder.swift#L884

Added line #L884 was not covered by tests
let _ = self.storage.popContainer()
}

Expand All @@ -893,6 +900,7 @@ extension _ParseEncoder {
} catch {
// If the value pushed a container before throwing, pop it back off to restore state.
if self.storage.count > depth {
// swiftlint:disable:next unused_optional_binding

Check warning on line 903 in Sources/ParseSwift/Coding/ParseEncoder.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ParseSwift/Coding/ParseEncoder.swift#L903

Added line #L903 was not covered by tests
let _ = self.storage.popContainer()
}

Expand Down Expand Up @@ -923,6 +931,7 @@ extension _ParseEncoder {
} catch {
// If the value pushed a container before throwing, pop it back off to restore state.
if self.storage.count > depth {
// swiftlint:disable:next unused_optional_binding

Check warning on line 934 in Sources/ParseSwift/Coding/ParseEncoder.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ParseSwift/Coding/ParseEncoder.swift#L934

Added line #L934 was not covered by tests
let _ = self.storage.popContainer()
}

Expand Down Expand Up @@ -978,6 +987,7 @@ extension _ParseEncoder {
} catch {
// If the value pushed a container before throwing, pop it back off to restore state.
if self.storage.count > depth {
// swiftlint:disable:next unused_optional_binding
let _ = self.storage.popContainer()
}

Expand All @@ -992,6 +1002,7 @@ extension _ParseEncoder {
return self.storage.popContainer()
}
}
// swiftlint:enable line_length

// MARK: - _ParseReferencingEncoder
// swiftlint:disable line_length
Expand Down Expand Up @@ -1181,3 +1192,12 @@ private var _iso8601Formatter: ISO8601DateFormatter = {
formatter.formatOptions = .withInternetDateTime
return formatter
}()

// swiftlint:enable type_name
// swiftlint:enable colon
// swiftlint:enable force_cast
// swiftlint:enable line_length
// swiftlint:enable return_arrow_whitespace
// swiftlint:enable file_length
// swiftlint:enable redundant_discardable_let
// swiftlint:enable cyclomatic_complexity
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,5 @@ public extension ParseLiveQueryDelegate {
func closedSocket(_ code: URLSessionWebSocketTask.CloseCode?, reason: Data?) { }
}
#endif

// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Sources/ParseSwift/Objects/ParseObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1577,3 +1577,5 @@ extension ParseObject {
try API.NonParseBodyCommand<NoBody, NoBody>.delete(self)
}
} // swiftlint:disable:this file_length

// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Sources/ParseSwift/Parse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -531,3 +531,5 @@ public func deleteObjectiveCKeychain() throws {
return true
}
#endif

// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Sources/ParseSwift/Protocols/ParsePushApplePayloadable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ public protocol ParsePushApplePayloadable: ParsePushPayloadable {
*/
var mdm: String? { get set }
}

// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Sources/ParseSwift/Types/ParseConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,5 @@ public struct ParseConfiguration {
self.isMigratingFromObjcSDK = migratingFromObjcSDK
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,5 @@ public struct ParsePushAppleAlert: ParseTypeable {
case title, subtitle, body, action
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ public struct ParsePushAppleSound: ParseTypeable {
*/
var volume: Double?
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,5 @@ public struct ParsePushPayloadApple: ParsePushApplePayloadable {
return mutablePayload
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,5 @@ public struct ParsePushFirebaseNotification: ParseTypeable {
self.image = image
}
}

// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,5 @@ class ParsePushPayloadAnyTests: XCTestCase {
#endif
}
}

// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Tests/ParseSwiftTests/ParsePushPayloadAppleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,5 @@ class ParsePushPayloadAppleTests: XCTestCase {
XCTAssertEqual(decodedAlert, applePayload)
}
}

// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Tests/ParseSwiftTests/ParsePushPayloadFirebaseTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ class ParsePushPayloadFirebaseTests: XCTestCase {
#endif
}
}

// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Tests/ParseSwiftTests/ParseQueryCacheTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -771,3 +771,5 @@ class ParseQueryCacheTests: XCTestCase { // swiftlint:disable:this type_body_len
}
#endif
}

// swiftlint:enable line_length

0 comments on commit 8127eb0

Please sign in to comment.