Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SWF-21 Replace alerts with new activity indicator
- replaced “placeholder” calls using alerts to use our new activity indicator look-alike
  • Loading branch information
ahm11003 committed Mar 28, 2019
1 parent 56caa7c commit 2c01f37
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="14490.64" 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="watch42" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="watchOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.47"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="14490.20"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="14490.21"/>
</dependencies>
<scenes>
<!--root-->
<scene sceneID="grn-eT-Mhz">
<objects>
<controller identifier="root" fullScreen="YES" id="Qge-pO-HLc" customClass="MainMenuInterfaceController" customModule="SynchronyFinancial_WatchKit_App" customModuleProvider="target">
<controller identifier="root" hidesWhenLoading="NO" fullScreen="YES" id="Qge-pO-HLc" customClass="MainMenuInterfaceController" customModule="SynchronyFinancial_WatchKit_App" customModuleProvider="target">
<items>
<button alignment="center" id="8yj-m6-1L9">
<group key="contentGroup" width="1" height="0.5" alignment="left" contentMode="scaleAspectFit" layout="vertical" id="SBG-wc-YDJ">
Expand All @@ -36,9 +36,11 @@
<segue destination="FsK-xr-8Fi" kind="push" identifier="toWellness" id="IWu-2V-Dh4"/>
</connections>
</button>
<imageView alignment="left" hidden="YES" animationDuration="1" id="c6R-RW-IpR"/>
</items>
<connections>
<outlet property="accountsButton" destination="8yj-m6-1L9" id="N4i-Zw-wUL"/>
<outlet property="activityIndicator" destination="c6R-RW-IpR" id="JKZ-46-2hN"/>
<outlet property="wellnessButton" destination="Vth-km-gVm" id="jaB-M2-lvs"/>
</connections>
</controller>
Expand Down Expand Up @@ -89,6 +91,7 @@
<objects>
<controller hidesWhenLoading="NO" id="Rpu-25-8st" customClass="AccountTableInterfaceController" customModule="SynchronyFinancial_WatchKit_Extension">
<items>
<imageView alignment="left" hidden="YES" id="juz-bW-tJj"/>
<label width="1" alignment="center" text="Accounts" textAlignment="center" id="JYm-yy-xrH"/>
<table alignment="left" id="To8-Ze-tMX">
<items>
Expand All @@ -107,6 +110,8 @@
</items>
<connections>
<outlet property="accountTable" destination="To8-Ze-tMX" id="oJb-Ry-7xR"/>
<outlet property="activityIndicator" destination="juz-bW-tJj" id="Coh-Qr-sk7"/>
<outlet property="titleLabel" destination="JYm-yy-xrH" id="V1g-ul-i8Y"/>
</connections>
</controller>
</objects>
Expand Down
Expand Up @@ -14,6 +14,8 @@ class AccountTableInterfaceController: WKInterfaceController {
var acctDict: [String: Account] = [:]
var transactionDict: [String: [Transaction]] = [:]

@IBOutlet var titleLabel: WKInterfaceLabel!
@IBOutlet var activityIndicator: WKInterfaceImage!
@IBOutlet weak var accountTable: WKInterfaceTable!
override func awake(withContext context: Any?) {
super.awake(withContext: context)
Expand Down Expand Up @@ -47,15 +49,17 @@ class AccountTableInterfaceController: WKInterfaceController {
}

override func table(_ table: WKInterfaceTable, didSelectRowAt rowIndex: Int) {
presentAlert(withTitle: "Loading...", message: "Loading Account Details and Recent Transactions", preferredStyle: .alert, actions: [WKAlertAction(title: "cancel", style: .cancel, handler: {
self.dismiss()
})])
accountTable.setHidden(true)
titleLabel.setHidden(true)
activityIndicator.configureForActivityIndicator()
acctDict.updateValue(accounts[rowIndex], forKey: "acct")
FetchData.fetchTransactionsFor(accountAlias: accounts[rowIndex].accountAlias) { transactions, error in
guard error == nil else { return }
self.transactionDict.updateValue(transactions, forKey: "transactions")
self.dismiss()
self.presentController(withNames: ["AccountDetails", "Transactions"], contexts: [self.acctDict, self.transactionDict])
self.accountTable.setHidden(false)
self.titleLabel.setHidden(false)
self.activityIndicator.stopAnimatingAsIndicator()
}
}

Expand Down
Expand Up @@ -15,15 +15,16 @@ class MainMenuInterfaceController: WKInterfaceController {
@IBOutlet weak var accountsButton: WKInterfaceButton!
@IBOutlet weak var wellnessButton: WKInterfaceButton!

@IBOutlet var activityIndicator: WKInterfaceImage!
var acctDict: [String: [Account]] = [:]

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

guard let initial = context as? [String: [Account]], let accts = initial["accts"] else {
presentAlert(withTitle: "Loading Accounts", message: nil, preferredStyle: .alert, actions: [WKAlertAction(title: "Cancel", style: .cancel, handler: {
self.dismiss()
})])
accountsButton.setHidden(true)
wellnessButton.setHidden(true)
activityIndicator.configureForActivityIndicator()
NSLog("Error getting context from WKExtensionDelegate")
return
}
Expand Down

0 comments on commit 2c01f37

Please sign in to comment.