Skip to content

Commit

Permalink
Add logic to open sheet when tapping contributor button in Contributo…
Browse files Browse the repository at this point in the history
…rView on iOS
  • Loading branch information
shin-usu committed Aug 16, 2024
1 parent 16d2480 commit 8296c6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app-ios/Sources/ContributorFeature/ContributorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ public struct ContributorView: View {
KmpPresenterContributorView()

case .fullKmp:
KmpContributorComposeViewControllerWrapper()
KmpContributorComposeViewControllerWrapper { urlString in
guard let url = URL(string: urlString) else {
return
}
store.send(.view(.contributorButtonTapped(url)))
}
}
}
.background(AssetColors.Surface.surface.swiftUIColor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ import SwiftUI
@preconcurrency import shared

public struct KmpContributorComposeViewControllerWrapper: UIViewControllerRepresentable {
public typealias URLString = String

public let repositories: any Repositories
private let onContributorsItemClick: (URLString) -> Void

public init() {
public init(onContributorsItemClick: @escaping (URLString) -> Void) {
self.repositories = Container.shared.get(type: (any Repositories).self)
self.onContributorsItemClick = onContributorsItemClick
}

public func makeUIViewController(context: Context) -> UIViewController {
Expand Down

0 comments on commit 8296c6e

Please sign in to comment.