예제 #1
0
        public DropOffSelectionMidTripViewModel(IOrderWorkflowService orderWorkflowService)
        {
            _orderWorkflowService = orderWorkflowService;

            Observe(_orderWorkflowService.GetAndObserveDestinationAddress(), address => DestinationAddress = address);
            Observe(_orderWorkflowService.GetAndObserveLoadingAddress(), loading => IsLoadingAddress       = loading);
        }
        public OrderReviewViewModel
        (
            IOrderWorkflowService orderWorkflowService,
            IPaymentService paymentService,
            IAccountService accountService,
            IVehicleTypeService vehicleTypeService,
            INetworkRoamingService networkRoamingService
        )
        {
            _vehicleTypeService    = vehicleTypeService;
            _orderWorkflowService  = orderWorkflowService;
            _accountService        = accountService;
            _paymentService        = paymentService;
            _networkRoamingService = networkRoamingService;

            Observe(_orderWorkflowService.GetAndObserveBookingSettings(), settings => SettingsUpdated(settings));
            Observe(_orderWorkflowService.GetAndObservePickupAddress(), address => Address = address);
            Observe(_orderWorkflowService.GetAndObservePickupDate(), DateUpdated);
            //We are throttling to prevent cases where we can cause the app to become unresponsive after typing fast.
            Observe(_orderWorkflowService.GetAndObserveNoteToDriver().Throttle(TimeSpan.FromMilliseconds(500)), note => Note = note);
            Observe(_orderWorkflowService.GetAndObserveTipIncentive().Throttle(TimeSpan.FromMilliseconds(500)), tipIncentive => DriverBonus = tipIncentive);
            Observe(_orderWorkflowService.GetAndObservePromoCode(), code => PromoCode = code);
            Observe(_networkRoamingService.GetAndObserveMarketSettings(), MarketChanged);

            _driverBonus = 5;

            GetIsCmtRideLinq().FireAndForget();
        }
예제 #3
0
        public MapViewModel(IOrderWorkflowService orderWorkflowService, IVehicleService vehicleService)
        {
            _orderWorkflowService = orderWorkflowService;

            Observe(_orderWorkflowService.GetAndObserveAddressSelectionMode(), addressSelectionMode => AddressSelectionMode          = addressSelectionMode);
            Observe(_orderWorkflowService.GetAndObserveIsDestinationModeOpened(), isDestinationModeOpened => IsDestinationModeOpened = isDestinationModeOpened);
            Observe(_orderWorkflowService.GetAndObservePickupAddress(), address => PickupAddress            = address);
            Observe(_orderWorkflowService.GetAndObserveDestinationAddress(), address => DestinationAddress  = address);
            Observe(vehicleService.GetAndObserveAvailableVehicles(), availableVehicles => AvailableVehicles = availableVehicles);
        }
예제 #4
0
 public HistoryDetailViewModel(IOrderWorkflowService orderWorkflowService,
                               IBookingService bookingService,
                               IAccountService accountService,
                               IPaymentService paymentSettings)
 {
     _orderWorkflowService = orderWorkflowService;
     _bookingService       = bookingService;
     _accountService       = accountService;
     _paymentSettings      = paymentSettings;
 }
        public EditAutoTipViewModel(IOrderWorkflowService orderWorkflowService,
                                    IPaymentService paymentService,
                                    IAccountService accountService,
                                    IBookingService bookingService)
        {
            _orderWorkflowService = orderWorkflowService;
            _paymentService       = paymentService;
            _bookingService       = bookingService;
            _accountService       = accountService;

            GetIsCmtRideLinq();
        }
        public PromotionViewModel(IOrderWorkflowService orderWorkflowService,
                                  IPromotionService promotionService,
                                  IAccountService accountService,
                                  IPaymentService paymentService)
        {
            _orderWorkflowService = orderWorkflowService;
            _promotionService     = promotionService;
            _accountService       = accountService;
            _paymentService       = paymentService;

            ActivePromotions = new ObservableCollection <PromotionItemViewModel>();
        }
