feat(Media): Toggleable Comments (#521)

* Smooth theme transitions
This commit is contained in:
Sadwhy
2024-11-17 12:21:44 +06:00
committed by GitHub
parent 56e557738c
commit d1e2ca8b5e
9 changed files with 85 additions and 40 deletions

View File

@@ -27,8 +27,11 @@ import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
object CommentsAPI {
private const val ADDRESS: String = "https://api.dantotsu.app"
private const val API_ADDRESS: String = "https://api.dantotsu.app"
private const val LOCAL_HOST: String = "https://127.0.0.1"
private var isOnline: Boolean = true
private var commentsEnabled = PrefManager.getVal<Int>(PrefName.CommentsEnabled) == 1
private val ADDRESS: String get() = if (commentsEnabled) API_ADDRESS else LOCAL_HOST
var authToken: String? = null
var userId: String? = null
var isBanned: Boolean = false
@@ -369,10 +372,9 @@ object CommentsAPI {
}
errorMessage("Failed to login after multiple attempts")
}
private fun errorMessage(reason: String) {
Logger.log(reason)
if (isOnline) snackString(reason)
if (commentsEnabled) Logger.log(reason)
if (isOnline && commentsEnabled) snackString(reason)
}
fun logout() {