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 @@ -74,9 +74,8 @@ class FeedDatabaseManager(context: Context) {
7474
7575 fun upsertAll (subscriptionId : Long , items : List <StreamInfoItem >) {
7676 val oldestAllowedDate = LocalDate .now().minusWeeks(13 )
77- val zoneId = ZoneId .systemDefault()
7877 val itemsToInsert = items.filter {
79- val uploadDate = it.uploadDate?.let { LocalDate .ofInstant(it.instant, zoneId) }
78+ val uploadDate = it.uploadDate?.localDateTime?.toLocalDate()
8079
8180 (uploadDate == null && it.streamType == StreamType .LIVE_STREAM ) ||
8281 (uploadDate != null && uploadDate >= oldestAllowedDate)
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ import org.schabi.newpipe.util.ExtractorHelper.getChannelTab
2929import org.schabi.newpipe.util.ExtractorHelper.getMoreChannelTabItems
3030import java.time.Instant
3131import java.time.LocalDate
32- import java.time.ZoneId
3332import java.util.concurrent.atomic.AtomicBoolean
3433import java.util.concurrent.atomic.AtomicInteger
3534
@@ -320,13 +319,12 @@ class FeedLoadManager(private val context: Context) {
320319 }
321320
322321 private fun filterNewStreams (list : List <StreamInfoItem >): List <StreamInfoItem > {
323- val zoneId = ZoneId .systemDefault()
324322 val oldestAllowedDate = LocalDate .now().minusWeeks(13 )
325323 return list.filter {
326324 // Streams older than this date are automatically removed from the feed.
327325 // Therefore, streams which are not in the database,
328326 // but older than this date, are considered old.
329- val date = it.uploadDate?.let { LocalDate .ofInstant(it.instant, zoneId) }
327+ val date = it.uploadDate?.localDateTime?.toLocalDate()
330328 ! feedDatabaseManager.doesStreamExist(it) && date != null && date > oldestAllowedDate
331329 }
332330 }
Original file line number Diff line number Diff line change 3434import java .math .RoundingMode ;
3535import java .text .NumberFormat ;
3636import java .time .Instant ;
37- import java .time .LocalDate ;
38- import java .time .ZoneId ;
3937import java .time .format .DateTimeFormatter ;
4038import java .time .format .FormatStyle ;
4139import java .util .Arrays ;
4240import java .util .List ;
4341import java .util .Locale ;
4442import java .util .stream .Collectors ;
4543
46-
4744/*
4845 * Created by chschtsch on 12/29/15.
4946 *
@@ -132,9 +129,8 @@ public static String localizeNumber(final double number) {
132129
133130 @ NonNull
134131 public static String formatDate (@ NonNull final DateWrapper dateWrapper ) {
135- final var localDate = LocalDate .ofInstant (dateWrapper .getInstant (), ZoneId .systemDefault ());
136132 return DateTimeFormatter .ofLocalizedDate (FormatStyle .MEDIUM ).withLocale (getAppLocale ())
137- .format (localDate );
133+ .format (dateWrapper . getLocalDateTime () );
138134 }
139135
140136 public static String localizeViewCount (@ NonNull final Context context , final long viewCount ) {
You can’t perform that action at this time.
0 commit comments