aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/androidTest/kotlin/com/pitchedapps/frost/FrostTestApp.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt30
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt41
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAsset.kt (renamed from app/src/main/kotlin/com/pitchedapps/frost/injectors/CssSmallAssets.kt)2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/ThemeProvider.kt (renamed from app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt)101
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt11
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt4
-rw-r--r--app/src/main/res/values/strings.xml1
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/injectors/ThemeProviderTest.kt (renamed from app/src/test/kotlin/com/pitchedapps/frost/injectors/CssAssetsTest.kt)4
-rw-r--r--app/src/web/scss/facebook/core/_core_bg.scss (renamed from app/src/web/scss/core/_core_bg.scss)0
-rw-r--r--app/src/web/scss/facebook/core/_core_border.scss (renamed from app/src/web/scss/core/_core_border.scss)0
-rw-r--r--app/src/web/scss/facebook/core/_core_messages.scss (renamed from app/src/web/scss/core/_core_messenger.scss)2
-rw-r--r--app/src/web/scss/facebook/core/_core_text.scss (renamed from app/src/web/scss/core/_core_text.scss)0
-rw-r--r--app/src/web/scss/facebook/core/_main.scss (renamed from app/src/web/scss/core/_main.scss)0
-rw-r--r--app/src/web/scss/facebook/core/_svg.scss (renamed from app/src/web/scss/core/_svg.scss)0
-rw-r--r--app/src/web/scss/facebook/core/core.scss (renamed from app/src/web/scss/core/core.scss)6
-rw-r--r--app/src/web/scss/facebook/themes/.gitignore (renamed from app/src/web/scss/themes/.gitignore)0
-rw-r--r--app/src/web/scss/facebook/themes/custom.scss2
-rw-r--r--app/src/web/scss/facebook/themes/material_amoled.scss2
-rw-r--r--app/src/web/scss/facebook/themes/material_dark.scss2
-rw-r--r--app/src/web/scss/facebook/themes/material_glass.scss2
-rw-r--r--app/src/web/scss/facebook/themes/material_light.scss2
-rw-r--r--app/src/web/scss/messenger/core/_core_bg.scss0
-rw-r--r--app/src/web/scss/messenger/core/_core_border.scss0
-rw-r--r--app/src/web/scss/messenger/core/_core_text.scss0
-rw-r--r--app/src/web/scss/messenger/core/_main.scss3
-rw-r--r--app/src/web/scss/messenger/core/core.scss5
-rw-r--r--app/src/web/scss/messenger/themes/.gitignore1
-rw-r--r--app/src/web/scss/messenger/themes/custom.scss2
-rw-r--r--app/src/web/scss/messenger/themes/material_amoled.scss2
-rw-r--r--app/src/web/scss/messenger/themes/material_dark.scss2
-rw-r--r--app/src/web/scss/messenger/themes/material_glass.scss2
-rw-r--r--app/src/web/scss/messenger/themes/material_light.scss2
-rw-r--r--app/src/web/scss/palette/_custom.scss (renamed from app/src/web/scss/themes/custom.scss)2
-rw-r--r--app/src/web/scss/palette/_material_amoled.scss (renamed from app/src/web/scss/themes/material_amoled.scss)2
-rw-r--r--app/src/web/scss/palette/_material_dark.scss (renamed from app/src/web/scss/themes/material_dark.scss)2
-rw-r--r--app/src/web/scss/palette/_material_glass.scss (renamed from app/src/web/scss/themes/material_glass.scss)4
-rw-r--r--app/src/web/scss/palette/_material_light.scss (renamed from app/src/web/scss/themes/material_light.scss)4
52 files changed, 184 insertions, 100 deletions
diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/FrostTestApp.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/FrostTestApp.kt
index 5103a0cf..9d0caae6 100644
--- a/app/src/androidTest/kotlin/com/pitchedapps/frost/FrostTestApp.kt
+++ b/app/src/androidTest/kotlin/com/pitchedapps/frost/FrostTestApp.kt
@@ -23,6 +23,7 @@ import ca.allanwang.kau.kpref.KPrefFactory
import ca.allanwang.kau.kpref.KPrefFactoryInMemory
import com.pitchedapps.frost.db.FrostDatabase
import com.pitchedapps.frost.facebook.FbCookie
+import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.prefs.Prefs
import org.junit.rules.TestRule
import org.junit.runner.Description
@@ -70,7 +71,8 @@ class FrostTestApp : Application() {
FrostDatabase.module(),
prefFactoryModule(),
Prefs.module(),
- FbCookie.module()
+ FbCookie.module(),
+ ThemeProvider.module()
)
)
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
index 40333d25..059b2a0e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
@@ -26,6 +26,7 @@ import ca.allanwang.kau.logging.KL
import ca.allanwang.kau.utils.buildIsLollipopAndUp
import com.pitchedapps.frost.db.FrostDatabase
import com.pitchedapps.frost.facebook.FbCookie
+import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.services.scheduleNotificationsFromPrefs
import com.pitchedapps.frost.services.setupNotificationChannels
@@ -58,7 +59,8 @@ class FrostApp : Application(), KoinComponent {
FrostDatabase.module(),
prefFactoryModule(),
Prefs.module(),
- FbCookie.module()
+ FbCookie.module(),
+ ThemeProvider.module()
)
)
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
index 0cb037a5..e352b2fc 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
@@ -202,7 +202,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
}
drawerWrapperBinding.mainContainer.addView(contentBinding.root)
with(contentBinding) {
- setFrostColors(prefs) {
+ setFrostColors {
toolbar(toolbar)
themeWindow = false
header(appbar)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt
index 54baa184..6067fa82 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt
@@ -71,7 +71,7 @@ class DebugActivity : KauBaseActivity() {
}
setTitle(R.string.debug_frost)
- setFrostColors(prefs) {
+ setFrostColors {
toolbar(toolbar)
}
debugWebview.loadUrl(FbItem.FEED.url)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
index 06626752..609ed049 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt
@@ -221,7 +221,7 @@ class ImageActivity : KauBaseActivity() {
loadError(e)
}
})
- setFrostColors(prefs) {
+ setFrostColors {
themeWindow = false
}
dragHelper = ViewDragHelper.create(imageDrag, ViewDragCallback()).apply {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
index be53f2c2..601516de 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
@@ -80,7 +80,7 @@ class LoginActivity : BaseActivity() {
setContentView(R.layout.activity_login)
setSupportActionBar(toolbar)
setTitle(R.string.kau_login)
- setFrostColors(prefs) {
+ setFrostColors {
toolbar(toolbar)
}
profileLoader = GlideApp.with(profile)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt
index a0e3ae42..33215c7e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt
@@ -67,7 +67,7 @@ class SelectorActivity : BaseActivity() {
}
}
})
- setFrostColors(prefs) {
+ setFrostColors {
text(text)
background(container)
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt
index aac714ce..3f2cb6ce 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt
@@ -39,6 +39,7 @@ import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import com.pitchedapps.frost.R
import com.pitchedapps.frost.db.NotificationDao
import com.pitchedapps.frost.facebook.FbCookie
+import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.settings.getAppearancePrefs
import com.pitchedapps.frost.settings.getBehaviourPrefs
@@ -69,6 +70,7 @@ class SettingsActivity : KPrefActivity() {
val fbCookie: FbCookie by inject()
val notifDao: NotificationDao by inject()
val prefs: Prefs by inject()
+ val themeProvider: ThemeProvider by inject()
private var resultFlag = Activity.RESULT_CANCELED
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
index 11126803..589289ab 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
@@ -107,7 +107,7 @@ class TabCustomizerActivity : BaseActivity() {
fabCancel.setIcon(GoogleMaterial.Icon.gmd_close, prefs.iconColor)
fabCancel.backgroundTintList = ColorStateList.valueOf(prefs.accentColor)
fabCancel.setOnClickListener { finish() }
- setFrostColors(prefs) {
+ setFrostColors {
themeWindow = true
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt
index abc07d57..c21f7362 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt
@@ -205,7 +205,7 @@ abstract class WebOverlayActivityBase(private val userAgent: String = USER_AGENT
toolbar.navigationIcon = GoogleMaterial.Icon.gmd_close.toDrawable(this, 16, prefs.iconColor)
toolbar.setNavigationOnClickListener { finishSlideOut() }
- setFrostColors(prefs) {
+ setFrostColors {
toolbar(toolbar)
themeWindow = false
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt b/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt
index bb2514f5..3dccc446 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt
@@ -18,11 +18,10 @@ package com.pitchedapps.frost.enums
import android.graphics.Color
import androidx.annotation.StringRes
+import androidx.annotation.VisibleForTesting
import com.pitchedapps.frost.R
-import com.pitchedapps.frost.injectors.CssAssets
-import com.pitchedapps.frost.injectors.InjectorContract
-import com.pitchedapps.frost.injectors.JsActions
import com.pitchedapps.frost.prefs.sections.ThemePrefs
+import java.util.Locale
/**
* Created by Allan Wang on 2017-06-14.
@@ -32,7 +31,7 @@ const val BLUE_LIGHT = 0xff5d86dd.toInt()
enum class Theme(
@StringRes val textRes: Int,
- val injector: InjectorContract,
+ file: String?,
val textColorGetter: (ThemePrefs) -> Int,
val accentColorGetter: (ThemePrefs) -> Int,
val backgroundColorGetter: (ThemePrefs) -> Int,
@@ -41,7 +40,7 @@ enum class Theme(
) {
DEFAULT(R.string.kau_default,
- JsActions.EMPTY,
+ null,
{ 0xde000000.toInt() },
{ FACEBOOK_BLUE },
{ 0xfffafafa.toInt() },
@@ -49,7 +48,7 @@ enum class Theme(
{ Color.WHITE }),
LIGHT(R.string.kau_light,
- CssAssets.MATERIAL_LIGHT,
+ "material_light",
{ 0xde000000.toInt() },
{ FACEBOOK_BLUE },
{ 0xfffafafa.toInt() },
@@ -57,7 +56,7 @@ enum class Theme(
{ Color.WHITE }),
DARK(R.string.kau_dark,
- CssAssets.MATERIAL_DARK,
+ "material_dark",
{ Color.WHITE },
{ BLUE_LIGHT },
{ 0xff303030.toInt() },
@@ -65,7 +64,7 @@ enum class Theme(
{ Color.WHITE }),
AMOLED(R.string.kau_amoled,
- CssAssets.MATERIAL_AMOLED,
+ "material_amoled",
{ Color.WHITE },
{ BLUE_LIGHT },
{ Color.BLACK },
@@ -73,7 +72,7 @@ enum class Theme(
{ Color.WHITE }),
GLASS(R.string.kau_glass,
- CssAssets.MATERIAL_GLASS,
+ "material_glass",
{ Color.WHITE },
{ BLUE_LIGHT },
{ 0x80000000.toInt() },
@@ -81,15 +80,26 @@ enum class Theme(
{ Color.WHITE }),
CUSTOM(R.string.kau_custom,
- CssAssets.CUSTOM,
+ "custom",
{ it.customTextColor },
{ it.customAccentColor },
{ it.customBackgroundColor },
{ it.customHeaderColor },
{ it.customIconColor });
+ @VisibleForTesting
+ internal val file = file?.let { "${it}.css" }
+
companion object {
val values = values() // save one instance
operator fun invoke(index: Int) = values[index]
}
}
+
+enum class ThemeCategory {
+ FACEBOOK, MESSENGER
+ ;
+
+ @VisibleForTesting
+ internal val folder = name.toLowerCase(Locale.CANADA)
+}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt
index 61745b95..7a65a818 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt
@@ -23,6 +23,8 @@ package com.pitchedapps.frost.facebook
const val FACEBOOK_COM = "facebook.com"
const val FBCDN_NET = "fbcdn.net"
const val WWW_FACEBOOK_COM = "www.$FACEBOOK_COM"
+const val HTTPS_FACEBOOK_COM = "https://$WWW_FACEBOOK_COM"
+const val HTTPS_MESSENGER_COM = "https://www.messenger.com"
const val FACEBOOK_BASE_COM = "m.$FACEBOOK_COM"
const val FB_URL_BASE = "https://$FACEBOOK_BASE_COM/"
const val FACEBOOK_MBASIC_COM = "mbasic.$FACEBOOK_COM"
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt
index e66eaf27..36d51ec9 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt
@@ -28,6 +28,7 @@ import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.cookies
import com.pitchedapps.frost.utils.launchLogin
+import kotlinx.coroutines.Dispatchers
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
import kotlinx.coroutines.NonCancellable
@@ -44,7 +45,8 @@ import org.koin.dsl.module
class FbCookie(private val prefs: Prefs, private val cookieDao: CookieDao) {
companion object {
- private const val COOKIE_DOMAIN = FB_URL_BASE
+ private const val FB_COOKIE_DOMAIN = HTTPS_FACEBOOK_COM
+ private const val MESSENGER_COOKIE_DOMAIN = HTTPS_MESSENGER_COM
fun module() = module {
single { FbCookie(get(), get()) }
@@ -56,36 +58,37 @@ class FbCookie(private val prefs: Prefs, private val cookieDao: CookieDao) {
* Note that this is a synchronized call
*/
val webCookie: String?
- get() = CookieManager.getInstance().getCookie(COOKIE_DOMAIN)
+ get() = CookieManager.getInstance().getCookie(FB_COOKIE_DOMAIN)
- private suspend fun CookieManager.suspendSetWebCookie(cookie: String?): Boolean {
+ val messengerCookie: String?
+ get() = CookieManager.getInstance().getCookie(HTTPS_MESSENGER_COM)
+
+ private suspend fun CookieManager.suspendSetWebCookie(domain: String, cookie: String?): Boolean {
cookie ?: return true
return withContext(NonCancellable) {
- removeAllCookies()
// Save all cookies regardless of result, then check if all succeeded
val result = cookie.split(";")
- .map { async { setSingleWebCookie(it) } }
+ .map { async { setSingleWebCookie(domain, it) } }
.awaitAll().all { it }
- flush()
L.d { "Cookies set" }
L._d { "Set $cookie\n\tResult $webCookie" }
result
}
}
+ private suspend fun CookieManager.setSingleWebCookie(domain: String, cookie: String): Boolean =
+ suspendCoroutine { cont ->
+ setCookie(domain, cookie.trim()) {
+ cont.resume(it)
+ }
+ }
+
private suspend fun CookieManager.removeAllCookies(): Boolean = suspendCoroutine { cont ->
removeAllCookies {
cont.resume(it)
}
}
- private suspend fun CookieManager.setSingleWebCookie(cookie: String): Boolean =
- suspendCoroutine { cont ->
- setCookie(COOKIE_DOMAIN, cookie.trim()) {
- cont.resume(it)
- }
- }
-
suspend fun save(id: Long) {
L.d { "New cookie found" }
prefs.userId = id
@@ -108,14 +111,20 @@ class FbCookie(private val prefs: Prefs, private val cookieDao: CookieDao) {
}
suspend fun switchUser(cookie: CookieEntity?) {
- if (cookie == null) {
+ if (cookie?.cookie == null) {
L.d { "Switching User; null cookie" }
return
}
- withContext(NonCancellable) {
+ withContext(Dispatchers.IO + NonCancellable) {
L.d { "Switching User" }
+ // TODO save old messenger cookie
prefs.userId = cookie.id
- CookieManager.getInstance().suspendSetWebCookie(cookie.cookie)
+ CookieManager.getInstance().apply {
+ removeAllCookies()
+ suspendSetWebCookie(FB_COOKIE_DOMAIN, cookie.cookie)
+ // TODO set messenger cookie
+ flush()
+ }
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt
index 4c33fe8d..9b08c775 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbItem.kt
@@ -48,6 +48,7 @@ enum class FbItem(
MARKETPLACE(R.string.marketplace, GoogleMaterial.Icon.gmd_store, "marketplace"),
MENU(R.string.menu, GoogleMaterial.Icon.gmd_menu, "settings"),
MESSAGES(R.string.messages, MaterialDesignIconic.Icon.gmi_comments, "messages"),
+ MESSENGER(R.string.messenger, CommunityMaterial.Icon2.cmd_facebook_messenger, "", prefix = HTTPS_MESSENGER_COM),
NOTES(R.string.notes, CommunityMaterial.Icon3.cmd_note, "notes"),
NOTIFICATIONS(R.string.notifications, MaterialDesignIconic.Icon.gmi_globe, "notifications"),
ON_THIS_DAY(R.string.on_this_day, GoogleMaterial.Icon.gmd_today, "onthisday"),
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssSmallAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAsset.kt
index 30ee7a8f..b384efad 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssSmallAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAsset.kt
@@ -22,7 +22,7 @@ import com.pitchedapps.frost.prefs.Prefs
/**
* Small misc inline css assets
*/
-enum class CssSmallAssets(private val content: String) : InjectorContract {
+enum class CssAsset(private val content: String) : InjectorContract {
FullSizeImage("div._4prr[style*=\"max-width\"][style*=\"max-height\"]{max-width:none !important;max-height:none !important}")
;
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/ThemeProvider.kt
index 5329046f..5a9576d2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/ThemeProvider.kt
@@ -18,19 +18,20 @@ 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.utils.adjustAlpha
import ca.allanwang.kau.utils.colorToBackground
import ca.allanwang.kau.utils.colorToForeground
+import ca.allanwang.kau.utils.isColorVisibleOn
import ca.allanwang.kau.utils.toRgbaString
import ca.allanwang.kau.utils.use
import ca.allanwang.kau.utils.withAlpha
+import com.pitchedapps.frost.enums.FACEBOOK_BLUE
+import com.pitchedapps.frost.enums.Theme
+import com.pitchedapps.frost.enums.ThemeCategory
import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.utils.L
import java.io.BufferedReader
import java.io.FileNotFoundException
-import java.util.Locale
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
@@ -39,30 +40,60 @@ import kotlinx.coroutines.withContext
* Mapping of the available assets
* The enum name must match the css file name
*/
-enum class CssAssets(val folder: String = THEME_FOLDER) : InjectorContract {
- MATERIAL_LIGHT, MATERIAL_DARK, MATERIAL_AMOLED, MATERIAL_GLASS, CUSTOM
- ;
+class ThemeProvider(private val context: Context, private val prefs: Prefs) {
- @VisibleForTesting
- internal val file = "${name.toLowerCase(Locale.CANADA)}.css"
+ var theme: Theme = Theme.values[prefs.theme]
+
+ private val injectors: MutableMap<ThemeCategory, InjectorContract> = mutableMapOf()
+
+ val textColor: Int
+ get() = theme.textColorGetter(prefs)
+
+ val accentColor: Int
+ get() = theme.accentColorGetter(prefs)
+
+ val accentColorForWhite: Int
+ get() = when {
+ accentColor.isColorVisibleOn(Color.WHITE) -> accentColor
+ textColor.isColorVisibleOn(Color.WHITE) -> textColor
+ else -> FACEBOOK_BLUE
+ }
+
+ val nativeBgColor: Int
+ get() = bgColor.withAlpha(30)
+
+ fun nativeBgColor(unread: Boolean) = bgColor
+ .colorToForeground(if (unread) 0.7f else 0.0f)
+ .withAlpha(30)
+
+ val bgColor: Int
+ get() = theme.backgroundColorGetter(prefs)
+
+ val headerColor: Int
+ get() = theme.headerColorGetter(prefs)
+
+ val iconColor: Int
+ get() = theme.iconColorGetter(prefs)
+
+ val isCustomTheme: Boolean
+ get() = theme == Theme.CUSTOM
/**
- * Note that while this can be loaded from any thread, it is typically done through [load]
+ * Note that while this can be loaded from any thread, it is typically done through [preload]]
*/
- private var injector: JsInjector? = null
-
- private fun injector(context: Context, prefs: Prefs): JsInjector =
- injector ?: createInjector(context, prefs).also { injector = it }
+ fun injector(category: ThemeCategory): InjectorContract =
+ injectors.getOrPut(category) { createInjector(category) }
/**
- * Note that while this can be loaded from any thread, it is typically done through [load]
+ * Note that while this can be loaded from any thread, it is typically done through [preload]
*/
- private fun createInjector(context: Context, prefs: Prefs): JsInjector =
+ private fun createInjector(category: ThemeCategory): InjectorContract {
+ val file = theme.file ?: return JsActions.EMPTY
try {
var content =
- context.assets.open("css/$folder/$file").bufferedReader()
+ context.assets.open("css/${category.folder}/theme/${file}").bufferedReader()
.use(BufferedReader::readText)
- if (this == CUSTOM) {
+ if (theme == Theme.CUSTOM) {
val bt = if (Color.alpha(prefs.bgColor) == 255)
prefs.bgColor.toRgbaString()
else
@@ -84,32 +115,32 @@ enum class CssAssets(val folder: String = THEME_FOLDER) : InjectorContract {
.replace("\$TI\$", bb.withAlpha(60).toRgbaString())
.replace("\$C\$", bt)
}
- JsBuilder().css(content).build()
+ return JsBuilder().css(content).build()
} catch (e: FileNotFoundException) {
L.e(e) { "CssAssets file not found" }
- JsInjector(JsActions.EMPTY.function)
+ return JsActions.EMPTY
}
+ }
- override fun inject(webView: WebView, prefs: Prefs) =
- injector(webView.context, prefs).inject(webView, prefs)
+ fun setTheme(id: Int) {
+ theme = Theme.values[id]
+ reset()
+ }
fun reset() {
- injector = null
+ injectors.clear()
}
- companion object {
-
- // Ensures that all non themes and the selected theme are loaded
- suspend fun load(context: Context, prefs: Prefs) {
- withContext(Dispatchers.IO) {
- val currentTheme = prefs.themeInjector as? CssAssets
- val (themes, others) = values().partition { it.folder == THEME_FOLDER }
- themes.filter { it != currentTheme }.forEach { it.reset() }
- currentTheme?.injector(context, prefs)
- others.forEach { it.injector(context, prefs) }
- }
+ suspend fun preload() {
+ withContext(Dispatchers.IO) {
+ reset()
+ ThemeCategory.values().forEach { injector(it) }
}
}
-}
-private const val THEME_FOLDER = "themes"
+ companion object {
+ fun module() = org.koin.dsl.module {
+ single { ThemeProvider(get(), get()) }
+ }
+ }
+} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt
index 84f64435..a5a66ee9 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt
@@ -106,7 +106,7 @@ class ThemePrefsImpl(
private val loader = lazyResettable { Theme.values[theme] }
- private val t: Theme by loader
+ val t: Theme by loader
override val textColor: Int
get() = t.textColorGetter(this)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
index 65e24ab8..a5f7ec28 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
@@ -27,7 +27,7 @@ import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.SettingsActivity
import com.pitchedapps.frost.enums.MainActivityLayout
import com.pitchedapps.frost.enums.Theme
-import com.pitchedapps.frost.injectors.CssAssets
+import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.utils.REQUEST_NAV
import com.pitchedapps.frost.utils.REQUEST_TEXT_ZOOM
import com.pitchedapps.frost.utils.frostEvent
@@ -44,7 +44,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
header(R.string.theme_customization)
- text(R.string.theme, prefs::theme, { prefs.theme = it }) {
+ text(R.string.theme, prefs::theme, { prefs.theme = it; themeProvider.setTheme(it) }) {
onClick = {
materialDialog {
title(R.string.theme)
@@ -76,7 +76,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
}
fun invalidateCustomTheme() {
- CssAssets.CUSTOM.reset()
+ themeProvider.reset()
}
colorPicker(R.string.text_color, prefs::customTextColor, {
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 e7bc1542..883ea9aa 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -67,7 +67,7 @@ import com.pitchedapps.frost.facebook.FbUrlFormatter.Companion.VIDEO_REDIRECT
import com.pitchedapps.frost.facebook.USER_AGENT
import com.pitchedapps.frost.facebook.formattedFbUri
import com.pitchedapps.frost.facebook.formattedFbUrl
-import com.pitchedapps.frost.injectors.CssAssets
+import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.injectors.JsAssets
import com.pitchedapps.frost.prefs.Prefs
import java.io.File
@@ -84,6 +84,8 @@ import org.apache.commons.text.StringEscapeUtils
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
+import org.koin.core.component.KoinComponent
+import org.koin.core.component.inject
/**
* Created by Allan Wang on 2017-06-03.
@@ -191,7 +193,10 @@ fun Activity.setFrostTheme(prefs: Prefs, forceTransparent: Boolean = false) {
}
}
-class ActivityThemeUtils(val prefs: Prefs) {
+class ActivityThemeUtils : KoinComponent {
+
+ private val prefs: Prefs by inject()
+ private val themeProvider: ThemeProvider by inject()
private var toolbar: Toolbar? = null
var themeWindow = true
@@ -454,6 +459,6 @@ fun String.unescapeHtml(): String =
.replace("\\\"", "\"")
suspend fun Context.loadAssets(prefs: Prefs): Unit = coroutineScope {
- CssAssets.load(this@loadAssets, prefs)
+ ThemeProvider.load(this@loadAssets, prefs)
JsAssets.load(this@loadAssets)
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt
index 17ab77a7..c68d3f57 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt
@@ -26,7 +26,7 @@ import android.webkit.WebView
import ca.allanwang.kau.utils.withAlpha
import com.pitchedapps.frost.facebook.USER_AGENT
import com.pitchedapps.frost.injectors.CssHider
-import com.pitchedapps.frost.injectors.CssSmallAssets
+import com.pitchedapps.frost.injectors.CssAsset
import com.pitchedapps.frost.injectors.jsInject
import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.utils.L
@@ -117,7 +117,7 @@ class DebugWebView @JvmOverloads constructor(
(url?.contains("?sk=h_chr") ?: false) &&
prefs.aggressiveRecents
),
- CssSmallAssets.FullSizeImage.maybe(prefs.fullSizeImage),
+ CssAsset.FullSizeImage.maybe(prefs.fullSizeImage),
prefs = prefs
)
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
index 324af69b..cf248baf 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -29,7 +29,7 @@ import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.WWW_FACEBOOK_COM
import com.pitchedapps.frost.facebook.formattedFbUrl
import com.pitchedapps.frost.injectors.CssHider
-import com.pitchedapps.frost.injectors.CssSmallAssets
+import com.pitchedapps.frost.injectors.CssAsset
import com.pitchedapps.frost.injectors.JsActions
import com.pitchedapps.frost.injectors.JsAssets
import com.pitchedapps.frost.injectors.jsInject
@@ -118,7 +118,7 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
CssHider.ADS.maybe(!prefs.showFacebookAds),
CssHider.POST_ACTIONS.maybe(!prefs.showPostActions),
CssHider.POST_REACTIONS.maybe(!prefs.showPostReactions),
- CssSmallAssets.FullSizeImage.maybe(prefs.fullSizeImage),
+ CssAsset.FullSizeImage.maybe(prefs.fullSizeImage),
JsAssets.DOCUMENT_WATCHER,
JsAssets.HORIZONTAL_SCROLLING,
JsAssets.AUTO_RESIZE_TEXTAREA.maybe(prefs.autoExpandTextBox),
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ee79b811..860895e5 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -7,6 +7,7 @@
<string name="events">Events</string>
<string name="friends">Friends</string>
<string name="messages">Messages</string>
+ <string name="messenger">Messenger</string>
<string name="notifications">Notifications</string>
<string name="activity_log">Activity Log</string>
<string name="pages">Pages</string>
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/injectors/CssAssetsTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/injectors/ThemeProviderTest.kt
index 8894e5b6..f59980d2 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/injectors/CssAssetsTest.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/injectors/ThemeProviderTest.kt
@@ -20,11 +20,11 @@ import java.io.File
import kotlin.test.Test
import kotlin.test.assertTrue
-class CssAssetsTest {
+class ThemeProviderTest {
@Test
fun verifyAssetsExist() {
- CssAssets.values().forEach { asset ->
+ ThemeProvider.values().forEach { asset ->
val file = File("src/web/assets/css/${asset.folder}/${asset.file}").absoluteFile
assertTrue(file.exists(), "${asset.name} not found at ${file.path}")
}
diff --git a/app/src/web/scss/core/_core_bg.scss b/app/src/web/scss/facebook/core/_core_bg.scss
index c5269ccf..c5269ccf 100644
--- a/app/src/web/scss/core/_core_bg.scss
+++ b/app/src/web/scss/facebook/core/_core_bg.scss
diff --git a/app/src/web/scss/core/_core_border.scss b/app/src/web/scss/facebook/core/_core_border.scss
index 1929e546..1929e546 100644
--- a/app/src/web/scss/core/_core_border.scss
+++ b/app/src/web/scss/facebook/core/_core_border.scss
diff --git a/app/src/web/scss/core/_core_messenger.scss b/app/src/web/scss/facebook/core/_core_messages.scss
index 608fc23d..aa3c04eb 100644
--- a/app/src/web/scss/core/_core_messenger.scss
+++ b/app/src/web/scss/facebook/core/_core_messages.scss
@@ -1,4 +1,4 @@
-// Not all messenger related components are here; only the main ones.
+// Not all message related components are here; only the main ones.
// Borders for instance are merged into core_border
// Other person's message bubble
diff --git a/app/src/web/scss/core/_core_text.scss b/app/src/web/scss/facebook/core/_core_text.scss
index 8ac66758..8ac66758 100644
--- a/app/src/web/scss/core/_core_text.scss
+++ b/app/src/web/scss/facebook/core/_core_text.scss
diff --git a/app/src/web/scss/core/_main.scss b/app/src/web/scss/facebook/core/_main.scss
index 3e972f93..3e972f93 100644
--- a/app/src/web/scss/core/_main.scss
+++ b/app/src/web/scss/facebook/core/_main.scss
diff --git a/app/src/web/scss/core/_svg.scss b/app/src/web/scss/facebook/core/_svg.scss
index 9ed25433..9ed25433 100644
--- a/app/src/web/scss/core/_svg.scss
+++ b/app/src/web/scss/facebook/core/_svg.scss
diff --git a/app/src/web/scss/core/core.scss b/app/src/web/scss/facebook/core/core.scss
index 38086529..dd8fd398 100644
--- a/app/src/web/scss/core/core.scss
+++ b/app/src/web/scss/facebook/core/core.scss
@@ -1,9 +1,9 @@
-@import "colors";
-@import "base";
+@import "../../core/colors";
+@import "../../core/base";
@import "core_text";
@import "core_bg";
@import "core_border";
-@import "core_messenger";
+@import "core_messages";
//GLOBAL overrides; use with caution
*, *::after, *::before {
diff --git a/app/src/web/scss/themes/.gitignore b/app/src/web/scss/facebook/themes/.gitignore
index 4c46adff..4c46adff 100644
--- a/app/src/web/scss/themes/.gitignore
+++ b/app/src/web/scss/facebook/themes/.gitignore
diff --git a/app/src/web/scss/facebook/themes/custom.scss b/app/src/web/scss/facebook/themes/custom.scss
new file mode 100644
index 00000000..ab3d0f34
--- /dev/null
+++ b/app/src/web/scss/facebook/themes/custom.scss
@@ -0,0 +1,2 @@
+@import "../../palette/custom";
+@import "../core/main";
diff --git a/app/src/web/scss/facebook/themes/material_amoled.scss b/app/src/web/scss/facebook/themes/material_amoled.scss
new file mode 100644
index 00000000..4b1b5d17
--- /dev/null
+++ b/app/src/web/scss/facebook/themes/material_amoled.scss
@@ -0,0 +1,2 @@
+@import "../../palette/material_amoled";
+@import "../core/main";
diff --git a/app/src/web/scss/facebook/themes/material_dark.scss b/app/src/web/scss/facebook/themes/material_dark.scss
new file mode 100644
index 00000000..badec66d
--- /dev/null
+++ b/app/src/web/scss/facebook/themes/material_dark.scss
@@ -0,0 +1,2 @@
+@import "../../palette/material_dark";
+@import "../core/main";
diff --git a/app/src/web/scss/facebook/themes/material_glass.scss b/app/src/web/scss/facebook/themes/material_glass.scss
new file mode 100644
index 00000000..480def7f
--- /dev/null
+++ b/app/src/web/scss/facebook/themes/material_glass.scss
@@ -0,0 +1,2 @@
+@import "../../palette/material_glass";
+@import "../core/main";
diff --git a/app/src/web/scss/facebook/themes/material_light.scss b/app/src/web/scss/facebook/themes/material_light.scss
new file mode 100644
index 00000000..2a84f449
--- /dev/null
+++ b/app/src/web/scss/facebook/themes/material_light.scss
@@ -0,0 +1,2 @@
+@import "../../palette/material_light";
+@import "../core/main"; \ No newline at end of file
diff --git a/app/src/web/scss/messenger/core/_core_bg.scss b/app/src/web/scss/messenger/core/_core_bg.scss
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/app/src/web/scss/messenger/core/_core_bg.scss
diff --git a/app/src/web/scss/messenger/core/_core_border.scss b/app/src/web/scss/messenger/core/_core_border.scss
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/app/src/web/scss/messenger/core/_core_border.scss
diff --git a/app/src/web/scss/messenger/core/_core_text.scss b/app/src/web/scss/messenger/core/_core_text.scss
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/app/src/web/scss/messenger/core/_core_text.scss
diff --git a/app/src/web/scss/messenger/core/_main.scss b/app/src/web/scss/messenger/core/_main.scss
new file mode 100644
index 00000000..e5da5377
--- /dev/null
+++ b/app/src/web/scss/messenger/core/_main.scss
@@ -0,0 +1,3 @@
+@import "core";
+
+//this file is used as the base for all messenger themes
diff --git a/app/src/web/scss/messenger/core/core.scss b/app/src/web/scss/messenger/core/core.scss
new file mode 100644
index 00000000..f6a92475
--- /dev/null
+++ b/app/src/web/scss/messenger/core/core.scss
@@ -0,0 +1,5 @@
+@import "../../core/colors";
+@import "../../core/base";
+@import "core_text";
+@import "core_bg";
+@import "core_border"; \ No newline at end of file
diff --git a/app/src/web/scss/messenger/themes/.gitignore b/app/src/web/scss/messenger/themes/.gitignore
new file mode 100644
index 00000000..4c46adff
--- /dev/null
+++ b/app/src/web/scss/messenger/themes/.gitignore
@@ -0,0 +1 @@
+test.scss
diff --git a/app/src/web/scss/messenger/themes/custom.scss b/app/src/web/scss/messenger/themes/custom.scss
new file mode 100644
index 00000000..ab3d0f34
--- /dev/null
+++ b/app/src/web/scss/messenger/themes/custom.scss
@@ -0,0 +1,2 @@
+@import "../../palette/custom";
+@import "../core/main";
diff --git a/app/src/web/scss/messenger/themes/material_amoled.scss b/app/src/web/scss/messenger/themes/material_amoled.scss
new file mode 100644
index 00000000..4b1b5d17
--- /dev/null
+++ b/app/src/web/scss/messenger/themes/material_amoled.scss
@@ -0,0 +1,2 @@
+@import "../../palette/material_amoled";
+@import "../core/main";
diff --git a/app/src/web/scss/messenger/themes/material_dark.scss b/app/src/web/scss/messenger/themes/material_dark.scss
new file mode 100644
index 00000000..badec66d
--- /dev/null
+++ b/app/src/web/scss/messenger/themes/material_dark.scss
@@ -0,0 +1,2 @@
+@import "../../palette/material_dark";
+@import "../core/main";
diff --git a/app/src/web/scss/messenger/themes/material_glass.scss b/app/src/web/scss/messenger/themes/material_glass.scss
new file mode 100644
index 00000000..480def7f
--- /dev/null
+++ b/app/src/web/scss/messenger/themes/material_glass.scss
@@ -0,0 +1,2 @@
+@import "../../palette/material_glass";
+@import "../core/main";
diff --git a/app/src/web/scss/messenger/themes/material_light.scss b/app/src/web/scss/messenger/themes/material_light.scss
new file mode 100644
index 00000000..2a84f449
--- /dev/null
+++ b/app/src/web/scss/messenger/themes/material_light.scss
@@ -0,0 +1,2 @@
+@import "../../palette/material_light";
+@import "../core/main"; \ No newline at end of file
diff --git a/app/src/web/scss/themes/custom.scss b/app/src/web/scss/palette/_custom.scss
index 50c029fb..b35bdfa1 100644
--- a/app/src/web/scss/themes/custom.scss
+++ b/app/src/web/scss/palette/_custom.scss
@@ -10,5 +10,3 @@ $bg_opaque2: unquote('$OO$');
$divider: unquote('$D$');
$card: unquote('$C$');
$tint: unquote('$TI$');
-
-@import "../core/main";
diff --git a/app/src/web/scss/themes/material_amoled.scss b/app/src/web/scss/palette/_material_amoled.scss
index 19190126..3eca36bc 100644
--- a/app/src/web/scss/themes/material_amoled.scss
+++ b/app/src/web/scss/palette/_material_amoled.scss
@@ -7,5 +7,3 @@ $background2: rgba($background, 0.35);
$bg_transparent: $background;
$card: $background2;
$tint: rgba(#fff, 0.2);
-
-@import "../core/main";
diff --git a/app/src/web/scss/themes/material_dark.scss b/app/src/web/scss/palette/_material_dark.scss
index 18b8b461..a27627c0 100644
--- a/app/src/web/scss/themes/material_dark.scss
+++ b/app/src/web/scss/palette/_material_dark.scss
@@ -6,5 +6,3 @@ $background: #303030;
$bg_transparent: $background;
$card: #353535;
$tint: rgba(#fff, 0.2);
-
-@import "../core/main";
diff --git a/app/src/web/scss/themes/material_glass.scss b/app/src/web/scss/palette/_material_glass.scss
index 0c61a38c..c9e399e7 100644
--- a/app/src/web/scss/themes/material_glass.scss
+++ b/app/src/web/scss/palette/_material_glass.scss
@@ -5,6 +5,4 @@ $accent: #5d86dd;
$background: rgba(#000, 0.1);
$bg_transparent: transparent;
$card: rgba(#000, 0.25);
-$tint: rgba(#fff, 0.15);
-
-@import "../core/main";
+$tint: rgba(#fff, 0.15); \ No newline at end of file
diff --git a/app/src/web/scss/themes/material_light.scss b/app/src/web/scss/palette/_material_light.scss
index 7ec58463..2a799180 100644
--- a/app/src/web/scss/themes/material_light.scss
+++ b/app/src/web/scss/palette/_material_light.scss
@@ -10,6 +10,4 @@ $background2: rgba(darken($background, 8%), 0.35);
$bg_transparent: $background;
$card: #fff;
-$tint: #ddd;
-
-@import "../core/main"; \ No newline at end of file
+$tint: #ddd; \ No newline at end of file