message: Use alpha features instead of beta flags (lib)
diff: @@ -4882,7 +4882,7 @@ void Context::syncerActivityWrapper() {
  HTTPRequest req;
  req.host = urls::API();
  - req.relative_url = "/api/v9/me/flags";
  + req.relative_url = "/api/v9/me/preferences";
  req.basic_auth_username = api_token;
  req.basic_auth_password = "api_token";
  @@ -4892,7 +4892,7 @@ void Context::syncerActivityWrapper() {
  if (resp.err == noError) {
  // if the server doesn't respond OK to this request, fall back to the legacy sync protocol
  if (resp.status_code != 200) {
  - logger.log("Syncer - Server didn't respond 200 to /me/flags, fallback to LEGACY");
  + logger.log("Syncer - Server didn't respond 200 to /me/preferences, fallback to LEGACY");
  state = LEGACY;
  }
  else { // is OK - 200
  @@ -4900,24 +4900,37 @@ void Context::syncerActivityWrapper() {
  Json::Value root;
  Json::Reader reader;
  if (!reader.parse(resp.body, root)) {
  - logger.log("Syncer - /me/flags response couldn't be parsed as JSON, fallback to LEGACY");
  + logger.log("Syncer - /me/preferences response couldn't be parsed as JSON, fallback to LEGACY");
  state = LEGACY;
  }
  else {
  + if (root.isMember("alpha_features")) {
  + state = LEGACY;
  + for (auto i : root["alpha_features"]) {
  + if (i.isMember("code")) {
  // there was a typo in the initial set of flags, use both variants to be sure
  - if (root[kSyncStrategyLegacy1].isBool() && root[kSyncStrategyLegacy1].asBool())
  + if (i["code"] == kSyncStrategyLegacy1 && i["enabled"].asBool()) {
  state = BATCHED;
  - else if (root[kSyncStrategyLegacy2].isBool() && root[kSyncStrategyLegacy2].asBool())
  + break;
  + }
  + if (i["code"] == kSyncStrategyLegacy2 && i["enabled"].asBool()) {
  state = BATCHED;
  - else
  - state = LEGACY;
  + break;
  + }
  + }
  + }
  logger.log("Syncer - Syncing protocol was selected: ", (state == BATCHED ? "BATCHED" : "LEGACY"));
  }
  + else {
  + logger.log("Syncer - /me/preferences response didn't contain alpha_features, fallback to LEGACY");
  + state = LEGACY;
  + }
  + }
  }
  }
  // it is a HTTP error in disguise which means the server is alive, fallback to LEGACY
  else if (resp.err == HTTPClient::StatusCodeToError(resp.status_code)) {
  - logger.log("Syncer - Server didn't respond 200 to /me/flags, fallback to LEGACY");
  + logger.log("Syncer - Server didn't respond 200 to /me/preferences, fallback to LEGACY");
  state = LEGACY;
  }
  break;
  