<commit_before>/*
 Copyright 2015 OpenMarket Ltd
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

#import <AVFoundation/AVFoundation.h>
#import "MXKMediaLoader.h"

/**
 The predefined folder for avatar thumbnail.
 */
extern NSString *const kMXKMediaManagerAvatarThumbnailFolder;

/**
 `MXKMediaManager` class provide multiple services related to media handling: cache storage, downloading, uploading.
 
 Cache is handled by folders. A specific folder is defined to store avatar thumbnails `kMXKMediaManagerAvatarThumbnailFolder`.
 Other folders creation is free.
 
 Media upload is based on matrix content repository. It requires a matrix session.
 */
@interface MXKMediaManager : NSObject

#pragma mark - File handling

/**
 Write data into the provided file path
 
 @param mediaData
 @param filePath
 @return YES on sucess.
 */
+ (BOOL)writeMediaData:(NSData *)mediaData toFilePath:(NSString*)filePath;

/**
 Load an image from its local storage path.
 The images are cached in a LRU cache.
 So, it should be faster than calling loadPictureFromFilePath;
 
 @param filePath picture file path.
 @return Image (if any).<commit_msg>Comment updates after review.<commit_after>/*
 Copyright 2015 OpenMarket Ltd
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

#import <AVFoundation/AVFoundation.h>
#import "MXKMediaLoader.h"

/**
 The predefined folder for avatar thumbnail.
 */
extern NSString *const kMXKMediaManagerAvatarThumbnailFolder;

/**
 `MXKMediaManager` class provide multiple services related to media handling: cache storage, downloading, uploading.
 
 Cache is handled by folders. A specific folder is defined to store avatar thumbnails `kMXKMediaManagerAvatarThumbnailFolder`.
 Other folders creation is free.
 
 Media upload is based on matrix content repository. It requires a matrix session.
 */
@interface MXKMediaManager : NSObject

#pragma mark - File handling

/**
 Write data into the provided file path
 
 @param mediaData
 @param filePath
 @return YES on sucess.
 */
+ (BOOL)writeMediaData:(NSData *)mediaData toFilePath:(NSString*)filePath;

/**
 Load an image in memory cache.
 The images are cached in a LRU cache if they are not yet loaded.
 So, it should be faster than calling loadPictureFromFilePath;
 
 @param filePath picture file path.
 @return Image (if any).
{'fraction_non_alphanumeric': 0.06393392474762924, 'fraction_numerical': 0.004894463138574488, 'mean_word_length': 4.440931780366056, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4377003', 'n_tokens_mistral': 870, 'n_tokens_neox': 797, 'n_words': 408}