Skip to content

Commit 0bd93b5

Browse files
minar changes
1 parent 72a6951 commit 0bd93b5

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

app/src/main/java/fr/free/nrw/commons/upload/depicts/DepictsDao.kt

+13-13
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ import java.util.*
1111
abstract class DepictsDao {
1212

1313
@Insert(onConflict = OnConflictStrategy.REPLACE)
14-
abstract suspend fun insert(depictedItem: Depicts);
14+
abstract suspend fun insert(depictedItem: Depicts)
1515

1616
@Query("Select * From depicts_table order by lastUsed DESC")
17-
abstract suspend fun getAllDepict(): List<Depicts>;
17+
abstract suspend fun getAllDepict(): List<Depicts>
1818

1919
@Query("Select * From depicts_table order by lastUsed DESC LIMIT :n OFFSET 10")
20-
abstract suspend fun getItemToDelete(n: Int): List<Depicts>;
20+
abstract suspend fun getItemToDelete(n: Int): List<Depicts>
2121

2222
@Delete
23-
abstract suspend fun delete(depicts: Depicts);
23+
abstract suspend fun delete(depicts: Depicts)
2424

25-
lateinit var allDepict: List<Depicts>;
26-
lateinit var listOfDelete: List<Depicts>;
25+
lateinit var allDepict: List<Depicts>
26+
lateinit var listOfDelete: List<Depicts>
2727

2828
fun depictsList(): List<Depicts> {
2929
runBlocking {
3030
launch(Dispatchers.IO) {
31-
allDepict = getAllDepict();
31+
allDepict = getAllDepict()
3232
}
3333
}
34-
return allDepict;
34+
return allDepict
3535
}
3636

3737
/**
@@ -40,7 +40,7 @@ abstract class DepictsDao {
4040
fun insertDepict(depictes: Depicts) {
4141
runBlocking {
4242
launch(Dispatchers.IO) {
43-
insert(depictes);
43+
insert(depictes)
4444
}
4545
}
4646
}
@@ -51,10 +51,10 @@ abstract class DepictsDao {
5151
fun getItemTodelete(number: Int): List<Depicts> {
5252
runBlocking {
5353
launch(Dispatchers.IO) {
54-
listOfDelete = getItemToDelete(number);
54+
listOfDelete = getItemToDelete(number)
5555
}
5656
}
57-
return listOfDelete;
57+
return listOfDelete
5858
}
5959

6060
/**
@@ -63,7 +63,7 @@ abstract class DepictsDao {
6363
fun deleteDepicts(depictes: Depicts) {
6464
runBlocking {
6565
launch(Dispatchers.IO) {
66-
delete(depictes);
66+
delete(depictes)
6767
}
6868
}
6969
}
@@ -80,7 +80,7 @@ abstract class DepictsDao {
8080
insertDepict(Depicts(depictsItem, Date()))
8181
}
8282

83-
numberofItemInRoomDataBase = depictsList().size;
83+
numberofItemInRoomDataBase = depictsList().size
8484
// delete the depicts for depictsroomdataBase when number of element in depictsroomdataBase is greater than 10
8585
if (numberofItemInRoomDataBase > maxNumberOfItemSaveInRoom) {
8686

app/src/main/java/fr/free/nrw/commons/upload/depicts/DepictsPresenter.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class DepictsPresenter @Inject constructor(
105105
override fun verifyDepictions() {
106106
if (repository.selectedDepictions.isNotEmpty()) {
107107
if (::depictsDao.isInitialized) {
108-
depictsDao.savingDepictsInRoomDataBase(repository.selectedDepictions);
108+
depictsDao.savingDepictsInRoomDataBase(repository.selectedDepictions)
109109
}
110110
view.goToNextScreen()
111111
} else {
@@ -114,7 +114,6 @@ class DepictsPresenter @Inject constructor(
114114
}
115115
}
116116

117-
118117
/**
119118
* This creates a dynamic proxy instance of the class,
120119
* proxy is to control access to the target object

app/src/test/kotlin/fr/free/nrw/commons/upload/DepictsPresenterTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@ class DepictsPresenterTest {
128128
@Test
129129
fun `verifyDepictions with non empty selectedDepictions goes to next screen`() {
130130
whenever(repository.selectedDepictions).thenReturn(listOf(depictedItem()))
131-
depictsPresenter.verifyDepictions();
131+
depictsPresenter.verifyDepictions()
132132
verify(view).goToNextScreen()
133133
}
134134

135135
@Test
136136
fun `verifyDepictions with empty selectedDepictions goes to noDepictionSelected`() {
137137
whenever(repository.selectedDepictions).thenReturn(emptyList())
138-
depictsPresenter.verifyDepictions();
138+
depictsPresenter.verifyDepictions()
139139
verify(view).noDepictionSelected()
140140
}
141141
}

0 commit comments

Comments
 (0)