diff options
author | Allan Wang <me@allanwang.ca> | 2019-07-01 21:36:55 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-07-01 21:36:55 -0700 |
commit | ce1c8ef5798e32987c90c9ffa05230472e27e78e (patch) | |
tree | cf4b9f70a71459520bff2cdfeb981bb9b0e9e398 /app/src | |
parent | 1472aa3bba0b5865aee1c52168bbc49a9f37c40b (diff) | |
download | frost-ce1c8ef5798e32987c90c9ffa05230472e27e78e.tar.gz frost-ce1c8ef5798e32987c90c9ffa05230472e27e78e.tar.bz2 frost-ce1c8ef5798e32987c90c9ffa05230472e27e78e.zip |
Update versions and add image activity test start
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt index cf8acdd3..8aebb575 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt @@ -16,7 +16,6 @@ */ package com.pitchedapps.frost -import android.content.Intent import android.graphics.Color import android.os.Build import android.os.Bundle @@ -26,11 +25,9 @@ import android.widget.TextView import ca.allanwang.kau.internal.KauBaseActivity import ca.allanwang.kau.utils.buildIsLollipopAndUp import ca.allanwang.kau.utils.setIcon -import ca.allanwang.kau.utils.startActivity import ca.allanwang.kau.utils.string 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 @@ -43,9 +40,9 @@ import com.pitchedapps.frost.db.saveTabs import com.pitchedapps.frost.db.selectAll import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.utils.BiometricUtils -import com.pitchedapps.frost.utils.EXTRA_COOKIES import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs +import com.pitchedapps.frost.utils.launchImageActivity import com.pitchedapps.frost.utils.launchNewTask import com.pitchedapps.frost.utils.loadAssets import com.raizlabs.android.dbflow.kotlinextensions.from @@ -86,18 +83,24 @@ class StartActivity : KauBaseActivity() { FbCookie.switchBackUser() val cookies = ArrayList(cookieDao.selectAll()) L.i { "Cookies loaded at time ${System.currentTimeMillis()}" } - L._d { "Cookies: ${cookies.joinToString("\t", transform = CookieEntity::toSensitiveString)}" } + L._d { + "Cookies: ${cookies.joinToString( + "\t", + transform = CookieEntity::toSensitiveString + )}" + } loadAssets() authDefer.await() when { cookies.isEmpty() -> launchNewTask<LoginActivity>() // Has cookies but no selected account Prefs.userId == -1L -> launchNewTask<SelectorActivity>(cookies) - else -> startActivity<MainActivity>(intentBuilder = { - putParcelableArrayListExtra(EXTRA_COOKIES, cookies) - flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or - Intent.FLAG_ACTIVITY_SINGLE_TOP - }) + else -> launchImageActivity("https://images.pexels.com/photos/374870/pexels-photo-374870.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500") +// else -> startActivity<MainActivity>(intentBuilder = { +// putParcelableArrayListExtra(EXTRA_COOKIES, cookies) +// flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or +// Intent.FLAG_ACTIVITY_SINGLE_TOP +// }) } } catch (e: Exception) { L._e(e) { "Load start failed" } @@ -112,7 +115,8 @@ class StartActivity : KauBaseActivity() { */ private suspend fun migrate() = withContext(Dispatchers.IO) { if (cookieDao.selectAll().isNotEmpty()) return@withContext - val cookies = (select from CookieModel::class).queryList().map { CookieEntity(it.id, it.name, it.cookie) } + val cookies = (select from CookieModel::class).queryList() + .map { CookieEntity(it.id, it.name, it.cookie) } if (cookies.isNotEmpty()) { cookieDao.save(cookies) L._d { "Migrated cookies ${cookieDao.selectAll()}" } |