Skip to content

Commit

Permalink
Merge branch 'main' into feature/open_settings_app_from_timetable_det…
Browse files Browse the repository at this point in the history
…ail_snack_bar_compose_multiplatform
  • Loading branch information
Corvus400 authored Sep 1, 2024
2 parents 5354a6e + c8b8910 commit d6911cb
Show file tree
Hide file tree
Showing 13 changed files with 201 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ private class ExternalNavController(

fun onShareClick(timetableItem: TimetableItem) {
shareNavigator.share(
"[${timetableItem.room.name.currentLangTitle}] ${timetableItem.startsTimeString} - ${timetableItem.endsTimeString}\n" +
"[${timetableItem.room.name.currentLangTitle}] ${timetableItem.formattedMonthAndDayString} " +
"${timetableItem.startsTimeString} - ${timetableItem.endsTimeString}\n" +
"${timetableItem.title.currentLangTitle}\n" +
timetableItem.url,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ class KmpKtorfitPlugin : Plugin<Project> {
add("ksp$it", libs.library("ktorfitKsp"))
}
}

// https://github.com/DroidKaigi/conference-app-2024/issues/485#issuecomment-2304251937
tasks.withType<KspTaskNative>().configureEach {
notCompatibleWithConfigurationCache("Configuration chache not supported for a system property read at configuration time")

}
tasks.withType<KotlinNativeLink>().configureEach {
notCompatibleWithConfigurationCache("Configuration chache not supported for a system property read at configuration time")
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.droidkaigi.confsched.primitive

import com.google.devtools.ksp.gradle.KspTaskNative
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
Expand All @@ -13,6 +14,11 @@ class KmpPlugin : Plugin<Project> {
with(pluginManager) {
apply("org.jetbrains.kotlin.multiplatform")

withPlugin(libs.plugin("kspGradlePlugin").pluginId) {
tasks.withType<KspTaskNative>().configureEach {
notCompatibleWithConfigurationCache("Configuration chache not supported for a system property read at configuration time")
}
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java) {
kotlinOptions.jvmTarget = "11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public sealed class TimetableItem {
"$startsDateString / $formattedTimeString ($minutesString)"
}

public val formattedMonthAndDayString: String by lazy {
val localDate = startsAt.toLocalDateTime(TimeZone.currentSystemDefault())
"${localDate.monthNumber}".padStart(2, '0') + "/" + "${localDate.dayOfMonth}".padStart(2, '0')
}

public val url: String get() = if (defaultLang() == Lang.JAPANESE) {
"https://2024.droidkaigi.jp/timetable/${id.value}"
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.github.droidkaigi.confsched.testing.robot
import android.graphics.RenderNode
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsEnabled
import androidx.compose.ui.test.assertIsNotDisplayed
import androidx.compose.ui.test.assertIsNotEnabled
import androidx.compose.ui.test.assertTextEquals
import androidx.compose.ui.test.hasTestTag
Expand All @@ -14,6 +15,7 @@ import io.github.droidkaigi.confsched.profilecard.ProfileCardCardScreenTestTag
import io.github.droidkaigi.confsched.profilecard.ProfileCardCreateButtonTestTag
import io.github.droidkaigi.confsched.profilecard.ProfileCardEditButtonTestTag
import io.github.droidkaigi.confsched.profilecard.ProfileCardEditScreenColumnTestTag
import io.github.droidkaigi.confsched.profilecard.ProfileCardInputErrorTextTestTag
import io.github.droidkaigi.confsched.profilecard.ProfileCardLinkTextFieldTestTag
import io.github.droidkaigi.confsched.profilecard.ProfileCardNicknameTextFieldTestTag
import io.github.droidkaigi.confsched.profilecard.ProfileCardOccupationTextFieldTestTag
Expand Down Expand Up @@ -140,6 +142,22 @@ class ProfileCardScreenRobot @Inject constructor(
.assertTextEquals(link)
}

fun checkLinkError(
link: String,
) {
composeTestRule
.onNode(hasTestTag(ProfileCardInputErrorTextTestTag.plus(link)))
.assertIsDisplayed()
}

fun checkLinkNotError(
link: String,
) {
composeTestRule
.onNode(hasTestTag(ProfileCardInputErrorTextTestTag.plus(link)))
.assertIsNotDisplayed()
}

fun checkCardScreenDisplayed() {
composeTestRule
.onNode(hasTestTag(ProfileCardCardScreenTestTag))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.spring
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.Arrangement
Expand All @@ -21,6 +22,7 @@ import androidx.compose.foundation.selection.selectableGroup
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
Expand Down Expand Up @@ -77,7 +79,13 @@ fun GlassLikeBottomNavigation(
.padding(horizontal = 48.dp)
.fillMaxWidth()
.height(64.dp)
.hazeChild(state = hazeState, shape = CircleShape)
.run {
if (isBlurSupported()) {
hazeChild(state = hazeState, shape = CircleShape)
} else {
background(MaterialTheme.colorScheme.background.copy(alpha = .95f))
}
}
.border(
width = Dp.Hairline,
brush =
Expand Down Expand Up @@ -130,15 +138,32 @@ fun GlassLikeBottomNavigation(
},
) {
val tabWidth = size.width / MainScreenTab.size
drawCircle(
color = animatedColor.copy(alpha = .6f),
radius = size.height / 2,
center =
Offset(
(tabWidth * animatedSelectedTabIndex) + tabWidth / 2,
size.height / 2,
),
val center = Offset(
(tabWidth * animatedSelectedTabIndex) + tabWidth / 2,
size.height / 2,
)
val radius = size.height / 2

if (isBlurSupported()) {
drawCircle(
color = animatedColor.copy(alpha = .6f),
radius = radius,
center = center,
)
} else {
drawCircle(
brush = Brush.radialGradient(
colors = listOf(
animatedColor.copy(alpha = .5f),
animatedColor.copy(alpha = .1f),
),
center = center,
radius = radius,
),
radius = radius,
center = center,
)
}
}

Canvas(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.spring
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.Arrangement
Expand All @@ -19,6 +20,7 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Icon
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
Expand Down Expand Up @@ -59,6 +61,7 @@ import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme
import io.github.droidkaigi.confsched.droidkaigiui.animation.onGloballyPositionedWithFavoriteAnimationScope
import io.github.droidkaigi.confsched.droidkaigiui.useIf
import io.github.droidkaigi.confsched.main.MainScreenTab
import io.github.droidkaigi.confsched.model.isBlurSupported
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
import org.jetbrains.compose.ui.tooling.preview.Preview
Expand All @@ -72,16 +75,22 @@ fun GlassLikeNavRail(
) {
Box(
modifier = modifier.size(width = 64.dp, height = 320.dp)
.hazeChild(state = hazeState, shape = CircleShape).border(
width = Dp.Hairline,
brush = Brush.verticalGradient(
colors = listOf(
Color.White.copy(alpha = .8f),
Color.White.copy(alpha = .2f),
),
),
shape = CircleShape,
),
.run {
if (isBlurSupported()) {
hazeChild(state = hazeState, shape = CircleShape).border(
width = Dp.Hairline,
brush = Brush.verticalGradient(
colors = listOf(
Color.White.copy(alpha = .8f),
Color.White.copy(alpha = .2f),
),
),
shape = CircleShape,
)
} else {
background(MaterialTheme.colorScheme.background.copy(alpha = .95f))
}
},
) {
NavRailTabs(
selectedTab = currentTab,
Expand Down Expand Up @@ -113,15 +122,32 @@ fun GlassLikeNavRail(
.blur(50.dp, edgeTreatment = BlurredEdgeTreatment.Unbounded),
) {
val tabWidth = size.height / MainScreenTab.size
drawCircle(
color = animatedColor.copy(alpha = .6f),
radius = size.width / 2,
center =
Offset(
size.width / 2,
(tabWidth * animatedSelectedTabIndex) + tabWidth / 2,
),
val radius = size.width / 2
val center = Offset(
size.width / 2,
(tabWidth * animatedSelectedTabIndex) + tabWidth / 2,
)

if (isBlurSupported()) {
drawCircle(
color = animatedColor.copy(alpha = .6f),
radius = radius,
center = center,
)
} else {
drawCircle(
brush = Brush.radialGradient(
colors = listOf(
animatedColor.copy(alpha = .5f),
animatedColor.copy(alpha = .1f),
),
center = center,
radius = radius,
),
radius = radius,
center = center,
)
}
}

Canvas(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,64 @@ class ProfileCardScreenTest(
checkEditScreenDisplayed()
}
}

describe("when url protocol is invalid") {
val url = "ttps://example.com"
doIt {
inputLink("ttps://example.com")
}
itShould("show error message") {
captureScreenWithChecks {
checkLinkError(url)
}
}
}

describe("when url top level domain is missing") {
val url = "https://example"
doIt {
inputLink(url)
}
itShould("show error message") {
captureScreenWithChecks {
checkLinkError(url)
}
}
}
describe("when url contains IDN domain name") {
val url = "https://example.xn--com"
doIt {
inputLink(url)
}
itShould("not show error message") {
captureScreenWithChecks {
checkLinkNotError(url)
}
}
}
describe("when protocol is missing") {
val url = "example.com/foobar"
doIt {
inputLink(url)
}
itShould("not show error message") {
captureScreenWithChecks {
checkLinkNotError(url)
}
}
}
describe("when url contains sub domain") {
val url = "https://www.example.co.jp/foobar"
doIt {
inputLink(url)
}
itShould("not show error message") {
captureScreenWithChecks {
checkLinkNotError(url)
}
}
}

// FIXME Add a test to confirm that it is possible to transition to the Card screen after entering the required input fields, including images.
// FIXME Currently, the test code does not allow the user to select and input an image from the Add Image button.
}
Expand All @@ -63,7 +121,7 @@ class ProfileCardScreenTest(
checkProfileCardFrontDisplayed()
}
}
describe("flip prifle card") {
describe("flip profile card") {
doIt {
flipProfileCard()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<string name="add_image">画像を追加</string>
<string name="enter_validate_format">%1$sを入力してください</string>
<string name="add_validate_format">%1$sを追加してください</string>
<string name="url_is_invalid">URLの形式が正しくありません</string>
<string name="share">共有する</string>
<string name="edit">編集する</string>
<string name="share_description">DroidKaigiのプロフィールカードを作成しました!イベントでつながりましょう。#DroidKaigi</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<string name="add_image">Add Image</string>
<string name="enter_validate_format">Please enter a %1$s</string>
<string name="add_validate_format">Please add %1$s</string>
<string name="url_is_invalid">The URL format is incorrect</string>
<string name="share">Share</string>
<string name="edit">Edit</string>
<string name="share_description">Check out my DroidKaigi Profile Card! Let's connect at the event. #DroidKaigi</string>
Expand Down
Loading

0 comments on commit d6911cb

Please sign in to comment.