-
Notifications
You must be signed in to change notification settings - Fork 117
Restore Wormholy, now installed via a fork supporting latest SPM #15771
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
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.
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 |
---|---|---|
|
@@ -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: | ||
|
@@ -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 | ||
|
@@ -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 } | ||
|
@@ -634,6 +647,8 @@ extension SettingsViewController: UITableViewDelegate { | |
aboutWasPressed() | ||
case .deviceSettings: | ||
deviceSettingsWasPressed() | ||
case .wormholy: | ||
wormholyWasPressed() | ||
case .whatsNew: | ||
whatsNewWasPressed() | ||
case .accountSettings: | ||
|
@@ -721,6 +736,7 @@ extension SettingsViewController { | |
|
||
// Other | ||
case deviceSettings | ||
case wormholy | ||
|
||
// Account settings | ||
case accountSettings | ||
|
@@ -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: | ||
|
@@ -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." | ||
) | ||
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: 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" | ||
|
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.
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.
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.
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.
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.
Actually, maybe I'm wrong, see https://developer.apple.com/documentation/packagedescription/buildsettingcondition
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.
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