Skip to content

Commit d106f2e

Browse files
minh-upnAdrian Chojnacki
authored andcommitted
BOS-958
+ activity indicators while configuration is loading + move reload configuration button to beacons tab + Info tab content & styling (see the android version screen)
1 parent 8bad3b3 commit d106f2e

File tree

4 files changed

+92
-23
lines changed

4 files changed

+92
-23
lines changed

BCSampleSwift/Base.lproj/Main.storyboard

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="15G1212" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="lUk-kd-LTs">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="lUk-kd-LTs">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
@@ -13,7 +13,7 @@
1313
<!--Events-->
1414
<scene sceneID="OXE-Rd-87A">
1515
<objects>
16-
<viewController id="vhe-4S-kmT" customClass="BCActionsViewController" customModule="BCBeaconMonitor" customModuleProvider="target" sceneMemberID="viewController">
16+
<viewController id="vhe-4S-kmT" customClass="BCActionsViewController" customModule="BeaconScan" customModuleProvider="target" sceneMemberID="viewController">
1717
<layoutGuides>
1818
<viewControllerLayoutGuide type="top" id="wCf-HY-6c2"/>
1919
<viewControllerLayoutGuide type="bottom" id="ajx-qD-R4o"/>
@@ -22,11 +22,14 @@
2222
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
2323
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2424
<subviews>
25+
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="qZi-R6-fHn">
26+
<rect key="frame" x="177" y="299" width="20" height="20"/>
27+
</activityIndicatorView>
2528
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsSelection="NO" rowHeight="81" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Zq5-zm-h2U">
2629
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
2730
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
2831
<prototypes>
29-
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="EventCellIdentifier" rowHeight="81" id="gm2-4y-v7h" customClass="BCEventCell" customModule="BCBeaconMonitor" customModuleProvider="target">
32+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="EventCellIdentifier" rowHeight="81" id="gm2-4y-v7h" customClass="BCEventCell" customModule="BeaconScan" customModuleProvider="target">
3033
<rect key="frame" x="0.0" y="28" width="375" height="81"/>
3134
<autoresizingMask key="autoresizingMask"/>
3235
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="gm2-4y-v7h" id="Goh-I5-rhM">
@@ -40,7 +43,7 @@
4043
<nil key="highlightedColor"/>
4144
</label>
4245
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="date" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FIU-gp-bFR">
43-
<rect key="frame" x="18" y="46" width="339" height="21"/>
46+
<rect key="frame" x="18" y="45" width="339" height="21"/>
4447
<fontDescription key="fontDescription" type="system" pointSize="17"/>
4548
<nil key="textColor"/>
4649
<nil key="highlightedColor"/>
@@ -71,12 +74,15 @@
7174
<constraints>
7275
<constraint firstAttribute="trailing" secondItem="Zq5-zm-h2U" secondAttribute="trailing" id="BCR-c2-7zA"/>
7376
<constraint firstItem="ajx-qD-R4o" firstAttribute="top" secondItem="Zq5-zm-h2U" secondAttribute="bottom" id="CPc-te-vCx"/>
77+
<constraint firstItem="qZi-R6-fHn" firstAttribute="centerY" secondItem="nIy-PG-p4U" secondAttribute="centerY" id="Cq4-B0-cnX"/>
7478
<constraint firstItem="Zq5-zm-h2U" firstAttribute="leading" secondItem="nIy-PG-p4U" secondAttribute="leading" id="f0A-gP-DdW"/>
79+
<constraint firstItem="qZi-R6-fHn" firstAttribute="centerX" secondItem="nIy-PG-p4U" secondAttribute="centerX" id="iWd-dm-Yca"/>
7580
<constraint firstItem="Zq5-zm-h2U" firstAttribute="top" secondItem="nIy-PG-p4U" secondAttribute="top" id="idf-aR-v9Y"/>
7681
</constraints>
7782
</view>
7883
<tabBarItem key="tabBarItem" title="Events" id="ec1-Ok-jvk"/>
7984
<connections>
85+
<outlet property="activityIndicator" destination="qZi-R6-fHn" id="Mia-F7-6S7"/>
8086
<outlet property="tableView" destination="Zq5-zm-h2U" id="TLl-1o-Wx5"/>
8187
</connections>
8288
</viewController>
@@ -87,7 +93,7 @@
8793
<!--Beacon Control-->
8894
<scene sceneID="xL5-tn-7CW">
8995
<objects>
90-
<viewController id="Bz1-BZ-l27" customClass="BCBeaconsViewController" customModule="BCBeaconMonitor" customModuleProvider="target" sceneMemberID="viewController">
96+
<viewController id="Bz1-BZ-l27" customClass="BCBeaconsViewController" customModule="BeaconScan" customModuleProvider="target" sceneMemberID="viewController">
9197
<layoutGuides>
9298
<viewControllerLayoutGuide type="top" id="YbY-LH-Z4J"/>
9399
<viewControllerLayoutGuide type="bottom" id="cmg-c0-pQy"/>
@@ -96,11 +102,14 @@
96102
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
97103
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
98104
<subviews>
105+
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="TQF-Wb-0Xp">
106+
<rect key="frame" x="178" y="299" width="20" height="20"/>
107+
</activityIndicatorView>
99108
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsSelection="NO" rowHeight="77" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="qeP-fg-PNa">
100-
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
109+
<rect key="frame" x="0.0" y="64" width="375" height="494"/>
101110
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
102111
<prototypes>
103-
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="BeaconCellIdentifier" rowHeight="77" id="ohm-6f-kCt" customClass="BCBeaconCell" customModule="BCBeaconMonitor" customModuleProvider="target">
112+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="BeaconCellIdentifier" rowHeight="77" id="ohm-6f-kCt" customClass="BCBeaconCell" customModule="BeaconScan" customModuleProvider="target">
104113
<rect key="frame" x="0.0" y="28" width="375" height="77"/>
105114
<autoresizingMask key="autoresizingMask"/>
106115
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ohm-6f-kCt" id="HOv-3h-ORa">
@@ -114,7 +123,7 @@
114123
<nil key="highlightedColor"/>
115124
</label>
116125
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="UUID" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pYi-wn-a5d">
117-
<rect key="frame" x="18" y="45.5" width="339" height="21"/>
126+
<rect key="frame" x="18" y="45" width="339" height="21"/>
118127
<fontDescription key="fontDescription" type="system" pointSize="17"/>
119128
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
120129
<nil key="highlightedColor"/>
@@ -149,18 +158,49 @@
149158
<outlet property="delegate" destination="Bz1-BZ-l27" id="093-k7-Qmb"/>
150159
</connections>
151160
</tableView>
161+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7gw-U4-4KU">
162+
<rect key="frame" x="0.0" y="558" width="375" height="60"/>
163+
<subviews>
164+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yDX-KE-cWT">
165+
<rect key="frame" x="20" y="10" width="335" height="40"/>
166+
<color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
167+
<state key="normal" title="Reload">
168+
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
169+
</state>
170+
<connections>
171+
<action selector="reloadButtonPressed:" destination="Bz1-BZ-l27" eventType="touchUpInside" id="3G4-DE-3l8"/>
172+
</connections>
173+
</button>
174+
</subviews>
175+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
176+
<constraints>
177+
<constraint firstAttribute="height" constant="60" id="JxO-Tk-w1k"/>
178+
<constraint firstItem="yDX-KE-cWT" firstAttribute="leading" secondItem="7gw-U4-4KU" secondAttribute="leading" constant="20" id="Ofl-nm-mtZ"/>
179+
<constraint firstItem="yDX-KE-cWT" firstAttribute="centerY" secondItem="7gw-U4-4KU" secondAttribute="centerY" id="Q83-cu-tIz"/>
180+
<constraint firstAttribute="trailing" secondItem="yDX-KE-cWT" secondAttribute="trailing" constant="20" id="TFF-tm-Rqv"/>
181+
<constraint firstAttribute="bottom" secondItem="yDX-KE-cWT" secondAttribute="bottom" constant="10" id="VoW-bI-7c6"/>
182+
<constraint firstItem="yDX-KE-cWT" firstAttribute="top" secondItem="7gw-U4-4KU" secondAttribute="top" constant="10" id="he5-hm-LmM"/>
183+
<constraint firstItem="yDX-KE-cWT" firstAttribute="centerX" secondItem="7gw-U4-4KU" secondAttribute="centerX" id="pHo-WU-Ksk"/>
184+
</constraints>
185+
</view>
152186
</subviews>
153187
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
154188
<constraints>
155-
<constraint firstItem="cmg-c0-pQy" firstAttribute="top" secondItem="qeP-fg-PNa" secondAttribute="bottom" id="AiP-9B-Cr6"/>
156-
<constraint firstItem="qeP-fg-PNa" firstAttribute="top" secondItem="2Ib-I0-iOd" secondAttribute="top" id="OEN-D1-aYN"/>
189+
<constraint firstItem="TQF-Wb-0Xp" firstAttribute="centerY" secondItem="2Ib-I0-iOd" secondAttribute="centerY" id="1ZU-Nu-5x7"/>
190+
<constraint firstItem="TQF-Wb-0Xp" firstAttribute="centerX" secondItem="2Ib-I0-iOd" secondAttribute="centerX" id="4dO-uC-XBU"/>
191+
<constraint firstItem="7gw-U4-4KU" firstAttribute="top" secondItem="qeP-fg-PNa" secondAttribute="bottom" id="Da8-ds-cPL"/>
157192
<constraint firstAttribute="trailing" secondItem="qeP-fg-PNa" secondAttribute="trailing" id="ZI7-hJ-09x"/>
193+
<constraint firstItem="7gw-U4-4KU" firstAttribute="leading" secondItem="2Ib-I0-iOd" secondAttribute="leading" id="co6-HD-Cbz"/>
194+
<constraint firstAttribute="trailing" secondItem="7gw-U4-4KU" secondAttribute="trailing" id="dW0-x6-LZ1"/>
195+
<constraint firstItem="qeP-fg-PNa" firstAttribute="top" secondItem="YbY-LH-Z4J" secondAttribute="bottom" id="eOr-Z8-7Ot"/>
196+
<constraint firstAttribute="bottom" secondItem="7gw-U4-4KU" secondAttribute="bottom" id="eg9-oy-1dB"/>
158197
<constraint firstItem="qeP-fg-PNa" firstAttribute="leading" secondItem="2Ib-I0-iOd" secondAttribute="leading" id="rI9-cH-DQy"/>
159198
</constraints>
160199
</view>
161200
<tabBarItem key="tabBarItem" title="Beacons" id="vDg-9M-6Bq"/>
162201
<navigationItem key="navigationItem" title="Beacon Control" id="iaY-Pl-NIv"/>
163202
<connections>
203+
<outlet property="activityIndicator" destination="TQF-Wb-0Xp" id="0rX-LF-0ZT"/>
164204
<outlet property="tableView" destination="qeP-fg-PNa" id="evW-eY-QT7"/>
165205
</connections>
166206
</viewController>
@@ -187,14 +227,8 @@
187227
<!--Beacon Control-->
188228
<scene sceneID="fPH-F8-Ibw">
189229
<objects>
190-
<tabBarController storyboardIdentifier="BCTabBarViewController" id="1tU-jY-e5X" customClass="BCTabBarController" customModule="BCBeaconMonitor" customModuleProvider="target" sceneMemberID="viewController">
191-
<navigationItem key="navigationItem" title="Beacon Control" id="fKH-fe-5Uz">
192-
<barButtonItem key="rightBarButtonItem" title="Reload" id="pmd-j5-JOm">
193-
<connections>
194-
<action selector="didPressReloadButton" destination="1tU-jY-e5X" id="NCX-mt-g1S"/>
195-
</connections>
196-
</barButtonItem>
197-
</navigationItem>
230+
<tabBarController storyboardIdentifier="BCTabBarViewController" id="1tU-jY-e5X" customClass="BCTabBarController" customModule="BeaconScan" customModuleProvider="target" sceneMemberID="viewController">
231+
<navigationItem key="navigationItem" title="Beacon Control" id="fKH-fe-5Uz"/>
198232
<tabBar key="tabBar" contentMode="scaleToFill" translucent="NO" id="hd9-bC-RGv">
199233
<rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
200234
<autoresizingMask key="autoresizingMask"/>

