Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Offline scans are not logged to history #267

Open
Tracked by #912
teolemon opened this issue Mar 8, 2019 · 4 comments
Open
Tracked by #912

Offline scans are not logged to history #267

teolemon opened this issue Mar 8, 2019 · 4 comments

Comments

@teolemon
Copy link
Member

teolemon commented Mar 8, 2019

Offline scans are not logged to history

@jncosideout
Copy link
Contributor

Hello! I am interested in working on this issue. I am new to open source but I have two years of iOS development experience and I have published a native iOS to the App Store. May we discuss a design to solve this one?

@jncosideout jncosideout self-assigned this Aug 9, 2020
@jncosideout
Copy link
Contributor

Here is what I've found so far, please let me know if I'm on the right track:

I tested the offline scan by setting my device to airplane mode and scanning a food product.
This forces the error callback (line 442) to be called in ScannerViewController inside getProduct(barcode: ...)
The next line checks isOffline(errorCode:) and if true, call handleGetProductSuccess(barcode: ...) in order to //Assume product does not exist and store locally for later upload

For me, the error code passed is -1004 "Could not connect to the server."
Because this does not match NSURLErrorNotConnectedToInternet || NSURLErrorTimedOut isOffline isOffline(errorCode:) returns FALSE even though I am offline in airplane mode.

I get the same errorCode (-1004) when I turn off WiFi.
Would including this NSURLErrorDomain Code=-1004 in isOffline(errorCode:) be the best way to fix this?

@philippeauriach
Copy link
Collaborator

philippeauriach commented Aug 10, 2020

Sounds logical to me

@teolemon
Copy link
Member Author

teolemon commented Dec 6, 2020

The issue is still here on latest build

@teolemon teolemon pinned this issue Dec 6, 2020
@teolemon teolemon unpinned this issue Sep 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants