-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace region preference with room, PR review improvements
- Loading branch information
1 parent
ff4314e
commit 5e05345
Showing
5 changed files
with
53 additions
and
25 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...ain/java/com/developersbreach/composeactors/data/datasource/database/dao/UserRegionDao.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.developersbreach.composeactors.data.datasource.database.dao | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.room.Dao | ||
import androidx.room.OnConflictStrategy | ||
import androidx.room.Query | ||
import androidx.room.Update | ||
import com.developersbreach.composeactors.data.datasource.database.entity.UserRegionEntity | ||
|
||
@Dao | ||
interface UserRegionDao { | ||
|
||
@Update(onConflict = OnConflictStrategy.REPLACE) | ||
fun editUserRegion(userRegionEntity: UserRegionEntity) | ||
|
||
@Query("SELECT * FROM user_region_table") | ||
fun getSavedUserRegion(): LiveData<UserRegionEntity> | ||
} |
16 changes: 16 additions & 0 deletions
16
...va/com/developersbreach/composeactors/data/datasource/database/entity/UserRegionEntity.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.developersbreach.composeactors.data.datasource.database.entity | ||
|
||
import androidx.room.ColumnInfo | ||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity(tableName = "user_region_table") | ||
data class UserRegionEntity( | ||
|
||
@PrimaryKey | ||
@ColumnInfo(name = "user_region_country_code") | ||
val countryCode: Int, | ||
|
||
@ColumnInfo(name = "user_region_country_name") | ||
val countryName: String | ||
) |
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
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
This file was deleted.
Oops, something went wrong.