Skip to content

Commit

Permalink
LUN-520: Fix editing bug (#454)
Browse files Browse the repository at this point in the history
* LUN-520: Remove unnecessary save

* LUN-520: Remove Promise

* LUN-520: Check if photo exists before saving

* LUN-520: Use timestamp for photo naming

* LUN-520: Remove test code
  • Loading branch information
LeandraH authored Jul 11, 2023
1 parent 2f71e4d commit c8fa139
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions release-notes/unreleased/LUN-520-edit-photo-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
issue_key: LUN-520
show_in_stores: true
platforms:
- ios
de: Ein Fehler beim Bearbeiten der eigenen Vokabeln wurde behoben.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ const UserVocabularyProcessScreen = ({ navigation, route }: UserVocabularyProces

const imagePaths = await Promise.all(
images.map(async (image, index) => {
const path = `file:///${DocumentDirectoryPath}/image-${id}-${index}.jpg`
const timestamp = Date.now()
const path = `file:///${DocumentDirectoryPath}/image-${id}-${index}-${timestamp}.jpg`
await moveFile(image, path)
return { id: index, image: path }
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jest.mock('react-native-image-crop-picker', () => ({
openPicker: jest.fn(),
}))

Date.now = jest.fn(() => 2000)

describe('UserVocabularyProcessScreen', () => {
const navigation = createNavigationMock<'UserVocabularyProcess'>()
const getRoute = (itemToEdit?: VocabularyItem): RouteProp<RoutesParams, 'UserVocabularyProcess'> => ({
Expand Down Expand Up @@ -76,8 +78,8 @@ describe('UserVocabularyProcessScreen', () => {
word: 'Auto',
article: ARTICLES[3],
images: [
{ id: 0, image: `file:///${DocumentDirectoryPath}/image-2-0.jpg` },
{ id: 1, image: `file:///${DocumentDirectoryPath}/image-2-1.jpg` },
{ id: 0, image: `file:///${DocumentDirectoryPath}/image-2-0-2000.jpg` },
{ id: 1, image: `file:///${DocumentDirectoryPath}/image-2-1-2000.jpg` },
],
audio: `file:///${DocumentDirectoryPath}/audio-2.m4a`,
alternatives: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const MeteringInfo = styled.View`
const MeteringBar = styled.View<{ height: number }>`
min-height: ${props => props.theme.spacings.xxs};
height: ${props => `${props.height * 2}`}px;
width: ${props => props.theme.spacings.xxs}
width: ${props => props.theme.spacings.xxs};
background-color: ${props => props.theme.colors.audioRecordingActive};
border-radius: 50px;
align-self: center;
Expand Down

0 comments on commit c8fa139

Please sign in to comment.