Ejemplo n.º 1
0
        protected async Task <ServerResponse <StatHeader> > FetchStats(Period period, DateTime from, DateTime to)
        {
            string                      apiFormat = "yyyy-MM-ddThh:mm";
            ISalesAppSession            session   = Resolver.Instance.Get <ISalesAppSession>();
            Guid                        userId    = session.UserId;
            ServerResponse <StatHeader> serverResponse;

            try
            {
                string url = string.Format("{0}?periodType={1}&from={2}&to={3}", userId, (int)period, @from.ToString(apiFormat), to.ToString(apiFormat));
                serverResponse = await MakeGetCallAsync <StatHeader>(url, filterFlags : ErrorFilterFlags.IgnoreNoInternetError);
            }
            catch (TimeoutException timeoutException)
            {
                this.Logger.Error(timeoutException);
                return(null);
            }
            catch (NotConnectedToInternetException exception)
            {
                this.Logger.Error(exception);
                return(null);
            }

            if (serverResponse == null || serverResponse.IsSuccessStatus == false)
            {
                return(null);
            }

            return(serverResponse);
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            this.session = Resolver.Instance.Get <ISalesAppSession>();

            this.SetContentView(Resource.Layout.layout_stats_main);

            // set the toolbar as actionbar
            this._toolbar = this.FindViewById <Toolbar>(Resource.Id.main_toolbar);
            this.SetSupportActionBar(this._toolbar);

            string title = string.Format(
                this.GetString(Resource.String.stats_screen_title), this.session.FirstName, this.session.LastName);

            this.SetScreenTitle(title);

            // load pager
            this._pager         = this.FindViewById <SwipeControlledViewPager>(Resource.Id.pager);
            this._pager.Adapter = new StatsFragmentAdapter(this.GetFragmentManager(), this);

            // Give the TabLayout the ViewPager
            this._tabLayout = this.FindViewById <ClickControlledTabLayout>(Resource.Id.sliding_tabs);
            this._tabLayout.SetupWithViewPager(this._pager);

            this._swipeRefreshLayout = this.FindViewById <SwipeRefreshLayout>(Resource.Id.swipe_refresh_layout);
            this._swipeRefreshLayout.SetColorSchemeResources(Resource.Color.blue, Resource.Color.white, Resource.Color.gray1, Resource.Color.green);
            this._swipeRefreshLayout.Refresh += SwipeRefreshLayoutOnRefresh;
            this._pager.PageSelected         += this.PagerOnPageSelected;
        }
Ejemplo n.º 3
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _session = Resolver.Instance.Get <ISalesAppSession>();
            _logger.Initialize(this.GetType().FullName);
            SetContentView(Resource.Layout.layout_welcome);

            this.AddToolbar(Resource.String.app_name, true);

            UiPermissionsController.SetViewsVisibilty();

            _sharedPrefService = Resolver.Instance.Get <ISharedPrefService>();

            _welcomeView = new WelcomeView(FindViewById <ViewGroup>(Resource.Id.welcomeRoot), this);
            _welcomeView.SetUser(_session.FirstName, _session.LastName);

            _welcomeView.RegisterProspectTouched += welcomeView_registerProspectTouched;

            _welcomeView.SwapComponentsTouched += (sender, e) => StartActivity(new Intent(this, typeof(SwapComponentsActivity)));

            FindViewById <RelativeLayout>(Resource.Id.btnRaiseIssue)
            .Click += (sender, e) =>
            {
                new IntentStartPointTracker()
                .StartIntentWithTracker
                (
                    this
                    , IntentStartPointTracker.IntentStartPoint.WelcomeScreen
                    , typeof(TicketStartActivity)
                );
            };
            _welcomeView.RegisterCustomerTouched += welcomeView_registerCustomerTouched;

            // check Location setting status from OTA
            // If its true then we check whether location settings on the device are on
            if (Settings.Instance.EnableLocationInfo)
            {
                if (!_locationListener.IsLocationOn())
                {
                    string acceptLocationTracking = _sharedPrefService.Get("accept_location_tracking");
                    if (acceptLocationTracking == null || !acceptLocationTracking.Equals("NO"))
                    {
                        CheckLocationStatus();
                    }
                }
            }

            // set app Google analytics
            GoogleAnalyticService.Instance.Initialize(this);

            Logger.Verbose("Creating new instance of CustomerPhotoUploaderReceiver");
            _customerPhotoUploaderReceiver = new CustomerPhotoUploaderReceiver();

            _photoUploadServiceIntent = new Intent(this, typeof(CustomerPhotoUploadService));

            // start the customer photo upload service
            StartService(_photoUploadServiceIntent);
        }
Ejemplo n.º 4
0
        protected void CreateUserSession()
        {
            ISalesAppSession session = Resolver.Instance.Get <ISalesAppSession>();

            session.FirstName = Dsr.FirstName;
            session.LastName  = Dsr.LastName;
            session.UserId    = Dsr.Id;
        }
Ejemplo n.º 5
0
 public void OnAppseeSessionStarted(AppseeSessionStartedInfo p0)
 {
     try
     {
         ISalesAppSession session = Resolver.Instance.Get <ISalesAppSession>();
         if (session != null)
         {
             Appsee.SetUserId(session.UserId.ToString());
         }
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
 }
Ejemplo n.º 6
0
        private async Task <Intent> GetContentIntentAsync(NotificationsHelperBase notificationHelper, TaskStackBuilder taskStackBuilder)
        {
            bool loginExpired = !(await new LoginService().GetLoginValidityAsync());

            ISalesAppSession session = Resolver.Instance.Get <ISalesAppSession>();

            if (loginExpired || session == null || session.UserId == default(Guid))
            {
                return(new Intent(AppContext, typeof(LoginActivityView)));
            }
            else
            {
                Logger.Debug("Session id is " + session.UserId);
                DestinationInformation destinationInformation = notificationHelper.GetDestinationInformation();
                taskStackBuilder.AddParentStack(Class.FromType(destinationInformation.ActivityType));
                taskStackBuilder.AddNextIntent(destinationInformation.ContentIntent);
                return(destinationInformation.ContentIntent);
            }
        }
Ejemplo n.º 7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Logger.Initialize(this.GetType().FullName);

            try
            {
                IO.Fabric.Sdk.Android.Fabric.With(this, new Com.Crashlytics.Android.Crashlytics());
                ISalesAppSession session = Resolver.Instance.Get <ISalesAppSession>();
                if (session != null)
                {
                    Crashlytics.SetUserIdentifier(session.UserId.ToString());
                    Crashlytics.SetUserName(session.FirstName + " " + session.LastName);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }

            try
            {
                Appsee.AddAppseeListener(this);
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }

            try
            {
                string key = "8d85ddd07dbb41909e60e7a54c6d0a7e";
#if RELEASE
                key = "16f9c8d0c2244b5dab0eef726d7a6245";
#endif
                Appsee.Start(key);
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }