Skip to content

Commit 88dfca3

Browse files
committed
Merge branch 'develop' of github.com:woocommerce/woocommerce-ios into issue/19-green-dot
* 'develop' of github.com:woocommerce/woocommerce-ios: Quick fix for notifications navbar button Tweaked NoteTableViewCell.xib for dynamic type OrderLoaderViewController: Updating reloadOrder Hook Revert "Revert to this commit to test OrderLoader Failure State" Revert to this commit to test OrderLoader Failure State Implementing OrderLoaderViewController NotificationsViewController: Wiring OrderLoaderVIewController OrderDetailsViewController: Adding comment Updating Project Orders.storyboard: Updating ViewController Identifier MetaContainer: New Key UIStoryboard: Woo Methods Use 'cocoapods-repo-update' CocoaPods plugin
2 parents 57f8e04 + 4151ac5 commit 88dfca3

File tree

12 files changed

+320
-23
lines changed

12 files changed

+320
-23
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
source 'https://rubygems.org' do
22
gem 'rake'
33
gem 'cocoapods', '~> 1.5.2'
4+
gem 'cocoapods-repo-update', '0.0.2'
45
gem 'xcpretty-travis-formatter'
56
gem 'danger'
67
gem 'danger-swiftlint'

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ GEM
5050
cocoapods-downloader (1.2.0)
5151
cocoapods-plugins (1.0.0)
5252
nap
53+
cocoapods-repo-update (0.0.2)
54+
cocoapods (~> 1.0, >= 1.3.0)
5355
cocoapods-search (1.0.0)
5456
cocoapods-stats (1.0.0)
5557
cocoapods-trunk (1.3.0)
@@ -236,6 +238,7 @@ PLATFORMS
236238

237239
DEPENDENCIES
238240
cocoapods (~> 1.5.2)!
241+
cocoapods-repo-update (= 0.0.2)!
239242
danger!
240243
danger-swiftlint!
241244
dotenv!

