Skip to content

Commit 6227824

Browse files
committed
Merge branch 'develop' into issue/2003-remove-showWPUsernamePassword
2 parents 91f9a49 + 9eceeaa commit 6227824

File tree

11 files changed

+77
-6
lines changed

11 files changed

+77
-6
lines changed

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ target 'WooCommerce' do
5656
pod 'Charts', '~> 3.3.0'
5757
pod 'ZendeskSupportSDK', '~> 5.0'
5858
pod 'Kingfisher', '~> 5.11.0'
59-
pod 'Wormholy', '~> 1.5.2', :configurations => ['Debug']
59+
pod 'Wormholy', '~> 1.6.0', :configurations => ['Debug']
6060

6161
# Unit Tests
6262
# ==========

Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ PODS:
7272
- CocoaLumberjack (~> 3.4)
7373
- FormatterKit/TimeIntervalFormatter (= 1.8.2)
7474
- WordPressUI (1.5.2)
75-
- Wormholy (1.5.2)
75+
- Wormholy (1.6.0)
7676
- WPMediaPicker (1.6.0)
7777
- wpxmlrpc (0.8.5)
7878
- XLPagerTabStrip (9.0.0)
@@ -104,7 +104,7 @@ DEPENDENCIES:
104104
- WordPressAuthenticator (~> 1.14.0-beta.1)
105105
- WordPressShared (~> 1.8.16)
106106
- WordPressUI (~> 1.5.2)
107-
- Wormholy (~> 1.5.2)
107+
- Wormholy (~> 1.6.0)
108108
- WPMediaPicker (~> 1.6.0)
109109
- XLPagerTabStrip (~> 9.0)
110110
- ZendeskSupportSDK (~> 5.0)
@@ -176,7 +176,7 @@ SPEC CHECKSUMS:
176176
WordPressKit: 84045e236949248632a2c644149e5657733011bb
177177
WordPressShared: 1bc316ed162f42af4e0fa2869437e9e28b532b01
178178
WordPressUI: 70cc58a253c352330b23cd8fa6dd6a2021570e18
179-
Wormholy: 3344d3591d78488d957402d51dccfbfafd6f9641
179+
Wormholy: f52cd3c384fb49ae3e8fdb2b1398b66746a65104
180180
WPMediaPicker: e5d28197da6b467d4e5975d64a49255977e39455
181181
wpxmlrpc: 6a9bdd6ab9d1b159b384b0df0f3f39de9af4fecf
182182
XLPagerTabStrip: 61c57fd61f611ee5f01ff1495ad6fbee8bf496c5
@@ -188,6 +188,6 @@ SPEC CHECKSUMS:
188188
ZendeskSupportProvidersSDK: e183d32abac888c448469e2005c4a5a8c3ed73f0
189189
ZendeskSupportSDK: e52f37fa8bcba91f024b81025869fe5a2860f741
190190

191-
PODFILE CHECKSUM: 241533919f715d30f23901123d0a89d3dc3e80c5
191+
PODFILE CHECKSUM: d66561e633700641266a46e0d1583e889aa31798
192192

193193
COCOAPODS: 1.9.1

WooCommerce/Classes/Extensions/UINavigationController+Woo.swift

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protocol UINavigationBarBackButtonHandler {
4343

4444
extension UIViewController: UINavigationBarBackButtonHandler {
4545
//Do not block the "Back" button action by default, otherwise, override this function in the specified viewcontroller
46-
@objc func shouldPopOnBackButton() -> Bool {
46+
@objc func shouldPopOnBackButton() -> Bool {
4747
return true
4848
}
4949
}
@@ -75,3 +75,34 @@ extension UINavigationController: UINavigationBarDelegate {
7575
return false
7676
}
7777
}
78+
79+
// MARK: - Handle the swipe back gesture
80+
protocol NavigationSwipeBackHandler {
81+
82+
/// Should block the 'SwipeBack' gesture
83+
///
84+
/// - Returns: true - don't block,false - block
85+
func shouldPopOnSwipeBack() -> Bool
86+
}
87+
88+
extension UIViewController: NavigationSwipeBackHandler {
89+
//Do not block the "Swipe back" gesture by default, otherwise, override this function in the specified viewcontroller
90+
@objc func shouldPopOnSwipeBack() -> Bool {
91+
return true
92+
}
93+
}
94+
95+
extension UIViewController: UIGestureRecognizerDelegate {
96+
97+
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
98+
if gestureRecognizer.isEqual(navigationController?.interactivePopGestureRecognizer) {
99+
return shouldPopOnSwipeBack()
100+
}
101+
102+
return false
103+
}
104+
105+
func handleSwipeBackGesture() {
106+
navigationController?.interactivePopGestureRecognizer?.delegate = self
107+
}
108+
}

WooCommerce/Classes/ViewRelated/Editor/AztecEditorViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ final class AztecEditorViewController: UIViewController, Editor {
131131
content = getHTML()
132132

133133
refreshPlaceholderVisibility()
134+
handleSwipeBackGesture()
134135
}
135136

