void HandleRemoteConfigFetchCompletionHandler(RemoteConfigFetchStatus status, NSError error)
        {
            switch (status)
            {
            case RemoteConfigFetchStatus.Success:
                AppDelegate.ShowMessage("Config Fetched!", "Settings will be updated", NavigationController, OkAction);
                break;

            case RemoteConfigFetchStatus.Throttled:
            case RemoteConfigFetchStatus.NoFetchYet:
            case RemoteConfigFetchStatus.Failure:
                AppDelegate.ShowMessage("Config not fetched...", error.LocalizedDescription, NavigationController, null);
                break;
            }

            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;

            void OkAction()
            {
                remoteConfig.ActivateFetched();

                var indexPaths = TableView.IndexPathsForVisibleRows;

                foreach (var indexPath in indexPaths)
                {
                    var cell    = TableView.CellAt(indexPath) as SettingTableViewCell;
                    var enabled = indexPath.Row == 0 ? remoteConfig ["perf_enable_auto"].BoolValue : remoteConfig ["perf_enable_manual"].BoolValue;
                    cell.SetEnabled(enabled, true);
                }
            }
        }
Exemplo n.º 2
0
 public string GetRemoteDataString(string key)
 {
     try
     {
         InitRemoteConfig();
         firebaseRemoteConfig.Fetch(new RemoteConfigFetchCompletionHandler(handler));
         firebaseRemoteConfig.ActivateFetched();
         return(firebaseRemoteConfig.GetConfigValue(key).StringValue);
     }
     catch (Exception ex)
     {
         return("all");
     }
 }
Exemplo n.º 3
0
 public async Task <bool> Fetch()
 {
     _result?.TrySetCanceled();
     _result = new TaskCompletionSource <bool>();
     _firebaseConfig.Fetch(0, (status, error) =>
     {
         if (status == RemoteConfigFetchStatus.Success)
         {
             _firebaseConfig.ActivateFetched();
             _result.SetResult(true);
         }
         else
         {
             _result.SetResult(false);
         }
     });
     return(await _result.Task);
 }
Exemplo n.º 4
0
        void HandleRemoteConfigFetchCompletionHandler(RemoteConfigFetchStatus status, NSError error)
        {
            if (status == RemoteConfigFetchStatus.Success)
            {
                ToastIOS.Toast.MakeText("Success");

                remoteConfigText.Text = remoteConfig["remote_text"].StringValue;

                var activate_fetched = RemoteConfig.SharedInstance.ActivateFetched();

                if (remoteConfig.ActivateFetched())
                {
                    remoteConfigText.Text = remoteConfig["remote_text"].StringValue;
                }
            }
            else
            {
                ToastIOS.Toast.MakeText("Error " + error.Description);
            }
        }
Exemplo n.º 5
0
 public void ActivateFetched() => _config.ActivateFetched();