Skip to content

Commit

Permalink
Merge branch 'main' into feature/add_map_link
Browse files Browse the repository at this point in the history
  • Loading branch information
Corvus400 authored Aug 11, 2024
2 parents b03668b + ab724fc commit 5e5109a
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 60 deletions.
18 changes: 17 additions & 1 deletion app-ios/Sources/App/RootReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public struct RootReducer {
case timetable(TimetableReducer.Action)
case favorite(FavoriteReducer.Action)
case about(AboutReducer.Action)
case view(View)
case paths(Paths)

@CasePathable
Expand All @@ -74,6 +75,10 @@ public struct RootReducer {
case favorite(StackActionOf<RootReducer.Path.Favorite>)
case about(StackActionOf<RootReducer.Path.About>)
}

public enum View {
case sameTabTapped(Tab)
}
}

public var body: some ReducerOf<Self> {
Expand Down Expand Up @@ -136,7 +141,18 @@ public struct RootReducer {
)
return .none
}


case let .view(.sameTabTapped(tab)):
switch tab {
case .timetable: state.paths.timetable.removeAll()
case .favorite: state.paths.favorite.removeAll()
case .about: state.paths.about.removeAll()
case .map: break
case .idCard: break
}

return .none

default:
return .none
}
Expand Down
107 changes: 62 additions & 45 deletions app-ios/Sources/App/RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import TimetableFeature
import EventMapFeature
import Theme

