示例#1
0
        public VehicleTypeService(INetworkRoamingService networkRoamingService, ICacheService cacheService)
        {
            _networkRoamingService = networkRoamingService;
            _cacheService          = cacheService;

            Observe(networkRoamingService.GetAndObserveMarketSettings(), marketSettings => MarketChanged(marketSettings));
        }
示例#2
0
 public GeolocService(IGeocoding geocoding, IAddresses addresses, IDirections directions, INetworkRoamingService networkRoamingService)
 {
     _directions            = directions;
     _networkRoamingService = networkRoamingService;
     _addresses             = addresses;
     _geocoding             = geocoding;
 }
        public UserTaxiHailNetworkSettingsViewModel(IAccountService accountService, INetworkRoamingService networkRoamingService)
        {
            _accountService        = accountService;
            _networkRoamingService = networkRoamingService;

            UserTaxiHailNetworkSettings = new ObservableCollection <ToggleItem>();
        }
        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();
        }
示例#5
0
 public CreditCardAddViewModel(
     ILocationService locationService,
     IPaymentService paymentService,
     IAccountService accountService,
     IDeviceCollectorService deviceCollectorService,
     IPhoneService phoneService,
     INetworkRoamingService networkRoamingService)
     : base(locationService, paymentService, accountService)
 {
     _accountService         = accountService;
     _networkRoamingService  = networkRoamingService;
     _deviceCollectorService = deviceCollectorService;
     _phoneService           = phoneService;
 }
        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();
        }
        public OrderWorkflowService(ILocationService locationService,
                                    IAccountService accountService,
                                    IGeolocService geolocService,
                                    IAppSettings configurationManager,
                                    ILocalization localize,
                                    IBookingService bookingService,
                                    ICacheService cacheService,
                                    IAccountPaymentService accountPaymentService,
                                    INetworkRoamingService networkRoamingService,
                                    IPaymentService paymentService,
                                    ILogger logger,
                                    IPOIProvider poiProvider,
                                    IVehicleTypeService vehicleTypeService,
                                    IDeviceCollectorService deviceCollectorService)
        {
            _cacheService           = cacheService;
            _appSettings            = configurationManager;
            _geolocService          = geolocService;
            _accountService         = accountService;
            _vehicleTypeService     = vehicleTypeService;
            _locationService        = locationService;
            _deviceCollectorService = deviceCollectorService;

            _bookingSettingsSubject = new BehaviorSubject <BookingSettings>(accountService.CurrentAccount.Settings);

            _vehicleTypeSubject = new BehaviorSubject <int?>(
                _appSettings.Data.VehicleTypeSelectionEnabled
                ? accountService.CurrentAccount.Settings.VehicleTypeId
                : null);

            _localize              = localize;
            _bookingService        = bookingService;
            _accountPaymentService = accountPaymentService;
            _networkRoamingService = networkRoamingService;
            _paymentService        = paymentService;
            _logger      = logger;
            _poiProvider = poiProvider;

            _estimatedFareDisplaySubject = new BehaviorSubject <string>(_localize[_appSettings.Data.DestinationIsRequired ? "NoFareTextIfDestinationIsRequired" : "NoFareText"]);

            Observe(_networkRoamingService.GetAndObserveMarketSettings(), marketSettings => MarketChanged(marketSettings).FireAndForget());
            Observe(_vehicleTypeService.GetAndObserveVehiclesList(), vehiclesList => PreselectDefaultVehicleType(vehiclesList));
        }
示例#8
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);
        }
示例#9
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());
        }
示例#10
0
        public AccountService(IAppSettings appSettings,
                              IFacebookService facebookService,
                              ITwitterService twitterService,
                              ILocalization localize,
                              IConnectivityService connectivityService,
                              INetworkRoamingService networkRoamingService,
                              IPaymentService paymentService)
        {
            _localize            = localize;
            _twitterService      = twitterService;
            _facebookService     = facebookService;
            _appSettings         = appSettings;
            _connectivityService = connectivityService;
            _paymentService      = paymentService;

            if (networkRoamingService != null)
            {
                Observe(networkRoamingService.GetAndObserveMarketSettings(), marketSettings => MarketChanged(marketSettings).FireAndForget());
            }
        }
示例#11
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);
        }
示例#12
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);
        }