Skip to content
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

Release/1.3.3 #335

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix some warnings
  • Loading branch information
winter-yuki committed Aug 25, 2024
commit a01d9a96965ed358a0f5bf9de89baa140a3f7ea1
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ abstract class LearnBrailleDatabase : RoomDatabase(), KoinComponent {

companion object {

const val name = "learn_braille_database"
private const val DB_NAME = "learn_braille_database"

/**
* Try to run `buildDatabase` before first user's request (mb in Application's `onCreate`)
@@ -94,7 +94,7 @@ abstract class LearnBrailleDatabase : RoomDatabase(), KoinComponent {
.databaseBuilder(
context.applicationContext,
LearnBrailleDatabase::class.java,
name
DB_NAME
)
.addCallback(object : Callback(), KoinComponent {

@@ -145,18 +145,18 @@ abstract class LearnBrailleDatabase : RoomDatabase(), KoinComponent {
}

private val MIGRATION_16_17 = object : Migration(16, 17), KoinComponent {
override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
Timber.i("Start 16-17 migration")

database.execSQL("delete from materials")
database.execSQL("delete from steps")
database.execSQL("delete from step_has_annotations")
db.execSQL("delete from materials")
db.execSQL("delete from steps")
db.execSQL("delete from step_has_annotations")

Timber.i("Removed old content")

prepopulationData.run {
materials?.forEach {
database.insert(
db.insert(
"materials",
SQLiteDatabase.CONFLICT_IGNORE,
it.run {
@@ -170,7 +170,7 @@ private val MIGRATION_16_17 = object : Migration(16, 17), KoinComponent {
Timber.i("Materials loaded")

steps?.forEach {
database.insert(
db.insert(
"steps",
SQLiteDatabase.CONFLICT_IGNORE,
it.run {
@@ -186,7 +186,7 @@ private val MIGRATION_16_17 = object : Migration(16, 17), KoinComponent {
Timber.i("Steps loaded")

stepsHasAnnotations?.forEach {
database.insert(
db.insert(
"step_has_annotations",
SQLiteDatabase.CONFLICT_IGNORE,
it.run {
@@ -205,9 +205,9 @@ private val MIGRATION_16_17 = object : Migration(16, 17), KoinComponent {
}

private val MIGRATION_17_18 = object : Migration(17, 18) {
override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
Timber.i("Start 17-18 migration")
database.execSQL(Action.creationQuery)
db.execSQL(Action.creationQuery)
Timber.i("Actions table created")
}
}
@@ -326,33 +326,33 @@ fun updateTheoryAndMaterials(database: SupportSQLiteDatabase) {
}

private val MIGRATION_18_19 = object : Migration(18, 19) {
override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
Timber.i("Start 18-19 migration")
updateTheoryAndMaterials(database)
updateTheoryAndMaterials(db)
Timber.i("Finish 18-19 migration")
}
}

private val MIGRATION_19_20 = object : Migration(19, 20) {
override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
Timber.i("Start 19-20 migration")
updateTheoryAndMaterials(database)
updateTheoryAndMaterials(db)
Timber.i("Finish 19-20 migration")
}
}

private val MIGRATION_20_21 = object : Migration(20, 21) {
override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
Timber.i("Start 20-21 migration")
updateTheoryAndMaterials(database)
updateTheoryAndMaterials(db)
Timber.i("Finish 20-21 migration")
}
}

private val MIGRATION_21_22 = object : Migration(21, 22) {
override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
Timber.i("Start 21-22 migration")
updateTheoryAndMaterials(database)
updateTheoryAndMaterials(db)
Timber.i("Finish 21-22 migration")
}
}
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ class SymbolsBuilder(private val symbolType: String, block: SymbolsBuilder.() ->
operator fun get(symbol: Char): Symbol? = _map[symbol]

fun symbol(char: Char, brailleDots: BrailleDots) {
@Suppress("NAME_SHADOWING") val char = char.toUpperCase()
@Suppress("NAME_SHADOWING") val char = char.uppercaseChar()
_map[char] = Symbol(char, brailleDots, symbolType)
}
}
@@ -119,7 +119,7 @@ class MarkersBuilder(private val block: MarkersBuilder.() -> Unit) {

class known(vararg chars: Char) {

private val cs = chars.map(Char::toUpperCase)
private val cs = chars.map(Char::uppercaseChar)
private var knownMaterials: List<KnownMaterial>? = null

operator fun getValue(thisRef: Any?, property: KProperty<*>): List<KnownMaterial> =
Original file line number Diff line number Diff line change
@@ -6,20 +6,20 @@ import com.github.braillesystems.learnbraille.data.entities.*

fun StepsBuilder.inputChars(chars: String): Unit =
chars
.map(Char::toUpperCase)
.map(Char::uppercaseChar)
.forEach { c -> +Input(content.symbols.getValue(c)) }

fun StepsBuilder.inputPhraseByLetters(phrase: String) {
val materials = phrase
.map(Char::toUpperCase)
.map(Char::uppercaseChar)
.map(content.symbols::getValue)
materials.forEachIndexed { i, _ ->
+InputPhraseLetter(materials, i)
}
}

fun StepsBuilder.showAndInputChars(chars: String): Unit =
chars.map(Char::toUpperCase).forEach {
chars.map(Char::uppercaseChar).forEach {
+Show(content.symbols.getValue(it))
+Input(content.symbols.getValue(it))
}
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -21,4 +21,3 @@ android.enableJetifier=true
kotlin.code.style=official
android.nonTransitiveRClass=false
android.nonFinalResIds=false
android.defaults.buildfeatures.buildconfig=true
Loading