aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-02-05 22:13:41 -0500
committerGitHub <noreply@github.com>2019-02-05 22:13:41 -0500
commit330bf2857396b15752afadb030c981a1cb2848fe (patch)
treece224b4ce241ccc58af32614052b2a407f3e89c0 /app/src/main/kotlin
parentc484c2728c1688ed695205a420eba3f2b2ba179d (diff)
downloadfrost-330bf2857396b15752afadb030c981a1cb2848fe.tar.gz
frost-330bf2857396b15752afadb030c981a1cb2848fe.tar.bz2
frost-330bf2857396b15752afadb030c981a1cb2848fe.zip
Enhancement/js (#1344)
* Attempt to add package json * Add initial typescript components * Convert remaining files * Remove some null checks * Reorganize folders * Add missing js and tests for file paths * Delete unused babelrc * Remove unused packages
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt6
2 files changed, 7 insertions, 3 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
index 0caeda1a..a466feec 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
@@ -19,6 +19,7 @@ package com.pitchedapps.frost.injectors
import android.content.Context
import android.graphics.Color
import android.webkit.WebView
+import androidx.annotation.VisibleForTesting
import ca.allanwang.kau.kotlin.lazyContext
import ca.allanwang.kau.utils.adjustAlpha
import ca.allanwang.kau.utils.colorToBackground
@@ -43,7 +44,8 @@ enum class CssAssets(val folder: String = THEME_FOLDER) : InjectorContract {
MATERIAL_LIGHT, MATERIAL_DARK, MATERIAL_AMOLED, MATERIAL_GLASS, CUSTOM, ROUND_ICONS("components")
;
- private val file = "${name.toLowerCase(Locale.CANADA)}.css"
+ @VisibleForTesting
+ internal val file = "${name.toLowerCase(Locale.CANADA)}.css"
/**
* Note that while this can be loaded from any thread, it is typically done through [load]
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
index 4b1bde43..e0be7977 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
@@ -18,6 +18,7 @@ package com.pitchedapps.frost.injectors
import android.content.Context
import android.webkit.WebView
+import androidx.annotation.VisibleForTesting
import ca.allanwang.kau.kotlin.lazyContext
import com.pitchedapps.frost.utils.L
import kotlinx.coroutines.Dispatchers
@@ -32,11 +33,12 @@ import java.util.Locale
* The enum name must match the css file name
*/
enum class JsAssets : InjectorContract {
- MENU, MENU_DEBUG, CLICK_A, CONTEXT_A, MEDIA, HEADER_BADGES, HEADER_HIDER, TEXTAREA_LISTENER, NOTIF_MSG,
+ MENU, CLICK_A, CONTEXT_A, MEDIA, HEADER_BADGES, HEADER_HIDER, TEXTAREA_LISTENER, NOTIF_MSG,
DOCUMENT_WATCHER
;
- private val file = "${name.toLowerCase(Locale.CANADA)}.js"
+ @VisibleForTesting
+ internal val file = "${name.toLowerCase(Locale.CANADA)}.js"
private val injector = lazyContext {
try {
val content = it.assets.open("js/$file").bufferedReader().use(BufferedReader::readText)