Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Flexible settings UI with AWS Cognito

Flexible settings UI with AWS Cognito

Roppongi.aar#3にて

y_matsuwitter

July 14, 2016
Tweet

More Decks by y_matsuwitter

Other Decks in Programming

Transcript

  1. 2 ©Gunosy Inc. About me n  Gunosy Inc. –  Development

    div. Corporate Officer n  Responsible for… –  Developing new projects and teams –  Golang evangelist at Gunosy n  Skills –  iOS / Android –  Web –  Infrastructure (only for AWS) –  Performance tuning –  ISUCON Matsumoto Yuki @y_matsuwitter
  2. 3 ©Gunosy Inc. Todayʼs agenda n  Common settings UI pattern

    n  About AWS Cognito SDK n  Letʼs build a flexible settings UI Building flexible settings UIs with AWS Cognito
  3. 4 ©Gunosy Inc. Common settings UI pattern Sometimes, weʼd like

    to change items without an app update. n  We use… –  PreferenceFragment with XML Custom views –  … or WebView? n  ”Hard-coded” settings items –  Canʼt change items without updating the application n  Fragmentation of settings –  Settings items differ for each released version We always code settings items in our applications.
  4. 5 ©Gunosy Inc. About AWS Cognito SDK Cognito Sync can

    be used to store settings items n  Cognito is used for –  Authentication –  Authorization for AWS services –  Storing and syncing data across devices n  Cognito Sync –  Key-value style storage. –  Sync across all devices for a given user account n  Can access data from servers via API. “Add user sign-up, sign-in, and data synchronization to your apps.” Amazon Cognito with SDK Mobile Client Authen'ca'on Store data Authorize users Access AWS with authen'cated user
  5. 6 ©Gunosy Inc. Flexible settings UI with AWS Cognito SDK.

    n  Settings template includes –  Settings item types –  Settings item default value –  Template version Combine Cognito sync with settings template data
  6. 7 ©Gunosy Inc. Preference fragment with settings templates and Cognito

    1.  Fetch Cognito sync datasets and settings template value from API using “combineLatest” 2.  If the template settings items donʼt match the Cognito dataset structure, the template will fill in the unset items in Cognito dataset with default values. 3.  Store the data in Cognito sync, then synchronize. 4.  Show setting items and their values by creating a PreferenceFragment programmatically Use PreferenceFragment for showing setting items
  7. 9 ©Gunosy Inc. Data flow of settings items We send

    this Cognito sync data to our database via event hooks. n  When a user changes settings, –  Put new settings items into Cognito –  Synchronize Cognito datasets n  Event hooks for data management –  Send settings value to database if the dataset changes n  Can change the template value any time we want –  Add new columns –  Remove unused items Can sync and manage settings items using Cognito sync Amazon Cognito Android App Event hook Synchronize Database
  8. 10 ©Gunosy Inc. Wrapup n  Common settings view –  “Hard-coded”

    settings items in an application n  AWS Cognito –  Provides authentication, authorization, and key-value store –  Can be used for setting values storage n  Settings UI with Cognito Sync –  Combine settings items template with Cognito Sync dataset –  Show dataset items with PreferenceFragment programmatically l  We can change settings itemsʼ structure at any time. Flexible settings UI helps your application grow faster!