@@ -2,6 +2,7 @@ import UIKit
22import WebKit
33import SafariServices
44import Crashlytics
5+ import NVActivityIndicatorView
56
67class BRBViewController : UIViewController , BRBConnectionDelegate , BRBLoginViewDelegate , BRBAccountSettingsDelegate , UITableViewDelegate , UITableViewDataSource {
78
@@ -11,8 +12,7 @@ class BRBViewController: UIViewController, BRBConnectionDelegate, BRBLoginViewDe
1112 var timer : Timer !
1213
1314 var tableView : UITableView !
14- let activityIndicatorView = UIActivityIndicatorView ( )
15- let activityIndicatorDescriptionLabel = UILabel ( )
15+ var activityIndicatorView : NVActivityIndicatorView !
1616 let timeout = 30.0 // seconds
1717 var time = 0.0 // time of request
1818 var historyHeader : EateriesCollectionViewHeaderView ?
@@ -35,12 +35,6 @@ class BRBViewController: UIViewController, BRBConnectionDelegate, BRBLoginViewDe
3535 }
3636
3737 connectionHandler. delegate = self
38-
39- activityIndicatorView. color = . black
40- activityIndicatorView. hidesWhenStopped = true
41- activityIndicatorDescriptionLabel. text = " Logging in, this may take a minute "
42- activityIndicatorDescriptionLabel. textAlignment = . center
43- activityIndicatorDescriptionLabel. font = UIFont . systemFont ( ofSize: 12 )
4438
4539 navigationItem. rightBarButtonItem? . isEnabled = false
4640
@@ -117,13 +111,8 @@ class BRBViewController: UIViewController, BRBConnectionDelegate, BRBLoginViewDe
117111 }
118112
119113 func setupAccountPage( ) {
120-
121114 diningHistory = connectionHandler. diningHistory
122115
123- if diningHistory. count == 0 {
124- activityIndicatorView. startAnimating ( )
125- }
126-
127116 navigationItem. rightBarButtonItem? . isEnabled = true
128117
129118 tableView = UITableView ( frame: . zero, style: . grouped)
@@ -139,6 +128,10 @@ class BRBViewController: UIViewController, BRBConnectionDelegate, BRBLoginViewDe
139128 tableView. snp. makeConstraints { make in
140129 make. top. edges. equalToSuperview ( )
141130 }
131+
132+ activityIndicatorView = NVActivityIndicatorView ( frame: CGRect ( x: 16.0 , y: 8.0 , width: 36.0 , height: 36.0 ) , type: . circleStrokeSpin, color: . gray)
133+ activityIndicatorView. startAnimating ( )
134+ tableView. tableFooterView = activityIndicatorView
142135 }
143136
144137 /// MARK: Table view delegate/data source
@@ -240,6 +233,9 @@ class BRBViewController: UIViewController, BRBConnectionDelegate, BRBLoginViewDe
240233
241234 let indexPaths = ( 0 ..< entries. count) . map { IndexPath ( row: $0, section: 1 ) }
242235 self . tableView. insertRows ( at: indexPaths, with: . automatic)
236+
237+ tableView. tableFooterView = nil
238+ activityIndicatorView. removeFromSuperview ( )
243239 }
244240
245241 func showSafariVC( ) {
@@ -264,9 +260,6 @@ class BRBViewController: UIViewController, BRBConnectionDelegate, BRBLoginViewDe
264260 keychainItemWrapper [ " netid " ] = loginView? . netidTextField. text! as AnyObject ?
265261 keychainItemWrapper [ " password " ] = loginView? . passwordTextField. text! as AnyObject ?
266262 }
267-
268- activityIndicatorView. stopAnimating ( )
269- activityIndicatorDescriptionLabel. removeFromSuperview ( )
270263
271264 if loginView != nil {
272265 loginView? . superview? . removeFromSuperview ( )
0 commit comments