Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Modules/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Modules/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ let package = Package(
.package(url: "https://github.com/markiv/SwiftUI-Shimmer", from: "1.0.0"),
.package(url: "https://github.com/nalexn/ViewInspector", from: "0.10.0"),
.package(url: "https://github.com/onevcat/Kingfisher", from: "7.6.2"),
.package(url: "https://github.com/pmusolino/Wormholy", from: "2.0.0"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering, can the package not get included in production builds in SPM? I tried building the app with the release build configuration and I still saw the related files being built. Not sure if the final build is optimized so that unused packages are removed, or this is just not supported in SPM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, Swift package manager does not support conditional compilation.

I know Apple does post processing of the IPA we send them, but I don't know if it removes unused frameworks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, Swift package manager does not support conditional compilation.

Actually, maybe I'm wrong, see https://developer.apple.com/documentation/packagedescription/buildsettingcondition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turns out I was right... Unfortunately.

SwiftPM allows conditional platform dependencies, but not conditional configurations.

See https://github.com/swiftlang/swift-evolution/blob/main/proposals/0273-swiftpm-conditional-target-dependencies.md which proposed both but is marked as implemented only for platform conditions.

It was possible at some point, but the capability was removed swiftlang/swift-package-manager#2598

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks a lot for looking into the feasibility. Is there a quick way to know how a library contributes to the app size? Would be great not to add to the app size as we've already got a warning about the > 200MB download size p91TBi-dnB-p2.

I know Apple does post processing of the IPA we send them, but I don't know if it removes unused frameworks.

I hope so.

Copy link
Contributor

@AliSoftware AliSoftware Jun 26, 2025

Choose a reason for hiding this comment

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

I doubt a debugging library would take up a lot of space though, […]

I know Apple does post processing of the IPA we send them, but I don't know if it removes unused frameworks.

For the record, I asked xcodebuild to generate the App Thinning Report with and without Wormholy and here is the thinned size comparison for the iPhone17.5, iOS 18.0 variant:

For iPhone17,5 & iOS 18 Download Size Install Size
With Wormholy 97.22 MB 191.50 MB
Without Wormholy 97.09 MB 191.20 MB

This is not a perfect comparison, as App Store might do additional optimizations, but should still be a pretty good indicator.

.package(url: "https://github.com/pavolkmet/ScrollViewSectionKit", from: "1.2.0"),
.package(url: "https://github.com/Quick/Nimble.git", from: "13.0.0"),
.package(url: "https://github.com/simibac/ConfettiSwiftUI.git", from: "1.0.0"),
Expand Down Expand Up @@ -375,6 +376,7 @@ enum XcodeSupport {
.product(name: "Shimmer", package: "SwiftUI-Shimmer"),
.product(name: "StripeTerminal", package: "stripe-terminal-ios"),
.product(name: "WordPressEditor", package: "AztecEditor-iOS"),
.product(name: "Wormholy", package: "Wormholy"),
.product(name: "ZendeskSupportSDK", package: "support_sdk_ios"),
]
),
Expand Down
11 changes: 10 additions & 1 deletion WooCommerce.xcworkspace/xcshareddata/swiftpm/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions WooCommerce/Classes/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import class Yosemite.ScreenshotStoresManager
// In that way, Inject will be available in the entire target.
@_exported import Inject

#if DEBUG
import WormholySwift
#endif

// MARK: - Woo's App Delegate!
//
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand Down Expand Up @@ -77,6 +81,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
setupLogLevel(.verbose)
setupPushNotificationsManagerIfPossible(pushNotesManager, stores: stores)
setupAppRatingManager()
setupWormholy()
setupKeyboardStateProvider()
handleLaunchArguments()
setupUserNotificationCenter()
Expand Down Expand Up @@ -407,6 +412,15 @@ private extension AppDelegate {
appRating.setVersion(version)
}

/// Set up Wormholy only in Debug build configuration
///
func setupWormholy() {
#if DEBUG
// We want to activate it programmatically, not using the shake.
Wormholy.shakeEnabled = false
#endif
}

/// Set up `KeyboardStateProvider`
///
func setupKeyboardStateProvider() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ private extension SettingsViewController {
configureWhatsNew(cell: cell)
case let cell as BasicTableViewCell where row == .deviceSettings:
configureAppSettings(cell: cell)
case let cell as BasicTableViewCell where row == .wormholy:
configureWormholy(cell: cell)
case let cell as BasicTableViewCell where row == .accountSettings:
configureAccountSettings(cell: cell)
case let cell as BasicTableViewCell where row == .logout:
Expand Down Expand Up @@ -264,6 +266,12 @@ private extension SettingsViewController {
cell.textLabel?.text = Localization.openDeviceSettings
}

func configureWormholy(cell: BasicTableViewCell) {
cell.accessoryType = .disclosureIndicator
cell.selectionStyle = .default
cell.textLabel?.text = Localization.launchWormHolyDebug
}

func configureWhatsNew(cell: BasicTableViewCell) {
cell.accessoryType = .disclosureIndicator
cell.selectionStyle = .default
Expand Down Expand Up @@ -481,6 +489,11 @@ private extension SettingsViewController {
UIApplication.shared.open(targetURL)
}

func wormholyWasPressed() {
// Fire a local notification, which fires Wormholy if enabled.
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "wormholy_fire"), object: nil)
}

func whatsNewWasPressed() {
ServiceLocator.analytics.track(event: .featureAnnouncementShown(source: .appSettings))
guard let announcement = viewModel.announcement else { return }
Expand Down Expand Up @@ -634,6 +647,8 @@ extension SettingsViewController: UITableViewDelegate {
aboutWasPressed()
case .deviceSettings:
deviceSettingsWasPressed()
case .wormholy:
wormholyWasPressed()
case .whatsNew:
whatsNewWasPressed()
case .accountSettings:
Expand Down Expand Up @@ -721,6 +736,7 @@ extension SettingsViewController {

// Other
case deviceSettings
case wormholy

// Account settings
case accountSettings
Expand Down Expand Up @@ -765,6 +781,8 @@ extension SettingsViewController {
return BasicTableViewCell.self
case .deviceSettings:
return BasicTableViewCell.self
case .wormholy:
return BasicTableViewCell.self
case .whatsNew:
return BasicTableViewCell.self
case .storeName:
Expand Down Expand Up @@ -871,6 +889,11 @@ private extension SettingsViewController {
comment: "Opens iOS's Device Settings for the app"
)

static let launchWormHolyDebug = NSLocalizedString(
"Launch Wormholy Debug",
comment: "Opens an internal library called Wormholy. Not visible to users."
)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we don't have to localize this string as this is developer-facing.


static let whatsNew = NSLocalizedString(
"What's New in WooCommerce",
comment: "Navigates to screen containing the latest WooCommerce Features"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,15 @@ private extension SettingsViewModel {

// Other
let otherSection: Section = {
let rows: [Row]
#if DEBUG
rows = [.deviceSettings, .wormholy]
#else
rows = [.deviceSettings]
#endif

return Section(title: Localization.otherTitle,
rows: [.deviceSettings],
rows: rows,
footerHeight: UITableView.automaticDimension)
}()

Expand Down