예제 #7
0
        public OrderAirportViewModel(IOrderWorkflowService orderWorkflowService, IAirportInformationService airportInformationService)
        {
            _orderWorkflowService      = orderWorkflowService;
            _airportInformationService = airportInformationService;

            Observe(_orderWorkflowService.GetAndObserveBookingSettings(), bookingSettings => BookingSettings = bookingSettings.Copy());
            Observe(_orderWorkflowService.GetAndObservePickupAddress(), address => PickupAddress             = address.Copy());
            Observe(_orderWorkflowService.GetAndObservePOIRefPickupList(), poiPickup => POIPickup            = poiPickup);
            Observe(_orderWorkflowService.GetAndObservePOIRefAirlineList(), poiAirline => POIAirline         = poiAirline);
            Observe(_orderWorkflowService.GetAndObservePickupDate(), pickupDate => PickupDate = pickupDate);

            //We are throttling to prevent cases where we can cause the app to become unresponsive after typing fast.
            Observe(_orderWorkflowService.GetAndObserveNoteToDriver().Throttle(TimeSpan.FromMilliseconds(500)), note => Note = note);
        }
        public OrderEditViewModel(IOrderWorkflowService orderWorkflowService, IAccountService accountService, IPaymentService paymentService, INetworkRoamingService networkRoamingService)
        {
            _orderWorkflowService  = orderWorkflowService;
            _accountService        = accountService;
            _paymentService        = paymentService;
            _networkRoamingService = networkRoamingService;

            _chargeTypes = new ListItem[0];

            Observe(_orderWorkflowService.GetAndObserveBookingSettings(), bookingSettings => BookingSettings = bookingSettings.Copy());
            Observe(_orderWorkflowService.GetAndObservePickupAddress(), address => PickupAddress             = address.Copy());
            Observe(_accountService.GetAndObservePaymentsList(), paymentTypes => PaymentTypesChanged(paymentTypes).FireAndForget());

            PhoneNumber = new PhoneNumberModel();
        }
예제 #9
0
 public PanelMenuViewModel(IMvxWebBrowserTask browserTask,
                           IOrderWorkflowService orderWorkflowService,
                           IAccountService accountService,
                           IPhoneService phoneService,
                           IPaymentService paymentService,
                           IPromotionService promotionService)
 {
     _browserTask          = browserTask;
     _orderWorkflowService = orderWorkflowService;
     _accountService       = accountService;
     _phoneService         = phoneService;
     _paymentService       = paymentService;
     _promotionService     = promotionService;
     PartialConstructor();
 }
예제 #10
0
        public HomeViewModel(IOrderWorkflowService orderWorkflowService,
                             IMvxWebBrowserTask browserTask,
                             ILocationService locationService,
                             ITutorialService tutorialService,
                             IPushNotificationService pushNotificationService,
                             IVehicleService vehicleService,
                             IAccountService accountService,
                             IPhoneService phoneService,
                             ITermsAndConditionsService termsService,
                             IPaymentService paymentService,
                             IMvxLifetime mvxLifetime,
                             IPromotionService promotionService,
                             IMetricsService metricsService,
                             IBookingService bookingService,
                             INetworkRoamingService networkRoamingService)
        {
            _locationService         = locationService;
            _orderWorkflowService    = orderWorkflowService;
            _tutorialService         = tutorialService;
            _pushNotificationService = pushNotificationService;
            _vehicleService          = vehicleService;
            _termsService            = termsService;
            _mvxLifetime             = mvxLifetime;
            _metricsService          = metricsService;
            _bookingService          = bookingService;
            _accountService          = accountService;
            _paymentService          = paymentService;

            Panel = new PanelMenuViewModel(browserTask, orderWorkflowService, accountService, phoneService, paymentService, promotionService);

            Map              = AddChild <MapViewModel>();
            OrderOptions     = AddChild <OrderOptionsViewModel>();
            OrderReview      = AddChild <OrderReviewViewModel>();
            OrderEdit        = AddChild <OrderEditViewModel>();
            OrderAirport     = AddChild <OrderAirportViewModel>();
            BottomBar        = AddChild <BottomBarViewModel>();
            AddressPicker    = AddChild <AddressPickerViewModel>();
            BookingStatus    = AddChild <BookingStatusViewModel>();
            DropOffSelection = AddChild <DropOffSelectionMidTripViewModel>();

            Observe(_vehicleService.GetAndObserveAvailableVehiclesWhenVehicleTypeChanges(), ZoomOnNearbyVehiclesIfPossible);
            Observe(networkRoamingService.GetAndObserveMarketSettings(), MarketChanged);
        }
