Skip to content

Commit

Permalink
Renamed files to more accurately represent them. Changed wellness rad…
Browse files Browse the repository at this point in the history
…ial indicator to match the others. Added metric for late payments and number of accounts.
  • Loading branch information
Jonathan Duarte committed Mar 29, 2019
1 parent 83e5766 commit 3be3eef
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
</connections>
</controller>
</objects>
<point key="canvasLocation" x="105" y="102"/>
<point key="canvasLocation" x="-2047" y="131"/>
</scene>
<!--Wellness Interface Controller-->
<scene sceneID="7P2-y3-sP1">
<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"/>
<imageView width="1" height="86" alignment="center" verticalAlignment="center" image="progress" contentMode="scaleAspectFit" initiallyAnimated="NO" animationDuration="2" id="aTf-mo-FEr"/>
<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="Tap For More" id="yYk-gv-I5B">
<fontDescription key="font" type="system" pointSize="13"/>
<connections>
Expand All @@ -64,14 +64,14 @@
</connections>
</controller>
</objects>
<point key="canvasLocation" x="414" y="250"/>
<point key="canvasLocation" x="-1657" y="250"/>
</scene>
<!--Balance Interface Controller-->
<!--Account Num Interface Controller-->
<scene sceneID="jxS-9m-lB7">
<objects>
<controller id="Mki-ad-UCC" customClass="BalanceInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<controller id="Mki-ad-UCC" customClass="AccountNumInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<items>
<label width="1" alignment="left" text="Balance Score" textAlignment="center" id="0ed-0W-LKq"/>
<label width="1" alignment="left" text="Account Score" 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"/>
</items>
<connections>
Expand All @@ -80,7 +80,7 @@
</connections>
</controller>
</objects>
<point key="canvasLocation" x="706" y="250"/>
<point key="canvasLocation" x="-1365" y="250"/>
</scene>
<!--Utilization Interface Controller-->
<scene sceneID="nMW-YM-Pwh">
Expand All @@ -96,22 +96,22 @@
</connections>
</controller>
</objects>
<point key="canvasLocation" x="962" y="249.5"/>
<point key="canvasLocation" x="-1067" y="250"/>
</scene>
<!--Account Number Interface Controller-->
<!--Consistency Interface Controller-->
<scene sceneID="do4-GS-cad">
<objects>
<controller id="k4M-kn-ZzM" customClass="AccountNumberInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<controller id="k4M-kn-ZzM" customClass="ConsistencyInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<items>
<label width="1" alignment="left" text="Account Score" textAlignment="center" id="5cf-d7-ssN"/>
<label width="1" height="20" alignment="left" text="Payment Score" textAlignment="center" id="5cf-d7-ssN"/>
<imageView width="1" height="120" alignment="center" verticalAlignment="center" image="scores" contentMode="scaleAspectFit" initiallyAnimated="NO" id="XsN-KK-JY4"/>
</items>
<connections>
<outlet property="image4" destination="XsN-KK-JY4" id="fqD-Hx-YuD"/>
</connections>
</controller>
</objects>
<point key="canvasLocation" x="1247" y="250"/>
<point key="canvasLocation" x="-766" y="250"/>
</scene>
<!--Accounts Interface Controller-->
<scene sceneID="5Qe-Th-pL8">
Expand All @@ -122,7 +122,7 @@
</items>
</controller>
</objects>
<point key="canvasLocation" x="414" y="-56"/>
<point key="canvasLocation" x="-1657" y="-74"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// BalanceInterfaceController.swift
// SynchronyFinancial WatchKit Extension
//
// Created by Jonathan Duarte on 2/18/19.
// Copyright © 2019 Alan Maynard. All rights reserved.
//

import WatchKit
import Foundation


