issues
search
AmericanWhitewater
/
aw-ios
American Whitewater's iOS app
5
stars
2
forks
source link
Refactor API layer, add missing models, etc.
#258
Closed
yeahphil
closed
2 years ago
yeahphil
commented
2 years ago
Make an API group/dir and move API related files to it
Mark all funcs in AWApiReachHelper public/private
Delete AWApiArticleHelper, which had been replaced with graphql calls
Add an API singleton, with funcs to proxy all public reach calls to AWApiReachHelper
Use API to make reach API calls
Remove AWApiLinks.swift (url globals), API passes down URLs to its helper
Whoops, API/AWApiReachHelper.fetchReachesByRegion had no callers
Change API funcs from callback/callbackError handlers to a completion handler with an optional Error
Rename a couple API funcs
Move GraphQL stuff into API group
API.updateReaches takes Int16 ids and stringifies them
API.updateReachDetail takes an Int16 id
Add proxies for all the public funcs in AWGQLApiHelper
Take away AWGWLApiHelper.shared and run its calls through API
Run AWGQLArticleApiHelper through API
Change Reach.id from Int16 to Int
Rename API graphql-based calls a little and change id's passed as String to Int
Whoops, fix a refactoring mistake: dropped a bunch of params from postPhoto()
Refactor getAccidentsForReach() and the stuff that uses it
Change AWGQLApiHelper's error callback type from (Error?, String?) to (Error)
Delete GQLError, now unused
Refactor API.getAlertsForReach() and the stuff that uses it
Update API.postAlert and add alert controller to use Alert type
Update API.getGaugeObservations, adding GaugeObservation type and refactoring as needed
Convert API.postGaugeObservation to completion style callback
Add a Photo model. Refactor API.getPhotos to use a completion callback returning [Photo]
Now that there's a Photo model, have GaugeObservation use it for its photos
Refactor API.postPhoto, returning a Photo or Error
Small cleanup: unnest an if-let by changing to guard
Move a surprise API call (get gauge graph) that was made from a view controller into API
Create a type GaugeDataPoint and use it to represent gauge data
GaugeDataPoint: change updated (a Double) to date (a Date)
Clarify that some model classes are only used internally by AWApiReachHelper
Delete Article, unused
More model file cleanup
API.getGauges cleanup
Convert API.getMetrics to return [Metric] instead of [String: String]
Remove many print statements from AWGQLApiHelper, formatting and some error handling cleanup
Reach API: extract managedObjectContext and main context merging rather than repeating in every method
Remove DispatchGroup stuff from AWApiReachHelper, extract private context creation to a private func
Add a ReachUpdater wrapper around API reach methods and call it when reach updates need to be made
Remove updateAllReachDistances() from API, AWApiReachHelper and move to ReachUpdater
Move persistence bits for ReachUpdater.updateReaches(regionCodes:) into ReachUpdater
Move persistence for updateReaches(reachIds:completion:) into ReachUpdater
Remove ReachUpdater.updateAllReaches(...), equivalent to updateReaches(regionCodes: Region.all.map { $0.code })
Move persistence stuff for updateReachDetail into ReachUpdater
Remove AWApiReachHelper dependency on CoreData
Move persistence-related parts of AWGQLArticleApiHelper into an ArticleUpdater
Update API
Fixes and improvements to AddRiverFlowTableViewController
Oops -- I was mistaken, this works fine (river flows cell types)
Oops -- I changed the condition for making a network call in RunsListViewController, change back