Skip to content

Commit 60bf552

Browse files
committed
adding a hack at first app launch to ensure proper database prepopulation
1 parent 213cbd8 commit 60bf552

File tree

1 file changed

+7
-0
lines changed
  • app/src/main/kotlin/com/simplemobiletools/notes/pro/helpers

1 file changed

+7
-0
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/helpers/NotesHelper.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ package com.simplemobiletools.notes.pro.helpers
22

33
import android.app.Activity
44
import com.simplemobiletools.notes.pro.R
5+
import com.simplemobiletools.notes.pro.extensions.config
56
import com.simplemobiletools.notes.pro.extensions.notesDB
67
import com.simplemobiletools.notes.pro.models.Note
78
import java.io.File
89

910
class NotesHelper(val activity: Activity) {
1011
fun getNotes(callback: (notes: ArrayList<Note>) -> Unit) {
1112
Thread {
13+
// make sure the initial note has enough time to be precreated
14+
if (activity.config.appRunCount == 1) {
15+
activity.notesDB.getNotes()
16+
Thread.sleep(200)
17+
}
18+
1219
val notes = activity.notesDB.getNotes() as ArrayList<Note>
1320
val notesToDelete = ArrayList<Note>(notes.size)
1421
notes.forEach {

0 commit comments

Comments
 (0)