Exemplo n.º 1
0
 public UtilityService(IPhotosService photoService, IConversationService conversationService, IProfileService profileService, IKatushaDbContext dbContext, IDocumentStore ravenStore,
                       IPhotoRepositoryDB photoRepository, IProfileRepositoryDB profileRepository, IUserRepositoryDB userRepository, IPhotoBackupService photoBackupService,
                       ICountriesToVisitRepositoryDB countriesToVisitRepository, ILanguagesSpokenRepositoryDB languagesSpokenRepository, ISearchingForRepositoryDB searchingForRepository,
                       IConversationRepositoryDB conversationRepository, IProfileRepositoryRavenDB profileRepositoryRaven, IVisitRepositoryRavenDB visitRepositoryRaven, IConversationRepositoryRavenDB conversationRepositoryRaven,
                       IKatushaFileSystem fileSystem)
 {
     _conversationRepositoryRaven = conversationRepositoryRaven;
     _fileSystem                 = fileSystem;
     _visitRepositoryRaven       = visitRepositoryRaven;
     _profileRepositoryRaven     = profileRepositoryRaven;
     _photoRepository            = photoRepository;
     _photoService               = photoService;
     _conversationService        = conversationService;
     _profileService             = profileService;
     _conversationRepository     = conversationRepository;
     _countriesToVisitRepository = countriesToVisitRepository;
     _languagesSpokenRepository  = languagesSpokenRepository;
     _searchingForRepository     = searchingForRepository;
     _ravenStore                 = ravenStore as KatushaRavenStore;
     _profileRepository          = profileRepository;
     _userRepository             = userRepository;
     _photoBackupService         = photoBackupService;
     _dbContext       = dbContext; // as KatushaDbContext;
     _resourceManager = ResourceManager.GetInstance();
     _countries       = _resourceManager.GetCountries();
     _languages       = _resourceManager.GetLanguages();
 }
Exemplo n.º 2
0
 public ProfileGenerator(IProfileService profileService, IUserService userService, IPhotosService photosService, IResourceService resourceService)
 {
     _profileService  = profileService;
     _userService     = userService;
     _photosService   = photosService;
     _resourceService = resourceService;
 }
Exemplo n.º 3
0
 public AdvertisementItemController(IPhotosService advertisementItemPhotosUploader, IAdvertisementItemService advertisementItemService, IIdentityService identityService, ILoggerFactory loggerFactory)
 {
     this.advertisementItemPhotosUploader = advertisementItemPhotosUploader;
     this.advertisementItemService        = advertisementItemService;
     this.identityService = identityService;
     this.logger          = loggerFactory.CreateLogger <AdvertisementItemController>();
 }
        public UsersController(
            IUsersService usersService,
            IPhotosService photosService,
            ITextSplitter textSplitter,
            ISystem system,
            ILogWriterFactory logWriterFactory)
        {
            if (textSplitter is null)
            {
                throw new ArgumentNullException(nameof(textSplitter));
            }

            if (system is null)
            {
                throw new ArgumentNullException(nameof(system));
            }

            if (logWriterFactory is null)
            {
                throw new ArgumentNullException(nameof(logWriterFactory));
            }

            this.usersService  = usersService ?? throw new ArgumentNullException(nameof(usersService));
            this.photosService = photosService ?? throw new ArgumentNullException(nameof(photosService));

            var imageAssetHost = new Uri(system.Environment.GetVariable(Constants.EnvironmentVariables.StaticAssetHost));

            this.photoModelConverter = new PhotoModelConverter(imageAssetHost, textSplitter, logWriterFactory);

            AWSSDKHandler.RegisterXRayForAllServices();
        }
Exemplo n.º 5
0
 public ConversationService(IConversationDbService conversationDbService, IPhotosService photosService, IApplicationUserManager applicationUserManager, AppConfiguration appConfiguration)
 {
     this.conversationDbService  = conversationDbService;
     this.photosService          = photosService;
     this.applicationUserManager = applicationUserManager;
     this.appConfiguration       = appConfiguration;
 }
Exemplo n.º 6
0
 public PhotosController(IPhotosService photosService, ICurrentUserService currentUserService, IUsersService usersService, IHostingEnvironment environment)
 {
     _photosService      = photosService;
     _environment        = environment;
     _currentUserService = currentUserService;
     _usersService       = usersService;
 }
        public PhotosController(
            IPhotosService photosService,
            IUsersService usersService,
            ITextSplitter textSplitter,
            ISystem system,
            ILogWriterFactory loggerFactory)
        {
            if (textSplitter is null)
            {
                throw new ArgumentNullException(nameof(textSplitter));
            }


            if (loggerFactory is null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            this.photosService = photosService ?? throw new ArgumentNullException(nameof(photosService));
            this.usersService  = usersService ?? throw new ArgumentNullException(nameof(usersService));
            this.system        = system ?? throw new ArgumentNullException(nameof(system));
            logger             = loggerFactory.CreateLogger <PhotosController>();
            lazyClaims         = new Lazy <Claim[]>(() => GetUserClaims());


            var staticAssetHost = new Uri(system.Environment.GetVariable(Constants.EnvironmentVariables.StaticAssetHost));

            this.photoModelConverter = new PhotoModelConverter(staticAssetHost, textSplitter, loggerFactory);
            AWSSDKHandler.RegisterXRayForAllServices();
        }
Exemplo n.º 8
0
        public PhotoListViewModel(IRouter router = null, IPhotosService service = null)
            : base(router)
        {
            Service = service ?? Locator.Current.GetService <IPhotosService>();
            var canLoad = Resumed.FirstAsync().Select(r => r?.LoadedPhotos == null);

            LoadPhotos = ReactiveCommand.CreateAsyncTask(canLoad, async o => await Service.GetPhotosAsync());
            var canLoadData = this.WhenAnyValue(vm => vm.LoadedPhotos)
                              .Select(p => p != null);

            LoadPhotoData = ReactiveCommand.CreateAsyncTask(canLoadData, async o => await LoadPhotoDataImpl());
            Share         = ReactiveCommand.CreateAsyncTask(async o => await ShareImpl());
            ShowPhoto     = ReactiveCommand.CreateAsyncTask(async p => await ShowPhotoImpl((int)p));
            loadedPhotos  = Resumed.Select(state => state?.LoadedPhotos).Merge(LoadPhotos)
                            .ObserveOn(RxApp.MainThreadScheduler)
                            .ToProperty(this, vm => vm.LoadedPhotos, new Photo[0]);
            loadedPhotoBytes = LoadPhotoData
                               .ObserveOn(RxApp.MainThreadScheduler)
                               .ToProperty(this, vm => vm.LoadedPhotoData);
            isLoading = LoadPhotos.IsExecuting.CombineLatest(LoadPhotoData.IsExecuting, (l, ld) => l || ld)
                        .DistinctUntilChanged()
                        .ObserveOn(RxApp.MainThreadScheduler)
                        .ToProperty(this, vm => vm.IsLoading);

            this.WhenAnyValue(vm => vm.LoadedPhotos)
            .InvokeCommand(this, vm => vm.LoadPhotoData);
        }
Exemplo n.º 9
0
 public PhotosController(IWebHostEnvironment webHostEnvironment, UserManager <ApplicationUser> userManager, IPhotosService photosService, ICommentsService commentsService)
 {
     this.webHostEnvironment = webHostEnvironment;
     this.userManager        = userManager;
     this.photosService      = photosService;
     this.commentsService    = commentsService;
 }
Exemplo n.º 10
0
        private async Task <string> ProcessImages(
            S3Event s3Event,
            IImageScaler imageScaler,
            ILogWriter <ImageResizeHandler> logger,
            IPhotosService photoService)
        {
            logger.LogInformation($"{nameof(ProcessImages)}");

            var s3Entity = s3Event.Records?[0].S3;

            if (s3Entity == null)
            {
                logger.LogCritical($"{nameof(s3Entity)} is null");
                return("NULL");
            }

            var     urlDecodedKey = System.Web.HttpUtility.UrlDecode(s3Entity.Object.Key);
            UserId  userId        = GetUserIdFromKey(urlDecodedKey);
            PhotoId photoId       = GetPhotoIdFromKey(urlDecodedKey);

            try
            {
                logger.LogInformation($"{nameof(urlDecodedKey)} is '{urlDecodedKey}'");



                await photoService.SetPhotoState(userId, photoId, PhotoState.ProcessingStarted);

                // generate filenames to use for the scaled images
                ImageKeys imageKeys = GetImageKeysWithoutExtension(urlDecodedKey);

                IEnumerable <Size> imageSizes;

                using (var s3InputObject = await S3Client.GetObjectAsync(s3Entity.Bucket.Name, urlDecodedKey))
                    using (var originalImageStream = new MemoryStream())
                    {
                        await ReadImageIntoStream(logger, originalImageStream, s3InputObject.ResponseStream);

                        imageSizes = await CreateScaledImages(imageScaler, logger, imageKeys, originalImageStream, GetTargetBucket());
                    }

                logger.LogInformation($"Updating photo data, making it available.");
                await UpdatePhotoData(photoService, photoId, imageSizes);

                // finish with deleting the upload file
                await DeleteOriginalSourceFile(logger, s3Entity, urlDecodedKey);

                logger.LogInformation($"Done with {urlDecodedKey}");
                return("OK");
            }
            catch (Exception ex)
            {
                logger.LogError(ex, $"Error when resizing {s3Entity.Object.Key} from bucket {s3Entity.Bucket.Name}:\n{ex.ToString()}");
                // set photo state to ProcessingFailed
                await photoService.SetPhotoState(userId, photoId, PhotoState.ProcessingFailed);

                throw;
            }
        }
 public ApplicationSignInManager(SignInManager <ApplicationUser> signInManager, IApplicationUserManager applicationUserManager, IFacebookApiManager facebookApiManager, IPhotosService advertisementItemPhotosUploader, TokenAuthorizationOptions tokenAuthorizationOptions)
 {
     this.signInManager                   = signInManager;
     this.applicationUserManager          = applicationUserManager;
     this.facebookApiManager              = facebookApiManager;
     this.advertisementItemPhotosUploader = advertisementItemPhotosUploader;
     this.tokenAuthorizationOptions       = tokenAuthorizationOptions;
 }
Exemplo n.º 12
0
        private static async Task UpdatePhotoData(IPhotosService photoService, PhotoId photoId, IEnumerable <Size> imageSizes)
        {
            var photoFromDb = await photoService.GetPhoto(photoId, Guid.Empty);

            photoFromDb.State = PhotoState.PhotoAvailable;
            photoFromDb.Sizes = imageSizes;
            await photoService.UpdatePhoto(photoFromDb);
        }
Exemplo n.º 13
0
 public SampleGenerator(IProfileService profileService, IUserService userService, IPhotosService photosService, IConversationService conversationService, IVisitService visitService, IResourceService resourceService)
 {
     _profileService = profileService;
     _userService = userService;
     _photosService = photosService;
     _conversationService = conversationService;
     _visitService = visitService;
     _resourceService = resourceService;
 }
Exemplo n.º 14
0
 public SampleGenerator(IProfileService profileService, IUserService userService, IPhotosService photosService, IConversationService conversationService, IVisitService visitService, IResourceService resourceService)
 {
     _profileService      = profileService;
     _userService         = userService;
     _photosService       = photosService;
     _conversationService = conversationService;
     _visitService        = visitService;
     _resourceService     = resourceService;
 }
Exemplo n.º 15
0
 public AlbumsAndPhotosService(
     IAlbumsService albumsService,
     IPhotosService photosService,
     IAlbumsAndPhotosHelper albumsAndPhotosHelper)
 {
     _albumsService         = albumsService;
     _photosService         = photosService;
     _albumsAndPhotosHelper = albumsAndPhotosHelper;
 }
Exemplo n.º 16
0
 public RealEstatesController(IRealEstatesService realEstatesService, IPhotosService photosService, IVisitorsService visitorsService,
                              IUsersService usersService, IUsersRolesService rolesService, IRealEstateCreateUtil util)
 {
     this.realEstatesService = realEstatesService;
     this.photosService      = photosService;
     this.visitorsService    = visitorsService;
     this.usersService       = usersService;
     this.rolesService       = rolesService;
     this.util = util;
 }
Exemplo n.º 17
0
 public ApiController(IResourceService resourceService, IUserService userService, IProfileService profileService,
                      IConversationService conversationService, IStateService stateService, IUtilityService utilityService,
                      ISearchService searchService, IPhotosService photoService
                      )
     : base(resourceService, userService, profileService, stateService, conversationService)
 {
     _searchService  = searchService;
     _photoService   = photoService;
     _utilityService = utilityService;
 }
 public RealEstatesController(IRealEstatesService realEstatesService, IPhotosService photosService, IVisitorsService visitorsService,
     IUsersService usersService, IUsersRolesService rolesService, IRealEstateCreateUtil util)
 {
     this.realEstatesService = realEstatesService;
     this.photosService = photosService;
     this.visitorsService = visitorsService;
     this.usersService = usersService;
     this.rolesService = rolesService;
     this.util = util;
 }
Exemplo n.º 19
0
 public ApiController(IResourceService resourceService, IUserService userService, IProfileService profileService, 
     IConversationService conversationService, IStateService stateService, IUtilityService utilityService,
     ISearchService searchService, IPhotosService photoService
     )
     : base(resourceService, userService, profileService, stateService, conversationService)
 {
     _searchService = searchService;
     _photoService = photoService;
     _utilityService = utilityService;
 }
Exemplo n.º 20
0
        private static void InjectServices()
        {
            _likesService          = ServiceInjector.Retrieve <ILikesService>();
            _apiFactory            = ServiceInjector.Retrieve <IVkApiFactory>();
            _photoService          = ServiceInjector.Retrieve <IPhotosService>();
            _configurationProvider = ServiceInjector.Retrieve <IConfigurationProvider>();
            _likeClickerService    = ServiceInjector.Retrieve <ILikeClickerService>();

            _userService = ServiceInjector.Retrieve <UserService>();
        }
 public AdvertisementItemService(IAdvertisementItemDbService advertisementItemDbService, ICoordinatesCalculator coordinatesCalculator, IPhotosService photosService, IAppFilesPathHelper appFilesPathHelper, IKeywordsService keywordsService, IChatHubCacheService chatHubCacheService, ILastUsersChecksCacheService lastUsersChecksCacheService, IGoogleMapsAPIService googleMapsAPIService)
 {
     this.advertisementItemDbService = advertisementItemDbService;
     this.coordinatesCalculator      = coordinatesCalculator;
     this.photosService               = photosService;
     this.appFilesPathHelper          = appFilesPathHelper;
     this.keywordsService             = keywordsService;
     this.chatHubCacheService         = chatHubCacheService;
     this.lastUsersChecksCacheService = lastUsersChecksCacheService;
     this.googleMapsAPIService        = googleMapsAPIService;
 }
Exemplo n.º 22
0
 public HomeController(
     IAlbumsService albumsService,
     ICommentsService commentsService,
     IPhotosService photosService,
     ILogger <HomeController> logger)
 {
     _albumsService   = albumsService;
     _commentsService = commentsService;
     _photosService   = photosService;
     _logger          = logger;
 }
Exemplo n.º 23
0
 public PhotosController(IMapper mapper,
                         IPhotosService photos,
                         IVehiclesService vehicles,
                         IHostingEnvironment host,
                         IOptionsSnapshot <PhotoSettings> options)
     : base(mapper)
 {
     _photos        = photos;
     _vehicles      = vehicles;
     _host          = host;
     _photoSettings = options.Value;
 }
Exemplo n.º 24
0
        public ItemsViewModel(
            IItemsService itemsService,
            ILoadsService loadsService,
            IPhotosService photosService)
        {
            this._ItemsService  = itemsService;
            this._LoadsService  = loadsService;
            this._PhotosService = photosService;

            if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            }
        }
Exemplo n.º 25
0
 public UtilitiesController(INotificationService notificationService, IResourceService resourceService, IUserService userService, IProfileService profileService, 
     ISamplesService samplesService, IVisitService visitService, IConversationService conversationService, IStateService stateService,
     IPhotosService photosService, IUtilityService utilityService, IKatushaGlobalCacheContext globalCacheContext
     )
     : base(resourceService, userService, profileService, stateService, conversationService)
 {
     _notificationService = notificationService;
     _globalCacheContext = globalCacheContext;
     _samplesService = samplesService;
     _visitService = visitService;
     _conversationService = conversationService;
     _photosService = photosService;
     _utilityService = utilityService;
 }
Exemplo n.º 26
0
 public UtilitiesController(INotificationService notificationService, IResourceService resourceService, IUserService userService, IProfileService profileService,
                            ISamplesService samplesService, IVisitService visitService, IConversationService conversationService, IStateService stateService,
                            IPhotosService photosService, IUtilityService utilityService, IKatushaGlobalCacheContext globalCacheContext
                            )
     : base(resourceService, userService, profileService, stateService, conversationService)
 {
     _notificationService = notificationService;
     _globalCacheContext  = globalCacheContext;
     _samplesService      = samplesService;
     _visitService        = visitService;
     _conversationService = conversationService;
     _photosService       = photosService;
     _utilityService      = utilityService;
 }
Exemplo n.º 27
0
        public PhotoViewModel(IRouter router = null, IPhotosService service = null) : base(router)
        {
            Service = service ?? Locator.Current.GetService <IPhotosService>();
            var canLoadData = this.WhenAnyValue(vm => vm.Photo)
                              .Select(p => p != null);

            LoadPhotoData = ReactiveCommand.CreateAsyncTask(canLoadData, async o => await LoadPhotoDataImpl());
            photo         = OnActivated.Select(p => p.Photo)
                            .ToProperty(this, vm => vm.Photo);
            photoData = LoadPhotoData
                        .ObserveOn(RxApp.MainThreadScheduler)
                        .ToProperty(this, vm => vm.PhotoData);
            isLoading = LoadPhotoData.IsExecuting
                        .ObserveOn(RxApp.MainThreadScheduler)
                        .ToProperty(this, vm => vm.IsLoading);
            this.WhenAnyValue(vm => vm.Photo)
            .InvokeCommand(this, vm => vm.LoadPhotoData);
        }
Exemplo n.º 28
0
        public ShareViewModel(IRouter router = null, IPhotosService service = null)
            : base(router)
        {
            Service = service ?? Locator.Current.GetService <IPhotosService>();
            var canShare = this.WhenAny(vm => vm.PhotoUrl, url => !string.IsNullOrEmpty(url.Value));

            Share = ReactiveCommand.CreateAsyncTask(canShare, async o =>
            {
                var photo = new Photo
                {
                    PhotoUrl = PhotoUrl
                };
                await Service.SharePhotoAsync(photo);
                await Router.ShowAsync <PhotoViewModel, PhotoViewModel.Params>(new PhotoViewModel.Params
                {
                    Photo = photo
                });
            });
        }
Exemplo n.º 29
0
        public TagsController(
            IPhotosService photosService,
            ITextSplitter textSplitter,
            ISystem system,
            ILogWriterFactory loggerFactory)
        {
            if (system is null)
            {
                throw new ArgumentNullException(nameof(system));
            }

            this.textSplitter  = textSplitter ?? throw new ArgumentNullException(nameof(textSplitter));
            this.loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
            this.photosService = photosService ?? throw new System.ArgumentNullException(nameof(photosService));

            var imageAssetHost = new Uri(system.Environment.GetVariable(Constants.EnvironmentVariables.StaticAssetHost));

            this.photoModelConverter = new PhotoModelConverter(imageAssetHost, textSplitter, loggerFactory);
            lazyClaims = new Lazy <Claim[]>(() => GetUserClaims());

            AWSSDKHandler.RegisterXRayForAllServices();
        }
Exemplo n.º 30
0
 public PhotosViewModel(IPhotosService photosService)
 {
     _PhotosService = photosService;
 }
Exemplo n.º 31
0
 public AlbumsController(IAlbumsService albumsService, IPhotosService photosService, IAlbumAggregator albumAggregator)
 {
     _albumsService   = albumsService;
     _photosService   = photosService;
     _albumAggregator = albumAggregator;
 }
 public PhotosController(ILogger <PhotosController> logger, IPhotosService photosService, IAuthorizationService authorizationService)
 {
     _logger                   = logger;
     this.photosService        = photosService;
     this.authorizationService = authorizationService;
 }
Exemplo n.º 33
0
 public PhotosController(IPhotosService service)
 {
     this.service = service;
 }
 public AgencyRealEstatesController(IRealEstatesService realEstatesService, IPhotosService photosService, IVisitorsService visitorsService,
     IUsersService usersService, IUsersRolesService rolesService, IRealEstateCreateUtil util)
     : base(realEstatesService, photosService, visitorsService, usersService, rolesService, util)
 {
 }
Exemplo n.º 35
0
 public SamplesService(IUserService userService, IProfileService profileService, IPhotosService photosService, IConversationService conversationService, IVisitService visitService, IResourceService resourceService)
 {
     _generator = new SampleGenerator(profileService, userService, photosService, conversationService, visitService, resourceService);
 }
 public RealEstateCreateUtil(IPhotosService photosService)
 {
     this.photosService = photosService;
 }
Exemplo n.º 37
0
 public FavoritePhotosViewModel(IPhotosService photosService, INavigationService navigationService) : base(photosService, navigationService)
 {
     this.RefreshCommand         = new AsyncCommand(async() => await this.GetFavoritePhotosAsync(), (_) => !this.Loading);
     this.ShowPhotoDetailCommand = new AsyncCommand(async() => await this.ShowPhotoDetailAsync());
 }
Exemplo n.º 38
0
 public PhotosController(IResourceService resourceService, IUserService userService, IProfileService profileService, IPhotosService photosService, IStateService stateService, IConversationService conversationService)
     : base(resourceService, userService, profileService, stateService, conversationService)
 {
     _profileService = profileService;
     _photosService = photosService;
 }