Calendar API - uoftblueprint/the-period-purse-ios GitHub Wiki

Month View

GETYearData

  • Makes API request to AsyncStorage to access symptoms for the entire year
  • It calls getItem with the year as the key.
  • It will check the length of the stored array for each month to verify validity of each one. It will do so by verifying that the number of elements (representing days) in each month has a size of 28-31.

Signature

static GETYearData(year: int): Promise

Returns

  • Promise resolving when operation finishes. Contains a dict of month objects for the year. If the year is not yet stored, return an empty dict.

Filtering by Symptoms

Just use GETYearData and store in local variable (Should have info for whole year loaded in local memory, so we don’t need to re-query Async Storage whenever scrolling)

Store lists for each symptom on startup (cache it), and when SelectedView is changed, switch to corresponding list.

POSTMostRecentCalendarState

  • Saves user's current selected filter, selected month, and selected year, to preserve the thing they are looking at. Meant to be used when user exits calendar page in any way.
  • Call multiSet on keys "selectedFilter", "selectedMonth" and "selectedYear", with values of selectedFilter, selectedMonth, selectedYear.
  • returns a promise resolving when multiSet is done.

Signature

static POSTMostRecentCalendarState(selectedView: string, selectedMonth: integer, selectedYear: integer): Promise

GETMostRecentCalendarState

  • Retrieves user's previous selected filter, selected month, and selected year, to preserve the thing they are looking at. Meant to be used when user returns to the calendar page in any way.
  • Calls multiGet(["selectedFilter", "selectedMonth", "selectedYear"]).
  • returns dictionary of form {"selectedFilter": selectedFilter, "selectedMonth": selectedMonth, "selectedYear": selectedYear}

Signature

static GETMostRecentCalendarState(): dict