Skip to content

Commit

Permalink
Dynamic Database Name implemented for all verticals, jioonline and bo…
Browse files Browse the repository at this point in the history
…ost360
  • Loading branch information
suhasnowfloats committed May 16, 2023
1 parent edd8c3d commit a6cfcd4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.room.Room
import androidx.room.RoomDatabase
import com.boost.dbcenterapi.upgradeDB.dao.*
import com.boost.dbcenterapi.upgradeDB.model.*
import com.boost.dbcenterapi.utils.Utils.getDatabaseName

@Database(entities = [FeaturesModel::class, WidgetModel::class, BundlesModel::class, CartModel::class, CouponsModel::class, YoutubeVideoModel::class, MarketOfferModel::class], version = 29, exportSchema = false)
abstract class AppDatabase : RoomDatabase() {
Expand All @@ -19,7 +20,7 @@ abstract class AppDatabase : RoomDatabase() {
if (instance == null) {
instance = Room.databaseBuilder(
context,
AppDatabase::class.java, "updates_db"
AppDatabase::class.java, getDatabaseName()
).fallbackToDestructiveMigration().build()
}
}
Expand Down
16 changes: 16 additions & 0 deletions dbcenterapi/src/main/java/com/boost/dbcenterapi/utils/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ import kotlin.collections.ArrayList

object Utils {

fun getDatabaseName(): String {
if(BuildConfig.FLAVOR.equals("partone"))
return "updates_db"
else if (BuildConfig.FLAVOR.equals("jioonline"))
return "jio_updates_db"
else if(BuildConfig.FLAVOR.equals("arantoo"))
return "arantoo_db"
else if(BuildConfig.FLAVOR.equals("ardhim"))
return "ardhim_db"
else if(BuildConfig.FLAVOR.equals("checkkinn"))
return "checkkinn_db"
else if(BuildConfig.FLAVOR.equals("healthgro"))
return "healthgro_db"
else
return "empty"
}

//getting retrofit instance
fun getRetrofit(
Expand Down

0 comments on commit a6cfcd4

Please sign in to comment.