1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-10 04:52:38 +01:00

Fix some null check warnings

This commit is contained in:
Allan Wang 2017-10-26 14:19:43 -04:00
parent 1cbee7747e
commit ca12899e10
4 changed files with 6 additions and 3 deletions

View File

@ -169,7 +169,7 @@ class DownloadService : IntentService("FrostVideoDownloader") {
private var totalBytesRead = 0L
override fun read(sink: Buffer?, byteCount: Long): Long {
override fun read(sink: Buffer, byteCount: Long): Long {
val bytesRead = super.read(sink, byteCount)
// read() returns the number of bytes read, or -1 if this source is exhausted.
totalBytesRead += if (bytesRead != -1L) bytesRead else 0

View File

@ -28,6 +28,7 @@ open class AdBlocker(val assetPath: String) {
}
fun isAd(url: String?): Boolean {
url ?: return false
val httpUrl = HttpUrl.parse(url) ?: return false
return isAdHost(httpUrl.host())
}

View File

@ -39,7 +39,8 @@ private val adWhitelistHost: Set<String> =
)
fun WebView.shouldFrostInterceptRequest(request: WebResourceRequest): WebResourceResponse? {
val httpUrl = HttpUrl.parse(request.url?.toString() ?: return null) ?: return null
request.url ?: return null
val httpUrl = HttpUrl.parse(request.url.toString()) ?: return null
val host = httpUrl.host()
val url = httpUrl.toString()
// if (blacklistHost.contains(host)) return blankResource

View File

@ -3,7 +3,8 @@
## v1.6.2
* Fix search update from Facebook
* Fix url parsing errors again
* Fix pip for bottom bar (rotation still has issues)
* Fix pip for bottom bar
* Fix pip after rotation
## v1.6.0
* Add Spanish translations