class AccountNumInterfaceController: WKInterfaceController {
var accNum: Int = 3
var didAnimate: Bool = false
var score: Int?


@IBOutlet weak var image2: WKInterfaceImage!
override func awake(withContext context: Any?) {
super.awake(withContext: context)

//Assigns score based on # of accounts
switch accNum {
case 2...3:
score = 50
case 3...4:
score = 75
case 5...10:
score = 100
default:
score = 25
}
}

override func didAppear() {
if !didAnimate {
image2.setImageNamed("scores")
image2.startAnimatingWithImages(in: NSRange(location: 1, length: score ?? 0), duration: 1.5, repeatCount: 1)
didAnimate = true
}
//image2.stopAnimating()
}

override func willDisappear() {
}

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()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,35 @@ import WatchKit
import Foundation


class AccountNumberInterfaceController: WKInterfaceController {
class ConsistencyInterfaceController: WKInterfaceController {
var didAnimate: Bool = false
var latePayments: Int = 3
var score: Int?

@IBOutlet weak var image4: WKInterfaceImage!
override func awake(withContext context: Any?) {
super.awake(withContext: context)

//get plist data to generate Account number metric
var plistValues = PlistUtil.readPlist(for: .account)
let accountNum = plistValues.count
print(accountNum)
//Assigns a score based on # of late payments
switch latePayments {
case 1:
score = 80
case 2:
score = 55
case 3:
score = 25
default:
score = 100
}
}

override func didAppear() {
// Called when watch interface is visible to user
image4.setImageNamed("scores")
image4.startAnimatingWithImages(in: NSRange(location: 0, length: 101), duration: 1.5, repeatCount: 1)
if !didAnimate {
image4.setImageNamed("scores")
image4.startAnimatingWithImages(in: NSRange(location: 1, length: score ?? 0), duration: 1.5, repeatCount: 1)
didAnimate = true
}
}

override func willActivate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
class UtilizationInterfaceController: WKInterfaceController {
var didAnimate: Bool = false
var util: Double = 0
var score: Int = 0
var score: Int?

@IBOutlet weak var image3: WKInterfaceImage!
override func awake(withContext context: Any?) {
Expand All @@ -22,8 +22,8 @@ class UtilizationInterfaceController: WKInterfaceController {
var plistValues = PlistUtil.readPlist(for: .balance)
let balance = plistValues[0][0]
let credit = plistValues[0][1] > 0 ? plistValues[0][1] : 1

util = round((Double(balance)/Double(credit)) * 100)

switch util {
case 0...10:
score = 100
Expand All @@ -43,7 +43,7 @@ class UtilizationInterfaceController: WKInterfaceController {
override func didAppear() {
if !didAnimate {
image3.setImageNamed("scores")
image3.startAnimatingWithImages(in: NSRange(location: 1, length: score ), duration: 1.5, repeatCount: 1)
image3.startAnimatingWithImages(in: NSRange(location: 1, length: score ?? 0), duration: 1.5, repeatCount: 1)
didAnimate = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class WellnessInterfaceController: WKInterfaceController {
override func awake(withContext context: Any?) {
super.awake(withContext: context)

image.setImageNamed("progress")
image.startAnimatingWithImages(in: NSRange(location: 0, length: 65), duration: 1.5, repeatCount: 1)
image.setImageNamed("scores")
image.startAnimatingWithImages(in: NSRange(location: 1, length: 65), duration: 1.5, repeatCount: 1)
}

override func willActivate() {
Expand Down
20 changes: 8 additions & 12 deletions SynchronyFinancial/SynchronyFinancial.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
67BAC287219E254900713FEF /* SynchronyFinancial WatchKit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 67BAC286219E254900713FEF /* SynchronyFinancial WatchKit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
67BAC28E219E254900713FEF /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67BAC28D219E254900713FEF /* ExtensionDelegate.swift */; };
67BAC292219E254900713FEF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 67BAC291219E254900713FEF /* Assets.xcassets */; };
67C8DD8121ED2A040063A01B /* AccountsInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67C8DD7F21ED29FF0063A01B /* AccountsInterfaceController.swift */; };
67C8DD8321ED323B0063A01B /* CircleIndicator.sks in Resources */ = {isa = PBXBuildFile; fileRef = 67C8DD8221ED323B0063A01B /* CircleIndicator.sks */; };
67C8DD8521ED3B5A0063A01B /* WellnessInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67C8DD8421ED3B5A0063A01B /* WellnessInterfaceController.swift */; };
9BCE39732227138E00B7A992 /* BalanceInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BCE39722227138E00B7A992 /* BalanceInterfaceController.swift */; };
9BCE39732227138E00B7A992 /* AccountNumInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BCE39722227138E00B7A992 /* AccountNumInterfaceController.swift */; };
9BCE39752227712500B7A992 /* BalanceInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9BCE39742227712500B7A992 /* BalanceInfo.plist */; };
9BCE39772227731800B7A992 /* UtilizationfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BCE39762227731800B7A992 /* UtilizationfaceController.swift */; };
9BCE39792227839B00B7A992 /* AccountNumberInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BCE39782227839B00B7A992 /* AccountNumberInterfaceController.swift */; };
9BCE39792227839B00B7A992 /* ConsistencyInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BCE39782227839B00B7A992 /* ConsistencyInterfaceController.swift */; };
9BCE397D222F5A2800B7A992 /* PlistUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BCE397C222F5A2800B7A992 /* PlistUtil.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -95,13 +94,12 @@
67BAC28D219E254900713FEF /* ExtensionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = "<group>"; };
67BAC291219E254900713FEF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
67BAC293219E254900713FEF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
67C8DD7F21ED29FF0063A01B /* AccountsInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AccountsInterfaceController.swift; path = "SynchronyFinancial WatchKit Extension/AccountsInterfaceController.swift"; sourceTree = SOURCE_ROOT; };
67C8DD8221ED323B0063A01B /* CircleIndicator.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = CircleIndicator.sks; sourceTree = "<group>"; };
67C8DD8421ED3B5A0063A01B /* WellnessInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WellnessInterfaceController.swift; sourceTree = "<group>"; };
9BCE39722227138E00B7A992 /* BalanceInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BalanceInterfaceController.swift; sourceTree = "<group>"; };
9BCE39722227138E00B7A992 /* AccountNumInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountNumInterfaceController.swift; sourceTree = "<group>"; };
9BCE39742227712500B7A992 /* BalanceInfo.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = BalanceInfo.plist; sourceTree = "<group>"; };
9BCE39762227731800B7A992 /* UtilizationfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilizationfaceController.swift; sourceTree = "<group>"; };
9BCE39782227839B00B7A992 /* AccountNumberInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountNumberInterfaceController.swift; sourceTree = "<group>"; };
9BCE39782227839B00B7A992 /* ConsistencyInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsistencyInterfaceController.swift; sourceTree = "<group>"; };
9BCE397C222F5A2800B7A992 /* PlistUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlistUtil.swift; sourceTree = "<group>"; };
9F53D0FFFE126D2BE8D08B80 /* Pods-SynchronyFinancial WatchKit App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SynchronyFinancial WatchKit App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SynchronyFinancial WatchKit App/Pods-SynchronyFinancial WatchKit App.debug.xcconfig"; sourceTree = "<group>"; };
B4F433747E1B9A2ED14BA462 /* Pods-SynchronyFinancial.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SynchronyFinancial.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SynchronyFinancial/Pods-SynchronyFinancial.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -182,10 +180,9 @@
isa = PBXGroup;
children = (
67C8DD8421ED3B5A0063A01B /* WellnessInterfaceController.swift */,
9BCE39722227138E00B7A992 /* BalanceInterfaceController.swift */,
9BCE39722227138E00B7A992 /* AccountNumInterfaceController.swift */,
9BCE39762227731800B7A992 /* UtilizationfaceController.swift */,
9BCE39782227839B00B7A992 /* AccountNumberInterfaceController.swift */,
67C8DD7F21ED29FF0063A01B /* AccountsInterfaceController.swift */,
9BCE39782227839B00B7A992 /* ConsistencyInterfaceController.swift */,
67C8DD8221ED323B0063A01B /* CircleIndicator.sks */,
673F396C21A644460051469E /* MainMenuInterfaceController.swift */,
67BAC28D219E254900713FEF /* ExtensionDelegate.swift */,
Expand Down Expand Up @@ -428,12 +425,11 @@
buildActionMask = 2147483647;
files = (
9BCE39772227731800B7A992 /* UtilizationfaceController.swift in Sources */,
67C8DD8121ED2A040063A01B /* AccountsInterfaceController.swift in Sources */,
67BAC28E219E254900713FEF /* ExtensionDelegate.swift in Sources */,
9BCE39792227839B00B7A992 /* AccountNumberInterfaceController.swift in Sources */,
9BCE39792227839B00B7A992 /* ConsistencyInterfaceController.swift in Sources */,
67C8DD8521ED3B5A0063A01B /* WellnessInterfaceController.swift in Sources */,
673F396E21A644570051469E /* MainMenuInterfaceController.swift in Sources */,
9BCE39732227138E00B7A992 /* BalanceInterfaceController.swift in Sources */,
9BCE39732227138E00B7A992 /* AccountNumInterfaceController.swift in Sources */,
6717460E21F8FCDB00696468 /* Transaction.swift in Sources */,
9BCE397D222F5A2800B7A992 /* PlistUtil.swift in Sources */,
6717460D21F8FCD800696468 /* Account.swift in Sources */,
Expand Down

0 comments on commit 3be3eef

Please sign in to comment.