Skip to content

Commit

Permalink
Merge branch 'main' into feature/430_cache_speaker_icon_image
Browse files Browse the repository at this point in the history
  • Loading branch information
mltokky committed Aug 19, 2024
2 parents 6a0520d + 38804f1 commit f09b3f5
Show file tree
Hide file tree
Showing 96 changed files with 2,268 additions and 600 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ios-assign-reviewers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ jobs:
PULL_NUMBER: ${{ steps.pr_number.outputs.number }}
with:
script: |
const { IOS_REVIEWERS } = process.env
const author = context.payload.pull_request.user.login;
const reviewers = IOS_REVIEWERS.split(',').filter(reviewer => reviewer !== author)
const { IOS_REVIEWERS, PULL_NUMBER } = process.env
const reviewers = IOS_REVIEWERS.split(',')
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: PULL_NUMBER,
pull_number: Number(PULL_NUMBER),
reviewers
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import io.github.droidkaigi.confsched.contributors.contributorsScreenRoute
import io.github.droidkaigi.confsched.contributors.contributorsScreens
import io.github.droidkaigi.confsched.designsystem.theme.ColorContrast
import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme
import io.github.droidkaigi.confsched.eventmap.eventMapScreenRoute
import io.github.droidkaigi.confsched.eventmap.eventMapScreens
import io.github.droidkaigi.confsched.eventmap.navigateEventMapScreen
import io.github.droidkaigi.confsched.favorites.favoritesScreenRoute
Expand Down Expand Up @@ -247,6 +248,7 @@ class KaigiAppMainNestedGraphStateHolder : MainNestedGraphStateHolder {
override fun routeToTab(route: String): MainScreenTab? {
return when (route) {
timetableScreenRoute -> Timetable
eventMapScreenRoute -> EventMap
profileCardScreenRoute -> ProfileCard
aboutScreenRoute -> About
favoritesScreenRoute -> Favorite
Expand Down
2 changes: 2 additions & 0 deletions app-ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UIUserInterfaceStyle = Dark;
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
Expand Down Expand Up @@ -365,6 +366,7 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UIUserInterfaceStyle = Dark;
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
Expand Down
1 change: 1 addition & 0 deletions app-ios/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ let package = Package(
.firebaseAuth,
.firebaseRemoteConfig,
.tca,
.model
]
),

Expand Down
2 changes: 1 addition & 1 deletion app-ios/Sources/CommonComponents/Timetable/RoomTag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extension MultiLangText {
}

extension RoomType {
var shape: some View {
public var shape: some View {
Group {
switch self {
case .roomG: Image(.icCircleFill).renderingMode(.template)
Expand Down
16 changes: 10 additions & 6 deletions app-ios/Sources/ContributorFeature/ContributorListItemView.swift
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import shared
import SwiftUI
import Theme
import Model

struct ContributorListItemView: View {
let contributor: Contributor
let onContributorButtonTapped: (URL) -> Void

var body: some View {
Button {
if let urlString = contributor.profileUrl,
let url = URL(string: urlString) {
if let url = contributor.profileUrl {
onContributorButtonTapped(url)
}
} label: {
HStack(alignment: .center, spacing: 12) {
AsyncImage(url: URL(string: contributor.iconUrl)) {
AsyncImage(url: contributor.iconUrl) {
$0.image?.resizable()
}
.frame(width: 52, height: 52)
.clipShape(Circle())

Text(contributor.username)
Text(contributor.userName)
.textStyle(.bodyLarge)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.multilineTextAlignment(.leading)
Expand All @@ -37,6 +36,11 @@ struct ContributorListItemView: View {

#Preview {
ContributorListItemView(
contributor: Contributor.companion.fakes().first!
contributor: .init(
id: 0,
userName: "hoge",
profileUrl: URL(string: "https://2024.droidkaigi.jp/"),
iconUrl: URL(string: "https://avatars.githubusercontent.com/u/10727543?s=200&v=4")!
)
) { _ in }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import ComposableArchitecture
import KMPClient
import Model
import Foundation
@preconcurrency import class shared.Contributor

@Reducer
public struct ContributorReducer: Sendable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ struct KmpPresenterContributorView: View {
if let contributors = currentState.map(\.contributors) {
ScrollView {
LazyVStack(spacing: 0) {
ForEach(contributors, id: \.id) { contributor in
ForEach(contributors, id: \.id) { value in
let contributor = Model.Contributor(
id: Int(value.id),
userName: value.username,
profileUrl: value.profileUrl.map { URL(string: $0)! } ,
iconUrl: URL(string: value.iconUrl)!
)
ContributorListItemView(contributor: contributor) { url in
showingUrl = IdentifiableURL(url)
}
Expand Down
7 changes: 4 additions & 3 deletions app-ios/Sources/KMPClient/Client.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import DependenciesMacros
import Dependencies
import shared
import Model

extension DependencyValues {
public var timetableClient: TimetableClient {
Expand Down Expand Up @@ -38,17 +39,17 @@ public struct TimetableClient: Sendable {

@DependencyClient
public struct StaffClient: Sendable {
public var streamStaffs: @Sendable () throws -> AsyncThrowingStream<[Staff], any Error>
public var streamStaffs: @Sendable () throws -> AsyncThrowingStream<[Model.Staff], any Error>
}

@DependencyClient
public struct SponsorsClient: Sendable {
public var streamSponsors: @Sendable () throws -> AsyncThrowingStream<[Sponsor], any Error>
public var streamSponsors: @Sendable () throws -> AsyncThrowingStream<[Model.Sponsor], any Error>
}

@DependencyClient
public struct ContributorClient: Sendable {
public var streamContributors: @Sendable () throws -> AsyncThrowingStream<[Contributor], any Error>
public var streamContributors: @Sendable () throws -> AsyncThrowingStream<[Model.Contributor], any Error>
public var refresh: @Sendable () async throws -> Void
}

Expand Down
2 changes: 1 addition & 1 deletion app-ios/Sources/KMPClient/Helpers/Container.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public func prepareFirebase() {
FirebaseApp.configure()
}

public struct Container {
public struct Container: Sendable {
public static let shared: Container = .init()

private let entryPoint: KmpEntryPoint
Expand Down
49 changes: 46 additions & 3 deletions app-ios/Sources/KMPClient/LiveKey.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Dependencies
import shared
import Model
import Foundation

private var sessionsRepository: any SessionsRepository {
Container.shared.get(type: (any SessionsRepository).self)
Expand Down Expand Up @@ -44,22 +46,63 @@ extension TimetableClient: DependencyKey {
extension StaffClient: DependencyKey {
public static let liveValue: StaffClient = .init(
streamStaffs: {
staffRepository.staffs().eraseToThrowingStream()
staffRepository
.staffs()
.map {
$0.map {
Model.Staff(
id: Int($0.id),
name: $0.username,
icon: URL(string: $0.iconUrl)!,
github: URL(string: $0.profileUrl)!
)
}
}
.eraseToThrowingStream()
}
)
}

extension SponsorsClient: DependencyKey {
public static let liveValue: SponsorsClient = .init(
streamSponsors: {
sponsorsRepository.getSponsorStream().eraseToThrowingStream()
sponsorsRepository
.getSponsorStream()
.map{
$0.map {
let plan = switch $0.plan {
case .platinum: Model.Sponsor.Plan.platinum
case .gold: Model.Sponsor.Plan.gold
case .supporter: Model.Sponsor.Plan.supporter
}
return Model.Sponsor(
id: $0.name,
logo: URL(string: $0.logo)!,
link: URL(string: $0.link)!,
plan: plan
)
}
}
.eraseToThrowingStream()
}
)
}

extension ContributorClient: DependencyKey {
public static let liveValue: ContributorClient = Self {
contributorRepository.getContributorStream().eraseToThrowingStream()
contributorRepository
.getContributorStream()
.map {
$0.map {
Model.Contributor(
id: Int($0.id),
userName: $0.username,
profileUrl: $0.profileUrl.map { URL(string: $0)! } ,
iconUrl: URL(string: $0.iconUrl)!
)
}
}
.eraseToThrowingStream()
} refresh: {
try await contributorRepository.refresh()
}
Expand Down
15 changes: 15 additions & 0 deletions app-ios/Sources/Model/Entity/Contributor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Foundation

public struct Contributor: Equatable, Sendable, Identifiable {
public var id: Int
public let userName: String
public let profileUrl: URL?
public let iconUrl: URL

public init(id: Int, userName: String, profileUrl: URL?, iconUrl: URL) {
self.id = id
self.userName = userName
self.profileUrl = profileUrl
self.iconUrl = iconUrl
}
}
20 changes: 20 additions & 0 deletions app-ios/Sources/Model/Entity/Sponsor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Foundation

public struct Sponsor: Equatable, Identifiable, Sendable {
public enum Plan: Equatable, Sendable {
case platinum
case gold
case supporter
}
public let id: String
public let logo: URL
public let link: URL
public let plan: Plan

public init(id: String, logo: URL, link: URL, plan: Sponsor.Plan) {
self.id = id
self.logo = logo
self.link = link
self.plan = plan
}
}
15 changes: 15 additions & 0 deletions app-ios/Sources/Model/Entity/Staff.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Foundation

public struct Staff: Equatable, Identifiable, Sendable {
public let id: Int
public let name: String
public let icon: URL
public let github: URL

public init(id: Int, name: String, icon: URL, github: URL) {
self.id = id
self.name = name
self.icon = icon
self.github = github
}
}
7 changes: 7 additions & 0 deletions app-ios/Sources/Model/Selectable.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
public protocol Selectable: CaseIterable, Equatable, Identifiable, Hashable {
associatedtype Options: RandomAccessCollection = [Self] where Self == Self.Options.Element
static var options: Options { get }
var caseTitle: String { get }

}

public extension Selectable {
static var options: Options { allCases as! Options }
}
8 changes: 6 additions & 2 deletions app-ios/Sources/SearchFeature/SearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ public struct SearchView: View {
selection: T?,
defaultTitle: String,
onSelect: @escaping (T) -> Void
) -> some View where T.AllCases: RandomAccessCollection {
) -> some View {
Menu {
ForEach(T.allCases, id: \.id) { menuSelection in
ForEach(T.options, id: \.id) { menuSelection in
Button {
onSelect(menuSelection)
} label: {
Expand Down Expand Up @@ -171,6 +171,10 @@ extension DroidKaigi2024Day {
String(localized: "9/13", bundle: .module)
}
}

public static var options: [DroidKaigi2024Day] {
[.conferenceDay1, .conferenceDay2]
}
}

#if hasFeature(RetroactiveAttribute)
Expand Down
Loading

0 comments on commit f09b3f5

Please sign in to comment.