OneBusAway / onebusaway-ios

OneBusAway for iOS, written in Swift.
Other
82 stars 33 forks source link

GRDB for REST models #686

Closed ualch9 closed 11 months ago

ualch9 commented 11 months ago

This is the previous PR (#684), but targeting feature branch ualch9/persistence and without MetaCodable. GRDB's Codable support was fighting with the code generated by MetaCodable, so I decided to drop it.

Each model defines their own tables, via protocol DatabaseTableCreator.createTable(in:) that is called by PersistenceManager when initially creating the database.

When storing on-disk, each database is stored per-region: {app_container}/Application Support/regions/{region_id}/onebusaway.sqlite

Screenshot 2023-10-26 at 12 12 26 PM

Undecided:

aaronbrethorst commented 11 months ago

What should be persisted (stops only? or everything?). As a first release, the database could operate only in-memory. Need to include some sort of expiration date. AFAIK, API responses do not include an expires header.

Only in memory sounds like a great first step. That'll help us deal with this problem you outline in point 2 (above).

How should bookmarks be stored so they can sync via iCloud.

Let's defer this just for a little bit. I think getting Sqlite up and running in a way we're comfortable with supporting is enough of a bite at this apple for now.

Objective-C support? Is this important enough that we should write wrappers for the new models?

I don't think so, no. I think we can effectively ignore Obj-C from here on out.

ualch9 commented 11 months ago

I think this is ready for review:

Need to do next: