1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 20:12:39 +01:00

Cancel image loading if activity is not found

This commit is contained in:
Allan Wang 2019-07-03 12:51:21 -07:00
parent 6685ed8d71
commit a0c8357793
No known key found for this signature in database
GPG Key ID: C93E3F9C679D7A56
3 changed files with 8 additions and 0 deletions

View File

@ -46,6 +46,7 @@ import com.pitchedapps.frost.utils.BiometricUtils
import com.pitchedapps.frost.utils.EXTRA_COOKIES import com.pitchedapps.frost.utils.EXTRA_COOKIES
import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.launchImageActivity
import com.pitchedapps.frost.utils.launchNewTask import com.pitchedapps.frost.utils.launchNewTask
import com.pitchedapps.frost.utils.loadAssets import com.pitchedapps.frost.utils.loadAssets
import com.raizlabs.android.dbflow.kotlinextensions.from import com.raizlabs.android.dbflow.kotlinextensions.from

View File

@ -39,6 +39,7 @@ import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.scaleXY import ca.allanwang.kau.utils.scaleXY
import ca.allanwang.kau.utils.setIcon import ca.allanwang.kau.utils.setIcon
import ca.allanwang.kau.utils.tint import ca.allanwang.kau.utils.tint
import ca.allanwang.kau.utils.toast
import ca.allanwang.kau.utils.withAlpha import ca.allanwang.kau.utils.withAlpha
import ca.allanwang.kau.utils.withMinAlpha import ca.allanwang.kau.utils.withMinAlpha
import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.ImageSource
@ -145,6 +146,11 @@ class ImageActivity : KauBaseActivity() {
else Prefs.bgColor.withMinAlpha(235) else Prefs.bgColor.withMinAlpha(235)
private fun loadError(e: Throwable) { private fun loadError(e: Throwable) {
if (e.message?.contains("<!DOCTYPE html>") == true) {
applicationContext.toast(R.string.image_not_found)
finish()
return
}
errorRef = e errorRef = e
e.logFrostEvent("Image load error") e.logFrostEvent("Image load error")
if (image_progress.isVisible) if (image_progress.isVisible)

View File

@ -11,4 +11,5 @@
<string name="error_notification">An error occurred when fetching notifications</string> <string name="error_notification">An error occurred when fetching notifications</string>
<string name="error_sdk">Your device\'s SDK (%d) is incompatible. Frost only supports Lollipop (SDK 21) and above</string> <string name="error_sdk">Your device\'s SDK (%d) is incompatible. Frost only supports Lollipop (SDK 21) and above</string>
<string name="error_webview">Your device does not seem to have a webview. Please add or enable one.</string> <string name="error_webview">Your device does not seem to have a webview. Please add or enable one.</string>
<string name="image_not_found">Image not found.</string>
</resources> </resources>