FoxiGram/TMessagesProj/jni/voip/webrtc/base/util/values/values_util.cc
instant992 8e79f2ee9c FoxiGram: Telegram client with built-in Xray VLESS proxy
Based on Nekogram. Key additions:
- Rebrand to FoxiGram (app name, APK name, applicationId com.foxigram.app)
- Embedded Xray (VLESS+Reality) proxy client via JNI libxray.so
- Bundled hidden one-tap proxies (LTE + WiFi), read-only in UI
- Auto-restore proxy on restart, rebind to active network (LTE/WiFi)
- Server credentials externalized to git-ignored XrayServers.java (+ template)
- libxray Go source included; compiled .so, keystore, google-services.json ignored
2026-06-08 16:41:07 +04:00

60 lines
1.7 KiB
C++

// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/util/values/values_util.h"
#include "base/strings/string_number_conversions.h"
namespace util {
base::Value Int64ToValue(int64_t integer) {
return base::Value(base::NumberToString(integer));
}
base::Optional<int64_t> ValueToInt64(const base::Value* value) {
return value ? ValueToInt64(*value) : base::nullopt;
}
base::Optional<int64_t> ValueToInt64(const base::Value& value) {
if (!value.is_string())
return base::nullopt;
int64_t integer;
if (!base::StringToInt64(value.GetString(), &integer))
return base::nullopt;
return integer;
}
base::Value TimeDeltaToValue(base::TimeDelta time_delta) {
return Int64ToValue(time_delta.InMicroseconds());
}
base::Optional<base::TimeDelta> ValueToTimeDelta(const base::Value* value) {
return value ? ValueToTimeDelta(*value) : base::nullopt;
}
base::Optional<base::TimeDelta> ValueToTimeDelta(const base::Value& value) {
base::Optional<int64_t> integer = ValueToInt64(value);
if (!integer)
return base::nullopt;
return base::TimeDelta::FromMicroseconds(*integer);
}
base::Value TimeToValue(base::Time time) {
return TimeDeltaToValue(time.ToDeltaSinceWindowsEpoch());
}
base::Optional<base::Time> ValueToTime(const base::Value* value) {
return value ? ValueToTime(*value) : base::nullopt;
}
base::Optional<base::Time> ValueToTime(const base::Value& value) {
base::Optional<base::TimeDelta> time_delta = ValueToTimeDelta(value);
if (!time_delta)
return base::nullopt;
return base::Time::FromDeltaSinceWindowsEpoch(*time_delta);
}
} // namespace util