136137
override func viewWillAppear(_ animated: Bool) {
@@ -258,6 +259,10 @@ extension AztecEditorViewController {
258259
return true
259260
}
260261

262+
override func shouldPopOnSwipeBack() -> Bool {
263+
return shouldPopOnBackButton()
264+
}
265+
261266
private func presentBackNavigationActionSheet() {
262267
UIAlertController.presentDiscardChangesActionSheet(viewController: self, onDiscard: { [weak self] in
263268
self?.navigationController?.popViewController(animated: true)

WooCommerce/Classes/ViewRelated/Products/Edit Product/Edit Price/ProductPriceSettingsViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ final class ProductPriceSettingsViewController: UIViewController {
6262
configureSections()
6363
configureTableView()
6464
retrieveProductTaxClass()
65+
handleSwipeBackGesture()
6566
}
6667
}
6768

@@ -137,6 +138,10 @@ extension ProductPriceSettingsViewController {
137138
return true
138139
}
139140

141+
override func shouldPopOnSwipeBack() -> Bool {
142+
return shouldPopOnBackButton()
143+
}
144+
140145
@objc private func completeUpdating() {
141146
viewModel.completeUpdating(onCompletion: { [weak self] (regularPrice, salePrice, dateOnSaleStart, dateOnSaleEnd, taxStatus, taxClass) in
142147
self?.onCompletion(regularPrice, salePrice, dateOnSaleStart, dateOnSaleEnd, taxStatus, taxClass)

WooCommerce/Classes/ViewRelated/Products/Edit Product/Inventory Settings/ProductInventorySettingsViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ final class ProductInventorySettingsViewController: UIViewController {
7373
configureMainView()
7474
configureTableView()
7575
reloadSections()
76+
handleSwipeBackGesture()
7677
}
7778
}
7879

@@ -193,6 +194,10 @@ extension ProductInventorySettingsViewController {
193194
return true
194195
}
195196

197+
override func shouldPopOnSwipeBack() -> Bool {
198+
return shouldPopOnBackButton()
199+
}
200+
196201
@objc private func completeUpdating() {
197202
if skuIsValid {
198203
let data = ProductInventoryEditableData(sku: self.sku,

WooCommerce/Classes/ViewRelated/Products/Edit Product/Product Settings/ProductSettingsViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ final class ProductSettingsViewController: UIViewController {
3131
configureNavigationBar()
3232
configureMainView()
3333
configureTableView()
34+
handleSwipeBackGesture()
3435
viewModel.onReload = { [weak self] in
3536
self?.tableView.reloadData()
3637
}
@@ -77,6 +78,10 @@ extension ProductSettingsViewController {
7778
return true
7879
}
7980

81+
override func shouldPopOnSwipeBack() -> Bool {
82+
return shouldPopOnBackButton()
83+
}
84+
8085
@objc private func completeUpdating() {
8186
onCompletion(viewModel.productSettings)
8287
navigationController?.popViewController(animated: true)

WooCommerce/Classes/ViewRelated/Products/Edit Product/ProductFormViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ final class ProductFormViewController: UIViewController {
8787
configureTableView()
8888

8989
startListeningToNotifications()
90+
handleSwipeBackGesture()
9091

9192
productImageActionHandler.addUpdateObserver(self) { [weak self] (productImageStatuses, error) in
9293
guard let self = self else {
@@ -426,6 +427,10 @@ extension ProductFormViewController {
426427
return true
427428
}
428429

430+
override func shouldPopOnSwipeBack() -> Bool {
431+
return shouldPopOnBackButton()
432+
}
433+
429434
private func presentBackNavigationActionSheet() {
430435
UIAlertController.presentDiscardChangesActionSheet(viewController: self, onDiscard: { [weak self] in
431436
self?.navigationController?.popViewController(animated: true)

WooCommerce/Classes/ViewRelated/Products/Edit Product/Shipping Settings/ProductShippingSettingsViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ final class ProductShippingSettingsViewController: UIViewController {
6666
configureMainView()
6767
configureTableView()
6868
retrieveProductShippingClass()
69+
handleSwipeBackGesture()
6970
}
7071
}
7172

@@ -130,6 +131,10 @@ extension ProductShippingSettingsViewController {
130131
return true
131132
}
132133

134+
override func shouldPopOnSwipeBack() -> Bool {
135+
return shouldPopOnBackButton()
136+
}
137+
133138
@objc private func completeUpdating() {
134139
let dimensions = ProductDimensions(length: length ?? "",
135140
width: width ?? "",

WooCommerce/Classes/ViewRelated/Products/Media/ProductImagesViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ final class ProductImagesViewController: UIViewController {
8686
configureAddButtonBottomBorderView()
8787
configureImagesContainerView()
8888
configureProductImagesObservation()
89+
handleSwipeBackGesture()
8990
}
9091
}
9192

@@ -177,6 +178,10 @@ extension ProductImagesViewController {
177178
return true
178179
}
179180

181+
override func shouldPopOnSwipeBack() -> Bool {
182+
return shouldPopOnBackButton()
183+
}
184+
180185
private func presentDiscardChangesActionSheet() {
181186
UIAlertController.presentDiscardChangesActionSheet(viewController: self, onDiscard: { [weak self] in
182187
self?.resetProductImages()

0 commit comments

Comments
 (0)