Skip to content

Commit

Permalink
Fix allowCustomObjectId (#101)
Browse files Browse the repository at this point in the history
* Doc nits

* Fix allowCustomObjectId

* increase codecov

* Prepare for release and doc nits

* nits
  • Loading branch information
cbaker6 authored Mar 27, 2021
1 parent 453ebdb commit 96b26a5
Show file tree
Hide file tree
Showing 19 changed files with 574 additions and 189 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Parse-Swift Changelog

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

### 1.2.3
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.2.2...1.2.3)

__Fixes__
- Fixed a bug that prevented custom objectIds from working ([#101](https://github.com/parse-community/Parse-Swift/pull/101)), thanks to [Corey Baker](https://github.com/cbaker6).

### 1.2.2
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.2.1...1.2.2)
Expand Down
2 changes: 1 addition & 1 deletion ParseSwift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ParseSwift"
s.version = "1.2.2"
s.version = "1.2.3"
s.summary = "Parse Pure Swift SDK"
s.homepage = "https://github.com/parse-community/Parse-Swift"
s.authors = {
Expand Down
32 changes: 16 additions & 16 deletions ParseSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@
70647E9D259E3A9A004C1004 /* ParseType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70647E9B259E3A9A004C1004 /* ParseType.swift */; };
70647E9E259E3A9A004C1004 /* ParseType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70647E9B259E3A9A004C1004 /* ParseType.swift */; };
70647E9F259E3A9A004C1004 /* ParseType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70647E9B259E3A9A004C1004 /* ParseType.swift */; };
70732C5A2606CCAD000CAB81 /* ParseObjectCustomObjectId.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70732C592606CCAD000CAB81 /* ParseObjectCustomObjectId.swift */; };
70732C5B2606CCAD000CAB81 /* ParseObjectCustomObjectId.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70732C592606CCAD000CAB81 /* ParseObjectCustomObjectId.swift */; };
70732C5C2606CCAD000CAB81 /* ParseObjectCustomObjectId.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70732C592606CCAD000CAB81 /* ParseObjectCustomObjectId.swift */; };
70732C5A2606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70732C592606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift */; };
70732C5B2606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70732C592606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift */; };
70732C5C2606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70732C592606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift */; };
707A3BF125B0A4F0000D215C /* ParseAuthentication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 707A3BF025B0A4F0000D215C /* ParseAuthentication.swift */; };
707A3BF225B0A4F0000D215C /* ParseAuthentication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 707A3BF025B0A4F0000D215C /* ParseAuthentication.swift */; };
707A3BF325B0A4F0000D215C /* ParseAuthentication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 707A3BF025B0A4F0000D215C /* ParseAuthentication.swift */; };
Expand Down Expand Up @@ -602,7 +602,7 @@
705D950725BE4C08003EF6F8 /* SubscriptionCallback.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionCallback.swift; sourceTree = "<group>"; };
70647E8D259E3375004C1004 /* LocallyIdentifiable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocallyIdentifiable.swift; sourceTree = "<group>"; };
70647E9B259E3A9A004C1004 /* ParseType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseType.swift; sourceTree = "<group>"; };
70732C592606CCAD000CAB81 /* ParseObjectCustomObjectId.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseObjectCustomObjectId.swift; sourceTree = "<group>"; };
70732C592606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseObjectCustomObjectIdTests.swift; sourceTree = "<group>"; };
707A3BF025B0A4F0000D215C /* ParseAuthentication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseAuthentication.swift; sourceTree = "<group>"; };
707A3C1025B0A8E8000D215C /* ParseAnonymous.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseAnonymous.swift; sourceTree = "<group>"; };
707A3C1F25B14BCF000D215C /* ParseApple.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseApple.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -834,7 +834,7 @@
7003963A25A288100052CB31 /* ParseLiveQueryTests.swift */,
70C7DC2024D20F190050419B /* ParseObjectBatchTests.swift */,
7044C1DE25C5C70D0011F6E7 /* ParseObjectCombine.swift */,
70732C592606CCAD000CAB81 /* ParseObjectCustomObjectId.swift */,
70732C592606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift */,
911DB13524C4FC100027F3C7 /* ParseObjectTests.swift */,
7044C1EB25C5CC930011F6E7 /* ParseOperationCombineTests.swift */,
70C5508425B4A68700B5DBC2 /* ParseOperationTests.swift */,
Expand Down Expand Up @@ -1665,7 +1665,7 @@
89899D772603CF66002E2043 /* ParseFacebookTests.swift in Sources */,
70386A4625D99C8B0048EC1B /* ParseLDAPTests.swift in Sources */,
911DB12E24C4837E0027F3C7 /* APICommandTests.swift in Sources */,
70732C5A2606CCAD000CAB81 /* ParseObjectCustomObjectId.swift in Sources */,
70732C5A2606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift in Sources */,
911DB12C24C3F7720027F3C7 /* MockURLResponse.swift in Sources */,
7044C24325C5EA360011F6E7 /* ParseAppleCombineTests.swift in Sources */,
7044C1DF25C5C70D0011F6E7 /* ParseObjectCombine.swift in Sources */,
Expand Down Expand Up @@ -1816,7 +1816,7 @@
89899D822603CF67002E2043 /* ParseFacebookTests.swift in Sources */,
70386A4825D99C8B0048EC1B /* ParseLDAPTests.swift in Sources */,
709B984C2556ECAA00507778 /* APICommandTests.swift in Sources */,
70732C5C2606CCAD000CAB81 /* ParseObjectCustomObjectId.swift in Sources */,
70732C5C2606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift in Sources */,
709B984D2556ECAA00507778 /* AnyDecodableTests.swift in Sources */,
7044C24525C5EA360011F6E7 /* ParseAppleCombineTests.swift in Sources */,
7044C1E125C5C70D0011F6E7 /* ParseObjectCombine.swift in Sources */,
Expand Down Expand Up @@ -1870,7 +1870,7 @@
89899D812603CF67002E2043 /* ParseFacebookTests.swift in Sources */,
70386A4725D99C8B0048EC1B /* ParseLDAPTests.swift in Sources */,
70F2E2B5254F283000B2EA5C /* ParseEncoderTests.swift in Sources */,
70732C5B2606CCAD000CAB81 /* ParseObjectCustomObjectId.swift in Sources */,
70732C5B2606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift in Sources */,
70F2E2C2254F283000B2EA5C /* APICommandTests.swift in Sources */,
7044C24425C5EA360011F6E7 /* ParseAppleCombineTests.swift in Sources */,
7044C1E025C5C70D0011F6E7 /* ParseObjectCombine.swift in Sources */,
Expand Down Expand Up @@ -2321,7 +2321,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.2.3;
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
PRODUCT_NAME = ParseSwift;
SKIP_INSTALL = YES;
Expand All @@ -2345,7 +2345,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.2.3;
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
PRODUCT_NAME = ParseSwift;
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -2411,7 +2411,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.2.3;
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
PRODUCT_NAME = ParseSwift;
SDKROOT = macosx;
Expand All @@ -2437,7 +2437,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.2.3;
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
PRODUCT_NAME = ParseSwift;
SDKROOT = macosx;
Expand Down Expand Up @@ -2584,7 +2584,7 @@
INFOPLIST_FILE = "ParseSwift-watchOS/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.2.3;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-watchOS";
Expand Down Expand Up @@ -2613,7 +2613,7 @@
INFOPLIST_FILE = "ParseSwift-watchOS/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.2.3;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-watchOS";
PRODUCT_NAME = ParseSwift;
Expand All @@ -2640,7 +2640,7 @@
INFOPLIST_FILE = "ParseSwift-tvOS/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.2.3;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-tvOS";
Expand Down Expand Up @@ -2668,7 +2668,7 @@
INFOPLIST_FILE = "ParseSwift-tvOS/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.2.2;
MARKETING_VERSION = 1.2.3;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-tvOS";
PRODUCT_NAME = ParseSwift;
Expand Down
2 changes: 1 addition & 1 deletion Scripts/jazzy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bundle exec jazzy \
--author_url http://parseplatform.org \
--github_url https://github.com/parse-community/Parse-Swift \
--root-url http://parseplatform.org/Parse-Swift/api/ \
--module-version 1.2.2 \
--module-version 1.2.3 \
--theme fullwidth \
--skip-undocumented \
--output ./docs/api \
Expand Down
16 changes: 11 additions & 5 deletions Sources/ParseSwift/API/API+Commands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ internal extension API.Command {
}

