Skip to content

Commit 50b9a7b

Browse files
authored
Merge pull request #13121 from theimpulson/forwardport
Merge dev into refactor
2 parents 61c25d4 + 4b424bc commit 50b9a7b

230 files changed

Lines changed: 1957 additions & 1786 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,13 @@
66
root = true
77

88
[*.{kt,kts}]
9+
ktlint_code_style = android_studio
10+
# https://pinterest.github.io/ktlint/latest/rules/standard/#function-naming
911
ktlint_function_naming_ignore_when_annotated_with = Composable
10-
ktlint_standard_annotation = disabled
11-
ktlint_standard_argument-list-wrapping = disabled
12-
ktlint_standard_backing-property-naming = disabled
13-
ktlint_standard_blank-line-before-declaration = disabled
14-
ktlint_standard_blank-line-between-when-conditions = disabled
15-
ktlint_standard_chain-method-continuation = disabled
12+
1613
ktlint_standard_class-signature = disabled
17-
ktlint_standard_comment-wrapping = disabled
18-
ktlint_standard_enum-wrapping = disabled
1914
ktlint_standard_function-expression-body = disabled
20-
ktlint_standard_function-literal = disabled
21-
ktlint_standard_function-signature = disabled
22-
ktlint_standard_indent = disabled
23-
ktlint_standard_kdoc = disabled
2415
ktlint_standard_max-line-length = disabled
2516
ktlint_standard_mixed-condition-operators = disabled
26-
ktlint_standard_multiline-expression-wrapping = disabled
27-
ktlint_standard_multiline-if-else = disabled
28-
ktlint_standard_no-blank-line-in-list = disabled
29-
ktlint_standard_no-consecutive-comments = disabled
30-
ktlint_standard_no-empty-first-line-in-class-body = disabled
31-
ktlint_standard_no-empty-first-line-in-method-block = disabled
32-
ktlint_standard_no-line-break-after-else = disabled
33-
ktlint_standard_no-semi = disabled
34-
ktlint_standard_no-single-line-block-comment = disabled
3517
ktlint_standard_package-name = disabled
36-
ktlint_standard_parameter-list-wrapping = disabled
3718
ktlint_standard_property-naming = disabled
38-
ktlint_standard_spacing-between-declarations-with-annotations = disabled
39-
ktlint_standard_spacing-between-declarations-with-comments = disabled
40-
ktlint_standard_statement-wrapping = disabled
41-
ktlint_standard_string-template-indent = disabled
42-
ktlint_standard_trailing-comma-on-call-site = disabled
43-
ktlint_standard_trailing-comma-on-declaration-site = disabled
44-
ktlint_standard_try-catch-finally-spacing = disabled
45-
ktlint_standard_when-entry-bracing = disabled

.github/workflows/backport-pr.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ jobs:
2525
- uses: actions/checkout@v4
2626
- name: Get backport metadata
2727
# the target branch is the first argument after `/backport`
28+
env:
29+
COMMENT_BODY: ${{ github.event.comment.body }}
2830
run: |
2931
set -euo pipefail
30-
body="${{ github.event.comment.body }}"
32+
body="$COMMENT_BODY"
3133
3234
line=${body%%$'\n'*} # Get the first line
3335
if [[ $line =~ ^/backport[[:space:]]+([^[:space:]]+) ]]; then

