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

NF: uses NoteId instead of Long #11984

Merged
merged 1 commit into from
Aug 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/CardInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class CardInfo : AnkiActivity() {
val cardType: String?,
val noteType: String,
val deckName: String,
val noteId: Long,
val noteId: NoteId,
val entries: List<RevLogEntry>
) {
val due: String
Expand Down
4 changes: 2 additions & 2 deletions AnkiDroid/src/main/java/com/ichi2/anki/CardTemplateEditor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ open class CardTemplateEditor : AnkiActivity(), DeckSelectionListener {
private set
private var mFieldNames: List<String>? = null
private var mModelId: Long = 0
private var mNoteId: Long = 0
private var mNoteId: NoteId = 0

// the position of the cursor in the editor view
private var tabToCursorPosition: HashMap<Int, Int?>? = null
Expand Down Expand Up @@ -952,7 +952,7 @@ open class CardTemplateEditor : AnkiActivity(), DeckSelectionListener {
companion object {
fun newInstance(
cardIndex: Int,
noteId: Long,
noteId: NoteId,
cursorPosition: Int,
viewId: Int
): CardTemplateFragment {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ class CardContentProvider : ContentProvider() {
return getCard(noteId, ord, col)
}

private fun getCard(noteId: Long, ord: Int, col: Collection): Card {
private fun getCard(noteId: NoteId, ord: Int, col: Collection): Card {
val currentNote = col.getNote(noteId)
var currentCard: Card? = null
for (card in currentNote.cards()) {
Expand Down
2 changes: 1 addition & 1 deletion AnkiDroid/src/main/java/com/ichi2/libanki/Card.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ open class Card : Cloneable {
// BEGIN SQL table entries
@set:VisibleForTesting
var id: Long
var nid: Long = 0
var nid: NoteId = 0
var did: DeckId = 0
var ord = 0
var mod: Long = 0
Expand Down
2 changes: 1 addition & 1 deletion AnkiDroid/src/main/java/com/ichi2/libanki/Collection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ open class Collection(

@JvmOverloads
fun <T> genCards(
nid: Long,
nid: NoteId,
model: Model,
task: T? = null
): ArrayList<Long>? where T : ProgressSender<Int?>?, T : CancelListener? {
Expand Down
2 changes: 1 addition & 1 deletion AnkiDroid/src/main/java/com/ichi2/libanki/ModelManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ abstract class ModelManager(protected val col: Collection) {
* @throws ConfirmModSchemaException
*/
@Throws(ConfirmModSchemaException::class)
abstract fun change(m: Model, nid: Long, newModel: Model, fmap: Map<Int, Int?>?, cmap: Map<Int, Int?>?)
abstract fun change(m: Model, nid: NoteId, newModel: Model, fmap: Map<Int, Int?>?, cmap: Map<Int, Int?>?)

/*
Schema hash ***********************************************************************************************
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 @@ -562,7 +562,7 @@ class ModelsV16(col: CollectionV16) : ModelManager(col) {

override fun change(
m: NoteType,
nid: Long,
nid: NoteId,
newModel: NoteType,
fmap: Map<Int, Int?>?,
cmap: Map<Int, Int?>?
Expand Down
3 changes: 1 addition & 2 deletions AnkiDroid/src/main/java/com/ichi2/libanki/PythonTypes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ import java.util.*
internal typealias Dict<K, V> = HashMap<K, V>
internal typealias ImmutableList<T> = List<T>
internal typealias str = String
/**
*/
internal typealias DeckId = Long
internal typealias dcid = Long
internal typealias NoteId = Long
internal typealias ntid = Long
internal typealias bool = Boolean
internal typealias Tuple<T1, T2> = Pair<T1, T2>
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ open class Anki2Importer(col: Collection?, file: String) : Importer(col!!, file)
private val mAllowUpdate: Boolean
private var mDupeOnSchemaChange: Boolean

private class NoteTriple(val nid: Long, val mod: Long, val mid: Long)
private class NoteTriple(val nid: NoteId, val mod: Long, val mid: Long)

private var mNotes: MutableMap<String, NoteTriple>? = null
private var mDecks: MutableMap<Long, Long>? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ open class NoteImporter(col: com.ichi2.libanki.Collection, file: String) : Impor
val mLapses = 0
}

private class Triple(val nid: Long, val ord: Int, val card: ForeignCard)
private class Triple(val nid: NoteId, val ord: Int, val card: ForeignCard)
companion object {
/** A magic string used in [this.mMapping] when a csv field should be mapped to the tags of a note */
const val TAGS_IDENTIFIER = "_tags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ abstract class BaseSched(val col: Collection) {
* Bury all cards for note until next session.
* @param nid The id of the targeted note.
*/
open fun buryNote(nid: Long) {
open fun buryNote(nid: NoteId) {
col.newBackend.backend.buryOrSuspendCards(
cardIds = listOf(),
noteIds = listOf(nid),
Expand Down