Rocket.Chat.ReactNative/app/lib/methods/helpers/ImagePicker/ImagePicker.mock.ts

46 lines
7.6 KiB
TypeScript

import { random } from 'lodash';
import { Image as ImageType, ImageOrVideo as ImageOrVideoType } from 'react-native-image-crop-picker';
export type Image = ImageType;
export type ImageOrVideo = ImageOrVideoType;
const mockImageRocketBase64 =
'/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAmKADAAQAAAABAAAAmAAAAAD/7QA4UGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAAA4QklNBCUAAAAAABDUHYzZjwCyBOmACZjs+EJ+/8AAEQgAmACYAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/bAEMAAgICAgICAwICAwQDAwMEBQQEBAQFBwUFBQUFBwgHBwcHBwcICAgICAgICAoKCgoKCgsLCwsLDQ0N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h2HwzqUNraWoMb3LW6EPcyRgEFyxIUbwX2qFGSM5xXhPXiisIZbhoctoL3dup6uL48z7Euu6uJb9ukp7LmSVle1umh2Hgvx54o8AaodX8K3ptJnGyVCqyRTR5ztkRgQw9DjI6gg17D/w1R8WP+e+n/8AgKtfN3NLzV1sBQqy56kU36HDl/Fuc4Cj9XwWJnCG9lJpX9Ef/9b8K6KKK+kPHCiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP/X/CuiiivpDxwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigD/0Pwrooor6Q8cKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9k=';
const image = {
exif: null,
filename: 'IMG_0007.PNG',
path: `/tmp/react-native-image-crop-picker/${random(20)}.jpg`,
height: 152,
width: 152,
data: mockImageRocketBase64,
modificationDate: null,
localIdentifier: 'CEEE9916-81FD-4544-9D86-7044DB6C4374/L0/001',
size: 5006,
sourceURL: `/tmp/react-native-image-crop-picker/${random(20)}.jpg`,
mime: 'image/jpeg',
cropRect: {
width: 152,
height: 152,
x: 134,
y: 0
},
duration: null,
creationDate: '1679327100'
};
export function openPicker(options: any): Promise<any> {
const mockImageRocketBase64 = options?.multiple ? [image] : image;
return Promise.resolve(mockImageRocketBase64);
}
export function openCamera(options: any): Promise<any> {
const mockImageRocketBase64 = options?.multiple ? [image] : image;
return Promise.resolve(mockImageRocketBase64);
}
export default {
openPicker,
openCamera
};