diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cd4a69d..4bcff12 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -25,6 +25,7 @@ @@ -42,6 +43,7 @@ diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/databases/ClipsDatabase.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/databases/ClipsDatabase.kt index 8b826e1..051fd9b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/databases/ClipsDatabase.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/databases/ClipsDatabase.kt @@ -4,6 +4,7 @@ import android.content.Context import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase +import com.simplemobiletools.commons.extensions.safeStorageContext import com.simplemobiletools.keyboard.interfaces.ClipsDao import com.simplemobiletools.keyboard.models.Clip @@ -19,7 +20,7 @@ abstract class ClipsDatabase : RoomDatabase() { if (db == null) { synchronized(ClipsDatabase::class) { if (db == null) { - db = Room.databaseBuilder(context.applicationContext, ClipsDatabase::class.java, "clips.db").build() + db = Room.databaseBuilder(context.applicationContext.safeStorageContext, ClipsDatabase::class.java, "clips.db").build() db!!.openHelper.setWriteAheadLoggingEnabled(true) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/extensions/Context.kt index 855438d..3e030a5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/extensions/Context.kt @@ -21,7 +21,7 @@ import com.simplemobiletools.keyboard.databases.ClipsDatabase import com.simplemobiletools.keyboard.helpers.* import com.simplemobiletools.keyboard.interfaces.ClipsDao -val Context.config: Config get() = Config.newInstance(applicationContext) +val Context.config: Config get() = Config.newInstance(applicationContext.safeStorageContext) val Context.clipsDB: ClipsDao get() = ClipsDatabase.getInstance(applicationContext).ClipsDao()