Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into SWF-12-make-payment-ui
# Conflicts:
#	SynchronyFinancial/SynchronyFinancial WatchKit App/Base.lproj/Interface.storyboard
#	SynchronyFinancial/SynchronyFinancial.xcodeproj/project.pbxproj
  • Loading branch information
ahm11003 committed Mar 28, 2019
2 parents 273c44d + 8ad372f commit 188adc3
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 17 deletions.
5 changes: 5 additions & 0 deletions SynchronyFinancial/.swiftlint.yml
@@ -0,0 +1,5 @@
disabled_rules:
- line_length
- identifier_name
excluded:
- Pods
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="14460.31" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Qge-pO-HLc">
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="14490.70" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Qge-pO-HLc">
<device id="watch38" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="watchOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="14460.16"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="14490.21"/>
</dependencies>
<scenes>
<!--Main Menu Interface Controller-->
Expand Down Expand Up @@ -100,7 +100,7 @@
</group>
<connections>
<outlet property="accountName" destination="Tl1-Kc-YJS" id="cgD-CY-lzh"/>
<segue destination="yrN-yp-gkH" kind="push" identifier="showAccountDetails" id="geu-70-EU1"/>
<segue destination="yrN-yp-gkH" kind="modal" identifier="showAccountDetails" id="geu-70-EU1"/>
</connections>
</tableRow>
</items>
Expand Down Expand Up @@ -136,6 +136,7 @@
<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"/>
<segue destination="Jfd-Hv-PHe" kind="relationship" relationship="nextPage" id="fqW-qd-CCS"/>
</connections>
</controller>
</objects>
Expand Down Expand Up @@ -185,11 +186,41 @@
<connections>
<outlet property="amount" destination="mT0-3D-JGP" id="rff-wG-B82"/>
<outlet property="detailButton" destination="SZD-0B-PrF" id="xEw-gE-yIP"/>
<outlet property="paymentButton" destination="FgU-iZ-2XU" id="yZe-dZ-nBV"/>
</connections>
</controller>
</objects>
<point key="canvasLocation" x="1405" y="-56"/>
</scene>
<!--Transactions Interface Controller-->
<scene sceneID="yXO-yR-k6b">
<objects>
<controller id="Jfd-Hv-PHe" customClass="TransactionsInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<items>
<table alignment="left" id="OQb-xu-Ynf">
<items>
<tableRow identifier="transactionCell" id="ICl-8S-VHQ" customClass="TransactionCell" customModule="SynchronyFinancial_WatchKit_Extension">
<group key="rootItem" width="1" height="49" alignment="left" layout="vertical" id="GP6-Ec-AVa">
<items>
<label width="1" alignment="left" text="Label" textAlignment="left" id="Hm4-1L-Cyl"/>
<label width="1" alignment="left" text="Label" textAlignment="right" id="Gxn-sX-7gs"/>
</items>
</group>
<connections>
<outlet property="transactionLabel" destination="Hm4-1L-Cyl" id="hYO-F0-S1A"/>
<outlet property="valueLabel" destination="Gxn-sX-7gs" id="COh-0S-dY7"/>
</connections>
</tableRow>
</items>
</table>
</items>
<connections>
<outlet property="transactionsTable" destination="OQb-xu-Ynf" id="eg6-n7-ldT"/>
</connections>
</controller>
</objects>
<point key="canvasLocation" x="1131" y="379"/>
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="kTV-Eb-cpT"/>
Expand Down
Expand Up @@ -31,11 +31,12 @@ class AccountTableInterfaceController: WKInterfaceController {
super.didDeactivate()
}

//swiftlint:disable:next line_length
override func contextForSegue(withIdentifier segueIdentifier: String, in table: WKInterfaceTable, rowIndex: Int) -> Any? {
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")
return acctDict
return [acctDict]
}
return nil
}
Expand Down
Expand Up @@ -8,7 +8,6 @@
import WatchKit

