Ejemplo n.º 1
0
        private void ProcessSingleOrNoFilteredAddresses(AddressLocationType filter, HomeViewModelState state)
        {
            var filteredAddress = AddressPicker.FilteredPlaces
                                  .Where(address => address.Address.AddressLocationType == filter)
                                  .ToArray();

            if (!filteredAddress.Any())
            {
                var localize = this.Services().Localize;
                this.Services().Message.ShowMessage(localize["FilteredAddresses_Error_Title"], localize["FilteredAddresses_Error_Message"]);

                return;
            }

            if (filteredAddress.Length == 1)
            {
                var address = filteredAddress
                              .Select(place => place.Address)
                              .First();

                AddressPicker.SelectAddress(address);

                return;
            }

            CurrentViewState = state;
        }
Ejemplo n.º 2
0
        public override void OnViewStarted(bool firstTime)
        {
            base.OnViewStarted(firstTime);

            try
            {
                _firstTime = firstTime;

                _locationService.Start();

                if (_orderWorkflowService.IsOrderRebooked())
                {
                    _bottomBar.ReviewOrderDetails().FireAndForget();
                }

                if (firstTime)
                {
                    Panel.Start().FireAndForget();

                    AddressPicker.RefreshFilteredAddress();

                    this.Services().ApplicationInfo.CheckVersionAsync().FireAndForget();

                    CheckTermsAsync();

                    CheckCreditCardExpiration().FireAndForget();

                    BottomBar.CheckManualRideLinqEnabledAsync();

                    _isShowingTutorial = _tutorialService.DisplayTutorialToNewUser(() =>
                    {
                        _isShowingTutorial = false;
                        LocateUserIfNeeded();
                    });
                    _pushNotificationService.RegisterDeviceForPushNotifications(force: true);
                }

                LocateUserIfNeeded();

                if (_defaultHintZoomLevel != null)
                {
                    ChangePresentation(_defaultHintZoomLevel);
                    _defaultHintZoomLevel = null;
                }

                _vehicleService.Start();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
Ejemplo n.º 3
0
        private void OnApplicationLifetimeChanged(object sender, MvxLifetimeEventArgs args)
        {
            if (args.LifetimeEvent == MvxLifetimeEvent.ActivatedFromDisk || args.LifetimeEvent == MvxLifetimeEvent.ActivatedFromMemory)
            {
                // since this is called before OnViewStarted and AutomaticLocateMe needs it, do it here, otherwise AutomaticLocateMe will be very slow
                _locationService.Start();

                var isInBookingMode = CurrentViewState == HomeViewModelState.ManualRidelinq ||
                                      CurrentViewState == HomeViewModelState.BookingStatus;

                if (!isInBookingMode)
                {
                    Task.Run(() => VerifyActiveOrder()).FireAndForget();
                }

                AutomaticLocateMeAtPickup.ExecuteIfPossible();
                CheckUnratedRide();
                CheckTermsAsync();
                CheckCreditCardExpiration().FireAndForget();
                AddressPicker.RefreshFilteredAddress();

                _metricsService.LogApplicationStartUp();
            }
        }
Ejemplo n.º 4
0
        protected override void OnViewModelSet()
        {
            base.OnViewModelSet();
            if (ViewModel != null)
            {
                ViewModel.OnViewLoaded();
                ViewModel.SubscribeLifetimeChangedIfNecessary();
            }

            var screenSize = new Point();

            WindowManager.DefaultDisplay.GetSize(screenSize);

            SetContentView(Resource.Layout.View_Home);

            _bigButton = (Button)FindViewById(Resource.Id.BigButtonTransparent);

            _orderOptions           = (OrderOptions)FindViewById(Resource.Id.orderOptions);
            _dropOffSelection       = (DropOffSelection)FindViewById(Resource.Id.dropOffSelection);
            _orderReview            = (OrderReview)FindViewById(Resource.Id.orderReview);
            _orderEdit              = (OrderEdit)FindViewById(Resource.Id.orderEdit);
            _orderAirport           = (OrderAirport)FindViewById(Resource.Id.orderAirport);
            _searchAddress          = (AddressPicker)FindViewById(Resource.Id.searchAddressControl);
            _appBar                 = (AppBar)FindViewById(Resource.Id.appBar);
            _frameLayout            = (FrameLayout)FindViewById(Resource.Id.RelInnerLayout);
            _btnSettings            = FindViewById <LinearLayout>(Resource.Id.btnSettings);
            _btnLocation            = FindViewById <LinearLayout>(Resource.Id.btnLocation);
            _appBarBookingStatus    = FindViewById <AppBarBookingStatus>(Resource.Id.appBarBookingStatus);
            _appBarDropOffSelection = FindViewById <AppBarDropOffSelection>(Resource.Id.appBarDropOffSelection);
            _orderStatus            = FindViewById <OrderStatusView>(Resource.Id.orderStatus);

            // attach big invisible button to the OrderOptions to be able to pass it to the address text box and clear focus when clicking outside
            _orderOptions.BigInvisibleButton     = _bigButton;
            _dropOffSelection.BigInvisibleButton = _bigButton;

            ((ViewGroup.MarginLayoutParams)_orderOptions.LayoutParameters).TopMargin = 0;
            ((ViewGroup.MarginLayoutParams)_orderReview.LayoutParameters).TopMargin  = screenSize.Y;
            ((ViewGroup.MarginLayoutParams)_orderAirport.LayoutParameters).TopMargin = screenSize.Y;

            var orderEditLayout = _orderEdit.GetLayoutParameters();

            var isRightToLeftLanguage = this.Services().Localize.IsRightToLeft;

            _orderEdit.SetLayoutParameters(screenSize.X, orderEditLayout.Height,
                                           isRightToLeftLanguage ? orderEditLayout.LeftMargin : screenSize.X,
                                           isRightToLeftLanguage ? screenSize.X : orderEditLayout.RightMargin,
                                           orderEditLayout.TopMargin, orderEditLayout.BottomMargin, orderEditLayout.Gravity);

            ((ViewGroup.MarginLayoutParams)_orderStatus.LayoutParameters).TopMargin = -screenSize.Y;

            // Creating a view controller for MapFragment
            var mapViewSavedInstanceState = _mainBundle != null?_mainBundle.GetBundle("mapViewSaveState") : null;

            _touchMap = (TouchableMap)FragmentManager.FindFragmentById(Resource.Id.mapPickup);
            _touchMap.OnCreate(mapViewSavedInstanceState);
            MapFragment = new OrderMapFragment(_touchMap, Resources, this.Services().Settings);

            var inputManager = (InputMethodManager)ApplicationContext.GetSystemService(InputMethodService);

            MapFragment.TouchableMap.Surface.Touched += (sender, e) =>
            {
                inputManager.HideSoftInputFromWindow(Window.DecorView.RootView.WindowToken, HideSoftInputFlags.None);
            };

            _orderReview.ScreenSize = screenSize;
            _orderReview.OrderReviewHiddenHeightProvider = () => _frameLayout.Height - _orderOptions.Height;
            _orderReview.OrderReviewShownHeightProvider  = () => _orderOptions.Height;
            _orderEdit.ScreenSize        = screenSize;
            _orderEdit.ParentFrameLayout = _frameLayout;

            _orderAirport.ScreenSize = screenSize;
            _orderAirport.OrderAirportHiddenHeightProvider = () => _frameLayout.Height - _orderOptions.Height;
            _orderAirport.OrderAirportShownHeightProvider  = () => _orderOptions.Height;

            ResumeFromBackgroundIfNecessary();

            SetupHomeViewBinding();

            PanelMenuInit();
        }
Ejemplo n.º 5
0
 private void OnFromAddressPickerClicked(object sender, EventArgs args)
 {
     AddressPicker.Focus();
 }