aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-03-11 19:24:32 -0400
committerGitHub <noreply@github.com>2018-03-11 19:24:32 -0400
commitfe51373f5a95323d64f6d966888a2c6c62a36deb (patch)
tree328bf7ab5bf00f01e070e9d84ff71cac59b0ecf1 /app/src/main/kotlin/com/pitchedapps/frost/utils
parent67988a25d83fc10b187fcc821c3ceacfad0195d5 (diff)
downloadfrost-fe51373f5a95323d64f6d966888a2c6c62a36deb.tar.gz
frost-fe51373f5a95323d64f6d966888a2c6c62a36deb.tar.bz2
frost-fe51373f5a95323d64f6d966888a2c6c62a36deb.zip
Enhancement/debug mode (#779)
* Update changelog * Improve debugger * Remove need for mapping urls * Remove excess logs * Clean up
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt8
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IabBinder.kt4
3 files changed, 13 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt
index 928f90d3..8d800e9b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/AnimatedVectorDelegate.kt
@@ -54,8 +54,10 @@ class AnimatedVectorDelegate(
override fun bind(view: ImageView) {
this.view = view
- view.context.drawable(avdStart) as? AnimatedVectorDrawable ?: throw IllegalArgumentException("AnimatedVectorDelegate has a starting drawable that isn't an avd")
- view.context.drawable(avdEnd) as? AnimatedVectorDrawable ?: throw IllegalArgumentException("AnimatedVectorDelegate has an ending drawable that isn't an avd")
+ view.context.drawable(avdStart) as? AnimatedVectorDrawable
+ ?: throw IllegalArgumentException("AnimatedVectorDelegate has a starting drawable that isn't an avd")
+ view.context.drawable(avdEnd) as? AnimatedVectorDrawable
+ ?: throw IllegalArgumentException("AnimatedVectorDelegate has an ending drawable that isn't an avd")
view.setImageResource(avdStart)
if (emitOnBind) animatedVectorListener?.invoke(avd!!, false)
}
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 3e102671..d73f29e9 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -32,6 +32,7 @@ import com.pitchedapps.frost.dbflow.CookieModel
import com.pitchedapps.frost.facebook.*
import com.pitchedapps.frost.facebook.FbUrlFormatter.Companion.VIDEO_REDIRECT
import com.pitchedapps.frost.utils.iab.IS_FROST_PRO
+import org.apache.commons.text.StringEscapeUtils
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import java.io.File
@@ -342,4 +343,9 @@ fun File.createFreshDir(): Boolean {
if (exists() && !deleteRecursively())
return false
return mkdirs()
-} \ No newline at end of file
+}
+
+fun String.unescapeHtml(): String =
+ StringEscapeUtils.unescapeXml(this)
+ .replace("\\u003C", "<")
+ .replace("\\\"", "\"")
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IabBinder.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IabBinder.kt
index cdfffb87..568127a2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IabBinder.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IabBinder.kt
@@ -94,8 +94,8 @@ abstract class IabBinder : FrostBilling {
error.logFrostAnswers("IAB error $errorCode")
}
- override fun onActivityResultBilling(requestCode: Int, resultCode: Int, data: Intent?): Boolean
- = bp?.handleActivityResult(requestCode, resultCode, data) ?: false
+ override fun onActivityResultBilling(requestCode: Int, resultCode: Int, data: Intent?): Boolean = bp?.handleActivityResult(requestCode, resultCode, data)
+ ?: false
override fun purchasePro() {
val bp = this.bp