Skip to content

Commit

Permalink
Merge branch 'main' into kuu/improve-oss-licenses-screen
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiya-kume authored Sep 23, 2023
2 parents 2e08ce5 + bc95318 commit a2e5eb3
Show file tree
Hide file tree
Showing 20 changed files with 549 additions and 119 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/CompareScreenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ jobs:
retention-days: 30

- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ always() }}
if: always()
with:
name: screenshot-diff-reports
path: |
**/build/reports
**/reports
**/build/outputs/roborazzi
retention-days: 30

- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
Expand All @@ -67,4 +68,4 @@ jobs:
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: pr
path: pr/
path: pr/
11 changes: 5 additions & 6 deletions .github/workflows/UnitTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ jobs:
**/build/outputs/roborazzi
retention-days: 30

- id: test-reports
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: always()
uses: ./.github/actions/upload-distributed-files
with:
copy-to: .test-reports
name: reports
name-type: directory
artifact-name: 'test-reports'
name: test-reports
path: |
**/reports
**/build/outputs/roborazzi
- id: test-results
if: always()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "trailing-icon 3.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "trailing-icon 4.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import shared

extension Kotlinx_datetimeInstant {
public func toDate(calendar: Calendar = .current) -> Date {
return Date(timeIntervalSince1970: TimeInterval(toEpochMilliseconds()))
public func toDate() -> Date {
return Date(timeIntervalSince1970: TimeInterval(epochSeconds))
}
}
15 changes: 15 additions & 0 deletions app-ios/Modules/Sources/Model/TimetableRoomGroupItems.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import shared

public struct TimetableRoomGroupItems: Identifiable, Equatable, Hashable {
public var id: String {
UUID().uuidString
}

public var room: TimetableRoom
public var items: [TimetableItemWithFavorite]

public init(room: TimetableRoom, items: [TimetableItemWithFavorite]) {
self.room = room
self.items = items
}
}
213 changes: 143 additions & 70 deletions app-ios/Modules/Sources/Navigation/RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@ import SwiftUI
import Theme
import Timetable

enum Tab {
enum Tab: Int, CaseIterable, Identifiable {
var id: Int {
rawValue
}

case timeline
case floorMap
case achievements
case about
}

public struct RootView: View {
@Environment(\.horizontalSizeClass) var horizontalSizeClass
@Environment(\.verticalSizeClass) var verticalSizeClass
@StateObject var viewModel: RootViewModel = .init()
@State var selection = Tab.timeline
@State var selectionForSidebar: Tab.ID? = Tab.timeline.id

public init() {}

Expand All @@ -33,89 +40,155 @@ public struct RootView: View {
case .failed:
EmptyView()
case .loaded(let isAchivementEnabled):
TabView(selection: $selection) {
TimetableView(
sessionViewBuilder: { timetableItem in
SessionView(timetableItem: timetableItem)
}
)
.tag(Tab.timeline)
.tabItem {
Label {
Text("Timetable")
} icon: {
if selection == .timeline {
Assets.Icons.timetable.swiftUIImage
.renderingMode(.template)
} else {
Assets.Icons.timetableFillOff.swiftUIImage
.renderingMode(.template)
let timetableView = TimetableView(
sessionViewBuilder: { timetableItem in
SessionView(timetableItem: timetableItem)
}
)
let aboutView = AboutView(
contributorViewProvider: { _ in
ContributorView()
},
staffViewProvider: { _ in
StaffView()
},
sponsorViewProvider: { _ in
SponsorView()
}
)
Group {
if horizontalSizeClass == .regular && verticalSizeClass == .regular {
NavigationSplitView(columnVisibility: .constant(.doubleColumn)) {
List(Tab.allCases, selection: $selectionForSidebar) {
let selected = $0.id == selectionForSidebar
switch $0 {
case .timeline:
TimetableViewLabel(selected: selected)
case .floorMap:
FloorMapViewLabel(selected: selected)
case .achievements:
AchievementsViewLabel(selected: selected)
case .about:
AboutViewLabel(selected: selected)
}
}
}
FloorMapView()
.tag(Tab.floorMap)
.tabItem {
Label {
Text("Floor Map")
} icon: {
if selection == .floorMap {
Assets.Icons.floorMap.swiftUIImage
.renderingMode(.template)
} else {
Assets.Icons.floorMapFillOff.swiftUIImage
.renderingMode(.template)
} detail: {
if let selectionForSidebar, let tab = Tab(rawValue: selectionForSidebar) {
switch tab {
case .timeline:
timetableView
case .floorMap:
FloorMapView()
case .achievements:
AchievementsView()
case .about:
aboutView
}
} else {
fatalError()
}
}
// if isAchivementEnabled {
AchievementsView()
.tag(Tab.achievements)
.tabItem {
Label {
Text("Achievements")
} icon: {
if selection == .achievements {
Assets.Icons.achievements.swiftUIImage
.renderingMode(.template)
} else {
Assets.Icons.achievementsFillOff.swiftUIImage
.renderingMode(.template)
}
.navigationSplitViewStyle(.balanced)
} else {
TabView(selection: $selection) {
timetableView
.tag(Tab.timeline)
.tabItem {
TimetableViewLabel(selected: selection == .timeline)
}
}
// }
AboutView(
contributorViewProvider: { _ in
ContributorView()
},
staffViewProvider: { _ in
StaffView()
},
sponsorViewProvider: { _ in
SponsorView()
}
)
.tag(Tab.about)
.tabItem {
Label {
Text("About")
} icon: {
if selection == .about {
Assets.Icons.info.swiftUIImage
.renderingMode(.template)
} else {
Assets.Icons.infoFillOff.swiftUIImage
.renderingMode(.template)
FloorMapView()
.tag(Tab.floorMap)
.tabItem {
FloorMapViewLabel(selected: selection == .floorMap)
}
// if isAchivementEnabled {
AchievementsView()
.tag(Tab.achievements)
.tabItem {
AchievementsViewLabel(selected: selection == .achievements)
}
// }
aboutView
.tag(Tab.about)
.tabItem {
AboutViewLabel(selected: selection == .about)
}
}
}
}
}
.tint(AssetColors.Secondary.onSecondaryContainer.swiftUIColor)
}
}
}

private struct TimetableViewLabel: View {
let selected: Bool
var body: some View {
Label {
Text("Timetable")
} icon: {
if selected {
Assets.Icons.timetable.swiftUIImage
.renderingMode(.template)
} else {
Assets.Icons.timetableFillOff.swiftUIImage
.renderingMode(.template)
}
}
}
}

private struct FloorMapViewLabel: View {
let selected: Bool
var body: some View {
Label {
Text("Floor Map")
} icon: {
if selected {
Assets.Icons.floorMap.swiftUIImage
.renderingMode(.template)
} else {
Assets.Icons.floorMapFillOff.swiftUIImage
.renderingMode(.template)
}
}
}
}

private struct AchievementsViewLabel: View {
let selected: Bool
var body: some View {
Label {
Text("Achievements")
} icon: {
if selected {
Assets.Icons.achievements.swiftUIImage
.renderingMode(.template)
} else {
Assets.Icons.achievementsFillOff.swiftUIImage
.renderingMode(.template)
}
}
}
}

private struct AboutViewLabel: View {
let selected: Bool
var body: some View {
Label {
Text("About")
} icon: {
if selected {
Assets.Icons.info.swiftUIImage
.renderingMode(.template)
} else {
Assets.Icons.infoFillOff.swiftUIImage
.renderingMode(.template)
}
}
}
}

// #Preview {
// RootView()
// }
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xD6",
"green" : "0xDA",
"red" : "0xFF"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x0A",
"green" : "0x00",
"red" : "0x93"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
18 changes: 18 additions & 0 deletions app-ios/Modules/Sources/Timetable/RoomType+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import shared
import SwiftUI
import Theme

extension RoomType {
func toColor() -> Color {
let colorAsset = switch self {
case .rooma: AssetColors.Custom.hallA
case .roomb: AssetColors.Custom.hallB
case .roomc: AssetColors.Custom.hallC
case .roomd: AssetColors.Custom.hallD
case .roome: AssetColors.Custom.hallE
case .roomde: AssetColors.Custom.hallD
default: AssetColors.Custom.white
}
return colorAsset.swiftUIColor
}
}
Loading

0 comments on commit a2e5eb3

Please sign in to comment.