예제 #1
0
 public async Task MarkNewsAsRead(News news)
 {
     news.localData = new News.LocalData()
     {
         isRead = true
     };
     await localCache.Set(news.key, news.localData);
 }
예제 #2
0
        public void TrackEvent(string category, string action, params object[] args)
        {
            var e = new AppFlowEvent()
            {
                cat = category, action = action, args = args
            };

            store.Set(e.time + "__" + category + "-" + action + ".json", e).LogOnError();
        }
예제 #3
0
        public async Task <FeatureFlag> GetFeatureFlag(string featureId)
        {
            FeatureFlag flag = await store.Get(featureId, null);

            if (flag != null && flag.localState.randomPercentage == 0)
            {
                // if the server decided its a staged rollout no rnd % generated yet so do it:
                flag.localState.randomPercentage = new Random().Next(1, 100);
                await store.Set(flag.id, flag); // save in local store
            }
            return(flag);
        }
예제 #4
0
        public void TrackEvent(string category, string action, params object[] args)
        {
            var e = new AppFlowEvent()
            {
                cat = category, action = action, args = args
            };

            store.Set(e.time + "__" + category + ":" + action, e).OnError((exeption) => {
                Log.e(exeption);
                return(Task.FromException(exeption));
            });
        }
예제 #5
0
 private async Task <T> ReturnInitializedFlag(T flag)
 {
     if (flag != null)
     {
         AssertV2.IsNotNull(flag.localState, "flag.localState");
         if (flag.localState.randomPercentage == 0)
         {
             // if the server decided its a staged rollout no rnd % generated yet so do it:
             flag.localState.randomPercentage = new Random().Next(1, 100);
             await featureFlagStore.Set(flag.id, flag); // save in local store
         }
     }
     return(flag);
 }