private enum Tab {
public enum Tab {
case timetable
case map
case favorite
Expand All @@ -26,54 +26,71 @@ public struct RootView: View {

public init(store: StoreOf<RootReducer>) {
self.store = store
UINavigationBar.appearance().barTintColor = AssetColors.Surface.surface.color
}

public var body: some View {
TabView(selection: $selection) {
timetableTab
.tag(Tab.timetable)
.tabItem {
Label(
title: { Text("Timetable") },
icon: { Image(.icTimetable).renderingMode(.template) }
)
}

eventMapTab
.tag(Tab.map)
.tabItem {
Label(
title: { Text("Event Map") },
icon: { Image(.icMap).renderingMode(.template) }
)
}

favoriteTab
.tag(Tab.favorite)
.tabItem {
Label(
title: { Text("Favorite") },
icon: { Image(.icFav).renderingMode(.template) }
)
}

aboutTab
.tag(Tab.about)
.tabItem {
Label(
title: { Text("About") },
icon: { Image(.icInfo).renderingMode(.template) }
)
}

Text("ID Card Feature")
.tag(Tab.idCard)
.tabItem {
Label(
title: { Text("ID Card") },
icon: { Image(.icProfileCard).renderingMode(.template) }
)
TabView(
selection: Binding(
get: { selection },
set: {
if selection != $0 {
selection = $0
return
}
store.send(.view(.sameTabTapped($0)))
}
)
) {
Group {
timetableTab
.tag(Tab.timetable)
.tabItem {
Label(
title: { Text("Timetable") },
icon: { Image(.icTimetable).renderingMode(.template) }
)
}

eventMapTab
.tag(Tab.map)
.tabItem {
Label(
title: { Text("Event Map") },
icon: { Image(.icMap).renderingMode(.template) }
)
}

favoriteTab
.tag(Tab.favorite)
.tabItem {
Label(
title: { Text("Favorite") },
icon: { Image(.icFav).renderingMode(.template) }
)
}

aboutTab
.tag(Tab.about)
.tabItem {
Label(
title: { Text("About") },
icon: { Image(.icInfo).renderingMode(.template) }
)
}

Text("ID Card Feature")
.tag(Tab.idCard)
.tabItem {
Label(
title: { Text("ID Card") },
icon: { Image(.icProfileCard).renderingMode(.template) }
)
}
}
.toolbarBackground(AssetColors.Surface.surface.swiftUIColor, for: .tabBar)
// If there are not this code, tab bar color is clear when scroll down to edge.
.toolbarBackground(.visible, for: .tabBar)
}
.navigationBarTitleStyle(
color: AssetColors.Surface.onSurface.swiftUIColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public struct TimetableDetailView: View {
.frame(maxWidth: .infinity)
.ignoresSafeArea(edges: [.top])
}
.toolbarBackground(AssetColors.Surface.surface.swiftUIColor, for: .navigationBar)
.tint(store.timetableItem.room.roomTheme.primaryColor)
.confirmationDialog(
$store.scope(
Expand Down
16 changes: 14 additions & 2 deletions app-ios/Tests/EventMapFeatureTests/EventMapTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
import Foundation
import XCTest
import ComposableArchitecture
@testable import EventMapFeature

// TODO: Implement tests for EventMapView
final class EventMap_iosTests: XCTestCase {
@MainActor func testFloorMapSelected() async throws {
let store = TestStore(initialState: EventMapReducer.State()) {
EventMapReducer()
}

await store.send(.view(.selectFloorMap(.firstBasement))) {
$0.selectedFloorMap = .firstBasement
}
}
}
11 changes: 1 addition & 10 deletions app-ios/Tests/FavoriteFeatureTests/FavoriteTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,5 @@ import ComposableArchitecture
@testable import FavoriteFeature

final class FavoriteTests: XCTestCase {
@MainActor func testExample() async throws {
let store = TestStore(
initialState: FavoriteReducer.State(text: "Test")
) {
FavoriteReducer()
}
await store.send(.onAppear) {
$0.text = "Favorite Feature"
}
}
// TODO: Add favorite feature tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string name="license">ライセンス</string>
<string name="privacy_policy">プライバシーポリシー</string>
<string name="app_version">アプリバージョン</string>
<string name="about-droidkaigi">Droidkaigiについて</string>
<string name="content_description_youtube">YouTube</string>
<string name="content_description_x">X</string>
<string name="content_description_medium">Medium</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string name="license">License</string>
<string name="privacy_policy">Privacy Policy</string>
<string name="app_version">App Version</string>
<string name="about_droidkaigi">About Droidkaigi</string>
<string name="content_description_youtube">YouTube</string>
<string name="content_description_x">X</string>
<string name="content_description_medium">Medium</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
Expand All @@ -18,6 +20,7 @@ import androidx.navigation.NavController
import androidx.navigation.NavGraph.Companion.findStartDestination
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import conference_app_2024.feature.about.generated.resources.about_droidkaigi
import io.github.droidkaigi.confsched.about.section.AboutDroidKaigiDetail
import io.github.droidkaigi.confsched.about.section.AboutFooterLinks
import io.github.droidkaigi.confsched.about.section.aboutCredits
Expand All @@ -26,6 +29,7 @@ import io.github.droidkaigi.confsched.model.AboutItem
import io.github.droidkaigi.confsched.model.AboutItem.Medium
import io.github.droidkaigi.confsched.model.AboutItem.X
import io.github.droidkaigi.confsched.model.AboutItem.YouTube
import org.jetbrains.compose.resources.stringResource

const val aboutScreenRoute = "about"

Expand Down Expand Up @@ -68,6 +72,7 @@ fun AboutScreen(

Scaffold(
modifier = modifier.testTag(AboutScreenTestTag.Screen),
topBar = { TopAppBar(title = { Text(stringResource(AboutRes.string.about_droidkaigi)) }) },
snackbarHost = { SnackbarHost(hostState = snackbarHostState) },
contentWindowInsets = WindowInsets(
left = contentPadding.calculateLeftPadding(layoutDirection),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -60,7 +61,9 @@ fun TimetableItemDetailHeadline(
)
Spacer(modifier = Modifier.height(16.dp))
timetableItem.speakers.forEach { speaker ->
Row {
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Image(
painter = rememberAsyncImagePainter(speaker.iconUrl),
contentDescription = null,
Expand Down

0 comments on commit 5e5109a

Please sign in to comment.