void received_config(DictionaryIterator *received)
{
	uint8_t* data = dict_find(received, 1)->value->data;

	uint16_t supportedVersion = (data[8] << 8) | (data[9]);
	if (supportedVersion > PROTOCOL_VERSION)
	{
		show_old_watchapp();
		return;
	}
	else if (supportedVersion < PROTOCOL_VERSION)
	{
		show_old_android();
		return;
	}

	config_titleFont = data[0];
	config_subtitleFont = data[1];
	config_bodyFont = data[2];
	config_timeout = (data[3] << 8) | (data[4]);
	config_dontClose = (data[7] & 0x02) != 0;
	config_showActive = (data[7] & 0x04) != 0;
	config_lightScreen = (data[7] & 0x10) != 0;
	config_dontVibrateWhenCharging = (data[7] & 0x20) != 0;
	config_disableNotifications = (data[7] & 0x80) != 0;

	config_shakeAction = data[10];
	config_periodicTimeout  = (data[11] << 8) | (data[12]);

	bool newInvertColors = (data[7] & 0x40) != 0;
	if (newInvertColors != config_invertColors)
	{
		persist_write_bool(0, newInvertColors);
		config_invertColors = newInvertColors;
	}

	gotConfig = true;
	loadingMode = false;

	bool notificationWaiting = (data[7] & 0x08) != 0;
	if (notificationWaiting)
	{
		app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);

		DictionaryIterator *iterator;
		app_message_outbox_begin(&iterator);
		dict_write_uint8(iterator, 0, 10);
		app_message_outbox_send();
	}
	else
	{
		show_menu();
	}

}
void received_config(DictionaryIterator *received)
{
	uint8_t* data = dict_find(received, 1)->value->data;

	uint16_t supportedVersion = (data[8] << 8) | (data[9]);
	if (supportedVersion > WATCHAPP_VERSION)
	{
		show_old_watchapp();
		return;
	}
	else if (supportedVersion < WATCHAPP_VERSION)
	{
		show_old_android();
		return;
	}

	config_titleFont = data[0];
	config_subtitleFont = data[1];
	config_bodyFont = data[2];
	config_timeout = (data[3] << 8) | (data[4]);
	config_vibratePeriodically = data[5];
	config_vibrateMode = data[6];
	config_autoSwitchNotifications = (data[7] & 0x01) != 0;
	config_dontClose = (data[7] & 0x02) != 0;
	config_showActive = (data[7] & 0x04) != 0;
	config_lightScreen = (data[7] & 0x10) != 0;
	config_dontVibrateWhenCharging = (data[7] & 0x20) != 0;
	config_dontVibrateWhenCharging = (data[7] & 0x20) != 0;
	config_shakeAction = data[10];

	gotConfig = true;

	bool notificationWaiting = (data[7] & 0x08) != 0;
	if (notificationWaiting || !config_showActive)
	{
		DictionaryIterator *iterator;
		app_message_outbox_begin(&iterator);
		dict_write_uint8(iterator, 0, 10);
		app_message_outbox_send();

		app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
		app_comm_set_sniff_interval(SNIFF_INTERVAL_NORMAL);
	}
	else
	{
		show_menu();
	}

}