Comments (26)
@hajjD If you would like to donate to our open collective, we'll raise the bounty for this issue here by the amount that you donate. Whoever provides this feature then gets the bounty, or if multiple people work on this feature, they can easily split up the bounty among them, according to the Parse Bounty Program.
from parse-swift.
I contributed $300 via my company, please increase the bounty as such.
transaction_parse-server_2022-12-18_8151efca-4cea-4e76-9080-de4326cf782f.pdf
from parse-swift.
Thanks for opening this issue!
- 🎉 We are excited about your ideas for improvement!
from parse-swift.
Yes, I recently started working on a project that needs to be offline first and realized that this is a gaping hole vs Parse ObjC
from parse-swift.
Did you read through the forum discussion to see whether you can implement a custom solution until this feature is added out-of-the-box to the SDK?
from parse-swift.
Unfortunately my time has been rather limited, is there a way I can up the bounty to help out financially?
from parse-swift.
Unfortunately my time has been rather limited, is there a way I can up the bounty to help out financially?
I have offline usage working for my own project. I could modify it to make it more generic, but I would need to take some days off and I don't know if I find it worth to put in the time and effort for 100$.
Also want to mention that I needed to enable custom objectId's on the server in order for it to work.
Because of this, I don't know if it is suitable for this to publish it.
from parse-swift.
@vdkdamian we could bump the bounty label, how much would you see appropriate for you to add the feature?
from parse-swift.
@vdkdamian we could bump the bounty label, how much would you see appropriate for you to add the feature?
Difficult question, I would need to see how much work it would take. I've done it using a observable object but I would need to change that in a more general way.
I also think I can drop the fact that custom object id's are required because I only use that for objects that are created locally to be saved when offline.
This would mean that existing objects in the database can be used offline with no problem.
from parse-swift.
Sounds good! So let me know when you get to an estimate, you can also reach me via Slack to discuss in more detail
from parse-swift.
Sounds good! So let me know when you get to an estimate, you can also reach me via Slack to discuss in more detail
How do I reach you on Slack?
from parse-swift.
I am willing to contribute $250 towards the bounty I just need to know how.
from parse-swift.
I'm still working on it. If finished I'll see what's willing to give as reward.
But definitely working on it now.
Will take some time tho since I have a full-time job and some side projects.
from parse-swift.
@hajjD Thanks for your contribution! I increased the bounty amount as requested.
from parse-swift.
@hajjD Could you test this branch?
from parse-swift.
Will do, thank you!
from parse-swift.
I finally had sometime for in depth testing. There appears to be two major issues:
- While offline if I create any data it will be lost if I close the app before reconnecting.
- For the life of me I cant get offline fetching to work. Ill try again tomorrow, as I feel I am missing something.
Another potential issue is when saving etc it will error out if offline, when ideally it should still count as a save if it gets locally stored. This will prevent a bunch of extra boilerplate code to check if online or not.
All in all we are almost there, thank you to everyone involved.
from parse-swift.
- While offline if I create any data it will be lost if I close the app before reconnecting.
First of all, did you enable custom objectId? (Also make sure that you set an objectId
on initialize of your ParseObject
)
Also make sure you set offlinePolicy
to .create
.
- For the life of me I cant get offline fetching to work. Ill try again tomorrow, as I feel I am missing something.
Do I understand it correctly that nothing is working?
Another potential issue is when saving etc it will error out if offline, when ideally it should still count as a save if it gets locally stored. This will prevent a bunch of extra boilerplate code to check if online or not.
That's true. I'll check it and see why it's throwing the issue if not connected to the internet.
All in all we are almost there, thank you to everyone involved.
Glad I can help.
If you have some code you can show me, it would be helpful for me to see how you set everything up.
It might be possible I forgot something in the Playground example.
I'm also wondering if you are calling fetchLocal on your ParseObject.
Since this will manage fetching.
I'm pretty sure I forgot to mention this in the Playground examples.
I'll check it out when I have some time.
from parse-swift.
Do I understand it correctly that nothing is working?
No, so right now if I save an object and reconnect to the internet it will sync it up as long as the app doesn't close.
I'm also wondering if you are calling fetchLocal on your ParseObject.
I am not, ill get back to you on this as today I also have extra time
from parse-swift.
I attempted to use fetchLocal (I could be way off here) as such
Here is the struct
struct TimelineEntry: ParseObject {
// Required for Parse (Protocol)
var originalData: Data?
var objectId: String? = UUID().uuidString
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseSwift.ParseACL?
// Our own custom variables
var date: Date?
var iconName: String?
var title: String?
var subtitle: String?
var additionalDetails: String?
}
Then saving the data
var newTimelineEntry = TimelineEntry()
newTimeLineEntry.title = "test"
try await newTimelineEntry.save()
Then loading the data
let test = try await TimelineEntry.fetchLocalStore(TimelineEntry.self)
print(test)
Unfortunately it is returning nil when trying to fetch via localStore
from parse-swift.
- While offline if I create any data it will be lost if I close the app before reconnecting.
First of all, did you enable custom objectId? (Also make sure that you set an
objectId
on initialize of yourParseObject
) Also make sure you setofflinePolicy
to.create
.
Forgot to answer this, yes my config has the following:
offlinePolicy: .create,
requiringCustomObjectIds: true)
from parse-swift.
Then saving the data
var newTimelineEntry = TimelineEntry() newTimeLineEntry.title = "test" try await newTimelineEntry.save()
This is fine.
Then loading the data
let test = try await TimelineEntry.fetchLocalStore(TimelineEntry.self) print(test)
Unfortunately it is returning nil when trying to fetch via localStore
I need to point out some things. Getting your objects should still be the same function as you always did.
You will need to make your query and then use .find()
to get your object.
I made sure this wouldn't change.
Only thing you need to set is ".useLocalStore()
".
Here is an example from the Playground:
let afterDate = Date().addingTimeInterval(-300)
var query = GameScore.query("points" > 50,
"createdAt" > afterDate)
.useLocalStore()
.order([.descending("points")])
let results = try await query.find()
let test = try await TimelineEntry.fetchLocalStore(TimelineEntry.self) print(test)
You have set this up correctly, but for now, you will need to set this on your init() or something. This way you can test if everything is working. This is just a manual way of fetching your local objects. I'll try to add this functionality standard on appLaunch and maybe when internet reconnects.
Also, if you look at the description, it states that this will only return results if your objects on the database was more recent then the local. This way you can choose what you do with it.
Generally you won't need the result since it handles it for you.
from parse-swift.
How's this issue coming? Can I help?
from parse-swift.
How's this issue coming? Can I help?
I was waiting for his answer, but you could help by testing and providing me some feedback.
from parse-swift.
@vdkdamian I would be happy to help you test this, and help support finishing this feature if needed. @mtrezza Also happy to contribute to the Bounty. Where can I slack you?
from parse-swift.
Hey @gregyoung14 you can join our Slack at https://chat.parseplatform.org. Maybe you could also take a look at @vdkdamian's previous comment, test this PR and provide feedback, to get the PR rolling.
from parse-swift.
Related Issues (20)
- Remove duplicate docs HOT 4
- Allow implementations of ParseObjects to set their own className HOT 7
- Allow implementations of ParseObjects to set their own className HOT 4
- Nested ParseFile saves invalid data HOT 1
- Auto-reuse existing installation object when migrating from ObjC SDK HOT 7
- Delete installation is impossible HOT 7
- Parse.User save not dispatching back to callback queue when result is success HOT 5
- 📣 Contributors wanted! HOT 1
- Parse Analytics - Track App Opened HOT 1
- ParseConfig throwing Codable errors when type `Object` exists in Config. HOT 1
- Unable to parse the exact error from ParseError HOT 1
- Fatal error: Duplicate elements of type 'ParseFile' were found in a Set. This usually means either that the type violates Hashable's requirements, or that members of such a set were mutated after insertion HOT 1
- Does not support automatic/anonymous user HOT 1
- When is the next release? HOT 2
- Crash: Installation.current setter not thread safe HOT 1
- Request: Make backingStore optional rather than force unwrapped HOT 2
- PFFacebookUtils' has no member 'initializeFacebookWithLaunchOptions HOT 1
- Count return 0 HOT 1
- Does not build against visionOS target HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parse-swift.