Last active
August 19, 2018 07:03
-
-
Save mcmatan/3453aabc67d41ab0ddae25098278381c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DataBase @Inject constructor() { | |
private val realmLock = RealmLock() | |
//Backround thread transaction | |
override fun saveLanguage(jsonArray: JSONArray) { | |
this.realmLock.transaction { | |
it.createAllFromJson(Language::class.java, jsonArray) | |
} | |
} | |
//UI thread transaction | |
private fun getFeedItem(id: String): HomeFeedItem? { | |
return realmLock.getRealm() | |
.where<HomeFeedItem>().equalTo("_id", id).findFirst() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment