-
Notifications
You must be signed in to change notification settings - Fork 6
View Layer Requirements from Client Model
The following API / functionality is envisioned to be provided by an async service layer (probably either one, two or three service API's). The view would access the data through the service which would place the needed requests to the model (whether that goes local or over the network). Upon receiving the data the service would be able of translating any information from the model into a format that is easily consumed by the view layer. For instance converting image or video URL's to bitmaps or video streams (as an example).
Note : Some API requirements have been marked as optional as we may decide to not support the associated feature. Unless otherwise indicated current assumptions are that this list of requirements is what the view will require to have available for consumption.
GetAllOfflineStories() : Collection
- Fetches all stories from the local cache and returns a list of references to them. Not expected to fail.
GetAllOnlineStories() : Collection
- Fetches all stories from the remote server. Expected to fail if network error.
GetFragment(identifier, story) : StoryFragment
- Fetches a fragment for a particular story. Expected to fail if network error.
GetBookmarks() : Collection
- Fetches the users local collection of bookmarks. Not expected to fail.
CreateBookmark(story, fragment) : Bookmark
- Creates a new bookmark at the current point in the story and stores it for later retrieval. Bookmark is expected to be persistent across user sessions. It is assumed that this method will implicitly save the bookmark to local storage. In the event there is an existing bookmark for this story the operation can either fail or overwrite the old bookmark. There must never be more than 1 bookmark associated with a particular story.
SaveBookmark(bookmark) : void
- Takes an edited bookmark and saves it to local storage.
DeleteBookmark(bookmark) : void optional
- Deletes an existing bookmark.
CreateNewStory() : Story
- Creates a new story and a head fragment. The story will have empty values for content but author and date will be filled out automatically.
- Assumes that this new story is automatically saved to local storage.
CreateFragment(story) : StoryFragment
- Creates an empty and fragment with no choices and no fragments that reference it. It is however linked to the story that is provided.
SaveEditedStory(story) : void optional
- Saves the story to local storage. Also iterates over all fragments automatically.
SaveEditedFragment(storyFragment)
- Saves the fragment to local storage.
DeleteStory(story) : void optional
- Deletes the provided story from the local cache. DOESN'T DELETE FROM ONLINE IF STORY WAS ALREADY PUBLISHED!
DeleteFragment(fragment) : void
- Deletes a fragment, removes it from its story and ensure that no other fragments reference it. In the event there are other fragments that reference it those references should be removed from those fragments.
PublishStory(story) : void
- Publish the provided story to the server. Expected to fail in event of network error.
AddResource(url, fragment) : void
- Add an image or video to a fragment. AddResource(url, story) : void optional
- Add an image or video to the story. Create