Skip to content

Swf 21 hook up to web apis #11

Merged
merged 23 commits into from Apr 3, 2019
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
79afbdf
SWF-21 [cocoapods] install Alamofire
ahm11003 Mar 12, 2019
ff0b413
Merge branch 'master' into SWF-21-hook-up-to-web-apis
ahm11003 Mar 12, 2019
f2a8883
SWF-21 [cocoapods] install SwiftyJSON
ahm11003 Mar 13, 2019
e85d2cb
SWF-21 initial web service setup
ahm11003 Mar 14, 2019
da5294a
Updated Accounts Model and created request to Multi-Account-Summary-D…
rrk12005 Mar 14, 2019
a2599ec
Quick Fix for bug where request not parsing payload JSON
rrk12005 Mar 14, 2019
ba4409d
SWF-21 improve login logic & more
ahm11003 Mar 21, 2019
8405351
Merge branch 'master' into SWF-21-hook-up-to-web-apis
ahm11003 Mar 28, 2019
c80231e
SWF-21 pass fetched accounts to AccountTVIC
ahm11003 Mar 28, 2019
c4cc995
SWF-21 Modified header for transactions fetch
ahm11003 Mar 28, 2019
21d742c
SWF-21 preliminary fetch function for transactions
ahm11003 Mar 28, 2019
8487ce3
SWF-21 Initial transaction implementation
ahm11003 Mar 28, 2019
24deb73
SWF-21 Initial setup for “loading” during account tap
ahm11003 Mar 28, 2019
a3682e4
SWF-21 basic paradigm for passing account data to root interface cont…
ahm11003 Mar 28, 2019
56caa7c
SWF-21 Extensions on WKInterfaceImage
ahm11003 Mar 28, 2019
2c01f37
SWF-21 Replace alerts with new activity indicator
ahm11003 Mar 28, 2019
82d2319
SWF-21 Remove unused code
ahm11003 Mar 28, 2019
28a7fc1
Merge branch 'master' into SWF-21-hook-up-to-web-apis
ahm11003 Mar 29, 2019
3ee46a5
SWF-21 move fetch transactions call
ahm11003 Mar 29, 2019
6bedc02
SWF-21 UI fixes
ahm11003 Mar 29, 2019
00d3583
SWF-21 Care credit image assets, loading label
ahm11003 Mar 29, 2019
d5f19aa
Added requests and handlers for fetching pending transactions, fetchi…
rrk12005 Apr 2, 2019
86153df
fixed constructor implementation for transaction and added newline af…
rrk12005 Apr 3, 2019
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

SWF-21 move fetch transactions call

- we now fetch transactions when the Recents button is tapped from AccountDetails
- created convenience method to show/hide all interface objects when showing activity indicator
  • Loading branch information
ahm11003 committed Mar 29, 2019
commit 3ee46a5b10e38b4e7452d0033d43bb4d18b0b304
@@ -91,7 +91,6 @@
<objects>
<controller hidesWhenLoading="NO" id="Rpu-25-8st" customClass="AccountTableInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<items>
<imageView alignment="left" hidden="YES" id="juz-bW-tJj"/>
<label width="1" alignment="center" text="Accounts" textAlignment="center" id="JYm-yy-xrH"/>
<table alignment="left" id="To8-Ze-tMX">
<items>
@@ -110,7 +109,6 @@
</items>
<connections>
<outlet property="accountTable" destination="To8-Ze-tMX" id="oJb-Ry-7xR"/>
<outlet property="activityIndicator" destination="juz-bW-tJj" id="Coh-Qr-sk7"/>
<outlet property="titleLabel" destination="JYm-yy-xrH" id="V1g-ul-i8Y"/>
</connections>
</controller>
@@ -122,6 +120,7 @@
<objects>
<controller identifier="AccountDetails" id="yrN-yp-gkH" customClass="AccountDetailsInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<items>
<imageView alignment="left" hidden="YES" id="diX-Fh-Why"/>
<label width="1" alignment="left" text="Label" textAlignment="center" id="qzl-GE-bpZ">
<fontDescription key="font" style="UICTFontTextStyleHeadline"/>
</label>
@@ -139,17 +138,19 @@
</button>
<button width="64" alignment="right" title="Recent" id="0HI-HK-yDl">
<connections>
<segue destination="Jfd-Hv-PHe" kind="push" identifier="showTransactions" id="bjb-v1-scE"/>
<action selector="recentButtonTapped" destination="yrN-yp-gkH" id="8Rp-SG-lGZ"/>
</connections>
</button>
</items>
</group>
</items>
<connections>
<outlet property="accountNameLabel" destination="qzl-GE-bpZ" id="6jA-KZ-quX"/>
<outlet property="activityIndicator" destination="diX-Fh-Why" id="Syr-8v-cTP"/>
<outlet property="availableFundsLabel" destination="q0b-tb-dAb" id="rcl-Tl-bDh"/>
<outlet property="balanceLabel" destination="mdb-QX-GuO" id="2Dj-nO-AM8"/>
<outlet property="nextPaymentDueLabel" destination="CPc-qk-Z2y" id="AzY-pn-EMY"/>
<outlet property="nextPaymentTitleLabel" destination="rxs-Zb-naU" id="IDH-8E-WWm"/>
<outlet property="payButton" destination="zeF-ky-mkm" id="v5U-Y5-shh"/>
<outlet property="transactionsButton" destination="0HI-HK-yDl" id="L5Z-M9-wgO"/>
</connections>
@@ -12,12 +12,15 @@ import Foundation
class AccountDetailsInterfaceController: WKInterfaceController {
var selectedAccount: Account?
var dictForAcct: [String: Account] = [:]
var transactionDict: [String: [Transaction]] = [:]

@IBOutlet var activityIndicator: WKInterfaceImage!
@IBOutlet weak var transactionsButton: WKInterfaceButton!
@IBOutlet weak var payButton: WKInterfaceButton!
@IBOutlet weak var balanceLabel: WKInterfaceLabel!
@IBOutlet weak var availableFundsLabel: WKInterfaceLabel!
@IBOutlet weak var accountNameLabel: WKInterfaceLabel!
@IBOutlet var nextPaymentTitleLabel: WKInterfaceLabel!
@IBOutlet weak var nextPaymentDueLabel: WKInterfaceLabel!

@IBAction func payBillTapped() {
@@ -27,6 +30,24 @@ class AccountDetailsInterfaceController: WKInterfaceController {
pushController(withName: "PayMinimum", context: dictForAcct)
}

@IBAction func recentButtonTapped() {
configureInterfaceObjects(false)
activityIndicator.configureForActivityIndicator()
if let alias = selectedAccount?.accountAlias {
FetchData.fetchTransactionsFor(accountAlias: alias) { transactions, error in
guard error == nil else {
NSLog("Error retrieving transactions for account.")
return
}

self.transactionDict.updateValue(transactions, forKey: "transactions")
self.pushController(withName: "Transactions", context: self.transactionDict)
self.configureInterfaceObjects(false)
self.activityIndicator.stopAnimatingAsIndicator()
}
}
}

override func awake(withContext context: Any?) {
super.awake(withContext: context)
payButton.setWidth(self.contentFrame.width / 2)
@@ -76,4 +97,14 @@ class AccountDetailsInterfaceController: WKInterfaceController {
availableFundsLabel.setText("Available: $\(availableFormatted)")
nextPaymentDueLabel.setText(date)
}

private func configureInterfaceObjects(_ hide: Bool) {
transactionsButton.setHidden(hide)
payButton.setHidden(hide)
balanceLabel.setHidden(hide)
availableFundsLabel.setHidden(hide)
accountNameLabel.setHidden(hide)
nextPaymentDueLabel.setHidden(hide)
nextPaymentTitleLabel.setHidden(hide)
}
}
@@ -15,8 +15,8 @@ class AccountTableInterfaceController: WKInterfaceController {
var transactionDict: [String: [Transaction]] = [:]

@IBOutlet var titleLabel: WKInterfaceLabel!
@IBOutlet var activityIndicator: WKInterfaceImage!
@IBOutlet weak var accountTable: WKInterfaceTable!

override func awake(withContext context: Any?) {
super.awake(withContext: context)

@@ -37,30 +37,9 @@ class AccountTableInterfaceController: WKInterfaceController {
super.didDeactivate()
}

override func contextsForSegue(withIdentifier segueIdentifier: String, in table: WKInterfaceTable, rowIndex: Int) -> [Any]? {
if segueIdentifier == "showAccountDetails" {
// account data is passed to the first interface controller in our new navigation stack
// if we want to pass to subsequent interface controllers, we would add them in corresponding order
// acctDict.updateValue(accounts[rowIndex], forKey: "acct")
// acctDict.updateValue(transactions, forKey: "transactions")
return [acctDict]
}
return nil
}

override func table(_ table: WKInterfaceTable, didSelectRowAt rowIndex: Int) {
accountTable.setHidden(true)
titleLabel.setHidden(true)
activityIndicator.configureForActivityIndicator()
acctDict.updateValue(accounts[rowIndex], forKey: "acct")
FetchData.fetchTransactionsFor(accountAlias: accounts[rowIndex].accountAlias) { transactions, error in
guard error == nil else { return }
self.transactionDict.updateValue(transactions, forKey: "transactions")
self.presentController(withNames: ["AccountDetails", "Transactions"], contexts: [self.acctDict, self.transactionDict])
self.accountTable.setHidden(false)
self.titleLabel.setHidden(false)
self.activityIndicator.stopAnimatingAsIndicator()
}
pushController(withName: "AccountDetails", context: acctDict)
}

private func configureRows() {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.