/// <summary> /// Initializes a new instance of the <see cref="SplashscreenViewModel" /> class. /// </summary> /// <param name="settings">The settings.</param> /// <param name="eventAggregator">The event aggregator.</param> public SplashscreenViewModel(SettingsViewModel settings, IEventAggregator eventAggregator) { this._settings = settings; this._eventAggrator = eventAggregator; if (!AssetService.Exists(LottieFileName)) { AssetService.Create(LottieFileName, GetResourceContent(LottieFileName)); } Execute.OnUIThread(async() => { using (var service = new PatreonService()) { var result = await service.IsPledging(); if (result) { return; } this.ShowPatreon = true; this.TrialAvailable = service.TrialAvailable; if (!this.TrialAvailable) { // this.ShowPatreon = true; } } }); }
private static AdminService GetAdminService() { FantasyCriticUserManager userManager = null !; IFantasyCriticUserStore betaUserStore = new MySQLFantasyCriticUserStore(_betaConnectionString, _clock); IMasterGameRepo masterGameRepo = new MySQLMasterGameRepo(_betaConnectionString, betaUserStore); IFantasyCriticRepo fantasyCriticRepo = new MySQLFantasyCriticRepo(_betaConnectionString, betaUserStore, masterGameRepo); InterLeagueService interLeagueService = new InterLeagueService(fantasyCriticRepo, masterGameRepo); LeagueMemberService leagueMemberService = new LeagueMemberService(null !, fantasyCriticRepo, _clock); GameAcquisitionService gameAcquisitionService = new GameAcquisitionService(fantasyCriticRepo, masterGameRepo, leagueMemberService, _clock); ActionProcessingService actionProcessingService = new ActionProcessingService(gameAcquisitionService); FantasyCriticService fantasyCriticService = new FantasyCriticService(leagueMemberService, interLeagueService, fantasyCriticRepo, _clock); IOpenCriticService openCriticService = null !; IGGService ggService = null !; PatreonService patreonService = null !; IRDSManager rdsManager = null !; RoyaleService royaleService = null !; IHypeFactorService hypeFactorService = new LambdaHypeFactorService(_awsRegion, _betaBucket); AdminServiceConfiguration configuration = new AdminServiceConfiguration(true); var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); var realHypeConstantsEnvironments = new List <string>() { "STAGING", "PRODUCTION" }; if (environment is not null && realHypeConstantsEnvironments.Contains(environment.ToUpper())) { configuration = new AdminServiceConfiguration(false); } return(new AdminService(fantasyCriticService, userManager, fantasyCriticRepo, masterGameRepo, interLeagueService, openCriticService, ggService, patreonService, _clock, rdsManager, royaleService, hypeFactorService, configuration, actionProcessingService)); }
public FantasyCriticUserManager(IFantasyCriticUserStore store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <FantasyCriticUser> passwordHasher, IEnumerable <IUserValidator <FantasyCriticUser> > userValidators, IEnumerable <IPasswordValidator <FantasyCriticUser> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <FantasyCriticUser> > logger, IClock clock, PatreonService patreonService) : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger) { _userStore = store; _clock = clock; _patreonService = patreonService; }
/// <summary> /// Updates this instance. /// </summary> private async Task CheckForUpdate() { var updateManager = IoC.Get <UpdateManager>(); this.NeedUpdate = await updateManager.CheckForUpdate(); if (this.NeedUpdate) { var message = new ManaBulbMessage() { IsUpdate = true, View = new UpdateViewModel(UpdateState.NeedUpdate), Action = () => this.Update(), }; this._eventAggregator.PublishOnUIThread(message); return; } else if (this._showUpdateSuccess) { this._showUpdateSuccess = false; this._eventAggregator.PublishOnUIThread(new ManaBulbMessage() { IsUpdate = true, View = new UpdateViewModel(UpdateState.Success), DisplayTime = TimeSpan.FromSeconds(5) }); } else { using (var patreonService = new PatreonService()) { var isPledging = await patreonService.IsPledging(); if (isPledging) { return; } } using (var service = new CollaborationService()) { var collaboration = await service.GetCollaborationAsync(); if (!collaboration.IsExpired()) { this._eventAggregator.PublishOnUIThread(new ManaBulbMessage() { View = new CollaborationViewModel(collaboration), Action = collaboration.Open, DisplayTime = TimeSpan.FromSeconds(6) }); } } } }
public AdminService(FantasyCriticService fantasyCriticService, FantasyCriticUserManager userManager, IFantasyCriticRepo fantasyCriticRepo, IMasterGameRepo masterGameRepo, InterLeagueService interLeagueService, IOpenCriticService openCriticService, IGGService ggService, PatreonService patreonService, IClock clock, IRDSManager rdsManager, RoyaleService royaleService, IHypeFactorService hypeFactorService, AdminServiceConfiguration configuration, ActionProcessingService actionProcessingService) { _fantasyCriticService = fantasyCriticService; _userManager = userManager; _fantasyCriticRepo = fantasyCriticRepo; _masterGameRepo = masterGameRepo; _interLeagueService = interLeagueService; _openCriticService = openCriticService; _ggService = ggService; _patreonService = patreonService; _clock = clock; _rdsManager = rdsManager; _royaleService = royaleService; _hypeFactorService = hypeFactorService; _configuration = configuration; _actionProcessingService = actionProcessingService; }
/// <summary> /// Called when activating. /// </summary> protected override void OnActivate() { this.HasCustomTradeSound = this._soundService.HasCustomTradeAlert(); this.HasCustomItemSound = this._soundService.HasCustomItemAlert(); this.BuildManager.PopulateBuilds(this.SyncBuild); this._activateTask = Task.Run(async() => { using (var service = new PatreonService()) { this.Pledging = await service.IsPledging(); if (!this.Pledging) { this.TrialAvailable = service.TrialAvailable; this.SearchEnabled = false; this.DashboardEnabled = false; this.MapEnabled = false; } else { if (service.IsTrialValid()) { var time = service.GetTrialRemainingTime(); this.BlessingText = GetBlessingText(time); } else { this.BlessingText = "A blessing I can’t deny"; } } } }); this.AlertVolume = (int)(this._settingService.AlertVolume * 100); this.ItemAlertVolume = (int)(this._settingService.ItemAlertVolume * 100); this.JoinHideoutVolume = (int)(this._settingService.JoinHideoutVolume * 100); this.CheckForUpdate(); base.OnActivate(); this._activated = true; }
/// <summary> /// Logins to patreon. /// </summary> public async void LoginToPatreon() { if (this._currentPatreonService != null) { this._currentPatreonService.Cancel(); await Task.Delay(600); } try { using (this._currentPatreonService = new PatreonService()) { if (!this._currentPatreonService.IsConnected) { await this._currentPatreonService.Login(); } this.Pledging = await this._currentPatreonService.IsPledging(); if (this.Pledging) { this.TrialAvailable = false; var time = this._currentPatreonService.GetTrialRemainingTime(); this.BlessingText = GetBlessingText(time); this.SearchEnabled = true; this.MapEnabled = true; this.DashboardEnabled = true; } this.NotifyOfPropertyChange("NotConnected"); } } catch (AuthenticationException) { } }
/// <summary> /// Starts the trial. /// </summary> public async void StartTrial() { await this.ShowProgress("Hold on", "Preparing the trial...", async() => { using (var service = new PatreonService()) { service.StartTrial(); var pledging = await service.IsPledging(); if (pledging) { this.SearchEnabled = true; this.DashboardEnabled = true; var time = service.GetTrialRemainingTime(); this.BlessingText = GetBlessingText(time); } this.TrialAvailable = false; this.Pledging = pledging; SentrySdk.CaptureMessage("New Trial", SentryLevel.Info); } }); }