Skip to content

Commit 0a70ec5

Browse files
authored
build: publish mobile beta 1.8.0-beta.8
2 parents 70cb0d5 + 451470a commit 0a70ec5

5 files changed

Lines changed: 19 additions & 7 deletions

File tree

‎app/build.gradle.kts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ android {
2626
applicationId = "dev.typetype.android"
2727
minSdk = 23
2828
targetSdk = 37
29-
versionCode = 10807
30-
versionName = "1.8.0-beta.7"
29+
versionCode = 10808
30+
versionName = "1.8.0-beta.8"
3131
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3232
resValue("string", "app_name", "TypeType")
3333
}

‎app/src/androidTest/java/dev/typetype/android/feature/player/components/CommentBodyTest.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class CommentBodyTest {
4747
}
4848

4949
composeRule.onNodeWithText("Read more").assertExists().performClick()
50-
composeRule.onNodeWithText("Long comment starts here$suffix").assertExists()
50+
composeRule.onNodeWithText("Show less").assertExists().performClick()
51+
composeRule.onNodeWithText("Read more").assertExists()
5152
}
5253
}

‎app/src/main/java/dev/typetype/android/data/stream/StreamRepositoryImpl.kt‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ internal class StreamRepositoryImpl @Inject constructor(
180180
},
181181
storyboard = previewFrames
182182
.mapNotNull { it.toDomainStoryboard() }
183-
.maxByOrNull { it.frameWidth },
183+
.let(::selectStoryboard),
184184
startPositionMillis = startPosition * 1000L,
185185
sponsorBlockSegments = sponsorBlockSegments.mapNotNull {
186186
it.toDomainSponsorBlockSegment(duration)
@@ -207,6 +207,11 @@ internal class StreamRepositoryImpl @Inject constructor(
207207
.maxByOrNull { it.height }
208208
?.url
209209

210+
private fun selectStoryboard(storyboards: List<StreamStoryboard>): StreamStoryboard? =
211+
storyboards.filter { it.frameWidth >= TARGET_STORYBOARD_FRAME_WIDTH }
212+
.minByOrNull { it.frameWidth }
213+
?: storyboards.maxByOrNull { it.frameWidth }
214+
210215
private fun PreviewFrameItem.toDomainStoryboard(): StreamStoryboard? =
211216
StreamStoryboard(
212217
urls = urls.filter(String::isNotBlank),
@@ -289,6 +294,7 @@ internal suspend fun <T> cancellableStreamResult(
289294
}
290295

291296
private const val SABR_DELIVERY_METHOD = "sabr"
297+
private const val TARGET_STORYBOARD_FRAME_WIDTH = 160
292298

293299
private class SabrContractException :
294300
IllegalStateException("The server returned no playable SABR contract"),

‎app/src/main/java/dev/typetype/android/feature/player/components/CommentListItems.kt‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,17 @@ private fun ExpandableCommentText(
139139
maxLines = if (expanded) Int.MAX_VALUE else COMMENT_COLLAPSE_LINE_LIMIT,
140140
overflow = if (expanded) TextOverflow.Clip else TextOverflow.Ellipsis,
141141
)
142-
if (needsTruncation && !expanded) {
142+
if (needsTruncation) {
143143
TextButton(
144-
onClick = { expanded = true },
144+
onClick = { expanded = !expanded },
145145
contentPadding = PaddingValues(horizontal = 4.dp),
146146
modifier = Modifier.padding(top = 2.dp),
147147
) {
148-
Text(stringResource(R.string.comments_read_more))
148+
Text(
149+
stringResource(
150+
if (expanded) R.string.comments_show_less else R.string.comments_read_more,
151+
)
152+
)
149153
}
150154
}
151155
}

‎app/src/main/res/values/strings.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@
497497
<string name="comments_title">Comments</string>
498498
<string name="comments_empty">No comments</string>
499499
<string name="comments_read_more">Read more</string>
500+
<string name="comments_show_less">Show less</string>
500501
<string name="comments_like_count">Likes: %1$s</string>
501502
<string name="comments_replies_failed">Couldn\'t load replies</string>
502503
<string name="comments_load_failed">Couldn\'t load comments</string>

0 commit comments

Comments
 (0)