aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-05-01 17:05:22 -0700
committerGitHub <noreply@github.com>2019-05-01 17:05:22 -0700
commite7a499f6314f8d6345b19c3e221f3cd9cd176d4f (patch)
treea19cbd9b60a218cdc3370ea83e565fd8ab086881 /app/src/main/kotlin
parentda93672c2ed6b54e0e7119a6b55715185112df3e (diff)
parent547bf6f932b56a4f66e9eb1d9f175e7db4e4512e (diff)
downloadfrost-e7a499f6314f8d6345b19c3e221f3cd9cd176d4f.tar.gz
frost-e7a499f6314f8d6345b19c3e221f3cd9cd176d4f.tar.bz2
frost-e7a499f6314f8d6345b19c3e221f3cd9cd176d4f.zip
Merge pull request #1416 from AllanWang/misc
Misc
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt11
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/db/Database.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt5
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt4
5 files changed, 17 insertions, 10 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
index 41c6ff4b..0c762b41 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
@@ -45,7 +45,9 @@ import com.raizlabs.android.dbflow.config.DatabaseConfig
import com.raizlabs.android.dbflow.config.FlowConfig
import com.raizlabs.android.dbflow.config.FlowManager
import com.raizlabs.android.dbflow.runtime.ContentResolverNotifier
-import org.koin.android.ext.android.startKoin
+import org.koin.android.ext.koin.androidContext
+import org.koin.android.ext.koin.androidLogger
+import org.koin.core.context.startKoin
import java.util.Random
import kotlin.reflect.KClass
@@ -134,7 +136,12 @@ class FrostApp : Application() {
L.d { "Activity ${activity.localClassName} created" }
}
})
- startKoin(this, listOf(FrostDatabase.module(this)))
+ startKoin {
+ if (BuildConfig.DEBUG)
+ androidLogger()
+ androidContext(this@FrostApp)
+ modules(FrostDatabase.module(this@FrostApp))
+ }
}
private fun initBugsnag() {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/db/Database.kt b/app/src/main/kotlin/com/pitchedapps/frost/db/Database.kt
index 67372e23..cd5fce02 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/db/Database.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/db/Database.kt
@@ -21,8 +21,8 @@ import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.pitchedapps.frost.BuildConfig
-import org.koin.dsl.module.module
-import org.koin.standalone.StandAloneContext
+import org.koin.core.context.GlobalContext
+import org.koin.dsl.module
interface FrostPrivateDao {
fun cookieDao(): CookieDao
@@ -101,6 +101,6 @@ class FrostDatabase(private val privateDb: FrostPrivateDatabase, private val pub
* Get from koin
* For the most part, you can retrieve directly from other koin components
*/
- fun get(): FrostDatabase = StandAloneContext.getKoin().koinContext.get()
+ fun get(): FrostDatabase = GlobalContext.get().koin.get()
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
index 76ffd8cd..557980af 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -186,7 +186,8 @@ fun MaterialDialog.Builder.theme(): MaterialDialog.Builder {
}
fun Activity.setFrostTheme(forceTransparent: Boolean = false) {
- val isTransparent = (Color.alpha(Prefs.bgColor) != 255) || (Color.alpha(Prefs.headerColor) != 255) || forceTransparent
+ val isTransparent =
+ (Color.alpha(Prefs.bgColor) != 255) || (Color.alpha(Prefs.headerColor) != 255) || forceTransparent
if (Prefs.bgColor.isColorDark)
setTheme(if (isTransparent) R.style.FrostTheme_Transparent else R.style.FrostTheme)
else
@@ -357,7 +358,7 @@ val dependentSegments = arrayOf(
)
inline val String?.isExplicitIntent
- get() = this != null && startsWith("intent://")
+ get() = this != null && (startsWith("intent://") || startsWith("market://"))
fun Context.frostChangelog() = showChangelog(R.xml.frost_changelog, Prefs.textColor) {
theme()
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt
index 81ade98f..b06208a6 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt
@@ -75,7 +75,6 @@ fun FrostWebView.requestWebOverlay(url: String): Boolean {
}
if (!Prefs.overlayEnabled) return false
if (context is WebOverlayActivityBase) {
- L.v { "Check web request from overlay" }
val shouldUseDesktop = url.formattedFbUrl.shouldUseDesktopAgent
//already overlay; manage user agent
if (userAgentString != USER_AGENT_DESKTOP && shouldUseDesktop) {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt b/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt
index 594da00a..66176aba 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/widgets/NotificationWidget.kt
@@ -47,8 +47,8 @@ import com.pitchedapps.frost.services.NotificationContent
import com.pitchedapps.frost.services.NotificationType
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.toReadableTime
-import org.koin.standalone.KoinComponent
-import org.koin.standalone.inject
+import org.koin.core.KoinComponent
+import org.koin.core.inject
class NotificationWidget : AppWidgetProvider() {