Exemplo n.º 1
0
 public ReportsManager(IApiFactory apiFactory)
 {
     _socialApi = apiFactory.SocialApi;
 }
 public CartModel(IApiFactory factory)
 {
     _api = factory.BasketApi ?? throw new ArgumentNullException(nameof(_api));
 }
Exemplo n.º 3
0
        public SignupViewModel(
            IApiFactory apiFactory,
            IUserAccessManager userAccessManager,
            IAnalyticsService analyticsService,
            IOnboardingStorage onboardingStorage,
            INavigationService navigationService,
            IErrorHandlingService errorHandlingService,
            ILastTimeUsageStorage lastTimeUsageStorage,
            ITimeService timeService,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory,
            IPlatformInfo platformInfo)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(apiFactory, nameof(apiFactory));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(errorHandlingService, nameof(errorHandlingService));
            Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));

            this.apiFactory           = apiFactory;
            this.userAccessManager    = userAccessManager;
            this.analyticsService     = analyticsService;
            this.onboardingStorage    = onboardingStorage;
            this.errorHandlingService = errorHandlingService;
            this.lastTimeUsageStorage = lastTimeUsageStorage;
            this.timeService          = timeService;
            this.schedulerProvider    = schedulerProvider;
            this.rxActionFactory      = rxActionFactory;
            this.platformInfo         = platformInfo;

            Login        = rxActionFactory.FromAsync(login);
            Signup       = rxActionFactory.FromAsync(signup);
            GoogleSignup = rxActionFactory.FromAsync(googleSignup);
            PickCountry  = rxActionFactory.FromAsync(pickCountry);

            var emailObservable = emailSubject.Select(email => email.TrimmedEnd());

            Shake = shakeSubject.AsDriver(this.schedulerProvider);

            Email = emailObservable
                    .Select(email => email.ToString())
                    .DistinctUntilChanged()
                    .AsDriver(this.schedulerProvider);

            Password = passwordSubject
                       .Select(password => password.ToString())
                       .DistinctUntilChanged()
                       .AsDriver(this.schedulerProvider);

            IsLoading = isLoadingSubject
                        .DistinctUntilChanged()
                        .AsDriver(this.schedulerProvider);

            IsCountryErrorVisible = isCountryErrorVisibleSubject
                                    .DistinctUntilChanged()
                                    .AsDriver(this.schedulerProvider);

            ErrorMessage = errorMessageSubject
                           .DistinctUntilChanged()
                           .AsDriver(this.schedulerProvider);

            CountryButtonTitle = countryNameSubject
                                 .DistinctUntilChanged()
                                 .AsDriver(this.schedulerProvider);

            IsPasswordMasked = isPasswordMaskedSubject
                               .DistinctUntilChanged()
                               .AsDriver(this.schedulerProvider);

            IsShowPasswordButtonVisible = Password
                                          .Select(password => password.Length > 1)
                                          .CombineLatest(isShowPasswordButtonVisibleSubject.AsObservable(), CommonFunctions.And)
                                          .DistinctUntilChanged()
                                          .AsDriver(this.schedulerProvider);

            HasError = ErrorMessage
                       .Select(string.IsNullOrEmpty)
                       .Select(CommonFunctions.Invert)
                       .AsDriver(this.schedulerProvider);

            SignupEnabled = emailObservable
                            .CombineLatest(
                passwordSubject.AsObservable(),
                IsLoading,
                countryNameSubject.AsObservable(),
                (email, password, isLoading, countryName) => email.IsValid && password.IsValid && !isLoading && (countryName != Resources.SelectCountry))
                            .DistinctUntilChanged()
                            .AsDriver(this.schedulerProvider);

            SuccessfulSignup = successfulSignupSubject
                               .AsDriver(this.schedulerProvider);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Testing constructor
 /// </summary>
 /// <param name="username">GitHub username that owns the repository</param>
 /// <param name="repoName">Name of the repository</param>
 /// <param name="apiFactory">Object that can create API clients</param>
 internal UpdateChecker(string username, string repoName, IApiFactory apiFactory)
 {
     _username   = username;
     _repoName   = repoName;
     _apiFactory = apiFactory;
 }
Exemplo n.º 5
0
 public OrderModel(IApiFactory factory)
 {
     _orderApi = factory.OrderApi ?? throw new ArgumentNullException(nameof(_orderApi));
 }
Exemplo n.º 6
0
 public ProductDetailModel(IApiFactory factory, IWebHostEnvironment env)
 {
     _productApi = factory.ProductApi ?? throw new ArgumentNullException(nameof(_productApi));
     _basketApi  = factory.BasketApi ?? throw new ArgumentNullException(nameof(_basketApi));
     _env        = env;
 }
Exemplo n.º 7
0
 public Builder WithApiFactory(IApiFactory apiFactory)
 {
     ApiFactory = apiFactory;
     return(this);
 }
Exemplo n.º 8
0
 public ApiService(ISettingsService settingsService, IApiFactory apiFactory)
 {
     _settingsService = settingsService;
     _apiFactory      = apiFactory;
     _api             = new Lazy <IApi>(CreateApi);
 }
Exemplo n.º 9
0
 public FriendsManager(IApiFactory apiFactory, IPreferencesService preferencesService)
 {
     _preferencesService = preferencesService;
     _socialApi          = apiFactory.SocialApi;
 }
Exemplo n.º 10
0
 public ViewModelFactory(IApiFactory apiFactory, Action <string> snackbarMessageQueue, CurrentState currentState)
 {
     _apiFactory           = apiFactory;
     _snackbarMessageQueue = snackbarMessageQueue;
     _currentState         = currentState;
 }
 public RegistrationModel(IApiFactory factory)
 {
     _usersApi = factory.UsersApi ?? throw new ArgumentNullException(nameof(_usersApi));
 }
Exemplo n.º 12
0
 public CallbackMessageHandler(IApiFactory factory)
 {
     _callbackValidator = factory.CreateCallbackValidator();
 }
 public IndexModel(IApiFactory factory)
 {
     _productApi = factory.ProductApi ?? throw new ArgumentNullException(nameof(_productApi));
     _basketApi  = factory.BasketApi ?? throw new ArgumentNullException(nameof(_basketApi));
 }
 public CheckOutModel(IApiFactory factory)
 {
     _basketApi = factory.BasketApi ?? throw new ArgumentNullException(nameof(_basketApi));
     _orderApi  = factory.OrderApi ?? throw new ArgumentNullException(nameof(_orderApi));
     _usersApi  = factory.UsersApi ?? throw new ArgumentNullException(nameof(_usersApi));
 }
Exemplo n.º 15
0
 protected ApiFactoryController(IApiFactory apiFactory)
 {
     ApiFactory = apiFactory ?? throw new ArgumentNullException(nameof(apiFactory));
 }
 public AddProductModel(IApiFactory factory, IMapper mapper, IWebHostEnvironment env)
 {
     _productApi = factory.ProductApi ?? throw new ArgumentNullException(nameof(_productApi));
     _mapper     = mapper;
     _env        = env;
 }