void delta_text_layer_update(TextLayer *text_layer, DataMessage *data) {
  static char delta_buffer[8];
  int delta;
  if (graph_staleness_padding() > 0) {
    delta = NO_DELTA_VALUE;
  } else {
    delta = data->delta;
  }

  if (delta == NO_DELTA_VALUE) {
    text_layer_set_text(text_layer, "-");
  } else {
    format_bg(delta_buffer, sizeof(delta_buffer), delta, true, get_prefs()->mmol);
    text_layer_set_text(text_layer, delta_buffer);
  }
}
void trend_arrow_component_update(TrendArrowComponent *c, DictionaryIterator *data) {
  if (graph_staleness_padding() > 0) {
    c->last_trend = -1;
    layer_set_hidden(bitmap_layer_get_layer(c->icon_layer), true);
    return;
  }

  int trend = dict_find(data, APP_KEY_TREND)->value->int32;
  if (trend == c->last_trend) {
    return;
  }
  c->last_trend = trend;

  if (TREND_ICONS[trend] == NO_ICON) {
    layer_set_hidden(bitmap_layer_get_layer(c->icon_layer), true);
  } else {
    layer_set_hidden(bitmap_layer_get_layer(c->icon_layer), false);
    if (c->icon_bitmap != NULL) {
      gbitmap_destroy(c->icon_bitmap);
    }
    c->icon_bitmap = gbitmap_create_with_resource(TREND_ICONS[trend]);
    bitmap_layer_set_bitmap(c->icon_layer, c->icon_bitmap);
  }
}