예제 #11
0
        public RideSettingsViewModel(IAccountService accountService,
                                     IVehicleTypeService vehicleTypeService,
                                     IPaymentService paymentService,
                                     IAccountPaymentService accountPaymentService,
                                     IOrderWorkflowService orderWorkflowService,
                                     INetworkRoamingService networkRoamingService)
        {
            _vehicleTypeService    = vehicleTypeService;
            _orderWorkflowService  = orderWorkflowService;
            _paymentService        = paymentService;
            _accountPaymentService = accountPaymentService;
            _accountService        = accountService;
            _networkRoamingService = networkRoamingService;

            _payments = new ListItem[0];

            PhoneNumber = new PhoneNumberModel();

            Observe(_accountService.GetAndObservePaymentsList(), paymentTypes => PaymentTypesChanged(paymentTypes).FireAndForget());
        }
        public AddressPickerViewModel(IOrderWorkflowService orderWorkflowService,
                                      IPlaces placesService,
                                      IGeolocService geolocService,
                                      IAccountService accountService,
                                      ILocationService locationService,
                                      IPostalCodeService postalCodeService,
                                      IGeocoding geocodingService)
        {
            _orderWorkflowService = orderWorkflowService;
            _geolocService        = geolocService;
            _placesService        = placesService;
            _accountService       = accountService;
            _locationService      = locationService;
            _postalCodeService    = postalCodeService;
            _geocodingService     = geocodingService;

            Observe(_orderWorkflowService.GetAndObserveAddressSelectionMode(), addressSelectionMode => AddressSelectionMode   = addressSelectionMode);
            Observe(_orderWorkflowService.GetAndObserveDropOffSelectionMode(), dropOffSelectionMode => IsDropOffSelectionMode = dropOffSelectionMode);

            FilteredPlaces = new AddressViewModel[0];
        }
예제 #13
0
        public BottomBarViewModel(IOrderWorkflowService orderWorkflowService,
                                  IMvxPhoneCallTask phone,
                                  IAccountService accountService,
                                  IPaymentService paymentService,
                                  INetworkRoamingService networkRoamingService,
                                  IBookingService bookingService)
        {
            _bookingService        = bookingService;
            _phone                 = phone;
            _orderWorkflowService  = orderWorkflowService;
            _accountService        = accountService;
            _paymentService        = paymentService;
            _networkRoamingService = networkRoamingService;

            if (!Settings.HideDestination)
            {
                Observe(_orderWorkflowService.GetAndObserveIsDestinationModeOpened(),
                        isDestinationModeOpened => EstimateSelected = isDestinationModeOpened);
            }

            if (Settings.PromotionEnabled)
            {
                Observe(ObserveIsPromoCodeApplied(), isPromoCodeApplied => IsPromoCodeActive = isPromoCodeApplied);
            }

            RefreshAppBarViewState(HomeViewModelState.Initial);

            // We ensure that we correctly update IsFutureBookingDisabled.
            var observeValidationResultAndMarkertSettings = Observable.CombineLatest(
                _orderWorkflowService.GetAndObserveOrderValidationResult(),
                _networkRoamingService.GetAndObserveMarketSettings(),
                (orderValidationResult, marketSettings) => new
            {
                OrderValidationResult = orderValidationResult,
                MarketSettings        = marketSettings
            });

            Observe(observeValidationResultAndMarkertSettings, mergedResult => HandleOrderValidatedtAndMarketSettingsChanged(mergedResult.OrderValidationResult, mergedResult.MarketSettings));
            Observe(_orderWorkflowService.GetAndObserveCanExecuteBookingOperation(), canExecuteBookOperation => CanExecuteBookOperation = canExecuteBookOperation);
        }
예제 #14
0
        public OrderOptionsViewModel(IOrderWorkflowService orderWorkflowService, INetworkRoamingService networkRoamingService, IAccountService accountService, IVehicleService vehicleService, IVehicleTypeService vehicleTypeService)
        {
            _orderWorkflowService  = orderWorkflowService;
            _networkRoamingService = networkRoamingService;
            _accountService        = accountService;
            _vehicleService        = vehicleService;
            _vehicleTypeService    = vehicleTypeService;

            Observe(_orderWorkflowService.GetAndObserveIsDestinationModeOpened(),
                    isDestinationModeOpened => {
                IsDestinationModeOpened = isDestinationModeOpened;
                OnDestinationModeOpened();
            });
            Observe(_orderWorkflowService.GetAndObservePickupAddress(), address => PickupAddress                     = address);
            Observe(_orderWorkflowService.GetAndObserveDestinationAddress(), address => DestinationAddress           = address);
            Observe(_orderWorkflowService.GetAndObserveAddressSelectionMode(), selectionMode => AddressSelectionMode = selectionMode);
            Observe(_orderWorkflowService.GetAndObserveEstimatedFare(), fare => EstimatedFare        = fare);
            Observe(_orderWorkflowService.GetAndObserveLoadingAddress(), loading => IsLoadingAddress = loading);
            Observe(_orderWorkflowService.GetAndObserveVehicleType(), vehicleType => VehicleTypeId   = vehicleType);
            Observe(_vehicleTypeService.GetAndObserveVehiclesList(), vehicleTypes => VehicleTypesChanged(vehicleTypes));
            Observe(_vehicleService.GetAndObserveEta(), eta => Eta = eta);
            Observe(_vehicleService.GetAndObserveAvailableVehicles(), vehicles => _availableVehicles = vehicles);
        }
 public RideSummaryViewModel(IOrderWorkflowService orderWorkflowService, IBookingService bookingService)
 {
     _orderWorkflowService = orderWorkflowService;
     _bookingService       = bookingService;
 }
