Esri / data-collection-ios

Mobile data collection app using the iOS Runtime SDK.
https://developers.arcgis.com/
Apache License 2.0
25 stars 26 forks source link

Introduces RichPopup and reorganizes project accordingly. #160

Closed esreli closed 5 years ago

esreli commented 5 years ago

This is a fairly lofty PR and I hope you're not daunted by it. My suggestion would be to evaluate various components that I identify here, as a whole rather than [files changed diff lines].

Broadly speaking, this PR sets out to formally delineate pop-up reading from editing.

I've introduced RichPopup, which contains a single property, relationships, an instance of Relationships, a data structure that handles loading (via AGSLoadable) and organizing related records.

Now, an instance of RichPopup can load relationships:

richPopup.relationships!.load({})

and check load status of relationships:

richPopup.relationships?.loadStatus

A Relationships (note the plural form) object maintains collections of related records. A Relationship (note the singular form) object represents a single relationship between two feature tables and is loaded via AGSLoadable. A Relationship is not intended to be used directly but instead to be subclassed, which the app does via OneToManyRelationship and ManyToOneRelationship. More relationship types can be added down the line, easily (such as one-to-one and many-to-one).

A Relationship subclass is a loadable model of related records for a specific relationship between and places the onus of actually relating the records into the RichPopupManager (née PopupRelatedRecordsManager).

This challenge opened up a series of app-wide changes, particularly in MapViewController and in RichPopupViewController (née PopupRelatedRecordsViewController) inspiring some cleanup up of this view controller as a whole.

I've also identified a number of other areas for improvement along the way, including a more clear and unified approach to AppErrors.

esreli commented 5 years ago

@philium i've made some changes re: your review.