// 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); }
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(); }
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); }
protected abstract Task <bool> SendEventToExternalSystem(AppFlowEvent appFlowEvent);