aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-03-05 21:06:24 -0500
committerAllan Wang <me@allanwang.ca>2019-03-05 21:06:24 -0500
commit65bb9233b2a0d8734c1d13e8f3a01bee0f6c3b17 (patch)
treeabe5c5db1b05757375d63c32ec8afae9893a9dee /app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
parent5c4400975450c9739f0986561075983e08afae89 (diff)
downloadfrost-65bb9233b2a0d8734c1d13e8f3a01bee0f6c3b17.tar.gz
frost-65bb9233b2a0d8734c1d13e8f3a01bee0f6c3b17.tar.bz2
frost-65bb9233b2a0d8734c1d13e8f3a01bee0f6c3b17.zip
Convert fbcookies to room entities
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt19
1 files changed, 15 insertions, 4 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
index 86596843..fe859f95 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt
@@ -32,6 +32,8 @@ import com.mikepenz.google_material_typeface_library.GoogleMaterial
import com.pitchedapps.frost.activities.LoginActivity
import com.pitchedapps.frost.activities.MainActivity
import com.pitchedapps.frost.activities.SelectorActivity
+import com.pitchedapps.frost.db.CookieDao
+import com.pitchedapps.frost.db.CookieEntity
import com.pitchedapps.frost.db.CookieModel
import com.pitchedapps.frost.db.loadFbCookiesSync
import com.pitchedapps.frost.facebook.FbCookie
@@ -43,6 +45,7 @@ import com.pitchedapps.frost.utils.loadAssets
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
+import org.koin.android.ext.android.inject
import java.util.ArrayList
/**
@@ -50,6 +53,8 @@ import java.util.ArrayList
*/
class StartActivity : KauBaseActivity() {
+ private val cookieDao: CookieDao by inject()
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -67,12 +72,11 @@ class StartActivity : KauBaseActivity() {
launch {
try {
+ migrate()
FbCookie.switchBackUser()
- val cookies = ArrayList(withContext(Dispatchers.IO) {
- loadFbCookiesSync()
- })
+ val cookies = ArrayList(cookieDao.selectAll())
L.i { "Cookies loaded at time ${System.currentTimeMillis()}" }
- L._d { "Cookies: ${cookies.joinToString("\t", transform = CookieModel::toSensitiveString)}" }
+ L._d { "Cookies: ${cookies.joinToString("\t", transform = CookieEntity::toSensitiveString)}" }
loadAssets()
when {
cookies.isEmpty() -> launchNewTask<LoginActivity>()
@@ -90,6 +94,13 @@ class StartActivity : KauBaseActivity() {
}
}
+ /**
+ * Migrate from dbflow to room
+ */
+ private suspend fun migrate() {
+
+ }
+
private fun showInvalidWebView() =
showInvalidView(R.string.error_webview)