Skip to content

Commit f0772cc

Browse files
committed
Merge branch 'develop' into issue/250-tracking-ui
2 parents e41f6f6 + 55fcc70 commit f0772cc

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

.hound.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
swift:
1+
swiftlint:
22
config_file: .swiftlint.yml
33
ruby:
44
enabled: false

WooCommerce/Classes/Authentication/Epilogue/StorePickerViewController.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,27 @@ extension StorePickerViewController {
353353
WooAnalytics.shared.track(.sitePickerContinueTapped,
354354
withProperties: ["selected_store_id": StoresManager.shared.sessionManager.defaultStoreID ?? String()])
355355

356+
presentStoreSwitchedNotice()
357+
356358
dismiss(animated: true) {
357359
AppDelegate.shared.authenticatorWasDismissed()
358360
MainTabBarController.switchToMyStoreTab(animated: true)
359361
}
360362
}
361363
}
364+
365+
private func presentStoreSwitchedNotice() {
366+
guard let newStoreName = StoresManager.shared.sessionManager.defaultSite?.name else {
367+
return
368+
}
369+
370+
let message = NSLocalizedString("Switched to \(newStoreName). You will only receive notifications from this store.",
371+
comment: "Message presented after users switch to a new store. "
372+
+ "Reads like: Switched to {store name}. You will only receive notifications from this store.")
373+
let notice = Notice(title: message, feedbackType: .success)
374+
375+
AppDelegate.shared.noticePresenter.enqueue(notice: notice)
376+
}
362377
}
363378

364379

WooCommerce/Classes/ViewRelated/Orders/NewNoteViewController.swift

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class NewNoteViewController: UIViewController {
3737

3838
override func viewDidAppear(_ animated: Bool) {
3939
super.viewDidAppear(animated)
40-
tableView.firstSubview(ofType: UITextView.self)?.becomeFirstResponder()
40+
showKeyboard()
4141
}
4242

4343
override func viewWillDisappear(_ animated: Bool) {
@@ -50,7 +50,7 @@ class NewNoteViewController: UIViewController {
5050
}
5151

5252
@objc func addButtonTapped() {
53-
switchRightButtonToProgressIndicator()
53+
configureForCommittingNote()
5454

5555
WooAnalytics.shared.track(.orderNoteAddButtonTapped)
5656
WooAnalytics.shared.track(.orderNoteAdd, withProperties: ["parent_id": viewModel.order.orderID,
@@ -63,7 +63,7 @@ class NewNoteViewController: UIViewController {
6363
WooAnalytics.shared.track(.orderNoteAddFailed, withError: error)
6464

6565
self?.displayErrorNotice()
66-
self?.switchRightButtonToAddButton()
66+
self?.configureForEditingNote()
6767
return
6868
}
6969
WooAnalytics.shared.track(.orderNoteAddSuccess)
@@ -257,7 +257,8 @@ private extension NewNoteViewController {
257257
navigationItem.rightBarButtonItem?.isEnabled = false
258258
}
259259

260-
func switchRightButtonToProgressIndicator() {
260+
func configureForCommittingNote() {
261+
hideKeyboard()
261262
configureRightButtonItemAsSpinner()
262263
navigationItem.rightBarButtonItem?.isEnabled = false
263264
}
@@ -272,10 +273,18 @@ private extension NewNoteViewController {
272273
navigationItem.setRightBarButton(rightBarButton, animated: true)
273274
}
274275

275-
func switchRightButtonToAddButton() {
276+
func configureForEditingNote() {
276277
configureRightButtonItemAsAdd()
277278
navigationItem.rightBarButtonItem?.isEnabled = true
278279
}
280+
281+
func showKeyboard() {
282+
tableView.firstSubview(ofType: UITextView.self)?.becomeFirstResponder()
283+
}
284+
285+
func hideKeyboard() {
286+
tableView.firstSubview(ofType: UITextView.self)?.resignFirstResponder()
287+
}
279288
}
280289

281290
// MARK: - Constants

0 commit comments

Comments
 (0)