|
12 | 12 | // See the License for the specific language governing permissions and
|
13 | 13 | // limitations under the License.
|
14 | 14 |
|
| 15 | +#include "remote_config/src/android/remote_config_android.h" |
| 16 | + |
15 | 17 | #include <assert.h>
|
16 | 18 |
|
17 | 19 | #include <set>
|
|
23 | 25 | #include "app/src/util.h"
|
24 | 26 | #include "app/src/util_android.h"
|
25 | 27 | #include "remote_config/src/common.h"
|
26 |
| -#include "remote_config/src/include/firebase/remote_config.h" |
27 | 28 |
|
28 | 29 | namespace firebase {
|
29 | 30 | namespace remote_config {
|
@@ -757,5 +758,155 @@ const ConfigInfo& GetInfo() {
|
757 | 758 | return config_info;
|
758 | 759 | }
|
759 | 760 |
|
| 761 | +namespace internal { |
| 762 | +RemoteConfigInternal::RemoteConfigInternal(const firebase::App& app) |
| 763 | + : app_(app), future_impl_(kRemoteConfigFnCount) { |
| 764 | + LogInfo("%s API Initialized", kApiIdentifier); |
| 765 | +} |
| 766 | + |
| 767 | +RemoteConfigInternal::~RemoteConfigInternal() { |
| 768 | + // TODO(cynthiajiang) android clean up |
| 769 | +} |
| 770 | + |
| 771 | +bool RemoteConfigInternal::Initialized() const{ |
| 772 | + // TODO(cynthiajiang) implement |
| 773 | + return true; |
| 774 | +} |
| 775 | + |
| 776 | +void RemoteConfigInternal::Cleanup() { |
| 777 | + // TODO(cynthiajiang) implement |
| 778 | +} |
| 779 | + |
| 780 | +Future<ConfigInfo> RemoteConfigInternal::EnsureInitialized() { |
| 781 | + const auto handle = |
| 782 | + future_impl_.SafeAlloc<ConfigInfo>(kRemoteConfigFnEnsureInitialized); |
| 783 | + // TODO(cynthiajiang) implement |
| 784 | + return MakeFuture<ConfigInfo>(&future_impl_, handle); |
| 785 | +} |
| 786 | + |
| 787 | +Future<ConfigInfo> RemoteConfigInternal::EnsureInitializedLastResult() { |
| 788 | + return static_cast<const Future<ConfigInfo>&>( |
| 789 | + future_impl_.LastResult(kRemoteConfigFnEnsureInitialized)); |
| 790 | +} |
| 791 | + |
| 792 | +Future<bool> RemoteConfigInternal::Activate() { |
| 793 | + const auto handle = future_impl_.SafeAlloc<bool>(kRemoteConfigFnActivate); |
| 794 | + // TODO(cynthiajiang) implement |
| 795 | + return MakeFuture<bool>(&future_impl_, handle); |
| 796 | +} |
| 797 | + |
| 798 | +Future<bool> RemoteConfigInternal::ActivateLastResult() { |
| 799 | + return static_cast<const Future<bool>&>( |
| 800 | + future_impl_.LastResult(kRemoteConfigFnActivate)); |
| 801 | +} |
| 802 | + |
| 803 | +Future<bool> RemoteConfigInternal::FetchAndActivate() { |
| 804 | + const auto handle = |
| 805 | + future_impl_.SafeAlloc<bool>(kRemoteConfigFnFetchAndActivate); |
| 806 | + // TODO(cynthiajiang) implement |
| 807 | + return MakeFuture<bool>(&future_impl_, handle); |
| 808 | +} |
| 809 | + |
| 810 | +Future<bool> RemoteConfigInternal::FetchAndActivateLastResult() { |
| 811 | + return static_cast<const Future<bool>&>( |
| 812 | + future_impl_.LastResult(kRemoteConfigFnFetchAndActivate)); |
| 813 | +} |
| 814 | + |
| 815 | +Future<void> RemoteConfigInternal::Fetch(uint64_t cache_expiration_in_seconds) { |
| 816 | + const auto handle = future_impl_.SafeAlloc<void>(kRemoteConfigFnFetch); |
| 817 | + // TODO(cynthiajiang) implement |
| 818 | + return MakeFuture<void>(&future_impl_, handle); |
| 819 | +} |
| 820 | + |
| 821 | +Future<void> RemoteConfigInternal::FetchLastResult() { |
| 822 | + return static_cast<const Future<void>&>( |
| 823 | + future_impl_.LastResult(kRemoteConfigFnFetch)); |
| 824 | +} |
| 825 | + |
| 826 | +Future<void> RemoteConfigInternal::SetDefaults(int defaults_resource_id) { |
| 827 | + const auto handle = future_impl_.SafeAlloc<void>(kRemoteConfigFnSetDefaults); |
| 828 | + // TODO(cynthiajiang) implement |
| 829 | + return MakeFuture<void>(&future_impl_, handle); |
| 830 | +} |
| 831 | + |
| 832 | +Future<void> RemoteConfigInternal::SetDefaults( |
| 833 | + const ConfigKeyValueVariant* defaults, size_t number_of_defaults) { |
| 834 | + const auto handle = future_impl_.SafeAlloc<void>(kRemoteConfigFnSetDefaults); |
| 835 | + // TODO(cynthiajiang) implement |
| 836 | + return MakeFuture<void>(&future_impl_, handle); |
| 837 | +} |
| 838 | + |
| 839 | +Future<void> RemoteConfigInternal::SetDefaults(const ConfigKeyValue* defaults, |
| 840 | + size_t number_of_defaults) { |
| 841 | + const auto handle = future_impl_.SafeAlloc<void>(kRemoteConfigFnSetDefaults); |
| 842 | + // TODO(cynthiajiang) implement |
| 843 | + return MakeFuture<void>(&future_impl_, handle); |
| 844 | +} |
| 845 | + |
| 846 | +Future<void> RemoteConfigInternal::SetDefaultsLastResult() { |
| 847 | + return static_cast<const Future<void>&>( |
| 848 | + future_impl_.LastResult(kRemoteConfigFnSetDefaults)); |
| 849 | +} |
| 850 | + |
| 851 | +#ifdef FIREBASE_EARLY_ACCESS_PREVIEW |
| 852 | +Future<void> RemoteConfigInternal::SetConfigSettings(ConfigSettings settings) { |
| 853 | + const auto handle = |
| 854 | + future_impl_.SafeAlloc<void>(kRemoteConfigFnSetConfigSettings); |
| 855 | + // TODO(cynthiajiang) implement |
| 856 | + return MakeFuture<void>(&future_impl_, handle); |
| 857 | +} |
| 858 | +#endif // FIREBASE_EARLY_ACCESS_PREVIEW |
| 859 | + |
| 860 | +Future<void> RemoteConfigInternal::SetConfigSettingsLastResult() { |
| 861 | + return static_cast<const Future<void>&>( |
| 862 | + future_impl_.LastResult(kRemoteConfigFnSetConfigSettings)); |
| 863 | +} |
| 864 | + |
| 865 | +bool RemoteConfigInternal::GetBoolean(const char* key, ValueInfo* info) { |
| 866 | + // TODO(cynthiajiang) implement |
| 867 | + return true; |
| 868 | +} |
| 869 | + |
| 870 | +int64_t RemoteConfigInternal::GetLong(const char* key, ValueInfo* info) { |
| 871 | + // TODO(cynthiajiang) implement |
| 872 | + return 0; |
| 873 | +} |
| 874 | + |
| 875 | +double RemoteConfigInternal::GetDouble(const char* key, ValueInfo* info) { |
| 876 | + // TODO(cynthiajiang) implement |
| 877 | + return 0.0f; |
| 878 | +} |
| 879 | + |
| 880 | +std::string RemoteConfigInternal::GetString(const char* key, ValueInfo* info) { |
| 881 | + // TODO(cynthiajiang) implement |
| 882 | + return ""; |
| 883 | +} |
| 884 | + |
| 885 | +std::vector<unsigned char> RemoteConfigInternal::GetData(const char* key, |
| 886 | + ValueInfo* info) { |
| 887 | + std::vector<unsigned char> value; |
| 888 | + // TODO(cynthiajiang) implement |
| 889 | + return value; |
| 890 | +} |
| 891 | + |
| 892 | +std::vector<std::string> RemoteConfigInternal::GetKeysByPrefix( |
| 893 | + const char* prefix) { |
| 894 | + std::vector<std::string> value; |
| 895 | + // TODO(cynthiajiang) implement |
| 896 | + return value; |
| 897 | +} |
| 898 | + |
| 899 | +std::vector<std::string> RemoteConfigInternal::GetKeys() { |
| 900 | + std::vector<std::string> value; |
| 901 | + // TODO(cynthiajiang) implement |
| 902 | + return value; |
| 903 | +} |
| 904 | + |
| 905 | +std::map<std::string, Variant> RemoteConfigInternal::GetAll() { |
| 906 | + std::map<std::string, Variant> value; |
| 907 | + // TODO(cynthiajiang) implement |
| 908 | + return value; |
| 909 | +} |
| 910 | +} // namespace internal |
760 | 911 | } // namespace remote_config
|
761 | 912 | } // namespace firebase
|
0 commit comments