Skip to content

Commit

Permalink
Merge branch 'main' into Issue-789
Browse files Browse the repository at this point in the history
  • Loading branch information
Noddy20 authored Aug 23, 2023
2 parents d28daf7 + 8bc1e2a commit 1a18aa1
Show file tree
Hide file tree
Showing 36 changed files with 320 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup-java/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ runs:

# Better than caching and/or extensions of actions/setup-java
- name: Setup Gradle
uses: gradle/gradle-build-action@a4cf152f482c7ca97ef56ead29bf08bcd953284c # v2.7.0
uses: gradle/gradle-build-action@243af859f8ca30903d9d7f7936897ca0358ba691 # v2.7.1
with:
gradle-version: wrapper

Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,11 @@ GEM
xcresult (0.2.1)

PLATFORMS
arm64-darwin-20
arm64-darwin-21
arm64-darwin-22
x86_64-darwin-20
x86_64-darwin-21
x86_64-darwin-22
x86_64-linux

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ private fun NavGraphBuilder.mainScreen(
onLinkClick = externalNavController::navigate,
)
nestedFloorMapScreen(
windowSize = windowSize,
onSideEventClick = externalNavController::navigate,
)
nestedStampsScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ class KaigiAppTest {
}
}

@Test
@Config(qualifiers = RobolectricDeviceQualifiers.MediumTablet)
fun checkMediumTabletNavigateToFloorMapShot() {
kaigiAppRobot {
goToFloorMap()
capture()
}
}

