-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #947 from yimajo/add_kmpclient_live
Extract `KMPClientLive` target from `KMPClient` target
- Loading branch information
Showing
14 changed files
with
131 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 12 additions & 10 deletions
22
.../KmpAppComposeViewControllerWrapper.swift → .../KmpAppComposeViewControllerWrapper.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 12 additions & 9 deletions
21
...ileCardComposeViewControllerWrapper.swift → ...ileCardComposeViewControllerWrapper.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
import SwiftUI | ||
import shared | ||
import ComposableArchitecture | ||
|
||
public struct KmpProfileCardComposeViewControllerWrapper: UIViewControllerRepresentable { | ||
public init() {} | ||
|
||
public func makeUIViewController(context: Context) -> UIViewController { | ||
struct KmpProfileCardComposeViewControllerWrapper: UIViewControllerRepresentable { | ||
@Dependency(\.containerClient) var containerClient | ||
|
||
init() {} | ||
|
||
func makeUIViewController(context: Context) -> UIViewController { | ||
profileCardViewController( | ||
repositories: Container.shared.get(type: (any Repositories).self), | ||
repositories: containerClient.repositories(), | ||
onClickShareProfileCard: { image, text in | ||
let activityViewController = UIActivityViewController(activityItems: [text, image], applicationActivities: nil) | ||
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, | ||
let keyWindow = windowScene.windows.first(where: { $0.isKeyWindow }), | ||
let rootViewController = keyWindow.rootViewController { | ||
let keyWindow = windowScene.windows.first(where: { $0.isKeyWindow }), | ||
let rootViewController = keyWindow.rootViewController { | ||
rootViewController.present(activityViewController, animated: true, completion: nil) | ||
} else { | ||
print("Unable to find the root view controller.") | ||
} | ||
} | ||
) | ||
} | ||
public func updateUIViewController(_ uiViewController: UIViewController, context: Context) { | ||
|
||
func updateUIViewController(_ uiViewController: UIViewController, context: Context) { | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
app-ios/Sources/ContributorFeature/KmpContributorComposeViewControllerWrapper.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import SwiftUI | ||
import shared | ||
import ComposableArchitecture | ||
|
||
struct KmpContributorComposeViewControllerWrapper: UIViewControllerRepresentable { | ||
public typealias URLString = String | ||
|
||
let repositories: any Repositories | ||
private let onContributorsItemClick: (URLString) -> Void | ||
|
||
init(onContributorsItemClick: @escaping (URLString) -> Void) { | ||
@Dependency(\.containerClient) var containerClient | ||
|
||
self.repositories = containerClient.repositories() | ||
self.onContributorsItemClick = onContributorsItemClick | ||
} | ||
|
||
func makeUIViewController(context: Context) -> UIViewController { | ||
return contributorsViewController( | ||
repositories: repositories, | ||
onContributorsItemClick: onContributorsItemClick | ||
) | ||
} | ||
|
||
func updateUIViewController(_ uiViewController: UIViewController, context: Context) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
app-ios/Sources/KMPClient/Views/KmpContributorComposeViewControllerWrapper.swift
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters