-
Notifications
You must be signed in to change notification settings - Fork 0
Swf 10 account details #8
Merged
+416
−17
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
721afe8
set up the account table
tiw15001 8999883
new storyboard with some problems.
tiw15001 77f7f65
Merge branch 'master' into SWF-10-account-details
ahm11003 d52628c
SWF-10 remove unused classes
ahm11003 1c70242
SWF-10 Change some file targets
ahm11003 4f91010
SWF-10 Remove unused outlets and interface controllers
ahm11003 3a44e11
SWF-10 Resolve swiftlint warnings, configure table for accounts
ahm11003 472f648
SWF-10 Account Details set up
ahm11003 424e7eb
SWF-10 Fix typo and set up format strings for labels
ahm11003 d0b53dc
Merge branch 'SWF-10-account-details' into SWF-11-recent-transactions
ahm11003 1b6bc34
SWF-11 Create new classes to support transaction display
ahm11003 7e8a9ce
SWF-11 Storyboard changes
ahm11003 bb5623c
SWF-11 Change context for segue
ahm11003 c1383b3
Merge pull request #9 from rrk12005/SWF-11-recent-transactions
rrk12005 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
SynchronyFinancial/SynchronyFinancial WatchKit Extension/AccountCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// Account.swift | ||
// SynchronyFinancial WatchKit Extension | ||
// | ||
// Created by Monday on 2019/02/13. | ||
// Copyright © 2019 Alan Maynard. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import WatchKit | ||
|
||
class AccountCell: NSObject { | ||
@IBOutlet weak var accountName: WKInterfaceLabel! | ||
} |
57 changes: 57 additions & 0 deletions
57
...nyFinancial/SynchronyFinancial WatchKit Extension/AccountDetailsInterfaceController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// AccountDetailsInterfaceController.swift | ||
// SynchronyFinancial WatchKit Extension | ||
// | ||
// Created by Alan Maynard on 3/6/19. | ||
// Copyright © 2019 Alan Maynard. All rights reserved. | ||
// | ||
|
||
import WatchKit | ||
import Foundation | ||
|
||
class AccountDetailsInterfaceController: WKInterfaceController { | ||
var selectedAccount: Account? | ||
|
||
@IBOutlet weak var balanceLabel: WKInterfaceLabel! | ||
@IBOutlet weak var availableFundsLabel: WKInterfaceLabel! | ||
@IBOutlet weak var accountNameLabel: WKInterfaceLabel! | ||
@IBOutlet weak var nextPaymentDueLabel: WKInterfaceLabel! | ||
|
||
override func awake(withContext context: Any?) { | ||
super.awake(withContext: context) | ||
|
||
guard let data = context as? [String: Account] else { | ||
NSLog("Error receiving context containing selected account in AccountDetailInterfaceController") | ||
return | ||
} | ||
|
||
selectedAccount = data["acct"] | ||
configureForAccount() | ||
} | ||
|
||
override func willActivate() { | ||
// This method is called when watch view controller is about to be visible to user | ||
super.willActivate() | ||
} | ||
|
||
override func didDeactivate() { | ||
// This method is called when watch view controller is no longer visible | ||
super.didDeactivate() | ||
} | ||
|
||
private func configureForAccount() { | ||
guard selectedAccount != nil, let acct = selectedAccount else { | ||
NSLog("Error configuring AccountDetails. selectedAccount is nil") | ||
return | ||
} | ||
|
||
let balanceFormatted = String(format: "%.2f", acct.balance) | ||
let availableFormatted = String(format: "%.2f", acct.limit - acct.balance) | ||
let date = DateFormatter.localizedString(from: acct.paymentDueDate, dateStyle: .medium, timeStyle: .none) | ||
|
||
accountNameLabel.setText(acct.accountNumber) | ||
balanceLabel.setText("Balance: $\(balanceFormatted)") | ||
availableFundsLabel.setText("Available: $\(availableFormatted)") | ||
nextPaymentDueLabel.setText(date) | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...ronyFinancial/SynchronyFinancial WatchKit Extension/AccountTableInterfaceController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// AccountTableInterfaceController.swift | ||
// SynchronyFinancial WatchKit Extension | ||
// | ||
// Created by Monday on 2019/02/13. | ||
// Copyright © 2019 Alan Maynard. All rights reserved. | ||
// | ||
|
||
import WatchKit | ||
import Foundation | ||
|
||
class AccountTableInterfaceController: WKInterfaceController { | ||
var accounts: [Account] = [] | ||
var acctDict: [String: Account] = [:] | ||
|
||
@IBOutlet weak var accountTable: WKInterfaceTable! | ||
override func awake(withContext context: Any?) { | ||
super.awake(withContext: context) | ||
|
||
populateDemoData() | ||
configureRows() | ||
} | ||
|
||
override func willActivate() { | ||
// This method is called when watch view controller is about to be visible to user | ||
super.willActivate() | ||
} | ||
|
||
override func didDeactivate() { | ||
// This method is called when watch view controller is no longer visible | ||
super.didDeactivate() | ||
} | ||
|
||
//swiftlint:disable:next line_length | ||
override func contextForSegue(withIdentifier segueIdentifier: String, in table: WKInterfaceTable, rowIndex: Int) -> Any? { | ||
if segueIdentifier == "showAccountDetails" { | ||
acctDict.updateValue(accounts[rowIndex], forKey: "acct") | ||
return acctDict | ||
} | ||
return nil | ||
} | ||
|
||
private func configureRows() { | ||
accountTable.setNumberOfRows(accounts.count, withRowType: "account") | ||
|
||
for index in 0..<accountTable.numberOfRows { | ||
if let row = accountTable.rowController(at: index) as? AccountCell { | ||
row.accountName.setText(accounts[index].accountNumber) | ||
} | ||
} | ||
} | ||
|
||
private func populateDemoData() { | ||
//swiftlint:disable line_length | ||
accounts.append(Account(accountNumber: "TD Bank", limit: 500.00, transactions: [], paymentDueDate: Date(), cycleEndDate: Date())) | ||
accounts.append(Account(accountNumber: "Care Credit", limit: 10000.00, transactions: [], paymentDueDate: Date(), cycleEndDate: Date())) | ||
accounts.append(Account(accountNumber: "People's Bank", limit: 500.00, transactions: [], paymentDueDate: Date(), cycleEndDate: Date())) | ||
accounts.append(Account(accountNumber: "Bank of America", limit: 10000.00, transactions: [], paymentDueDate: Date(), cycleEndDate: Date())) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These accounts were created for illustrative purposes, and once we get actual accounts from synchrony's mock environment these can be safely removed