app/build.gradle.kts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ android {
4747
minSdk = 23
4848
targetSdk = 35
4949

50-
versionCode = System.getProperty("versionCodeOverride")?.toInt() ?: 1005
50+
versionCode = System.getProperty("versionCodeOverride")?.toInt() ?: 1006
5151

52-
versionName = "0.28.0"
52+
versionName = "0.28.1"
5353
System.getProperty("versionNameSuffix")?.let { versionNameSuffix = it }
5454

5555
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@@ -140,6 +140,13 @@ ksp {
140140
// Custom dependency configuration for ktlint
141141
val ktlint by configurations.creating
142142

143+
// https://checkstyle.org/#JRE_and_JDK
144+
tasks.withType<Checkstyle>().configureEach {
145+
javaLauncher = javaToolchains.launcherFor {
146+
languageVersion = JavaLanguageVersion.of(21)
147+
}
148+
}
149+
143150
checkstyle {
144151
configDirectory = rootProject.file("checkstyle")
145152
isIgnoreFailures = false

app/proguard-rules.pro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
-dontwarn javax.script.**
1717
-keep class jdk.dynalink.** { *; }
1818
-dontwarn jdk.dynalink.**
19+
# Rules for jsoup
20+
# Ignore intended-to-be-optional re2j classes - only needed if using re2j for jsoup regex
21+
# jsoup safely falls back to JDK regex if re2j not on classpath, but has concrete re2j refs
22+
# See https://github.com/jhy/jsoup/issues/2459 - may be resolved in future, then this may be removed
23+
-dontwarn com.google.re2j.**
1924

2025
## Rules for ExoPlayer
2126
-keep class com.google.android.exoplayer2.** { *; }

app/src/androidTest/java/org/schabi/newpipe/database/DatabaseMigrationTest.kt

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,28 +176,32 @@ class DatabaseMigrationTest {
176176

177177
databaseInV7.run {
178178
insert(
179-
"search_history", SQLiteDatabase.CONFLICT_FAIL,
179+
"search_history",
180+
SQLiteDatabase.CONFLICT_FAIL,
180181
ContentValues().apply {
181182
put("service_id", serviceId)
182183
put("search", defaultSearch1)
183184
}
184185
)
185186
insert(
186-
"search_history", SQLiteDatabase.CONFLICT_FAIL,
187+
"search_history",
188+
SQLiteDatabase.CONFLICT_FAIL,
187189
ContentValues().apply {
188190
put("service_id", serviceId)
189191
put("search", defaultSearch2)
190192
}
191193
)
192194
insert(
193-
"search_history", SQLiteDatabase.CONFLICT_FAIL,
195+
"search_history",
196+
SQLiteDatabase.CONFLICT_FAIL,
194197
ContentValues().apply {
195198
put("service_id", otherServiceId)
196199
put("search", defaultSearch1)
197200
}
198201
)
199202
insert(
200-
"search_history", SQLiteDatabase.CONFLICT_FAIL,
203+
"search_history",
204+
SQLiteDatabase.CONFLICT_FAIL,
201205
ContentValues().apply {
202206
put("service_id", otherServiceId)
203207
put("search", defaultSearch2)
@@ -207,13 +211,17 @@ class DatabaseMigrationTest {
207211
}
208212

209213
testHelper.runMigrationsAndValidate(
210-
AppDatabase.DATABASE_NAME, Migrations.DB_VER_8,
211-
true, Migrations.MIGRATION_7_8
214+
AppDatabase.DATABASE_NAME,
215+
Migrations.DB_VER_8,
216+
true,
217+
Migrations.MIGRATION_7_8
212218
)
213219

214220
testHelper.runMigrationsAndValidate(
215-
AppDatabase.DATABASE_NAME, Migrations.DB_VER_9,
216-
true, Migrations.MIGRATION_8_9
221+
AppDatabase.DATABASE_NAME,
222+
Migrations.DB_VER_9,
223+
true,
224+
Migrations.MIGRATION_8_9
217225
)
218226

219227
val migratedDatabaseV8 = getMigratedDatabase()
@@ -235,41 +243,47 @@ class DatabaseMigrationTest {
235243
val remoteUid2: Long
236244
databaseInV8.run {
237245
localUid1 = insert(
238-
"playlists", SQLiteDatabase.CONFLICT_FAIL,
246+
"playlists",
247+
SQLiteDatabase.CONFLICT_FAIL,
239248
ContentValues().apply {
240249
put("name", DEFAULT_NAME + "1")
241250
put("is_thumbnail_permanent", false)
242251
put("thumbnail_stream_id", -1)
243252
}
244253
)
245254
localUid2 = insert(
246-
"playlists", SQLiteDatabase.CONFLICT_FAIL,
255+
"playlists",
256+
SQLiteDatabase.CONFLICT_FAIL,
247257
ContentValues().apply {
248258
put("name", DEFAULT_NAME + "2")
249259
put("is_thumbnail_permanent", false)
250260
put("thumbnail_stream_id", -1)
251261
}
252262
)
253263
delete(
254-
"playlists", "uid = ?",
264+
"playlists",
265+
"uid = ?",
255266
Array(1) { localUid1 }
256267
)
257268
remoteUid1 = insert(
258-
"remote_playlists", SQLiteDatabase.CONFLICT_FAIL,
269+
"remote_playlists",
270+
SQLiteDatabase.CONFLICT_FAIL,
259271
ContentValues().apply {
260272
put("service_id", DEFAULT_SERVICE_ID)
261273
put("url", DEFAULT_URL)
262274
}
263275
)
264276
remoteUid2 = insert(
265-
"remote_playlists", SQLiteDatabase.CONFLICT_FAIL,
277+
"remote_playlists",
278+
SQLiteDatabase.CONFLICT_FAIL,
266279
ContentValues().apply {
267280
put("service_id", DEFAULT_SECOND_SERVICE_ID)
268281
put("url", DEFAULT_SECOND_URL)
269282
}
270283
)
271284
delete(
272-
"remote_playlists", "uid = ?",
285+
"remote_playlists",
286+
"uid = ?",
273287
Array(1) { remoteUid2 }
274288
)
275289
close()

app/src/androidTest/java/org/schabi/newpipe/database/FeedDAOTest.kt

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import android.content.Context
44
import androidx.room.Room
55
import androidx.test.core.app.ApplicationProvider
66
import io.reactivex.rxjava3.core.Single
7+
import java.io.IOException
8+
import java.time.OffsetDateTime
79
import org.junit.After
810
import org.junit.Assert.assertEquals
911
import org.junit.Assert.assertNotNull
@@ -20,9 +22,6 @@ import org.schabi.newpipe.database.subscription.SubscriptionEntity
2022
import org.schabi.newpipe.extractor.ServiceList
2123
import org.schabi.newpipe.extractor.channel.ChannelInfo
2224
import org.schabi.newpipe.extractor.stream.StreamType
23-
import java.io.IOException
24-
import java.time.OffsetDateTime
25-
import kotlin.streams.toList
2625

2726
class FeedDAOTest {
2827
private lateinit var db: AppDatabase
@@ -41,14 +40,21 @@ class FeedDAOTest {
4140
private val stream7 = StreamEntity(7, serviceId, "https://youtube.com/watch?v=7", "stream 7", StreamType.VIDEO_STREAM, 1000, "channel-4", "https://youtube.com/channel/4", "https://i.ytimg.com/vi/1/hqdefault.jpg", 100, "2023-08-10", OffsetDateTime.parse("2023-08-10T00:00:00Z"))
4241

4342
private val allStreams = listOf(
44-
stream1, stream2, stream3, stream4, stream5, stream6, stream7
43+
stream1,
44+
stream2,
45+
stream3,
46+
stream4,
47+
stream5,
48+
stream6,
49+
stream7
4550
)
4651

4752
@Before
4853
fun createDb() {
4954
val context = ApplicationProvider.getApplicationContext<Context>()
5055
db = Room.inMemoryDatabaseBuilder(
51-
context, AppDatabase::class.java
56+
context,
57+
AppDatabase::class.java
5258
).build()
5359
feedDAO = db.feedDAO()
5460
streamDAO = db.streamDAO()
@@ -65,7 +71,10 @@ class FeedDAOTest {
6571
fun testUnlinkStreamsOlderThan_KeepOne() {
6672
setupUnlinkDelete("2023-08-15T00:00:00Z")
6773
val streams = feedDAO.getStreams(
68-
FeedGroupEntity.GROUP_ALL_ID, includePlayed = true, includePartiallyPlayed = true, null
74+
FeedGroupEntity.GROUP_ALL_ID,
75+
includePlayed = true,
76+
includePartiallyPlayed = true,
77+
null
6978
)
7079
.blockingGet()
7180
val allowedStreams = listOf(stream3, stream5, stream6, stream7)
@@ -76,7 +85,10 @@ class FeedDAOTest {
7685
fun testUnlinkStreamsOlderThan_KeepMultiple() {
7786
setupUnlinkDelete("2023-08-01T00:00:00Z")
7887
val streams = feedDAO.getStreams(
79-
FeedGroupEntity.GROUP_ALL_ID, includePlayed = true, includePartiallyPlayed = true, null
88+
FeedGroupEntity.GROUP_ALL_ID,
89+
includePlayed = true,
90+
includePartiallyPlayed = true,
91+
null
8092
)
8193
.blockingGet()
8294
val allowedStreams = listOf(stream3, stream4, stream5, stream6, stream7)
@@ -112,7 +124,7 @@ class FeedDAOTest {
112124
SubscriptionEntity.from(ChannelInfo(serviceId, "1", "https://youtube.com/channel/1", "https://youtube.com/channel/1", "channel-1")),
113125
SubscriptionEntity.from(ChannelInfo(serviceId, "2", "https://youtube.com/channel/2", "https://youtube.com/channel/2", "channel-2")),
114126
SubscriptionEntity.from(ChannelInfo(serviceId, "3", "https://youtube.com/channel/3", "https://youtube.com/channel/3", "channel-3")),
115-
SubscriptionEntity.from(ChannelInfo(serviceId, "4", "https://youtube.com/channel/4", "https://youtube.com/channel/4", "channel-4")),
127+
SubscriptionEntity.from(ChannelInfo(serviceId, "4", "https://youtube.com/channel/4", "https://youtube.com/channel/4", "channel-4"))
116128
)
117129
)
118130
feedDAO.insertAll(
@@ -123,7 +135,7 @@ class FeedDAOTest {
123135
FeedEntity(4, 2),
124136
FeedEntity(5, 2),
125137
FeedEntity(6, 3),
126-
FeedEntity(7, 4),
138+
FeedEntity(7, 4)
127139
)
128140
)
129141
}

app/src/androidTest/java/org/schabi/newpipe/error/ErrorInfoTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import android.os.Parcelable
66
import androidx.test.core.app.ApplicationProvider
77
import androidx.test.ext.junit.runners.AndroidJUnit4
88
import androidx.test.filters.LargeTest
9+
import java.io.IOException
10+
import java.net.SocketTimeoutException
911
import org.junit.Assert.assertEquals
1012
import org.junit.Assert.assertFalse
1113
import org.junit.Assert.assertNull
@@ -16,8 +18,6 @@ import org.schabi.newpipe.R
1618
import org.schabi.newpipe.extractor.ServiceList
1719
import org.schabi.newpipe.extractor.exceptions.ParsingException
1820
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException
19-
import java.io.IOException
20-
import java.net.SocketTimeoutException
2121

2222
/**
2323
* Instrumented tests for {@link ErrorInfo}.

app/src/androidTest/java/org/schabi/newpipe/local/history/HistoryRecordManagerTest.kt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package org.schabi.newpipe.local.history
22

33
import androidx.test.core.app.ApplicationProvider
4+
import java.time.LocalDateTime
5+
import java.time.OffsetDateTime
6+
import java.time.ZoneOffset
47
import org.assertj.core.api.Assertions.assertThat
58
import org.junit.After
69
import org.junit.Assert.assertEquals
@@ -11,9 +14,6 @@ import org.schabi.newpipe.database.AppDatabase
1114
import org.schabi.newpipe.database.history.model.SearchHistoryEntry
1215
import org.schabi.newpipe.testUtil.TestDatabase
1316
import org.schabi.newpipe.testUtil.TrampolineSchedulerRule
14-
import java.time.LocalDateTime
15-
import java.time.OffsetDateTime
16-
import java.time.ZoneOffset
1717

1818
class HistoryRecordManagerTest {
1919

@@ -54,7 +54,7 @@ class HistoryRecordManagerTest {
5454
SearchHistoryEntry(creationDate = time.minusSeconds(1), serviceId = 0, search = "A"),
5555
SearchHistoryEntry(creationDate = time.minusSeconds(2), serviceId = 2, search = "A"),
5656
SearchHistoryEntry(creationDate = time.minusSeconds(3), serviceId = 1, search = "B"),
57-
SearchHistoryEntry(creationDate = time.minusSeconds(4), serviceId = 0, search = "B"),
57+
SearchHistoryEntry(creationDate = time.minusSeconds(4), serviceId = 0, search = "B")
5858
)
5959

6060
// make sure all 4 were inserted
@@ -85,7 +85,7 @@ class HistoryRecordManagerTest {
8585
val entries = listOf(
8686
SearchHistoryEntry(creationDate = time.minusSeconds(1), serviceId = 1, search = "A"),
8787
SearchHistoryEntry(creationDate = time.minusSeconds(2), serviceId = 2, search = "B"),
88-
SearchHistoryEntry(creationDate = time.minusSeconds(3), serviceId = 0, search = "C"),
88+
SearchHistoryEntry(creationDate = time.minusSeconds(3), serviceId = 0, search = "C")
8989
)
9090

9191
// make sure all 3 were inserted
@@ -98,7 +98,6 @@ class HistoryRecordManagerTest {
9898
}
9999

100100
private fun insertShuffledRelatedSearches(relatedSearches: Collection<SearchHistoryEntry>) {
101-
102101
// shuffle to make sure the order of items returned by queries depends only on
103102
// SearchHistoryEntry.creationDate, not on the actual insertion time, so that we can
104103
// verify that the `ORDER BY` clause does its job
@@ -121,7 +120,7 @@ class HistoryRecordManagerTest {
121120
RELATED_SEARCHES_ENTRIES[6].search, // A (even if in two places)
122121
RELATED_SEARCHES_ENTRIES[4].search, // B
123122
RELATED_SEARCHES_ENTRIES[5].search, // AA
124-
RELATED_SEARCHES_ENTRIES[2].search, // BA
123+
RELATED_SEARCHES_ENTRIES[2].search // BA
125124
)
126125
}
127126

@@ -136,7 +135,7 @@ class HistoryRecordManagerTest {
136135
SearchHistoryEntry(creationDate = time.minusSeconds(4), serviceId = 3, search = "A"),
137136
SearchHistoryEntry(creationDate = time.minusSeconds(3), serviceId = 3, search = "A"),
138137
SearchHistoryEntry(creationDate = time.minusSeconds(2), serviceId = 0, search = "A"),
139-
SearchHistoryEntry(creationDate = time.minusSeconds(1), serviceId = 2, search = "AA"),
138+
SearchHistoryEntry(creationDate = time.minusSeconds(1), serviceId = 2, search = "AA")
140139
)
141140
insertShuffledRelatedSearches(relatedSearches)
142141

@@ -153,7 +152,7 @@ class HistoryRecordManagerTest {
153152
assertThat(searches).containsExactly(
154153
RELATED_SEARCHES_ENTRIES[6].search, // A (even if in two places)
155154
RELATED_SEARCHES_ENTRIES[5].search, // AA
156-
RELATED_SEARCHES_ENTRIES[1].search, // BA
155+
RELATED_SEARCHES_ENTRIES[1].search // BA
157156
)
158157

159158
// also make sure that the string comparison is case insensitive
@@ -171,7 +170,7 @@ class HistoryRecordManagerTest {
171170
SearchHistoryEntry(creationDate = time.minusSeconds(4), serviceId = 3, search = "A"),
172171
SearchHistoryEntry(creationDate = time.minusSeconds(2), serviceId = 0, search = "B"),
173172
SearchHistoryEntry(creationDate = time.minusSeconds(3), serviceId = 2, search = "AA"),
174-
SearchHistoryEntry(creationDate = time.minusSeconds(1), serviceId = 1, search = "A"),
173+
SearchHistoryEntry(creationDate = time.minusSeconds(1), serviceId = 1, search = "A")
175174
)
176175
}
177176
}

0 commit comments

Comments
 (0)