diff options
author | Allan Wang <me@allanwang.ca> | 2019-09-07 18:10:38 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-09-07 18:10:38 -0700 |
commit | e736b53094629c4250c536170e938c625f5dc03c (patch) | |
tree | 8704f9b8986a4f5c643dfe2c683bc557be3f2221 | |
parent | 1a0ec6fc0239d77c2aa771a23ab857f5bd7703d9 (diff) | |
download | frost-e736b53094629c4250c536170e938c625f5dc03c.tar.gz frost-e736b53094629c4250c536170e938c625f5dc03c.tar.bz2 frost-e736b53094629c4250c536170e938c625f5dc03c.zip |
Remove desktop overlay activity
4 files changed, 4 insertions, 43 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 664ffd38..d30b5177 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -60,13 +60,6 @@ android:launchMode="singleTop" android:theme="@style/FrostTheme.Overlay.Slide" /> <activity - android:name=".activities.WebOverlayDesktopActivity" - android:configChanges="orientation|screenSize|locale" - android:hardwareAccelerated="true" - android:label="@string/frost_web" - android:launchMode="singleTop" - android:theme="@style/FrostTheme.Overlay.Slide" /> - <activity android:name=".activities.FrostWebActivity" android:autoRemoveFromRecents="true" android:configChanges="orientation|screenSize|locale" 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 b3ef9bd4..d82084d5 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt @@ -16,7 +16,6 @@ */ package com.pitchedapps.frost.activities -import android.annotation.SuppressLint import android.content.Intent import android.graphics.PointF import android.net.Uri @@ -60,7 +59,6 @@ import com.pitchedapps.frost.enums.OverlayContext import com.pitchedapps.frost.facebook.FB_URL_BASE import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.facebook.FbItem -import com.pitchedapps.frost.facebook.USER_AGENT_DESKTOP import com.pitchedapps.frost.facebook.formattedFbUrl import com.pitchedapps.frost.kotlin.subscribeDuringJob import com.pitchedapps.frost.services.FrostRunnable @@ -94,7 +92,7 @@ import okhttp3.HttpUrl * Going back will bring you back to the previous app */ @UseExperimental(ExperimentalCoroutinesApi::class) -class FrostWebActivity : WebOverlayActivityBase(false) { +class FrostWebActivity : WebOverlayActivityBase() { override fun onCreate(savedInstanceState: Bundle?) { val requiresAction = !parseActionSend() @@ -143,19 +141,12 @@ class FrostWebActivity : WebOverlayActivityBase(false) { } /** - * Variant that forces a desktop user agent. This is largely internal, - * and is only necessary when we are launching from an existing [WebOverlayActivityBase] - */ -class WebOverlayDesktopActivity : WebOverlayActivityBase(true) - -/** * Internal overlay for the app; this is tied with the main task and is singleTop as opposed to singleInstance */ -class WebOverlayActivity : WebOverlayActivityBase(false) +class WebOverlayActivity : WebOverlayActivityBase() -@SuppressLint("Registered") @UseExperimental(ExperimentalCoroutinesApi::class) -open class WebOverlayActivityBase(private val forceDesktopAgent: Boolean) : BaseActivity(), +abstract class WebOverlayActivityBase : BaseActivity(), ActivityContract, FrostContentContainer, VideoViewHolder, FileChooserContract by FileChooserDelegate() { @@ -217,8 +208,6 @@ open class WebOverlayActivityBase(private val forceDesktopAgent: Boolean) : Base } with(web) { - if (forceDesktopAgent) //todo check; the webview already adds it dynamically - userAgentString = USER_AGENT_DESKTOP Prefs.prevId = Prefs.userId launch { val authDefer = BiometricUtils.authenticate(this@WebOverlayActivityBase) 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 0367457e..9022d51f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt @@ -57,7 +57,6 @@ import com.pitchedapps.frost.activities.SettingsActivity import com.pitchedapps.frost.activities.TabCustomizerActivity import com.pitchedapps.frost.activities.WebOverlayActivity import com.pitchedapps.frost.activities.WebOverlayActivityBase -import com.pitchedapps.frost.activities.WebOverlayDesktopActivity import com.pitchedapps.frost.db.CookieEntity import com.pitchedapps.frost.facebook.FACEBOOK_COM import com.pitchedapps.frost.facebook.FBCDN_NET @@ -138,9 +137,6 @@ private inline fun <reified T : WebOverlayActivityBase> Context.launchWebOverlay fun Context.launchWebOverlay(url: String) = launchWebOverlayImpl<WebOverlayActivity>(url) -fun Context.launchWebOverlayDesktop(url: String) = - launchWebOverlayImpl<WebOverlayDesktopActivity>(url) - private fun Context.fadeBundle() = ActivityOptions.makeCustomAnimation( this, android.R.anim.fade_in, android.R.anim.fade_out diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt index 4aa43b49..eec5a5dc 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt @@ -22,7 +22,6 @@ import com.pitchedapps.frost.activities.WebOverlayActivityBase import com.pitchedapps.frost.contracts.VideoViewHolder import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.facebook.FbItem -import com.pitchedapps.frost.facebook.USER_AGENT_DESKTOP import com.pitchedapps.frost.facebook.formattedFbUrl import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs @@ -32,7 +31,6 @@ import com.pitchedapps.frost.utils.isIndirectImageUrl import com.pitchedapps.frost.utils.isVideoUrl import com.pitchedapps.frost.utils.launchImageActivity import com.pitchedapps.frost.utils.launchWebOverlay -import com.pitchedapps.frost.utils.launchWebOverlayDesktop import com.pitchedapps.frost.views.FrostWebView /** @@ -74,22 +72,7 @@ fun FrostWebView.requestWebOverlay(url: String): Boolean { return false } if (!Prefs.overlayEnabled) return false - if (context is WebOverlayActivityBase) { - val shouldUseDesktop = url.formattedFbUrl.shouldUseDesktopAgent - //already overlay; manage user agent - if (userAgentString != USER_AGENT_DESKTOP && shouldUseDesktop) { - L._i { "Switch to desktop agent overlay" } - context.launchWebOverlayDesktop(url) - return true - } - if (userAgentString == USER_AGENT_DESKTOP && !shouldUseDesktop) { - L._i { "Switch from desktop agent" } - context.launchWebOverlay(url) - return true - } - L._i { "return false switch" } - return false - } + if (context is WebOverlayActivityBase) return false L.v { "Request web overlay passed" } context.launchWebOverlay(url) return true |