Provide cookies database autoMigration
This commit is contained in:
1 parent
dc47f68ff3
commit
8e4d3df400
5 files changed
+204
-2
No files matched your search
@@ -31,7 +31,7 @@ import java.util.regex.Pattern
|
||||
typealias KtorCookie = io.ktor.http.Cookie
|
||||
|
||||
object EhCookieStore : CookieJar, CookiesStorage {
|
||||
private val db: CookieDatabase = CookieDatabase(EhApplication.application, "okhttp3-cookie-2.db")
|
||||
private val db: CookieDatabase = CookieDatabase(EhApplication.application, "okhttp3-cookie.db")
|
||||
private val map: MutableMap<String, CookieSet> = db.allCookies
|
||||
|
||||
fun signOut() {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.hippo.network
|
||||
|
||||
import android.content.Context
|
||||
import androidx.room.AutoMigration
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Database
|
||||
@@ -69,7 +70,17 @@ interface CookiesDao {
|
||||
fun update(cookie: Cookie)
|
||||
}
|
||||
|
||||
@Database(entities = [Cookie::class], version = 1, exportSchema = false)
|
||||
/* 1 -> 2 some nullability changes */
|
||||
@Database(
|
||||
entities = [Cookie::class],
|
||||
version = 2,
|
||||
autoMigrations = [
|
||||
AutoMigration(
|
||||
from = 1,
|
||||
to = 2
|
||||
)
|
||||
]
|
||||
)
|
||||
abstract class CookiesDatabase : RoomDatabase() {
|
||||
abstract fun cookiesDao(): CookiesDao
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user