Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline mode #434

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
afe5203
LocalStore
vdkdamian Dec 20, 2022
36920d4
FindExplain not working (yet)
vdkdamian Dec 20, 2022
22fb134
Revert "FindExplain not working (yet)"
vdkdamian Dec 20, 2022
40f21ab
Fix
vdkdamian Dec 21, 2022
ad7e586
Fix, Print
vdkdamian Dec 21, 2022
ccb65b3
Fix
vdkdamian Dec 21, 2022
81fccd6
useLocalStore fix
vdkdamian Dec 21, 2022
fffd358
Filename change
vdkdamian Dec 21, 2022
30a309b
Test
vdkdamian Dec 21, 2022
cd32e30
Changed queryIdentifier
vdkdamian Dec 21, 2022
9b0cea9
Fix
vdkdamian Dec 21, 2022
c455849
Classname
vdkdamian Dec 21, 2022
6157b30
QueryDate, print
vdkdamian Dec 21, 2022
35e1c5f
print
vdkdamian Dec 21, 2022
cab5ae7
Print decode error
vdkdamian Dec 21, 2022
a5e5750
queryIdentifiers
vdkdamian Dec 21, 2022
e9e8237
Sets fix
vdkdamian Dec 21, 2022
7d3f12c
Fix
vdkdamian Dec 21, 2022
ecfeec8
Cleaned
vdkdamian Dec 21, 2022
0a375fb
sorted Sets names
vdkdamian Dec 21, 2022
3b2469c
Comment
vdkdamian Dec 21, 2022
1746e29
Fix: added fields set
vdkdamian Dec 21, 2022
2d6a9da
Print responseError
vdkdamian Dec 21, 2022
faba328
Removed print
vdkdamian Dec 21, 2022
aa64598
Created no internet connection error
vdkdamian Dec 21, 2022
f96380a
Compare error
vdkdamian Dec 21, 2022
3acf50c
Fix
vdkdamian Dec 21, 2022
0874000
Try new error code for fix iOS
vdkdamian Dec 21, 2022
517499c
Connection not allowed
vdkdamian Dec 21, 2022
f0e9cee
Function changes
vdkdamian Dec 22, 2022
6b32d79
FindAll
vdkdamian Dec 22, 2022
05d3821
First
vdkdamian Dec 22, 2022
0e44109
Save object
vdkdamian Dec 22, 2022
471863c
saveLocally
vdkdamian Dec 22, 2022
56c6343
hasNoInternetConnection
vdkdamian Dec 22, 2022
6ac8a93
FetchObject
vdkdamian Dec 22, 2022
6d7d95d
HiddenFile
vdkdamian Dec 23, 2022
1059b3b
uniqueObjectsById, Create fetchobjects when policy enabled
vdkdamian Dec 23, 2022
799ed42
Cleanup
vdkdamian Dec 23, 2022
345993a
Comment
vdkdamian Dec 23, 2022
4fb6971
Moved some code
vdkdamian Dec 23, 2022
158a151
Make sure new FetchObjects are unique
vdkdamian Dec 23, 2022
f3566eb
Fetching Local Store
vdkdamian Dec 24, 2022
5ba3892
Print
vdkdamian Dec 25, 2022
0e258f4
Error change
vdkdamian Dec 25, 2022
2c0dbf1
Change function
vdkdamian Dec 25, 2022
daa251d
Revert
vdkdamian Dec 25, 2022
3bfce97
Lint fix
vdkdamian Dec 25, 2022
04826e0
Remove files if corrupted, Remove files if empty, code clean
vdkdamian Dec 25, 2022
ca175d0
Fixes
vdkdamian Dec 26, 2022
455c78b
Fix: don't create when an error
vdkdamian Dec 27, 2022
65843f7
Fix
vdkdamian Dec 27, 2022
25b8ea9
Print
vdkdamian Dec 27, 2022
46c0dd5
Fix where save was executed before result
vdkdamian Dec 27, 2022
a0428e9
Cleanup
vdkdamian Dec 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Created no internet connection error
  • Loading branch information
vdkdamian committed Dec 21, 2022
commit aa645984f801c1346212f559dee8d7c77c5fc8ba
9 changes: 7 additions & 2 deletions Sources/ParseSwift/Extensions/URLSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,16 @@ internal extension URLSession {
responseError: Error?,
mapper: @escaping (Data) throws -> U) -> Result<U, ParseError> {
if let responseError = responseError {
guard let parseError = responseError as? ParseError else {
if responseError._code == NSURLErrorNotConnectedToInternet {
return .failure(ParseError(code: .unknownError,
message: "Unable to connect with parse-server: \(responseError)"))
} else {
guard let parseError = responseError as? ParseError else {
return .failure(ParseError(code: .notConnectedToInternet,
message: "Unable to connect with the internet: \(responseError)"))
}
return .failure(parseError)
}
return .failure(parseError)
}
guard let response = urlResponse else {
guard let parseError = responseError as? ParseError else {
Expand Down
5 changes: 5 additions & 0 deletions Sources/ParseSwift/Types/ParseError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ public struct ParseError: ParseTypeable, Swift.Error {
a non-2XX status code.
*/
case xDomainRequest = 602

/**
Error code indicating that the device is not connected to the internet.
*/
case notConnectedToInternet = 1009

/**
Error code indicating any other custom error sent from the Parse Server.
Expand Down