Skip to content

Swf 17 credit health #17

Merged
merged 26 commits into from May 1, 2019
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
38a78cf
radial progress indicators and page-based nav
ahm11003 Feb 13, 2019
5d7cb80
Added Balance, Utilization, and AccountNumber Controllers. Added PLis…
Mar 6, 2019
10e6442
PList Functions
ahm11003 Mar 6, 2019
c212e13
Merge pull request #5 from rrk12005/demo-radial-style-progress-indica…
jod13004 Mar 6, 2019
83e5766
Added Utilization score calculation
Mar 28, 2019
3be3eef
Renamed files to more accurately represent them. Changed wellness rad…
Mar 29, 2019
5a821f7
no message
Mar 29, 2019
a2f3c9d
Merge branch 'master' into SWF-17-credit-health
ahm11003 Apr 9, 2019
9303329
- Functions for utilization and account (temporary) metrics.
Apr 11, 2019
3599c77
SWF-17 remove storyboard segue
ahm11003 Apr 11, 2019
2c07f8e
SWF-17 pass our metrics to page hierarchy
ahm11003 Apr 11, 2019
416c2ea
SWF-17 credit utilization improvements
ahm11003 Apr 17, 2019
3e7ddcd
SWE-17 remove unused classes and files
ahm11003 Apr 17, 2019
8e8dec7
SWF-17 fix logical error leading to bad utilization score
ahm11003 Apr 17, 2019
a5c4ac1
SWF-17 remove unused class
ahm11003 Apr 17, 2019
85fd3e2
SWF-17 new class to display trends in credit utilization
ahm11003 Apr 17, 2019
4f67b56
SWF-17 new image assets, implementation for utilization trend
ahm11003 Apr 17, 2019
23fb930
SWF-17 Added basic details for utilization trends
ahm11003 Apr 17, 2019
80acdbf
Merge branch 'master' into SWF-17-credit-health
ahm11003 Apr 17, 2019
ddbc228
SWF-17 More wellness implementation
ahm11003 Apr 23, 2019
4a55d89
SWF-17 more wellness configuration
ahm11003 Apr 23, 2019
d170909
SWF-17 remove unused code
ahm11003 Apr 23, 2019
433ebac
SWF-17 More wellness implementation and improvements
ahm11003 Apr 23, 2019
17dd1df
SWF-17 metric calculations
ahm11003 Apr 23, 2019
a949599
SWF-17 clean up how we receive data for utilization
ahm11003 Apr 23, 2019
f84701b
SWF-17 new image assets, wellness calculation
ahm11003 Apr 24, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+105 −14
Diff settings

Always

Just for now

SWF-17 new image assets, implementation for utilization trend

- currently we generate a random number between 0 and the credit limit of an account in order to “simulate” trend compared to previous statement utilization
- added some nice images to further display the trends
  • Loading branch information...
ahm11003 committed Apr 17, 2019
commit 4f67b56ea082d9bc489856ade79fd1a69c20e6fe
@@ -56,7 +56,9 @@
<objects>
<controller id="FsK-xr-8Fi" customClass="WellnessInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<items>
<label width="1" alignment="center" text="Credit Wellness" textAlignment="center" id="eqA-XH-rlH"/>
<label width="1" alignment="center" text="Credit Wellness" textAlignment="center" id="eqA-XH-rlH">
<fontDescription key="font" type="boldSystem" pointSize="16"/>
</label>
<imageView width="1" height="86" alignment="center" verticalAlignment="center" image="scores" contentMode="scaleAspectFit" initiallyAnimated="NO" animationDuration="2" id="aTf-mo-FEr"/>
<button width="1" alignment="center" verticalAlignment="bottom" title="Breakdown" id="yYk-gv-I5B">
<fontDescription key="font" type="system" pointSize="13"/>
@@ -72,16 +74,25 @@
</objects>
<point key="canvasLocation" x="23" y="602"/>
</scene>
<!--AccountScore-->
<!--UtilizationTrend-->
<scene sceneID="jxS-9m-lB7">
<objects>
<controller identifier="AccountScore" id="Mki-ad-UCC" customClass="UtilizationTrendInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<controller identifier="UtilizationTrend" id="Mki-ad-UCC" customClass="UtilizationTrendInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<items>
<label width="1" alignment="left" text="Utilization Trends" textAlignment="center" id="0ed-0W-LKq"/>
<imageView width="1" height="120" alignment="center" verticalAlignment="center" image="scores" contentMode="scaleAspectFit" initiallyAnimated="NO" id="RlX-Hj-mTY"/>
<label width="1" alignment="left" text="Utilization Trends" textAlignment="center" id="0ed-0W-LKq">
<fontDescription key="font" type="boldSystem" pointSize="15"/>
</label>
<group width="1" alignment="left" verticalAlignment="center" id="FNM-AZ-gSn">
<items>
<label width="0.59999999999999998" widthAdjustment="2" height="75" alignment="right" alpha="0.0" text="Down from 75% last statement" textAlignment="center" numberOfLines="4" minimumScaleFactor="0.59999999999999998" id="YAS-g2-ZSX"/>
<imageView width="0.40000000000000002" height="69" alignment="left" verticalAlignment="center" alpha="0.0" image="arrow_down" contentMode="scaleAspectFit" initiallyAnimated="NO" id="RlX-Hj-mTY"/>
</items>
</group>
<button width="1" alignment="left" verticalAlignment="bottom" title="Details" id="dAi-xm-mph"/>
</items>
<connections>
<outlet property="image2" destination="RlX-Hj-mTY" id="9Ni-gP-7T5"/>
<outlet property="trendImage" destination="RlX-Hj-mTY" id="pc0-UO-40U"/>
<outlet property="trendLabel" destination="YAS-g2-ZSX" id="o4S-5g-JUe"/>
<segue destination="RNe-Ul-1jm" kind="relationship" relationship="nextPage" id="idj-33-lnN"/>
</connections>
</controller>
@@ -321,7 +332,9 @@
<items>
<group width="1" height="1" alignment="left" layout="vertical" id="ad4-JN-O9D">
<items>
<label width="1" alignment="left" text="Credit Utilization" textAlignment="center" id="Rzj-RR-iat"/>
<label width="1" alignment="left" text="Credit Utilization" textAlignment="center" id="Rzj-RR-iat">
<fontDescription key="font" type="boldSystem" pointSize="16"/>
</label>
<imageView width="1" height="100" alignment="center" verticalAlignment="center" image="scores" contentMode="scaleAspectFit" initiallyAnimated="NO" id="MkL-48-J8l"/>
<button width="1" alignment="left" verticalAlignment="center" title="Details" id="AR5-QD-8ad">
<connections>
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "arrow_down.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "arrow_down@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "arrow_down@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "arrow_up.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "arrow_up@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "arrow_up@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -9,23 +9,48 @@
import WatchKit
import Foundation


