Exemple #1
0
        public static void ActivateLowLevelUiEventTracking(this IAppFlow self)
        {
            // Button UI tracking:
            EventBus.instance.Subscribe(self, EventConsts.catUi + UiEvents.BUTTON_CLICKED, (Button button) => {
                self.TrackEvent(EventConsts.catUi, UiEvents.BUTTON_CLICKED + "_" + button, button);
            });

            // Toggle UI tracking:
            EventBus.instance.Subscribe(self, EventConsts.catUi + UiEvents.TOGGLE_CHANGED, (Toggle toggle, bool isChecked) => {
                self.TrackEvent(EventConsts.catUi, UiEvents.TOGGLE_CHANGED + "_" + toggle + "_" + isChecked, toggle, isChecked);
            });

            { // InputField UI tracking:
                EventHandler <string> action = (input, newText) => {
                    self.TrackEvent(EventConsts.catUi, UiEvents.INPUTFIELD_CHANGED + "_" + input, input);
                };
                var delayedAction = action.AsThrottledDebounce(delayInMs: 1900, skipFirstEvent: true);
                EventBus.instance.Subscribe(self, EventConsts.catUi + UiEvents.INPUTFIELD_CHANGED, (InputField input, string newText) => {
                    delayedAction(input, newText);
                });
            }

            // Dropdown UI tracking:
            EventBus.instance.Subscribe(self, EventConsts.catUi + UiEvents.DROPDOWN_CHANGED, (Dropdown d, int selection) => {
                self.TrackEvent(EventConsts.catUi, UiEvents.DROPDOWN_CHANGED + "_" + d + "_" + selection, d, selection);
            });
        }
Exemple #2
0
 public static IAppFlow WithAllTrackingActive(this IAppFlow self)
 {
     self.ActivateLinkMapTracking();
     self.ActivatePrefabLoadTracking();
     self.ActivateUiEventTracking();
     self.ActivateViewStackTracking();
     return(self);
 }
        public MainPageViewModel(IAppFlow appFlow)
        {
            if (NullChecker.IsObjectInitialized(appFlow))
            {
                _appFlow = appFlow;
            }

            IsBusy = true;
            _appFlow.DetermineAppPathAsync();
            IsBusy = false;
        }
 public static void ActivatePresenterTracking(this IAppFlow self)
 {
     EventBus.instance.Subscribe(self, EventConsts.catPresenter + EventConsts.START,
                                 (string name, object presenter, object model) => {
         self.TrackEvent(EventConsts.catPresenter, EventConsts.START + name, presenter, model);
     });
     EventBus.instance.Subscribe(self, EventConsts.catPresenter + EventConsts.DONE,
                                 (string name, object presenter, object model) => {
         self.TrackEvent(EventConsts.catPresenter, EventConsts.DONE + name, presenter, model);
     });
 }
Exemple #5
0
 public static void ActivateViewStackTracking(this IAppFlow self)
 {
     EventBus.instance.Subscribe(self, EventConsts.SHOW_VIEW, (GameObject view) => {
         self.TrackEvent(EventConsts.catView, EventConsts.SHOW_VIEW + "_" + view.name, view);
     });
     EventBus.instance.Subscribe(self, EventConsts.SWITCH_BACK_TO_LAST_VIEW, (string currentViewName, GameObject lastView) => {
         self.TrackEvent(EventConsts.catView, EventConsts.SWITCH_BACK_TO_LAST_VIEW + "_" + currentViewName + "->" + lastView.name, lastView);
     });
     EventBus.instance.Subscribe(self, EventConsts.SWITCH_TO_NEXT_VIEW, (GameObject currentView, GameObject nextView) => {
         self.TrackEvent(EventConsts.catView, EventConsts.SWITCH_TO_NEXT_VIEW + "_" + currentView.name + "->" + nextView.name, currentView, nextView);
     });
 }
 public static void ActivateMethodTracking(this IAppFlow self)
 {
     EventBus.instance.Subscribe(self, EventConsts.catMethod, (string methodName) => {
         self.TrackEvent(EventConsts.catMethod, methodName);
     });
     EventBus.instance.Subscribe(self, EventConsts.catMethod + " ENTERED",
                                 (string methodName, object[] args) => {
         self.TrackEvent(EventConsts.catMethod, methodName, args);
     });
     EventBus.instance.Subscribe(self, EventConsts.catMethod + " DONE",
                                 (string methodName, Stopwatch timing) => {
         self.TrackEvent(EventConsts.catMethod, methodName + " DONE", timing);
     });
 }
 public static void ActivateSystemTracking(this IAppFlow self)
 {
     EventBus.instance.Subscribe(self, EventConsts.catSystem + EventConsts.APP_VERSION_CHANGED,
                                 (string oldVersion, string newVersion) => {
         self.TrackEvent(EventConsts.catSystem, EventConsts.APP_VERSION_CHANGED, oldVersion, newVersion);
     });
     EventBus.instance.Subscribe(self, EventConsts.catSystem + EventConsts.INET_CHANGED,
                                 (bool oldState, bool newState) => {
         self.TrackEvent(EventConsts.catSystem, EventConsts.INET_CHANGED, oldState, newState);
     });
     EventBus.instance.Subscribe(self, EventConsts.catSystem + EventConsts.LOW_MEMORY, () => {
         self.TrackEvent(EventConsts.catSystem, EventConsts.LOW_MEMORY);
     });
 }