BCSampleSwift/controller/BCBeaconsViewController.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,26 @@ import UIKit
1010

1111
class BCBeaconsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
1212
@IBOutlet weak var tableView: UITableView!
13+
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
1314

15+
var delegate:TabbarViewControllerDelegate?
16+
1417
private var beacons : [BCLBeacon] = []
1518
private let BCBeaconCellIdentifier = "BeaconCellIdentifier"
1619

1720
override func viewDidLoad() {
1821
super.viewDidLoad()
1922
}
23+
24+
func startedLoading(){
25+
self.tableView.isHidden = true;
26+
self.activityIndicator.startAnimating()
27+
}
28+
func endLoading(){
29+
self.tableView.isHidden = false;
30+
self.activityIndicator.stopAnimating()
31+
32+
}
2033

2134
func set(beacons: [BCLBeacon]?) {
2235
self.beacons = beacons != nil ? beacons! : [BCLBeacon]();
@@ -33,4 +46,16 @@ class BCBeaconsViewController: UIViewController, UITableViewDataSource, UITableV
3346
cell.configure(beacon: beacon);
3447
return cell;
3548
}
49+
50+
@IBAction func reloadButtonPressed(_ sender: Any) {
51+
// if ((self.delegate?.reloadButtonPressed) != nil) {
52+
self.delegate?.reloadButtonPressed()
53+
// }
54+
}
55+
}
56+
57+
58+
59+
protocol TabbarViewControllerDelegate {
60+
func reloadButtonPressed()
3661
}

