// Checks if a new screen was entered to cache the current screen name
 private bool ExtractScreenName(AppFlowEvent appFlowEvent)
 {
     try {
         if (appFlowEvent.cat == EventConsts.catView)
         {
             if (appFlowEvent.action.StartsWith(EventConsts.SHOW))
             {
                 latestScreen = "" + appFlowEvent.args.First();
                 return(true);
             }
             if (appFlowEvent.action.StartsWith(EventConsts.SWITCH_BACK_TO_LAST))
             {
                 latestScreen = "" + appFlowEvent.args.First();
                 return(true);
             }
             if (appFlowEvent.action.StartsWith(EventConsts.SWITCH_TO_NEXT))
             {
                 latestScreen = "" + appFlowEvent.args[1];
                 return(true);
             }
             if (appFlowEvent.action.StartsWith(EventConsts.ADDED))
             {
                 latestScreen = "" + appFlowEvent.args.First();
                 return(true);
             }
         }
     } catch (Exception e) { Log.e(e); }
     return(false);
 }
Beispiel #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();
        }
Beispiel #3
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));
            });
        }
 protected override async Task <bool> SendEventToExternalSystem(AppFlowEvent e)
 {
     ExtractScreenName(e);
     if (e.args?.FirstOrDefault(x => x is Stopwatch) is Stopwatch timing)
     {
         await SendToGA(NewTiming(e.cat, e.action, timingInMs : timing.ElapsedMilliseconds)).GetResult <string>();
     }
     else
     {
         await SendToGA(NewEvent(e.cat, e.action)).GetResult <string>();
     }
     return(true);
 }
Beispiel #5
0
 protected abstract Task <bool> SendEventToExternalSystem(AppFlowEvent appFlowEvent);