Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Components - breaking the ice #1109

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

borisprimer
Copy link
Contributor

@borisprimer borisprimer commented Feb 6, 2025

This is a WIP PR for all the Components related work for now, keeping it in the draft.

Screen.Recording.2025-02-06.at.16.08.43.mov

@borisprimer borisprimer requested a review from a team as a code owner February 6, 2025 15:09

/// Returns the current simulated state.
func getState() async -> PaymentMethodState {
// TODO: Replace simulated state with actual state mapping from your processing logic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (Replace simulated state with a...). (todo)


/// Simulate payment submission.
func submit() async -> Result<PaymentResult, Error> {
// TODO: Replace with real payment submission logic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (Replace with real payment subm...). (todo)


/// Initialize with default payment methods.
init() {
// TODO: In a production system, fetch or update available payment methods dynamically.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (In a production system, fetch ...). (todo)

return AsyncStream { continuation in
self.paymentMethodsContinuation = continuation
continuation.yield(self._paymentMethods)
// TODO: Implement dynamic updates if payment methods change.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (Implement dynamic updates if p...). (todo)

return AsyncStream { continuation in
self.selectedMethodContinuation = continuation
continuation.yield(self._selectedMethod)
// TODO: Implement dynamic updates if the selection changes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (Implement dynamic updates if t...). (todo)

Text("Apple Pay UI for \(method.name)")
.font(.headline)
.padding()
// TODO: Add Apple Pay-specific UI elements and configuration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (Add Apple Pay-specific UI elem...). (todo)


/// Returns the current state for PayPal.
func getState() async -> PaymentMethodState {
// TODO: Replace with actual state logic for PayPal.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (Replace with actual state logi...). (todo)


/// Submits the PayPal payment.
func submit() async -> Result<PaymentResult, Error> {
// TODO: Implement PayPal-specific submission logic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (Implement PayPal-specific subm...). (todo)

Text("PayPal Payment UI for \(method.name)")
.font(.headline)
.padding()
// TODO: Add PayPal-specific UI elements and configuration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (Add PayPal-specific UI element...). (todo)

PrimerUIManager.primerRootViewController?.show(viewController: pucvc)

if #available(iOS 15.0, *) {
// TODO: TEMP - JUST FOR TESTING
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (TEMP - JUST FOR TESTING). (todo)

Copy link
Contributor

github-actions bot commented Feb 6, 2025

Warnings
⚠️ This PR doesn't seem to contain any updated Unit Test 🤔. Please consider double checking it.🙏
⚠️ > Pull Request size seems relatively large. If this Pull Request contains multiple changes, please split each into separate PR will helps faster, easier review.

Generated by 🚫 Danger Swift against c01c621

Copy link
Contributor

github-actions bot commented Feb 6, 2025

return .success(PaymentResult(success: true, message: "Payment processed successfully"))
}

#if canImport(SwiftUI)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we require #canImport(SwiftUI) given our current iOS target?

@borisprimer borisprimer self-assigned this Feb 10, 2025
self.clientToken = clientToken
self.onPaymentFinished = onPaymentFinished
self.customContent = nil
// TODO: Validate the client token if necessary.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (Validate the client token if n...). (todo)

self.clientToken = clientToken
self.onPaymentFinished = onPaymentFinished
self.customContent = customContent
// TODO: Validate the client token if necessary.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ TODOs should be resolved (Validate the client token if n...). (todo)

}
.padding()
.task {
async let _ = await viewModel.loadPaymentMethods()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Prefer _ = foo() over let _ = foo() when discarding a result from a function. (redundant_discardable_let)

@borisprimer borisprimer force-pushed the bn/feature/components branch from c69ac71 to e1f3d85 Compare February 25, 2025 13:46
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
9.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@borisprimer borisprimer force-pushed the bn/feature/components branch from b767d9e to dc87349 Compare February 25, 2025 16:17
@borisprimer borisprimer force-pushed the bn/feature/components branch from 7851c12 to 6b2a93e Compare February 25, 2025 19:36
@borisprimer borisprimer force-pushed the bn/feature/components branch from ff17eb1 to b1c6e64 Compare March 3, 2025 15:43
@borisprimer borisprimer force-pushed the bn/feature/components branch from b1c6e64 to ad68c0e Compare March 3, 2025 16:05
@borisprimer borisprimer force-pushed the bn/feature/components branch from ef4abec to cbdc264 Compare March 3, 2025 16:38
import SwiftUI

extension Color {
/// Initializes a Color from a hex string (e.g. "#f5f5f5" or "f5f5f5").
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ A doc comment should be attached to a declaration. (orphaned_doc_comment)

@borisprimer borisprimer force-pushed the bn/feature/components branch from 8968212 to 7656ea1 Compare March 3, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants