Skip to content

Commit

Permalink
Updates for 2.1.66
Browse files Browse the repository at this point in the history
  • Loading branch information
dae committed Jul 3, 2023
1 parent e2bec74 commit d5eba8c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
5 changes: 2 additions & 3 deletions AnkiDroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ android {
// needed for upgrades to be offered correctly.
versionCode=21600204
versionName="2.16.0beta4"
minSdkVersion 21
minSdkVersion 23
//noinspection OldTargetApi - also performed in api/build.fradle
targetSdkVersion 31 // change .tests_emulator.yml
testApplicationId "com.ichi2.anki.tests"
Expand Down Expand Up @@ -220,7 +220,6 @@ android {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11
}
ndkVersion "22.0.7026061"
}

play {
Expand Down Expand Up @@ -307,7 +306,7 @@ dependencies {

// Backend libraries

implementation 'com.google.protobuf:protobuf-kotlin:3.23.3' // This is required when loading from a file
implementation 'com.google.protobuf:protobuf-kotlin-lite:3.23.3' // This is required when loading from a file

Properties localProperties = new Properties()
if (project.rootProject.file('local.properties').exists()) {
Expand Down
2 changes: 1 addition & 1 deletion AnkiDroid/src/main/java/com/ichi2/libanki/ModelsV16.kt
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class ModelsV16(col: CollectionV16) : ModelManager(col) {
private fun newBasicNotetype(): NoteType {
return NoteType(
BackendUtils.from_json_bytes(
col.backend.getStockNotetypeLegacy(StockNotetype.Kind.BASIC)
col.backend.getStockNotetypeLegacy(StockNotetype.Kind.KIND_BASIC)
)
)
}
Expand Down
9 changes: 5 additions & 4 deletions AnkiDroid/src/main/java/com/ichi2/libanki/TemplateManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ class TemplateManager {
}

val qtext = apply_custom_filters(partial.qnodes, this, front_side = null)
val qout = col().backend.extractAVTags(text = qtext, questionSide = true)
val qout = col().backend.extractAvTags(text = qtext, questionSide = true)
var qoutText = qout.text

val atext = apply_custom_filters(partial.anodes, this, front_side = qout.text)
val aout = col().backend.extractAVTags(text = atext, questionSide = false)
val aout = col().backend.extractAvTags(text = atext, questionSide = false)
var aoutText = aout.text

if (!_browser) {
Expand Down Expand Up @@ -251,11 +251,12 @@ class TemplateManager {
_note.toBackendNote(),
_card.ord,
BackendUtils.to_json_bytes(_template!!.deepClone()),
_fill_empty
_fill_empty,
true
)
} else {
// existing card (eg study mode)
backend.renderExistingCard(_card.id, _browser)
backend.renderExistingCard(_card.id, _browser, true)
}
}
return PartiallyRenderedCard.from_proto(proto)
Expand Down
28 changes: 14 additions & 14 deletions AnkiDroid/src/main/java/com/ichi2/libanki/sched/SchedV3.kt
Original file line number Diff line number Diff line change
Expand Up @@ -161,28 +161,28 @@ class SchedV3(col: CollectionV16) : AbstractSched(col) {
}

private fun intervalForState(state: SchedulingState): Long {
return when (state.valueCase) {
SchedulingState.ValueCase.NORMAL -> intervalForNormalState(state.normal)
SchedulingState.ValueCase.FILTERED -> intervalForFilteredState(state.filtered)
SchedulingState.ValueCase.VALUE_NOT_SET, null -> TODO("invalid scheduling state")
return when (state.kindCase) {
SchedulingState.KindCase.NORMAL -> intervalForNormalState(state.normal)
SchedulingState.KindCase.FILTERED -> intervalForFilteredState(state.filtered)
SchedulingState.KindCase.KIND_NOT_SET, null -> TODO("invalid scheduling state")
}
}

private fun intervalForNormalState(normal: SchedulingState.Normal): Long {
return when (normal.valueCase) {
SchedulingState.Normal.ValueCase.NEW -> 0
SchedulingState.Normal.ValueCase.LEARNING -> normal.learning.scheduledSecs.toLong()
SchedulingState.Normal.ValueCase.REVIEW -> normal.review.scheduledDays.toLong() * 86400
SchedulingState.Normal.ValueCase.RELEARNING -> normal.relearning.learning.scheduledSecs.toLong()
SchedulingState.Normal.ValueCase.VALUE_NOT_SET, null -> TODO("invalid normal state")
return when (normal.kindCase) {
SchedulingState.Normal.KindCase.NEW -> 0
SchedulingState.Normal.KindCase.LEARNING -> normal.learning.scheduledSecs.toLong()
SchedulingState.Normal.KindCase.REVIEW -> normal.review.scheduledDays.toLong() * 86400
SchedulingState.Normal.KindCase.RELEARNING -> normal.relearning.learning.scheduledSecs.toLong()
SchedulingState.Normal.KindCase.KIND_NOT_SET, null -> TODO("invalid normal state")
}
}

private fun intervalForFilteredState(filtered: SchedulingState.Filtered): Long {
return when (filtered.valueCase) {
SchedulingState.Filtered.ValueCase.PREVIEW -> filtered.preview.scheduledSecs.toLong()
SchedulingState.Filtered.ValueCase.RESCHEDULING -> intervalForNormalState(filtered.rescheduling.originalState)
SchedulingState.Filtered.ValueCase.VALUE_NOT_SET, null -> TODO("invalid filtered state")
return when (filtered.kindCase) {
SchedulingState.Filtered.KindCase.PREVIEW -> filtered.preview.scheduledSecs.toLong()
SchedulingState.Filtered.KindCase.RESCHEDULING -> intervalForNormalState(filtered.rescheduling.originalState)
SchedulingState.Filtered.KindCase.KIND_NOT_SET, null -> TODO("invalid filtered state")
}
}
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
ext.kotlin_version = '1.8.22'
ext.lint_version = '31.0.2' // 31.0.1 stopped running lint checks in CI
ext.acra_version = '5.10.1'
ext.ankidroid_backend_version = '0.1.21-anki2.1.61'
ext.ankidroid_backend_version = '0.1.22-anki2.1.66'
ext.hamcrest_version = '2.2'
ext.junit_version = '5.9.3'
ext.coroutines_version = '1.7.1'
Expand Down

0 comments on commit d5eba8c

Please sign in to comment.