-
Notifications
You must be signed in to change notification settings - Fork 4
Using readmill provided ui
hwaxxer edited this page Nov 14, 2011
·
11 revisions
For the simplest integration with Readmill for an eBook reader style of application, the Readmill SDK provides its own UI to allow users of your application to link their books to Readmill’s service.
- Figure 1: An example of the Readmill SDK’s book linking UI.
- Figure 2: An example of the Readmill SDK’s book view reading UI.
- If the user has logged into Readmill through your application before, create a
ReadmillUser
object from saved credentials. - If the user hasn’t logged into Readmill through your application before, allow the user to log in through the Readmill website and create a
ReadmillUser
object from the returned authorisation information.
- Create the
ReadmillConnectBookUI
with-initWithUser:ISBN:title:author:
. Bring up a dialog where the user can connect the book to the Readmill service by instantiating aReadmillUIPresenter
with theReadmillConnectBookUI
as contentViewController and calling-presentInViewController:animated:
. - If the user connected their book to their Readmill account, the
ReadmillConnectBookUI
class will provide theReadmillReading
object through its delegate method-connect:didSucceedToLinkToBook:withReading:
, which represents the user’s overall interaction with the book. Use the-createReadSession
method on this object to create a newReadmillReadingSession
object, which represents this specific reading session.
- Periodically call the
-pingWithProgress:pingDuration:delegate:
method on yourReadmillReadingSession
object, where progress is percentage as a float (0-1), and pingDuration is the interval (in seconds) which with you are pinging (300s is the recommended interval). This informs Readmill in real-time that the user is reading the book and of the progress they are making.
- There’s nothing further to do. When you stop calling
-pingWithProgress:
, Readmill will automatically do the right thing and understand that the user isn’t reading any more.
- Use the
ReadmillViewReadingUI
class in combination with theReadmillUIPresenter
class to present a Readmill user interface to the user to allow them to mark their book as finished in their Readmill account and optionally set a closing remark — a mini-review, if you will.
The sample iPad application provided with the SDK goes through this entire workflow, including saving login credentials and authenticating with the Readmill website. To get started, check it out — the Xcode project provides everything you need to integrate with Readmill, and all the class headers in the Readmill SDK are documented if you need more help.