File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package org.schabi.newpipe.ktx
2+
3+ import android.content.SharedPreferences
4+
5+ fun SharedPreferences.getStringSafe (key : String , defValue : String ): String {
6+ return getString(key, null ) ? : defValue
7+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import org.schabi.newpipe.extractor.Info
1919import org.schabi.newpipe.extractor.NewPipe
2020import org.schabi.newpipe.extractor.feed.FeedInfo
2121import org.schabi.newpipe.extractor.stream.StreamInfoItem
22+ import org.schabi.newpipe.ktx.getStringSafe
2223import org.schabi.newpipe.local.feed.FeedDatabaseManager
2324import org.schabi.newpipe.local.subscription.SubscriptionManager
2425import org.schabi.newpipe.util.ChannelTabHelper
@@ -69,12 +70,10 @@ class FeedLoadManager(private val context: Context) {
6970 val outdatedThreshold = if (ignoreOutdatedThreshold) {
7071 OffsetDateTime .now(ZoneOffset .UTC )
7172 } else {
72- val thresholdOutdatedSeconds = (
73- defaultSharedPreferences.getString(
74- context.getString(R .string.feed_update_threshold_key),
75- context.getString(R .string.feed_update_threshold_default_value)
76- ) ? : context.getString(R .string.feed_update_threshold_default_value)
77- ).toInt()
73+ val thresholdOutdatedSeconds = defaultSharedPreferences.getStringSafe(
74+ context.getString(R .string.feed_update_threshold_key),
75+ context.getString(R .string.feed_update_threshold_default_value)
76+ ).toInt()
7877 OffsetDateTime .now(ZoneOffset .UTC ).minusSeconds(thresholdOutdatedSeconds.toLong())
7978 }
8079
You can’t perform that action at this time.
0 commit comments