Skip to content

Commit

Permalink
Added option to open feed in WebView
Browse files Browse the repository at this point in the history
Signed-off-by: saulhdev <[email protected]>
  • Loading branch information
saulhdev committed Sep 22, 2024
1 parent 2895eba commit 0866f1c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.saulhdev.feeder.theme.Theming
import com.saulhdev.feeder.utils.RelativeTimeHelper
import com.saulhdev.feeder.utils.isDark
import com.saulhdev.feeder.utils.launchView
import com.saulhdev.feeder.utils.urlEncode
import com.saulhdev.feeder.utils.openLinkInCustomTab
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -93,12 +93,21 @@ object StoryCardBinder : FeedBinder {
)
)
} else {
view.context.startActivity(
MainActivity.navigateIntent(
view.context,
"${Routes.WEB_VIEW}/${content.link.urlEncode()}"
)
)
scope.launch {
if (prefs.offlineReader.getValue()) {
view.context.startActivity(
MainActivity.navigateIntent(
context,
"${Routes.ARTICLE_VIEW}/${item.id}"
)
)
} else {
openLinkInCustomTab(
context,
content.link
)
}
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/saulhdev/feeder/overlay/OverlayView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ import com.saulhdev.feeder.views.DialogMenu
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.launch
import kotlinx.coroutines.plus
import org.koin.java.KoinJavaComponent.inject


class OverlayView(val context: Context) :
OverlayController(context, R.style.AppTheme, R.style.WindowTheme),
OverlayBridge.OverlayBridgeCallback {
Expand All @@ -77,7 +77,6 @@ class OverlayView(val context: Context) :

val prefs = FeedPreferences.getInstance(context)


private fun setTheme(force: String?) {
themeHolder.setTheme(
when (force ?: prefs.overlayTheme.getValue()) {
Expand Down Expand Up @@ -208,6 +207,7 @@ class OverlayView(val context: Context) :
)
}

@OptIn(ExperimentalCoroutinesApi::class)
override fun onCreate(bundle: Bundle?) {
super.onCreate(bundle)
getWindow().decorView.systemUiVisibility =
Expand Down

0 comments on commit 0866f1c

Please sign in to comment.