BCSampleSwift/controller/BCEventsViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import UIKit
1111
class BCActionsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
1212

1313
@IBOutlet weak var tableView: UITableView!
14+
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
1415
var events = [BCEvent]()
1516
private let BCEventCellIdentifier = "EventCellIdentifier"
1617

BCSampleSwift/controller/BCTabBarController.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import UIKit
1010

11-
class BCTabBarController: UITabBarController, BCLBeaconCtrlDelegate {
11+
class BCTabBarController: UITabBarController, BCLBeaconCtrlDelegate, TabbarViewControllerDelegate {
1212

1313
var clientID: String?
1414
var clientSecret: String?
@@ -20,6 +20,7 @@ class BCTabBarController: UITabBarController, BCLBeaconCtrlDelegate {
2020
didSet {
2121
self.eventsViewController?.set(events: events)
2222
}
23+
2324
}
2425

2526
private var timer: Timer?
@@ -43,6 +44,7 @@ class BCTabBarController: UITabBarController, BCLBeaconCtrlDelegate {
4344
for controller in self.viewControllers! {
4445
if let destinationVC = controller as? BCBeaconsViewController {
4546
self.beaconsViewController = destinationVC
47+
self.beaconsViewController?.delegate = self
4648
} else if let destinationVC = controller as? BCActionsViewController {
4749
self.eventsViewController = destinationVC
4850
}
@@ -65,19 +67,26 @@ class BCTabBarController: UITabBarController, BCLBeaconCtrlDelegate {
6567
}
6668
}
6769

70+
71+
6872
//MARK: - BeaconCtrl Delegate
6973

7074
func didPerform(_ action: BCLAction!) {
7175
self.events += [BCEvent(action: action)]
7276
}
7377

74-
//MARK: - Actions
75-
76-
@IBAction func didPressReloadButton() {
78+
//MARK: - TabbarViewControllerDelegate
79+
80+
func reloadButtonPressed() {
81+
82+
self.beaconsViewController?.startedLoading()
83+
7784
self.beaconCtrl?.fetchConfiguration { error in
7885
DispatchQueue.main.async {
7986
self.beaconCtrl?.startMonitoringBeacons()
8087
self.reloadBeacons()
88+
self.beaconsViewController?.endLoading()
89+
8190
}
8291
}
8392
}

0 commit comments

Comments
 (0)