-
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
Changes from 28 commits
b29dd16
cf92419
5bd198c
ba66da9
8d9111d
b785662
efb555e
f7d89b1
ba8dd96
dc4987f
85c6e66
776fe4c
b1781c1
f8d0cec
2e7d591
f45e920
6b4ab2c
ad46f34
01280eb
b874f2c
a13955e
495c14c
4509f48
d46f71b
ba85d6c
f5e18e6
5edfbfc
264a0c5
40eb857
e614f93
931b614
41e86f1
File filter
Filter by extension
Conversations
Jump to
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.
| 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 |
||
| } | ||
| 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")! | ||
|
||
| } | ||
|
|
||
| /// Card Reader Update arrow - used in reader update progress | ||
| /// | ||
| static var cardReaderUpdateProgressArrow: UIImage { | ||
| return UIImage(named: "card-reader-update-progress-arrow")! | ||
| } | ||
|
|
||
| /// Card Reader Update checkmark - used in reader update progress completion | ||
| /// | ||
| static var cardReaderUpdateProgressCheckmark: UIImage { | ||
| return UIImage(named: "card-reader-update-progress-checkmark")! | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -15,6 +15,28 @@ public struct IndefiniteCircularProgressViewStyle: ProgressViewStyle { | |||||
| @State private var viewRotation: Angle = .radians(0) | ||||||
| @State private var arcTimer: Timer? | ||||||
|
|
||||||
| public init( | ||||||
| size: CGFloat, | ||||||
| lineWidth: CGFloat = Constants.lineWidth, | ||||||
| lineCap: CGLineCap = .round, | ||||||
| circleColor: Color = Color(.primaryButtonBackground).opacity(Constants.backgroundOpacity), | ||||||
| fillColor: Color = Color(.primaryButtonBackground), | ||||||
| arcEnd: Double = Constants.initialArcEnd, | ||||||
| rotation: Angle = Constants.threeQuarterRotation, | ||||||
| viewRotation: Angle = .radians(0), | ||||||
| arcTimer: Timer? = nil | ||||||
| ) { | ||||||
| self.size = size | ||||||
| self.lineWidth = lineWidth | ||||||
| self.lineCap = lineCap | ||||||
| self.circleColor = circleColor | ||||||
| self.fillColor = fillColor | ||||||
| self.arcEnd = arcEnd | ||||||
| self.rotation = rotation | ||||||
| self.viewRotation = viewRotation | ||||||
| self.arcTimer = arcTimer | ||||||
| } | ||||||
|
|
||||||
| public func makeBody(configuration: ProgressViewStyleConfiguration) -> some View { | ||||||
| VStack { | ||||||
| ZStack { | ||||||
|
|
@@ -78,20 +100,20 @@ public struct IndefiniteCircularProgressViewStyle: ProgressViewStyle { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| private extension IndefiniteCircularProgressViewStyle { | ||||||
| enum Constants { | ||||||
| static let lineWidth: CGFloat = 10.0 | ||||||
| static let backgroundOpacity: CGFloat = 0.2 | ||||||
| public extension IndefiniteCircularProgressViewStyle { | ||||||
| public enum Constants { | ||||||
|
||||||
| public enum Constants { | |
| enum Constants { |
Outdated
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: does this string need to be public?
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.