|
|
|
@ -3,6 +3,7 @@ package net.pokeranalytics.android.model.utils |
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import io.realm.Realm |
|
|
|
import io.realm.Realm |
|
|
|
import io.realm.kotlin.where |
|
|
|
import io.realm.kotlin.where |
|
|
|
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.model.realm.* |
|
|
|
import net.pokeranalytics.android.model.realm.* |
|
|
|
import net.pokeranalytics.android.model.realm.Currency |
|
|
|
import net.pokeranalytics.android.model.realm.Currency |
|
|
|
import net.pokeranalytics.android.util.UserDefaults |
|
|
|
import net.pokeranalytics.android.util.UserDefaults |
|
|
|
@ -19,7 +20,7 @@ class Seed(var context:Context) : Realm.Transaction { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun createDefaultTournamentFeatures(realm: Realm) { |
|
|
|
private fun createDefaultTournamentFeatures(realm: Realm) { |
|
|
|
context.resources.getStringArray(net.pokeranalytics.android.R.array.seed_tournament_features).forEach { |
|
|
|
context.resources.getStringArray(R.array.seed_tournament_features).forEach { |
|
|
|
val tournamentFeature = TournamentFeature() |
|
|
|
val tournamentFeature = TournamentFeature() |
|
|
|
tournamentFeature.id = UUID.randomUUID().toString() |
|
|
|
tournamentFeature.id = UUID.randomUUID().toString() |
|
|
|
tournamentFeature.name = it |
|
|
|
tournamentFeature.name = it |
|
|
|
@ -44,8 +45,8 @@ class Seed(var context:Context) : Realm.Transaction { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun createDefaultGames(realm: Realm) { |
|
|
|
private fun createDefaultGames(realm: Realm) { |
|
|
|
val gamesName = context.resources.getStringArray(net.pokeranalytics.android.R.array.seed_games) |
|
|
|
val gamesName = context.resources.getStringArray(R.array.seed_games) |
|
|
|
val gamesShortName = context.resources.getStringArray(net.pokeranalytics.android.R.array.seed_games_short_name) |
|
|
|
val gamesShortName = context.resources.getStringArray(R.array.seed_games_short_name) |
|
|
|
for ((index, name) in gamesName.withIndex()) { |
|
|
|
for ((index, name) in gamesName.withIndex()) { |
|
|
|
val game = Game() |
|
|
|
val game = Game() |
|
|
|
game.id = UUID.randomUUID().toString() |
|
|
|
game.id = UUID.randomUUID().toString() |
|
|
|
@ -58,6 +59,11 @@ class Seed(var context:Context) : Realm.Transaction { |
|
|
|
private fun createDefaultTransactionTypes(realm: Realm) { |
|
|
|
private fun createDefaultTransactionTypes(realm: Realm) { |
|
|
|
TransactionType.Value.values().forEachIndexed { index, value -> |
|
|
|
TransactionType.Value.values().forEachIndexed { index, value -> |
|
|
|
val type = TransactionType() |
|
|
|
val type = TransactionType() |
|
|
|
|
|
|
|
type.name = when(value) { |
|
|
|
|
|
|
|
TransactionType.Value.WITHDRAWAL -> context.getString(R.string.withdrawal) |
|
|
|
|
|
|
|
TransactionType.Value.DEPOSIT -> context.getString(R.string.deposit) |
|
|
|
|
|
|
|
TransactionType.Value.BONUS -> context.getString(R.string.bonus) |
|
|
|
|
|
|
|
} |
|
|
|
type.additive = value.additive |
|
|
|
type.additive = value.additive |
|
|
|
type.kind = index |
|
|
|
type.kind = index |
|
|
|
type.lock = true |
|
|
|
type.lock = true |
|
|
|
|