Rocket.Chat.ReactNative/app/views/ChangeAvatarView/ImagePicker.mock.ts

37 lines
7.3 KiB
TypeScript
Raw Normal View History

feat: Change Avatar View (#4746) * [NEW] Change Avatar View * change avatar view and avatar suggestion * avatar Url * change avatar for profile it's done, missing fix revalidate the avatar in profile and drawer * pick image * clean profile view * Finished the profile and fixed the avatar when change the user profile * fix the profile update through all the app * refactor avatar suggestion * fix the delete from rooms and finished RoomInfoView, missing RoomInfoEditView * room info edit view * ipad navigation * refactor the submit function * refactor the e2e test * minor tweak with themes and buttons * minor tweak in edit button * minor tweaks * tweak IAvatarContainer * fixing pt-br * removed the avatarETagUser and search by username and text * created the useHooke useAvatarETag * fix lint * refactor image.ts and test * refactor avatar component * fix the edit button * refactor useAvatarETag * fix the pt-br translation * minor tweak tests * back handleError to views and refactor the submit * avatar suggestion item * types for change avatar view context * fix avatar on header for tablets * minor tweak changeavatarview * refactor avatar url to use hook form * tweak on yup validation * minor tweak with handle error * minor tweak * minor tweak * interface avatar container * minor tweak * Refactor all the changeAvatarView and fix how to test the image url * fixed the layout * minor refactor * minor tweaks * fix the visual bug when the user change the avatar to new then clear cache * fix the flicker when upload an image * update package.json * test the reset, discard alert, cancel and discard * separate the avatar test from profile and create new tests for change avatar * mock imagepicker * minor tweak, adding console and add echo to config.yml * use RUNNING_E2E_TESTS as env to other files * exprt env at android build * change the to way to set the running e2e test env * update test * delete the .env and update the e2e/readme and the file review * minor tweak * minor tweak * update the test, fixing how to dismiss the keyboard --------- Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>
2023-04-10 14:59:00 +00:00
import { Image as ImageInterface } from 'react-native-image-crop-picker';
import { random } from '../../lib/methods/helpers';
export type Image = ImageInterface;
const mockImageRocketBase64 =
'/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAmKADAAQAAAABAAAAm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fj341WFI2j0I3SWKqPlh+0S7eMYwyxExkf7Rr3XwT4Y8O/AL4cTjWL9Wjgd73ULsrs82ZwqhIlJJ6KqIuclucDJFfGHwd+LUGkfGO98U+Iitva+JXuYrqQlQlu1zIJEYkr9xXUKx+XAO49MV51GDrvFVcMvca08/61PtczxVHKIcO4HP5J4inK8ru/LFppXflLl1/us6n9rbxdqt34utfB6yGPTrC1juDGD/rZ58ku3H8KhQBzjkjG7FfI6O6MJEJVlOQRwQfY9sf59a/Sb4+fA24+JP2fxR4WmQ6zbQrA0MjgRXUAbKlHZtqMu4kdmHcY5+WtJ/Zh+Luo3i217psGmx7gr3FxdQuigjJIELyM3p8qnn6HHs5PmWEhhIwlJRa3TPy3xS4E4nxfFFfEU8POrGo7xlFNrl6ara3mUvglq2qa58b/DupaxcyXl28rI80zb3ZYrV40yx5O1FAyeeOc9a/Q/xV4A0bxf4p8O65rOyePw+LyWK0dQwlmuPJCOckZWMx5wRgkjPv8N+CfBqfD79pbSfCKXRvPsMke6crs3vNYec2FBOAGcgDJ4A5Ne+ftGePdc+HHiHwV4j0NlLgapHPC/3J4CbQvG3scAg9QQDXl5tGVfGUlhnbmjp+J+h+G2IoZNwlj559DmVLEJTV76qUNfPlevnax51+1f8AEfXU1JPhxZxTWVgYo7u5mJKi9D8oq8AGJGBB6hpFIIG3m
export function openPicker(_options: any): Promise<any> {
return Promise.resolve({
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 default {
openPicker
};