@Test
fun checkNavigateToStampsShot() {
kaigiAppRobot {
Expand Down
20 changes: 20 additions & 0 deletions app-ios/Modules/Sources/Component/RoundedCornersShape.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import SwiftUI

public struct RoundedCornersShape: Shape {
public var corners: UIRectCorner
public var cornerSize: CGSize

public init(corners: UIRectCorner = .allCorners, cornerSize: CGSize) {
self.corners = corners
self.cornerSize = cornerSize
}

public init(corners: UIRectCorner = .allCorners, cornerRadius: CGFloat) {
self.corners = corners
self.cornerSize = CGSize(width: cornerRadius, height: cornerRadius)
}

public func path(in rect: CGRect) -> Path {
Path(UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: cornerSize).cgPath)
}
}
47 changes: 25 additions & 22 deletions app-ios/Modules/Sources/Timetable/PersonLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,43 @@ import SwiftUI
import Theme

struct PersonLabel: View {
let speakers: [TimetableSpeaker]
let speaker: TimetableSpeaker

var body: some View {
HStack(alignment: .center, spacing: 8) {
HStack(spacing: -8) {
ForEach(speakers.map(\.iconUrl), id: \.self) { iconUrl in
CacheAsyncImage(url: URL(string: iconUrl)) { image in
image.resizable()
} placeholder: {
Color.gray
}
.frame(width: 40, height: 40)
.scaledToFill()
.clipShape(RoundedRectangle(cornerRadius: 12))
.overlay(
RoundedRectangle(cornerRadius: 12)
.stroke(AssetColors.Outline.outline.swiftUIColor, lineWidth: 1)
)
}
CacheAsyncImage(url: URL(string: speaker.iconUrl)) { image in
image.resizable()
} placeholder: {
Color.gray
}
.frame(width: 40, height: 40)
.scaledToFill()
.clipShape(RoundedRectangle(cornerRadius: 12))
.overlay(
RoundedRectangle(cornerRadius: 12)
.stroke(AssetColors.Outline.outline.swiftUIColor, lineWidth: 1)
)

Text(speakers.map(\.name).joined(separator: ","))
Text(speaker.name)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.font(Font.system(size: 14, weight: .medium))
.lineLimit(2)
}
.frame(maxWidth: .infinity, alignment: .leading)
}
}

// Waiting for '#Preview is only available in iOS 17 or newer' bug fixes
// https://developer.apple.com/forums/thread/731182
//
#Preview {
PersonLabel(
speakers: [TimetableSpeaker](repeating: TimetableSpeaker(id: UUID().uuidString, name: "speaker name", iconUrl: "https://placehold.jp/40x40.png", bio: "Bio", tagLine: ""), count: 3)
)
}
#Preview {
PersonLabel(
speaker: TimetableSpeaker(
id: UUID().uuidString,
name: "speaker name",
iconUrl: "https://placehold.jp/40x40.png",
bio: "Bio",
tagLine: ""
)
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftUI

struct InfoLabel: View {
struct SessionTag: View {

private let label: String
private let labelColor: Color
Expand All @@ -26,10 +26,10 @@ struct InfoLabel: View {
.padding(.vertical, 4)
.foregroundColor(labelColor)
.background(backgroundColor)
.cornerRadius(4)
.cornerRadius(50)
.overlay {
if let strokeColor = strokeColor {
RoundedRectangle(cornerRadius: 4)
Capsule()
.inset(by: 0.5)
.stroke(strokeColor, lineWidth: 1)
} else {
Expand Down
23 changes: 12 additions & 11 deletions app-ios/Modules/Sources/Timetable/TimetableListItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,27 @@ struct TimetableListItemView: View {
var body: some View {
HStack(alignment: .top) {
VStack(alignment: .leading, spacing: 0) {
Spacer().frame(height: 4)
Spacer().frame(height: 16)
// TODO apply like flexbox layout
LazyHStack(spacing: 4) {
InfoLabel(
HStack(spacing: 4) {
SessionTag(
timetableItem.room.name.currentLangTitle,
labelColor: AssetColors.Custom.hallText.swiftUIColor,
backgroundColor: timetableItem.room.type.toColor()
)
ForEach(timetableItem.language.labels, id: \.self) { label in
InfoLabel(
SessionTag(
label,
labelColor: AssetColors.Surface.onSurfaceVariant.swiftUIColor,
strokeColor: AssetColors.Outline.outline.swiftUIColor
)
}
}
Spacer().frame(height: 12)
Spacer().frame(height: 8)
Text(timetableItem.title.currentLangTitle)
.multilineTextAlignment(.leading)
.font(Font.system(size: 22, weight: .medium, design: .default))
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.frame(maxWidth: .infinity, alignment: .leading)
if let session = timetableItem as? TimetableItem.Session {
if let message = session.message {
Spacer().frame(height: 8)
Expand All @@ -50,12 +49,14 @@ struct TimetableListItemView: View {
}
if !session.speakers.isEmpty {
Spacer().frame(height: 8)
PersonLabel(
speakers: session.speakers
)
VStack {
ForEach(session.speakers, id: \.self) { speaker in
PersonLabel(speaker: speaker)
}
}
}
}
Spacer().frame(height: 8)
Spacer().frame(height: 16)
}
Button(
action: {
Expand All @@ -69,7 +70,7 @@ struct TimetableListItemView: View {
}
}
)
.frame(width: 52, height: 52)
.frame(width: 56, height: 56)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
}
}
Expand Down
2 changes: 2 additions & 0 deletions app-ios/Modules/Sources/Timetable/TimetableView.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Assets
import Component
import Model
import shared
import SwiftUI
Expand Down Expand Up @@ -61,6 +62,7 @@ public struct TimetableView<SessionView: View>: View {
}
}
.background(AssetColors.Surface.surface.swiftUIColor)
.clipShape(RoundedCornersShape(corners: [.topLeft, .topRight], cornerRadius: 40))
}
.navigationDestination(for: TimetableRouting.self) { routing in
switch routing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ fun SessionsAllResponse.Companion.fake(): SessionsAllResponse {
en = "DroidKaigi App Architecture day$day room${room.name.en} index$index",
),
speakers = listOf("1", "2"),
description = "これはディスクリプションです。\nこれはディスクリプションです。",
description = "これはディスクリプションです。\nこれはディスクリプションです。\nこれはディスクリプションです。\n" +
"これはディスクリプションです。\nこれはディスクリプションです。\nこれはディスクリプションです。\n",
startsAt = start.toString(),
endsAt = end.toString(),
language = "JAPANESE",
Expand Down
1 change: 1 addition & 0 deletions core/testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ dependencies {
implementation(libs.kermit)
api(libs.roborazziRule)
api(libs.composeUiTestJunit4)
implementation(libs.composeMaterialWindowSize)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.github.droidkaigi.confsched2023.testing.robot

import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass
import androidx.compose.ui.test.isRoot
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
import androidx.compose.ui.test.onNodeWithTag
Expand All @@ -14,6 +16,7 @@ import kotlinx.coroutines.test.TestDispatcher
import javax.inject.Inject
import kotlin.time.Duration.Companion.seconds

@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
class FloorMapScreenRobot @Inject constructor(
private val testDispatcher: TestDispatcher,
) {
Expand All @@ -33,6 +36,7 @@ class FloorMapScreenRobot @Inject constructor(
KaigiTheme {
FloorMapScreen(
onSideEventClick = { },
windowSize = calculateWindowSizeClass(composeTestRule.activity),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.ui.test.isRoot
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performScrollTo
import androidx.compose.ui.test.performTouchInput
import androidx.compose.ui.test.swipeUp
import com.github.takahirom.roborazzi.Dump
Expand All @@ -15,6 +16,7 @@ import io.github.droidkaigi.confsched2023.data.sessions.response.SessionsAllResp
import io.github.droidkaigi.confsched2023.designsystem.theme.KaigiTheme
import io.github.droidkaigi.confsched2023.sessions.TimetableItemDetailScreen
import io.github.droidkaigi.confsched2023.sessions.component.TimetableItemDetailBookmarkIconTestTag
import io.github.droidkaigi.confsched2023.sessions.component.TimetableItemDetailReadMoreButtonTestTag
import io.github.droidkaigi.confsched2023.testing.RobotTestRule
import io.github.droidkaigi.confsched2023.testing.coroutines.runTestWithLogging
import kotlinx.coroutines.test.TestDispatcher
Expand Down Expand Up @@ -55,6 +57,19 @@ class TimetableItemDetailScreenRobot @Inject constructor(
waitUntilIdle()
}

fun scrollToDescription() {
composeTestRule
.onNode(hasTestTag(TimetableItemDetailReadMoreButtonTestTag))
.performScrollTo()
scroll()
}

fun clickReadMoreButton() {
composeTestRule
.onNode(hasTestTag(TimetableItemDetailReadMoreButtonTestTag))
.performClick()
}

fun scroll() {
composeTestRule
.onRoot()
Expand Down
1 change: 1 addition & 0 deletions feature/floor-map/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies {
implementation(projects.core.designsystem)
implementation(projects.core.ui)
implementation(projects.core.model)
implementation(libs.composeMaterialWindowSize)
testImplementation(projects.core.testing)

implementation(libs.composeHiltNavigtation)
Expand Down
Loading

0 comments on commit 1a18aa1

Please sign in to comment.