class UtilizationTrendInterfaceController: WKInterfaceController {
@IBOutlet var trendImage: WKInterfaceImage!
@IBOutlet var trendLabel: WKInterfaceLabel!

var previousUtilization: Int?
var currentUtilization: Int?

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

// Configure interface objects here.
guard let data = context as? [Int], data.count == 2 else {
NSLog("Error getting utilization data from wellness.")
return
}
previousUtilization = data[1]
currentUtilization = data[0]
configure()
}

override func willActivate() {
override func didAppear() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
super.didAppear()
animate(withDuration: 1.5) {
self.trendImage.setAlpha(1.0)
self.trendLabel.setAlpha(1.0)
}
}

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

private func configure() {
if let prev = previousUtilization, let curr = currentUtilization {
if prev > curr {
trendImage.setImageNamed("arrow_down")
trendLabel.setText("Down from \(prev)% last statement.")
} else {
trendImage.setImageNamed("arrow_up")
trendLabel.setText("Up from \(prev)% last statement.")
}
}
}

}
@@ -9,14 +9,14 @@
import WatchKit
import Foundation


class WellnessInterfaceController: WKInterfaceController {
var accounts: [Account] = []
var transactions: [Transaction] = []
var transactionDict: [String: [Transaction]] = [:]
var wellnessScore: Int?
var utilizationScore: Int = 0
var paymentScore: Int = 0
var previousUtil: Int = 0

@IBOutlet weak var image: WKInterfaceImage!

@@ -56,13 +56,16 @@ class WellnessInterfaceController: WKInterfaceController {
private func calculateUtilization() {
var totalBalance: Double = 0
var totalCredit: Double = 0
var previous: Double = 0

accounts.forEach {
totalCredit += $0.creditLimit
totalBalance += $0.curBalance
previous += Double(arc4random_uniform(UInt32($0.creditLimit)))
}

utilizationScore = Int((totalBalance / totalCredit) * 100)
previousUtil = Int((previous / totalCredit) * 100)
}

private func calculateWellness() {
@@ -89,6 +92,8 @@ class WellnessInterfaceController: WKInterfaceController {
}*/

@IBAction func moreButtonTapped() {
presentController(withNames: ["UtilizationScore", "PaymentScore"], contexts: [utilizationScore, paymentScore])
let pages = ["UtilizationScore", "UtilizationTrend", "PaymentScore"]
let contexts: [Any] = [utilizationScore, [utilizationScore, previousUtil], paymentScore]
presentController(withNames: pages, contexts: contexts)
}
}
@@ -26,6 +26,7 @@
676392B422429DC800740A8C /* TransactionsInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 676392B322429DC800740A8C /* TransactionsInterfaceController.swift */; };
676392B62242A3F800740A8C /* TransactionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 676392B52242A3F800740A8C /* TransactionCell.swift */; };
678535932267D706000DF272 /* UtilizationTrendInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 678535922267D706000DF272 /* UtilizationTrendInterfaceController.swift */; };
678535942267D9BC000DF272 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 67BAC291219E254900713FEF /* Assets.xcassets */; };
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 */; };
@@ -359,6 +360,7 @@
buildActionMask = 2147483647;
files = (
48F2430A2214CBA200B9C894 /* Interface.storyboard in Resources */,
678535942267D9BC000DF272 /* Assets.xcassets in Resources */,
673F397021A652A00051469E /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.