Skip to content

Commit

Permalink
Cleanup code of libanki.Storage
Browse files Browse the repository at this point in the history
  • Loading branch information
lukstbit authored and BrayanDSO committed Sep 6, 2023
1 parent cf28cef commit 0a8b9d4
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions AnkiDroid/src/main/java/com/ichi2/libanki/Storage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. *
*/
@file:Suppress("FunctionName") // _createDb and other names defined by libAnki

package com.ichi2.libanki

import com.ichi2.anki.UIUtils.getDayStart
Expand All @@ -31,8 +29,8 @@ object Storage {
/**
* Open a new or existing collection.
*
* @param Path The path to the collection.anki2 database. Should be unicode.
* path should be tested with File.exists() and File.canWrite() before this is called.
* @param path The path to the collection.anki2 database. Should be unicode.
* path should be tested with [File.exists] and [File.canWrite] before this is called.
* */
fun collection(
path: String,
Expand All @@ -44,7 +42,7 @@ object Storage {
}

/**
* Called as part of Collection initialization. Don't call directly.
* Called as part of [Collection] initialization. Don't call directly.
*/
internal fun openDB(path: String, backend: Backend, afterFullSync: Boolean): Pair<DB, Boolean> {
val dbFile = File(path)
Expand All @@ -58,12 +56,12 @@ object Storage {

// initialize
if (create) {
_createDB(db, time)
createDB(db, time)
}
return Pair(db, create)
}

private fun _createDB(db: DB, time: Time) {
private fun createDB(db: DB, time: Time) {
// This line is required for testing - otherwise Rust will override a mocked time.
db.execute("update col set crt = ?", getDayStart(time) / 1000)
}
Expand Down

0 comments on commit 0a8b9d4

Please sign in to comment.