Networking/Networking/Model/MetaContainer.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ extension MetaContainer {
4949
public enum Keys: String {
5050
case comment
5151
case home
52+
case order
5253
case post
5354
case reply = "reply_comment"
5455
case site

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use_frameworks!
44
platform :ios, '11.0'
55
workspace 'WooCommerce.xcworkspace'
66

7-
7+
plugin 'cocoapods-repo-update'
88

99
# Main Target!
1010
# ============

Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,6 @@ SPEC CHECKSUMS:
154154
XLPagerTabStrip: 22d4c58200d7c105e0e407ab6bfd01a5d85014be
155155
ZendeskSDK: 44ee00338dd718495f0364369420ae11b389c878
156156

157-
PODFILE CHECKSUM: 6c1aafce7d9026c5a6ff7b5a454cf412b5b7bb11
157+
PODFILE CHECKSUM: 11e311a5637345ed4d3db5098c28bb9535261761
158158

159159
COCOAPODS: 1.5.3
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Foundation
2+
import UIKit
3+
4+
5+
// MARK: - UIStoryboard Woo Methods
6+
//
7+
extension UIStoryboard {
8+
9+
/// Returns a (new) instance of the Orders Storyboard.
10+
///
11+
static var orders: UIStoryboard {
12+
return UIStoryboard(name: "Orders", bundle: .main)
13+
}
14+
}

WooCommerce/Classes/ViewRelated/Notifications/Cells/NoteTableViewCell.xib

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,28 @@
1818
<rect key="frame" x="0.0" y="0.0" width="375" height="87.5"/>
1919
<autoresizingMask key="autoresizingMask"/>
2020
<subviews>
21-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="-" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MDO-G5-bNl">
22-
<rect key="frame" x="14" y="11" width="25" height="20.5"/>
21+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="-" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MDO-G5-bNl">
22+
<rect key="frame" x="14" y="11" width="25" height="25"/>
2323
<constraints>
24-
<constraint firstAttribute="width" constant="25" id="Eqv-DJ-O5N"/>
24+
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="25" id="Eqv-DJ-O5N"/>
25+
<constraint firstAttribute="width" secondItem="MDO-G5-bNl" secondAttribute="height" multiplier="1:1" id="GCe-Ud-F7E"/>
2526
</constraints>
26-
<fontDescription key="fontDescription" type="system" pointSize="17"/>
27+
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
2728
<nil key="textColor"/>
2829
<nil key="highlightedColor"/>
2930
</label>
3031
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="3" translatesAutoresizingMaskIntoConstraints="NO" id="fNu-km-jyX">
31-
<rect key="frame" x="55" y="11" width="304" height="42"/>
32+
<rect key="frame" x="55" y="11" width="304" height="39.5"/>
3233
<subviews>
33-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Subject" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ow4-CR-HAI" userLabel="Subject Label">
34-
<rect key="frame" x="0.0" y="0.0" width="304" height="19.5"/>
35-
<fontDescription key="fontDescription" type="system" pointSize="16"/>
34+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Subject" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ow4-CR-HAI" userLabel="Subject Label">
35+
<rect key="frame" x="0.0" y="0.0" width="304" height="20.5"/>
36+
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
3637
<nil key="textColor"/>
3738
<nil key="highlightedColor"/>
3839
</label>
39-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="752" text="Snippet" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JQs-0C-rb6" userLabel="Snippet Label">
40-
<rect key="frame" x="0.0" y="22.5" width="304" height="19.5"/>
41-
<fontDescription key="fontDescription" type="system" pointSize="16"/>
40+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="752" text="Snippet" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JQs-0C-rb6" userLabel="Snippet Label">
41+
<rect key="frame" x="0.0" y="23.5" width="304" height="16"/>
42+
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
4243
<nil key="textColor"/>
4344
<nil key="highlightedColor"/>
4445
</label>

WooCommerce/Classes/ViewRelated/Notifications/NotificationsViewController.swift

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ private extension NotificationsViewController {
123123
/// Setup: NavigationBar Buttons
124124
///
125125
func configureNavigationBarButtons() {
126-
let rightBarButton = UIBarButtonItem(image: Gridicon.iconOfType(.menus),
126+
let leftBarButton = UIBarButtonItem(image: Gridicon.iconOfType(.checkmark),
127127
style: .plain,
128128
target: self,
129129
action: #selector(markAllAsRead))
130-
rightBarButton.tintColor = .white
131-
rightBarButton.accessibilityTraits = .button
132-
rightBarButton.accessibilityLabel = NSLocalizedString("Mark All as Read", comment: "Accessibility label for the Mark All Notifications as Read Button")
133-
rightBarButton.accessibilityHint = NSLocalizedString("Marks Every Notification as Read", comment: "VoiceOver accessibility hint for the Mark All Notifications as Read Action")
134-
navigationItem.rightBarButtonItem = rightBarButton
130+
leftBarButton.tintColor = .white
131+
leftBarButton.accessibilityTraits = .button
132+
leftBarButton.accessibilityLabel = NSLocalizedString("Mark All as Read", comment: "Accessibility label for the Mark All Notifications as Read Button")
133+
leftBarButton.accessibilityHint = NSLocalizedString("Marks Every Notification as Read", comment: "VoiceOver accessibility hint for the Mark All Notifications as Read Action")
134+
navigationItem.leftBarButtonItem = leftBarButton
135135
}
136136

137137
/// Setup: TableView
@@ -262,8 +262,37 @@ extension NotificationsViewController: UITableViewDelegate {
262262
tableView.deselectRow(at: indexPath, animated: true)
263263

264264
let note = resultsController.object(at: indexPath)
265-
let detailsViewController = NotificationDetailsViewController(note: note)
266265

266+
switch note.kind {
267+
case .storeOrder:
268+
presentOrderDetails(for: note)
269+
default:
270+
presentNotificationDetails(for: note)
271+
}
272+
}
273+
}
274+
275+
276+
// MARK: - Details Rendering
277+
//
278+
private extension NotificationsViewController {
279+
280+
/// Pushes the Order Details associated to a given Note (if possible).
281+
///
282+
func presentOrderDetails(for note: Note) {
283+
guard let orderID = note.meta.identifier(forKey: .order), let siteID = note.meta.identifier(forKey: .site) else {
284+
DDLogError("## Notification with [\(note.noteId)] lacks its OrderID!")
285+
return
286+
}
287+
288+
let loaderViewController = OrderLoaderViewController(orderID: orderID, siteID: siteID)
289+
navigationController?.pushViewController(loaderViewController, animated: true)
290+
}
291+
292+
/// Pushes the Notification Details associated to a given Note.
293+
///
294+
func presentNotificationDetails(for note: Note) {
295+
let detailsViewController = NotificationDetailsViewController(note: note)
267296
navigationController?.pushViewController(detailsViewController, animated: true)
268297
}
269298
}

WooCommerce/Classes/ViewRelated/Orders/OrderDetails/OrderDetailsViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import Yosemite
66
import CocoaLumberjack
77

88

9+
// MARK: - OrderDetailsViewController: Displays the details for a given Order.
10+
//
911
class OrderDetailsViewController: UIViewController {
1012

1113
/// Main TableView.

0 commit comments

Comments
 (0)