-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(office): migrated Dbflow to Room #2309
feat(office): migrated Dbflow to Room #2309
Conversation
fun fromOpeningDateList(list: List<Int?>?): String { | ||
return Gson().toJson(list) | ||
} | ||
|
||
@TypeConverter | ||
fun toOpeningDateList(json: String): List<Int?> { | ||
return Gson().fromJson(json, object : TypeToken<List<Int?>>() {}.type) | ||
} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@ColumnInfo(name = "openingDate") | ||
var openingDate: List<Int?> = ArrayList(), | ||
) : Parcelable | ||
val openingDate: List<Int?> = ArrayList(), |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
* [database/survey] dbflow to room [database/survey] dbflow to room * removed extra changes * fixed spotless and detekt
* MIFOSAC-391 database.staff dbflow to room * remove suspend * made suggested changes * fix
…igrating-office-to-room # Conflicts: # core/data/src/main/java/com/mifos/core/data/repository/CreateNewClientRepository.kt # core/data/src/main/java/com/mifos/core/data/repositoryImp/CreateNewClientRepositoryImp.kt # core/database/src/main/java/com/mifos/room/db/MifosDatabase.kt # core/database/src/main/java/com/mifos/room/di/DaoModule.kt # core/database/src/main/java/com/mifos/room/entities/organisation/Staff.kt
@@ -25,9 +26,9 @@ interface CreateNewClientRepository { | |||
|
|||
fun clientTemplate(): Observable<ClientsTemplate> | |||
|
|||
suspend fun offices(): List<Office> | |||
suspend fun offices(): List<OfficeEntity> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be Flow
import rx.Observable | ||
|
||
/** | ||
* Created by Aditya Gupta on 10/08/23. | ||
*/ | ||
interface CreateNewGroupRepository { | ||
|
||
suspend fun offices(): List<Office> | ||
suspend fun offices(): List<OfficeEntity> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be Flow, and i wonder why we have same methods in multiple files
return dataManagerOffices.offices() | ||
} | ||
|
||
override suspend fun getStaffInOffice(officeId: Int): List<Staff> { | ||
override fun getStaffInOffice(officeId: Int): Flow<List<Staff>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inject ioDispatcher in this class and use flowOn(ioDispatcher) oparator, for all methods which returns as Flow, do this in other classes too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@niyajali I implemented your suggestions before, but @therajanmaurya bhaiya advised against using them.
And for suspend fun use withContext(ioDispatcher) to switch the thread for all one time events like create/update etc.. @Nagarjuna0033 @itsPronay @biplab1 above these comments might helps |
@niyajali Thanks for the suggestion! |
Close in reference of #2314 |
Fixes - Jira-#389
Didn't create a Jira ticket, click here to create new.
Please Add Screenshots If there are any UI changes.
Please make sure these boxes are checked before submitting your pull request - thanks!
Run the static analysis check
./gradlew check
orci-prepush.sh
to make sure you didn't break anythingIf you have multiple commits please combine them into one commit by squashing them.