//swiftlint:disable line_length
class ExtensionDelegate: NSObject, WKExtensionDelegate {

func applicationDidFinishLaunching() {
Expand Down
Expand Up @@ -9,24 +9,22 @@
import WatchKit
import Foundation


class PaymentDetailInterfaceController: WKInterfaceController {
var selectedAccount: Account?
var dictForAcct: [String: Account] = [:]

@IBOutlet weak var detailButton: WKInterfaceButton!
@IBOutlet weak var amount: WKInterfaceLabel!

@IBAction func paymentButton() {
}
@IBOutlet weak var paymentButton: WKInterfaceButton!

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

// Configure interface objects here.
}

override func contextForSegue(withIdentifier segueIdentifier: String) -> Any? {
if (segueIdentifier == "PayAll" || segueIdentifier == "PayMinimum"){
if segueIdentifier == "PayAll" || segueIdentifier == "PayMinimum" {
if let acct = selectedAccount {
dictForAcct.updateValue(acct, forKey: "acct")
return dictForAcct
Expand Down
@@ -0,0 +1,16 @@
//
// TransactionCell.swift
// SynchronyFinancial WatchKit Extension
//
// Created by Alan Maynard on 3/20/19.
// Copyright © 2019 Alan Maynard. All rights reserved.
//
import Foundation
import WatchKit

class TransactionCell: NSObject {

@IBOutlet weak var transactionLabel: WKInterfaceLabel!
@IBOutlet weak var valueLabel: WKInterfaceLabel!
}
@@ -0,0 +1,48 @@
//
// TransactionsInterfaceController.swift
// SynchronyFinancial WatchKit Extension
//
// Created by Alan Maynard on 3/20/19.
// Copyright © 2019 Alan Maynard. All rights reserved.
//
import WatchKit
import Foundation

class TransactionsInterfaceController: WKInterfaceController {
@IBOutlet weak var transactionsTable: WKInterfaceTable!
var transactions: [Transaction] = []

override func awake(withContext context: Any?) {
super.awake(withContext: context)
for i in 0..<5 {
transactions.append(Transaction(type: .purchase, amount: 50.00 * Double(i), merchantID: "WalMart Store 1245\(i)", date: Calendar.current.date(byAdding: .day, value: -i, to: Date()) ?? Date()))
transactions.append(Transaction(type: .reimbursement, amount: 12.5 * Double(i), merchantID: "Thank You", date: Calendar.current.date(byAdding: .day, value: -i, to: Date()) ?? Date()))
}
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()
}

private func configureRows() {
// first sort our demo data in descending date order
transactions.sort(by: { $0.date > $1.date })
transactionsTable.setNumberOfRows(transactions.count, withRowType: "transactionCell")

for index in 0..<transactionsTable.numberOfRows {
if let row = transactionsTable.rowController(at: index) as? TransactionCell {
row.transactionLabel.setText(transactions[index].merchantID)
row.valueLabel.setText(String(format: "$%.2f", transactions[index].amount))
row.valueLabel.setTextColor(transactions[index].type == .purchase ? UIColor.red : UIColor.green)
}
}
}
}
Expand Up @@ -21,6 +21,8 @@
673F397021A652A00051469E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 673F396F21A652A00051469E /* Assets.xcassets */; };
674BD1532239A39D0076AFD6 /* PayBillInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 674BD1522239A39D0076AFD6 /* PayBillInterfaceController.swift */; };
674BD1542239A39D0076AFD6 /* PayBillInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 674BD1522239A39D0076AFD6 /* PayBillInterfaceController.swift */; };
676392B422429DC800740A8C /* TransactionsInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 676392B322429DC800740A8C /* TransactionsInterfaceController.swift */; };
676392B62242A3F800740A8C /* TransactionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 676392B52242A3F800740A8C /* TransactionCell.swift */; };
678C38842230950100FEAAF6 /* AccountDetailsInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 678C38832230950100FEAAF6 /* AccountDetailsInterfaceController.swift */; };
678C3885223098C400FEAAF6 /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48F2430B2214CBF700B9C894 /* Account.swift */; };
678C388622309F7D00FEAAF6 /* AccountCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48DA0057221D12E70081A500 /* AccountCell.swift */; };
Expand Down Expand Up @@ -91,6 +93,8 @@
673F396C21A644460051469E /* MainMenuInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuInterfaceController.swift; sourceTree = "<group>"; };
673F396F21A652A00051469E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
674BD1522239A39D0076AFD6 /* PayBillInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayBillInterfaceController.swift; sourceTree = "<group>"; };
676392B322429DC800740A8C /* TransactionsInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionsInterfaceController.swift; sourceTree = "<group>"; };
676392B52242A3F800740A8C /* TransactionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionCell.swift; sourceTree = "<group>"; };
678C38832230950100FEAAF6 /* AccountDetailsInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountDetailsInterfaceController.swift; sourceTree = "<group>"; };
67BAC265219E254700713FEF /* SynchronyFinancial.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SynchronyFinancial.app; sourceTree = BUILT_PRODUCTS_DIR; };
67BAC268219E254700713FEF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -191,12 +195,14 @@
children = (
674BD1522239A39D0076AFD6 /* PayBillInterfaceController.swift */,
481864A7224802BB0059CF7A /* PaymentDetailInterfaceController.swift */,
676392B322429DC800740A8C /* TransactionsInterfaceController.swift */,
673F396C21A644460051469E /* MainMenuInterfaceController.swift */,
67BAC28D219E254900713FEF /* ExtensionDelegate.swift */,
48F243062214C98600B9C894 /* AccountTableInterfaceController.swift */,
678C38832230950100FEAAF6 /* AccountDetailsInterfaceController.swift */,
67BAC291219E254900713FEF /* Assets.xcassets */,
48DA0057221D12E70081A500 /* AccountCell.swift */,
676392B52242A3F800740A8C /* TransactionCell.swift */,
67BAC293219E254900713FEF /* Info.plist */,
);
path = "SynchronyFinancial WatchKit Extension";
Expand Down Expand Up @@ -468,7 +474,9 @@
678C38842230950100FEAAF6 /* AccountDetailsInterfaceController.swift in Sources */,
673F396E21A644570051469E /* MainMenuInterfaceController.swift in Sources */,
48F243072214C98600B9C894 /* AccountTableInterfaceController.swift in Sources */,
676392B62242A3F800740A8C /* TransactionCell.swift in Sources */,
48F2430F2214CC2200B9C894 /* Transaction.swift in Sources */,
676392B422429DC800740A8C /* TransactionsInterfaceController.swift in Sources */,
48DA0058221D12E70081A500 /* AccountCell.swift in Sources */,
481864A9224802BB0059CF7A /* PaymentDetailInterfaceController.swift in Sources */,
);
Expand Down
1 change: 0 additions & 1 deletion SynchronyFinancial/SynchronyFinancial/AppDelegate.swift
Expand Up @@ -8,7 +8,6 @@
import UIKit

//swiftlint:disable line_length
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

Expand Down

0 comments on commit 188adc3

Please sign in to comment.