-
Notifications
You must be signed in to change notification settings - Fork 121
[Woo POS][Modularization] Batch 1: Make Woo app dependencies reusable for PointOfSale module #15968
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
Merged
staskus
merged 32 commits into
woomob-935-woo-pos-hack-week-pos-modularization
from
woomob-935-woo-pos-hack-week-pos-modularization-woo-app-dependencies
Aug 11, 2025
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
b29dd16
Create POSNavigationAdaptor to remove DeepLinkNavigator and AppDelega…
staskus cf92419
Remove SafariView dependency by moving SafariView to PointOfSaleDashb…
staskus 5bd198c
Create POSExternalViewProvider to extract SupportForm away from POS
staskus ba66da9
Remove CardPresentPaymentsOnboardingViewModel IPP dependency from POS
staskus 8d9111d
Remove CardPresentPaymentsOnboardingViewModel dependency from POS tests
staskus b785662
Delete unused CardPresentPaymentError
staskus efb555e
Move CardPresentPaymentInvalidatablePaymentOrchestrator and CardPrese…
staskus f7d89b1
Move alerts provider to POS Adaptors
staskus ba8dd96
Split POSCollectOrderPaymentAnalytics implementation and protocol
staskus dc4987f
Move Orders-related POS events to POSAnalyticsEvent to be reachable o…
staskus 85c6e66
Move OrderTotalsCalculator to Yosemite to share between Woo app and POS
staskus 776fe4c
Remove POSSessionManagerProviding since it was replaced by externalVi…
staskus b1781c1
Move VersionHelpers to WooFoundation
staskus f8d0cec
Move Array+Helpers to WooFoundation
staskus 2e7d591
Move some String+Helpers to WooFoundation
staskus f45e920
Move IndefiniteCircularProgressViewStyle to WooFoundation
staskus 6b4ab2c
Move KeyboardObserver to WooFoundation
staskus ad46f34
Move View+Measurements to WooFoundation
staskus 01280eb
Move View+ScrollModifiers to WooFoundation
staskus b874f2c
Move ScrollableVStack to WooFoundation
staskus a13955e
Move View+Conditionals to WooFoundation
staskus 495c14c
Move View+RoundedBorder to WooFoundation
staskus 4509f48
Make additional WooFoundation imports
staskus d46f71b
Move WooRoundedBorderTextFieldStyle to WooFoundation
staskus ba85d6c
Move View+ AutofocusTextModifier to WooFoundation
staskus f5e18e6
Move View+SizeTracker to WooFoundation
staskus 5edfbfc
Swiftlint updates
staskus 264a0c5
Move UIImages used in POS to UIImage+POS
staskus 40eb857
Update IndefiniteCircularProgressViewStyle.swift
staskus e614f93
Mark UIImage+POS specifically from the main bundle
staskus 931b614
Move SafariView to WooFoundation
staskus 41e86f1
Use the same instance of onboardingViewModel for configuration and vi…
staskus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,17 +1,19 @@ | ||
| import Foundation | ||
| import SwiftUI | ||
| import WooFoundation | ||
| import Experiments | ||
| import protocol Yosemite.Action | ||
| import struct Yosemite.Site | ||
|
|
||
| /// Main dependency provider protocol for POS module | ||
| /// This abstracts away direct ServiceLocator access | ||
| /// This abstracts away dependencies from the main Woo app | ||
| public protocol POSDependencyProviding { | ||
| var analytics: POSAnalyticsProviding { get } | ||
| var currency: POSCurrencySettingsProviding { get } | ||
| var featureFlags: POSFeatureFlagProviding { get } | ||
| var session: POSSessionManagerProviding { get } | ||
| var connectivity: POSConnectivityProviding { get } | ||
| var externalNavigation: POSExternalNavigationProviding { get } | ||
| var externalViews: POSExternalViewProviding { get } | ||
| } | ||
|
|
||
| public protocol POSAnalyticsProviding { | ||
|
|
@@ -21,10 +23,6 @@ public protocol POSAnalyticsProviding { | |
| func track(_ stat: WooAnalyticsStat) | ||
| } | ||
|
|
||
| public protocol POSSessionManagerProviding { | ||
| var defaultSite: Site? { get } | ||
| } | ||
|
|
||
| public protocol POSFeatureFlagProviding { | ||
| func isFeatureFlagEnabled(_ flag: FeatureFlag) -> Bool | ||
| } | ||
|
|
@@ -36,3 +34,13 @@ public protocol POSCurrencySettingsProviding { | |
| public protocol POSConnectivityProviding { | ||
| var connectivityObserver: ConnectivityObserver { get } | ||
| } | ||
|
|
||
| /// Navigation to the Woo app service abstraction | ||
| public protocol POSExternalNavigationProviding { | ||
| func navigateToCreateOrder() | ||
| } | ||
|
|
||
| /// External view service abstraction | ||
| public protocol POSExternalViewProviding { | ||
| func createSupportFormView(isPresented: Binding<Bool>) -> AnyView | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: a bit scary seeing |
||
| } | ||
This file contains hidden or 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 hidden or 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,24 @@ | ||
| import UIKit | ||
|
|
||
| /// Point of Sale specific UIImage extensions | ||
| /// Contains only the UIImage extensions needed by the POS module to minimize external dependencies | ||
| extension UIImage { | ||
|
|
||
| /// App icon (iPhone size) - used in receipt eligibility banner | ||
| /// | ||
| static var appIconDefault: UIImage { | ||
| return UIImage(named: "AppIcon60x60", in: .main, compatibleWith: nil)! | ||
| } | ||
|
|
||
| /// Card Reader Update arrow - used in reader update progress | ||
| /// | ||
| static var cardReaderUpdateProgressArrow: UIImage { | ||
| return UIImage(named: "card-reader-update-progress-arrow", in: .main, compatibleWith: nil)! | ||
| } | ||
|
|
||
| /// Card Reader Update checkmark - used in reader update progress completion | ||
| /// | ||
| static var cardReaderUpdateProgressCheckmark: UIImage { | ||
| return UIImage(named: "card-reader-update-progress-checkmark", in: .main, compatibleWith: nil)! | ||
| } | ||
| } |
This file contains hidden or 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
23 changes: 23 additions & 0 deletions
23
Modules/Sources/WooFoundation/UI Components/SafariView.swift
This file contains hidden or 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,23 @@ | ||
| import SwiftUI | ||
| import SafariServices | ||
|
|
||
| /// SwiftUI interface for UIKit SFSafariViewController | ||
| /// Provides a visible interface for web browsing, and Safari features | ||
| /// | ||
| public struct SafariView: UIViewControllerRepresentable { | ||
|
|
||
| public let url: URL | ||
|
|
||
| public init(url: URL) { | ||
| self.url = url | ||
| } | ||
|
|
||
| public func makeUIViewController(context: UIViewControllerRepresentableContext<SafariView>) -> SFSafariViewController { | ||
| return SFSafariViewController(url: url) | ||
| } | ||
|
|
||
| public func updateUIViewController(_ uiViewController: SFSafariViewController, | ||
| context: UIViewControllerRepresentableContext<SafariView>) { | ||
|
|
||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this seems to be tracked in both POS and IPP, WDYT having this extension in WooFoundation for example for use? this way, any modifications to the tracking apply to both use cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if we should strive to reuse 100%. Since it's the only event so far that had the same logic, I felt it was fine to keep it separately next to other POS events. In fact, I think we track OrderCreationErrorType only on POS for now.