Skip to content

Commit c8252bc

Browse files
authored
feat: allow any dimension value for ParseAnalytics (#341)
* feat: allow any dimension value for ParseAnalytics * nit changelog * nits * Update .codecov.yml * coverage * more coverage * improve
1 parent 5307210 commit c8252bc

15 files changed

+224
-224
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33
### main
44

5-
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/4.0.1...main)
5+
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/4.1.0...main)
66
* _Contributing to this repo? Add info about your change here to be included in the next release_
77

8+
### 4.1.0
9+
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/4.0.1...4.1.0)
10+
11+
__Improvements__
12+
- Let the OS and developer decide if app tracking authorization is required when using ParseAnalytics. ParseAnalytics can now take any Codable value in its' dimensions instead of just strings. Added a new property "date" to ParseAnalytics. The "at" property will be deprecated in ParseSwift 5.0.0, so developers should switch to "date". ParseAnalytics can now be properly decoded after encoding with a JSONEncoder. This is useful if ParseAnalytics need to be stored locally and sent to the server later ([#341](https://github.com/parse-community/Parse-Swift/pull/341)), thanks to [Corey Baker](https://github.com/cbaker6).
13+
814
### 4.0.1
915
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/4.0.0...4.0.1)
1016

@@ -21,7 +27,7 @@ __New features__
2127
- Add DocC for SDK documentation ([#209](https://github.com/parse-community/Parse-Swift/pull/214)), thanks to [Corey Baker](https://github.com/cbaker6).
2228

2329
__Improvements__
24-
- (Breaking Change) Make ParseRelation conform to Codable and add methods to make decoded stored ParseRelations "usable". ParseObjects can now contain properties of ParseRelation<Self>. In addition, ParseRelations can now be made from ParseObject pointers. For ParseRole, the computed properties: users and roles, are now optional. The queryRoles property has been changed to queryRoles() to improve the handling of thrown errors ([#328](https://github.com/parse-community/Parse-Swift/pull/328)), thanks to @cbaker6.
30+
- (Breaking Change) Make ParseRelation conform to Codable and add methods to make decoded stored ParseRelations "usable". ParseObjects can now contain properties of ParseRelation<Self>. In addition, ParseRelations can now be made from ParseObject pointers. For ParseRole, the computed properties: users and roles, are now optional. The queryRoles property has been changed to queryRoles() to improve the handling of thrown errors ([#328](https://github.com/parse-community/Parse-Swift/pull/328)), thanks to [Corey Baker](https://github.com/cbaker6).
2531
- (Breaking Change) Change the following method parameter names: isUsingMongoDB -> usingMongoDB, isIgnoreCustomObjectIdConfig -> ignoringCustomObjectIdConfig, isUsingEQ -> usingEqComparator ([#321](https://github.com/parse-community/Parse-Swift/pull/321)), thanks to [Corey Baker](https://github.com/cbaker6).
2632
- (Breaking Change) Change the following method parameter names: isUsingMongoDB -> usingMongoDB, isIgnoreCustomObjectIdConfig -> ignoringCustomObjectIdConfig, isUsingEQ -> usingEqComparator ([#321](https://github.com/parse-community/Parse-Swift/pull/321)), thanks to [Corey Baker](https://github.com/cbaker6).
2733
- (Breaking Change) Change the following method parameter names: isUsingTransactions -> usingTransactions, isAllowingCustomObjectIds -> allowingCustomObjectIds, isUsingEqualQueryConstraint -> usingEqualQueryConstraint, isMigratingFromObjcSDK -> migratingFromObjcSDK, isDeletingKeychainIfNeeded -> deletingKeychainIfNeeded ([#323](https://github.com/parse-community/Parse-Swift/pull/323)), thanks to [Corey Baker](https://github.com/cbaker6).

ParseSwift.xcodeproj/project.pbxproj

Lines changed: 21 additions & 21 deletions
Large diffs are not rendered by default.

Sources/ParseSwift/Coding/ParseEncoder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public struct ParseEncoder {
191191
}
192192

193193
// MARK: _ParseEncoder
194-
private class _ParseEncoder: JSONEncoder, Encoder {
194+
internal class _ParseEncoder: JSONEncoder, Encoder {
195195
var codingPath: [CodingKey]
196196
let dictionary: NSMutableDictionary
197197
let skippedKeys: Set<String>

Sources/ParseSwift/LiveQuery/ParseLiveQuery+async.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import Foundation
1111

1212
extension ParseLiveQuery {
13-
// MARK: Async/Await
13+
// MARK: Connection - Async/Await
1414

1515
/**
1616
Manually establish a connection to the `ParseLiveQuery` Server.

Sources/ParseSwift/LiveQuery/ParseLiveQuery+combine.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Foundation
1111
import Combine
1212

1313
extension ParseLiveQuery {
14-
// MARK: Combine
14+
// MARK: Connection - Combine
1515

1616
/**
1717
Manually establish a connection to the `ParseLiveQuery` Server. Publishes when established.

Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ Not attempting to open ParseLiveQuery socket anymore
223223
}
224224
}
225225

226-
// MARK: Helpers
227226
extension ParseLiveQuery {
228227

229228
/// Current LiveQuery client.

Sources/ParseSwift/Objects/ParseRole.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ public extension ParseRole {
9898
}
9999

100100
static func == (lhs: Self, rhs: Self) -> Bool {
101-
lhs.name == rhs.name && lhs.className == rhs.className
101+
lhs.debugDescription == rhs.debugDescription
102102
}
103103

104104
func hash(into hasher: inout Hasher) {
105-
hasher.combine("\(self.className)_\(String(describing: self.name))")
105+
hasher.combine(self.debugDescription)
106106
}
107107
}
108108

Sources/ParseSwift/ParseConstants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010

1111
enum ParseConstants {
1212
static let sdk = "swift"
13-
static let version = "4.0.1"
13+
static let version = "4.1.0"
1414
static let fileManagementDirectory = "parse/"
1515
static let fileManagementPrivateDocumentsDirectory = "Private Documents/"
1616
static let fileManagementLibraryDirectory = "Library/"

Sources/ParseSwift/Types/ParseACL.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ public struct ParseACL: ParseType,
3232
case write
3333

3434
public init(from decoder: Decoder) throws {
35-
self = Access(rawValue: try decoder.singleValueContainer().decode(String.self))!
35+
guard let decoded = Access(rawValue: try decoder.singleValueContainer().decode(String.self)) else {
36+
throw ParseError(code: .unknownError, message: "Not able to decode ParseACL Access")
37+
}
38+
self = decoded
3639
}
3740

3841
public func encode(to encoder: Encoder) throws {

Sources/ParseSwift/Types/ParseAnalytics+async.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,19 @@ public extension ParseAnalytics {
9696
- parameter at: Explicitly set the time associated with a given event. If not provided the
9797
server time will be used.
9898
- parameter options: A set of header options sent to the server. Defaults to an empty set.
99-
- warning: This method makes a copy of the current `ParseAnalytics` and then mutates
100-
it. You will not have access to the mutated analytic after calling this method.
10199
- throws: An error of type `ParseError`.
102100
*/
103-
func track(dimensions: [String: String]?,
104-
at date: Date? = nil,
105-
options: API.Options = []) async throws {
106-
let _: Void = try await withCheckedThrowingContinuation { continuation in
107-
var analytic = self
108-
analytic.track(dimensions: dimensions,
109-
at: date,
110-
options: options,
111-
completion: continuation.resume)
101+
mutating func track(dimensions: [String: String]?,
102+
at date: Date? = nil,
103+
options: API.Options = []) async throws {
104+
let result = try await withCheckedThrowingContinuation { continuation in
105+
self.track(dimensions: dimensions,
106+
at: date,
107+
options: options,
108+
completion: continuation.resume)
109+
}
110+
if case let .failure(error) = result {
111+
throw error
112112
}
113113
}
114114
}

0 commit comments

Comments
 (0)