예제 #16
0
 public ManualPairingForRideLinqViewModel(IBookingService bookingService, IOrderWorkflowService orderWorkflowService, IDeviceCollectorService deviceCollectorService)
 {
     _bookingService         = bookingService;
     _orderWorkflowService   = orderWorkflowService;
     _deviceCollectorService = deviceCollectorService;
 }
예제 #17
0
        public VehicleService(IOrderWorkflowService orderWorkflowService,
                              IDirections directions,
                              IAppSettings settings)
        {
            _directions = directions;
            _settings   = settings;

            // having publish and connect fixes the problem that caused the code to be executed 2 times
            // because there was 2 subscriptions
            _availableVehiclesObservable = _timerSubject
                                           .Switch()
                                           .CombineLatest(
                orderWorkflowService.GetAndObservePickupAddress(),
                _availableVehicleEnabled.DistinctUntilChanged(),
                (_, address, enableAvailableVehicle) => new { address, enableAvailableVehicle }
                )
                                           .Where(x => x.enableAvailableVehicle && x.address.HasValidCoordinate())
                                           .Select(x => x.address)
                                           .SelectMany(async x =>
            {
                var vehicleTypeId = await orderWorkflowService.GetAndObserveVehicleType()
                                    .Take(1)
                                    .ToTask()
                                    .ConfigureAwait(false);

                return(await CheckForAvailableVehicles(x, vehicleTypeId).ConfigureAwait(false));
            })
                                           .Publish();
            _availableVehiclesObservable.Connect();

            _availableVehiclesWhenTypeChangesObservable = orderWorkflowService.GetAndObserveVehicleType()
                                                          .SelectMany(async vehicleTypeId =>
            {
                var address = await orderWorkflowService.GetAndObservePickupAddress()
                              .Take(1)
                              .ToTask()
                              .ConfigureAwait(false);

                return(new { vehicleTypeId, address });
            })
                                                          .Where(x => x.address.HasValidCoordinate())
                                                          .SelectMany(x => CheckForAvailableVehicles(x.address, x.vehicleTypeId));

            _isUsingGeoServicesObservable = orderWorkflowService.GetAndObserveIsUsingGeo();

            _etaObservable = _availableVehiclesObservable
                             .Where(_ => _settings.Data.ShowEta)
                             .CombineLatest(
                _isUsingGeoServicesObservable,
                orderWorkflowService.GetAndObservePickupAddress(),
                (vehicles, isUsingGeoServices, address) => new { address, isUsingGeoServices, vehicles }
                )
                             .Select(x => new { x.address, x.isUsingGeoServices, vehicle = GetNearestVehicle(x.isUsingGeoServices, x.address, x.vehicles) })
                             .DistinctUntilChanged(x =>
            {
                if (x.isUsingGeoServices && x.vehicle != null)
                {
                    return(x.vehicle.Eta ?? double.MaxValue);
                }

                return(x.vehicle == null
                                        ? double.MaxValue
                                        : Position.CalculateDistance(x.vehicle.Latitude, x.vehicle.Longitude, x.address.Latitude, x.address.Longitude));
            })
                             .SelectMany(x => CheckForEta(x.isUsingGeoServices, x.address, x.vehicle));
        }
 public InitializeOrderForAccountPaymentViewModel(IOrderWorkflowService orderWorkflowService, IMvxPhoneCallTask phone)
 {
     _orderWorkflowService = orderWorkflowService;
     _phone = phone;
 }
 public LocationDetailViewModel(IOrderWorkflowService orderWorkflowService,
                                IAccountService accountService)
 {
     _orderWorkflowService = orderWorkflowService;
     _accountService       = accountService;
 }