Exemple #8
0
 public static void AddAppFlowTracker(IAppFlow tracker)
 {
     if (instance == null)
     {
         instance = tracker;
     }
     else if (instance is AppFlowMultipleTrackers multi)
     {
         multi.trackers.Add(tracker);
     }
     else
     {
         instance = new AppFlowMultipleTrackers(instance, tracker);
     }
 }
Exemple #9
0
        public static void ActivateHighLevelUiEventTracking(this IAppFlow self)
        {
            // ActionMenu tracking:
            EventBus.instance.Subscribe(self, EventConsts.catUi + UiEvents.ACTION_MENU, (string entry) => {
                self.TrackEvent(EventConsts.catUi, UiEvents.ACTION_MENU + "_" + entry, entry);
            });

            // Dialog tracking:
            EventBus.instance.Subscribe(self, EventConsts.catUi + UiEvents.DIALOG, (Dialog d) => {
                self.TrackEvent(EventConsts.catUi, UiEvents.DIALOG + "_" + d.caption, d);
            });
            EventBus.instance.Subscribe(self, EventConsts.catUi + UiEvents.CONFIRM_CANCEL_DIALOG, (ConfirmCancelDialog d) => {
                var action = UiEvents.CONFIRM_CANCEL_DIALOG + "_" + d.caption + (d.dialogWasConfirmed ? " CONFIRMED" : " CANCELED");
                self.TrackEvent(EventConsts.catUi, action, d);
            });
        }
Exemple #10
0
        public static IEnumerable <T> GetAllOfType <T>() where T : IAppFlow
        {
            IAppFlow i = AppFlow.instance(null);

            if (i is AppFlowMultipleTrackers m)
            {
                return(m.trackers.OfType <T>());
            }
            if (i is T)
            {
                return(new T[1] {
                    (T)i
                });
            }
            return(null);
        }
Exemple #11
0
        public static AppFlowMultipleTrackers AddAppFlowTracker(IAppFlow tracker)
        {
            var oldInstance = instance(null);

            if (oldInstance == null)
            {
                var m1 = new AppFlowMultipleTrackers(tracker);
                IoC.inject.SetSingleton <IAppFlow>(m1);
                return(m1);
            }
            if (oldInstance is AppFlowMultipleTrackers m2)
            {
                m2.trackers.Add(tracker);
                return(m2);
            }
            var m3 = new AppFlowMultipleTrackers(oldInstance, tracker);

            IoC.inject.SetSingleton <IAppFlow>(m3);
            return(m3);
        }
Exemple #12
0
 public static void ActivateViewStackTracking(this IAppFlow self)
 {
     EventBus.instance.Subscribe(self, EventConsts.catView + EventConsts.SHOW, (GameObject view) => {
         self.TrackEvent(EventConsts.catView, EventConsts.SHOW + "_" + view.name, view);
     });
     EventBus.instance.Subscribe(self, EventConsts.catView + EventConsts.SWITCH_BACK_TO_LAST, (string currentViewName, GameObject lastView) => {
         self.TrackEvent(EventConsts.catView, EventConsts.SWITCH_BACK_TO_LAST + "_" + currentViewName + "->" + lastView.name, lastView);
     });
     EventBus.instance.Subscribe(self, EventConsts.catView + EventConsts.SWITCH_TO_NEXT, (GameObject currentView, GameObject nextView) => {
         self.TrackEvent(EventConsts.catView, EventConsts.SWITCH_TO_NEXT + "_" + currentView.name + "->" + nextView.name, currentView, nextView);
     });
     EventBus.instance.Subscribe(self, EventConsts.catView + EventConsts.SWITCH_REJECTED, (DefaultSwitchScreenAction.SwitchDirection direction) => {
         self.TrackEvent(EventConsts.catView, EventConsts.SWITCH_REJECTED, direction);
     });
     EventBus.instance.Subscribe(self, EventConsts.catView + EventConsts.ADDED, (GameObject view) => {
         self.TrackEvent(EventConsts.catView, EventConsts.ADDED + "_" + view.name, view);
     });
     EventBus.instance.Subscribe(self, EventConsts.catView + EventConsts.REMOVED, (GameObject view) => {
         self.TrackEvent(EventConsts.catView, EventConsts.REMOVED + "_" + view.name, view);
     });
 }
Exemple #13
0
 public static void ActivateLinkMapTracking(this IAppFlow self)
 {
     EventBus.instance.Subscribe(self, EventConsts.catLinked, (GameObject target, Dictionary <string, Link> links) => {
         self.TrackEvent(EventConsts.catLinked, $"Collect_{links.Count}_Links_" + target.name, target, links);
     });
 }
Exemple #14
0
 public static void ActivatePrefabLoadTracking(this IAppFlow self)
 {
     EventBus.instance.Subscribe(self, EventConsts.catTemplate, (GameObject prefab) => {
         self.TrackEvent(EventConsts.catTemplate, "Loaded_" + prefab.name, prefab);
     });
 }
 public static void ActivateMutationTracking(this IAppFlow self)
 {
     EventBus.instance.Subscribe(self, EventConsts.catMutation, (string actionString, object action) => {
         self.TrackEvent(EventConsts.catMutation, actionString, action);
     });
 }
 public static void ActivateInjectionTracking(this IAppFlow self)
 {
     EventBus.instance.Subscribe(self, EventConsts.catInjection, (string injected) => {
         self.TrackEvent(EventConsts.catInjection, injected);
     });
 }