Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SWE-13 [swiftlint] resolve swiftlint warnings
  • Loading branch information
ahm11003 committed Apr 9, 2019
1 parent 3594b68 commit 0c9a242
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
Expand Up @@ -25,11 +25,10 @@ class PaymentDetailInterfaceController: WKInterfaceController {
@IBOutlet weak var paymentButton: WKInterfaceButton! @IBOutlet weak var paymentButton: WKInterfaceButton!
@IBOutlet weak var payFrom: WKInterfaceLabel! @IBOutlet weak var payFrom: WKInterfaceLabel!
@IBOutlet weak var separate: WKInterfaceSeparator! @IBOutlet weak var separate: WKInterfaceSeparator!



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

guard let data = context as? [String: Any], let acct = data["acct"] as? Account, let amount = data["payment_amount"] as? Double else { guard let data = context as? [String: Any], let acct = data["acct"] as? Account, let amount = data["payment_amount"] as? Double else {
NSLog("Error getting account object and payment amount") NSLog("Error getting account object and payment amount")
return return
Expand All @@ -52,17 +51,18 @@ class PaymentDetailInterfaceController: WKInterfaceController {
let type: PaymentType = self.paymentAmount == self.selectedAccount?.curBalance ? .currentBal : .minimumDue let type: PaymentType = self.paymentAmount == self.selectedAccount?.curBalance ? .currentBal : .minimumDue


// process this payment using default bank account (9999) until ability to change account is implemented // process this payment using default bank account (9999) until ability to change account is implemented
guard let bankacct = UserDefaults.standard.dictionary(forKey: "default_bank_acct") as? [String: String], let bankID = bankacct["bankAcctId"] else{ guard let bankacct = UserDefaults.standard.dictionary(forKey: "default_bank_acct") as? [String: String],
NSLog("Error retrieving Payment Option") let bankID = bankacct["bankAcctId"] else {
return NSLog("Error retrieving Payment Option")
return
} }
FetchData.submitPayment(for: alias, type: type, amount: self.paymentAmount, bankID: bankID) { confirmationNum, paymentID, error in FetchData.submitPayment(for: alias, type: type, amount: self.paymentAmount, bankID: bankID) { confirmationNum, paymentID, error in
guard error == nil else { guard error == nil else {
let dismiss = WKAlertAction(title: "Dismiss", style: .cancel, handler: {}) let dismiss = WKAlertAction(title: "Dismiss", style: .cancel, handler: {})
self.presentAlert(withTitle: "Error", message: "We were unable to process your payment at this time. Please try again later.", preferredStyle: .alert, actions: [dismiss]) self.presentAlert(withTitle: "Error", message: "We were unable to process your payment at this time. Please try again later.", preferredStyle: .alert, actions: [dismiss])
return return
} }

self.dictForPayment.updateValue(confirmationNum, forKey: "payment_confirmation_number") self.dictForPayment.updateValue(confirmationNum, forKey: "payment_confirmation_number")
self.dictForPayment.updateValue(paymentID, forKey: "payment_id") self.dictForPayment.updateValue(paymentID, forKey: "payment_id")
self.activityIndicator.stopAnimatingAsIndicator() self.activityIndicator.stopAnimatingAsIndicator()
Expand All @@ -81,7 +81,7 @@ class PaymentDetailInterfaceController: WKInterfaceController {
} }
} }
} }

@IBAction func bankAccountsTapped() { @IBAction func bankAccountsTapped() {
configureInterfaceObjects(true) configureInterfaceObjects(true)
activityIndicator.configureForActivityIndicator() activityIndicator.configureForActivityIndicator()
Expand All @@ -96,7 +96,6 @@ class PaymentDetailInterfaceController: WKInterfaceController {
self.activityIndicator.stopAnimatingAsIndicator() self.activityIndicator.stopAnimatingAsIndicator()
self.pushController(withName: "PaymentOptions", context: self.dictForBankAcct) self.pushController(withName: "PaymentOptions", context: self.dictForBankAcct)
} }

} }


override func willActivate() { override func willActivate() {
Expand All @@ -111,7 +110,7 @@ class PaymentDetailInterfaceController: WKInterfaceController {
// This method is called when watch view controller is no longer visible // This method is called when watch view controller is no longer visible
super.didDeactivate() super.didDeactivate()
} }

private func configureInterfaceObjects(_ hide: Bool) { private func configureInterfaceObjects(_ hide: Bool) {
detailButton.setHidden(hide) detailButton.setHidden(hide)
amount.setHidden(hide) amount.setHidden(hide)
Expand Down
Expand Up @@ -23,17 +23,17 @@ class PaymentOptionsInterfaceController: WKInterfaceController {
bankAccts = accts bankAccts = accts
configureRows() configureRows()
} }

override func willActivate() { override func willActivate() {
// This method is called when watch view controller is about to be visible to user // This method is called when watch view controller is about to be visible to user
super.willActivate() super.willActivate()
} }

override func didDeactivate() { override func didDeactivate() {
// This method is called when watch view controller is no longer visible // This method is called when watch view controller is no longer visible
super.didDeactivate() super.didDeactivate()
} }

private func configureRows() { private func configureRows() {
bankAcctTable.setNumberOfRows(bankAccts.count, withRowType: "bankAcctCell") bankAcctTable.setNumberOfRows(bankAccts.count, withRowType: "bankAcctCell")
for index in 0..<bankAcctTable.numberOfRows { for index in 0..<bankAcctTable.numberOfRows {
Expand All @@ -43,7 +43,7 @@ class PaymentOptionsInterfaceController: WKInterfaceController {
} }
} }
} }

override func table(_ table: WKInterfaceTable, didSelectRowAt rowIndex: Int) { override func table(_ table: WKInterfaceTable, didSelectRowAt rowIndex: Int) {
let acct = bankAccts[rowIndex] let acct = bankAccts[rowIndex]
dictForDefault.updateValue(acct.acctType.rawValue, forKey: "acctType") dictForDefault.updateValue(acct.acctType.rawValue, forKey: "acctType")
Expand Down
Expand Up @@ -41,7 +41,7 @@ class TransactionsInterfaceController: WKInterfaceController {
"merchant": transaction.merchantID, "merchant": transaction.merchantID,
"date": transaction.date, "date": transaction.date,
"amount": transaction.amount] "amount": transaction.amount]

presentController(withName: "TransactionDetails", context: context) presentController(withName: "TransactionDetails", context: context)
} }


Expand Down
1 change: 0 additions & 1 deletion SynchronyFinancial/SynchronyFinancial/BankAcct.swift
Expand Up @@ -25,4 +25,3 @@ class BankAcct: NSObject {
self.last4Acct = last4Acct self.last4Acct = last4Acct
} }
} }

Expand Up @@ -12,7 +12,7 @@ extension UserDefaults {
func setDefaultBankAccount(_ acct: BankAcct) { func setDefaultBankAccount(_ acct: BankAcct) {
UserDefaults.standard.set(acct, forKey: "default_bank_acct") UserDefaults.standard.set(acct, forKey: "default_bank_acct")
} }

func getDefaultBankAccount() -> BankAcct? { func getDefaultBankAccount() -> BankAcct? {
if let bank = UserDefaults.standard.value(forKey: "default_bank_acct") as? BankAcct { if let bank = UserDefaults.standard.value(forKey: "default_bank_acct") as? BankAcct {
return bank return bank
Expand Down

0 comments on commit 0c9a242

Please sign in to comment.