// MARK: Saving ParseObjects
static func saveCommand<T>(_ object: T) -> API.Command<T, T> where T: ParseObject {
static func saveCommand<T>(_ object: T) throws -> API.Command<T, T> where T: ParseObject {
if ParseConfiguration.allowCustomObjectId && object.objectId == nil {
throw ParseError(code: .missingObjectId, message: "objectId must not be nil")
}
if object.isSaved {
return updateCommand(object)
}
Expand All @@ -326,7 +329,7 @@ internal extension API.Command {
try ParseCoding.jsonDecoder().decode(SaveResponse.self, from: data).apply(to: object)
}
return API.Command<T, T>(method: .POST,
path: object.endpoint,
path: object.endpoint(.POST),
body: object,
mapper: mapper)
}
Expand All @@ -346,6 +349,9 @@ internal extension API.Command {
guard let objectable = object as? Objectable else {
throw ParseError(code: .unknownError, message: "Not able to cast to objectable. Not saving")
}
if ParseConfiguration.allowCustomObjectId && objectable.objectId == nil {
throw ParseError(code: .missingObjectId, message: "objectId must not be nil")
}
if objectable.isSaved {
return try updateCommand(object)
} else {
Expand All @@ -364,9 +370,9 @@ internal extension API.Command {
return try objectable.toPointer()
}
return API.Command<T, PointerType>(method: .POST,
path: objectable.endpoint,
body: object,
mapper: mapper)
path: objectable.endpoint(.POST),
body: object,
mapper: mapper)
}

private static func updateCommand<T>(_ object: T) throws -> API.Command<T, PointerType> where T: Encodable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import Combine
- Once logged out, an anonymous user cannot be recovered.
- When the current user is anonymous, the following methods can be used to switch
to a different user or convert the anonymous user into a regular one:
- *signup* converts an anonymous user to a standard user with the given username and password.
- *signup* converts an anonymous user to a standard user with the given username and password.
Data associated with the anonymous user is retained.
- *login* switches users without converting the anonymous user.
- *login* switches users without converting the anonymous user.
Data associated with the anonymous user will be lost.
- Service *login* (e.g. Apple, Facebook, Twitter) will attempt to convert
- Service *login* (e.g. Apple, Facebook, Twitter) will attempt to convert
the anonymous user into a standard user by linking it to the service.
If a user already exists that is linked to the service, it will instead switch to the existing user.
- Service linking (e.g. Apple, Facebook, Twitter) will convert the anonymous user
- Service linking (e.g. Apple, Facebook, Twitter) will convert the anonymous user
into a standard user by linking it to the service.
*/
public struct ParseAnonymous<AuthenticatedUser: ParseUser>: ParseAuthentication {
Expand Down
8 changes: 5 additions & 3 deletions Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ import FoundationNetworking
The above creates a `ParseLiveQuery` using either the `liveQueryServerURL` (if it has been set)
or `serverURL` when using `ParseSwift.initialize`. All additional queries will be
created in the same way. The times you will want to initialize a new `ParseLiveQuery` instance
are: 1) If you want to become a `ParseLiveQueryDelegate` to respond to authentification challenges
are:
1. If you want to become a `ParseLiveQueryDelegate` to respond to authentification challenges
and/or receive metrics and error messages for a `ParseLiveQuery`client.
2) You have specific LiveQueries that need to subscribe to a server that have a different url than
the default. 3) You want to change the default url for all LiveQuery connections when the app is already
2. You have specific LiveQueries that need to subscribe to a server that have a different url than
the default.
3. You want to change the default url for all LiveQuery connections when the app is already
running. Initializing new instances will create a new task/connection to the `ParseLiveQuery` server.
When an instance is deinitialized it will automatically close it's connection gracefully.
*/
Expand Down
Loading

0 comments on commit 96b26a5

Please sign in to comment.