Skip to content

Commit 0c408a7

Browse files
committed
Fix: timeout for beacon notifications
1 parent 57df232 commit 0c408a7

File tree

11 files changed

+197
-11
lines changed

11 files changed

+197
-11
lines changed

NearBee.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = 'NearBee'
33
s.swift_version = '5.0'
4-
s.version = '0.3.0'
4+
s.version = '0.3.1'
55
s.summary = 'iOS library for Eddystone beacons'
66

77
s.homepage = 'https://github.com/Beaconstac/NearBee-iOS-SDK'

NearBee/NearBee-Swift.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,4 +431,4 @@ typedef SWIFT_ENUM(NSInteger, NearBeeState, closed) {
431431
#if __has_attribute(external_source_symbol)
432432
# pragma clang attribute pop
433433
#endif
434-
#pragma clang diagnostic pop
434+
#pragma clang diagnostic pop
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

NearBee/NearBeeResources.bundle/_CodeSignature/CodeResources

+9-9
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@
3030
</data>
3131
<key>NearBeeModel.momd/Model 8.mom</key>
3232
<data>
33-
VWTw85YRgyKvHzWfHzJJUICSayY=
33+
ubeT80Uea2cTJhh7i8mO4nJW7a0=
3434
</data>
3535
<key>NearBeeModel.momd/Model 8.omo</key>
3636
<data>
37-
Ida8Cb68I3+PDmbJfLqF1cxWcXY=
37+
Jm6sJjnuENUUIXKuRDYbqswW6s0=
3838
</data>
3939
<key>NearBeeModel.momd/Model.mom</key>
4040
<data>
4141
2IG9nvXDnU3VZCS9E7v3uS3enHE=
4242
</data>
4343
<key>NearBeeModel.momd/VersionInfo.plist</key>
4444
<data>
45-
2z8a6yNKSBQD51OLlEdELqZOrpg=
45+
Asdxtn5l15GnYdaJRkXv4KXrMzo=
4646
</data>
4747
</dict>
4848
<key>files2</key>
@@ -117,22 +117,22 @@
117117
<dict>
118118
<key>hash</key>
119119
<data>
120-
VWTw85YRgyKvHzWfHzJJUICSayY=
120+
ubeT80Uea2cTJhh7i8mO4nJW7a0=
121121
</data>
122122
<key>hash2</key>
123123
<data>
124-
3vvdFFLA4oGl576yRlbTkMTY1fHUrGAZOjghCpylECg=
124+
ABaLOknuCInG7VtNmT1nqcypOUVjzlW+pwUzHgtt4RY=
125125
</data>
126126
</dict>
127127
<key>NearBeeModel.momd/Model 8.omo</key>
128128
<dict>
129129
<key>hash</key>
130130
<data>
131-
Ida8Cb68I3+PDmbJfLqF1cxWcXY=
131+
Jm6sJjnuENUUIXKuRDYbqswW6s0=
132132
</data>
133133
<key>hash2</key>
134134
<data>
135-
rE9U5HgIUnfDPIv5DWWDYElKVEiJF/NU6Ww27p9lOtQ=
135+
TOlKQ792k3D6iVdpvGLl6fpdoFgFkUlN1uagw2rss2Y=
136136
</data>
137137
</dict>
138138
<key>NearBeeModel.momd/Model.mom</key>
@@ -150,11 +150,11 @@
150150
<dict>
151151
<key>hash</key>
152152
<data>
153-
2z8a6yNKSBQD51OLlEdELqZOrpg=
153+
Asdxtn5l15GnYdaJRkXv4KXrMzo=
154154
</data>
155155
<key>hash2</key>
156156
<data>
157-
b+BCI/YICKyQ7y6eaYcHPQxd9kWK6xoE3Tkmy+VuhZI=
157+
Po8+Uns8OEa0nEyGqAyyFseNTg4Mf5FmibsV7x8aI00=
158158
</data>
159159
</dict>
160160
</dict>

NearBee/libNearBee.a

-30.1 KB
Binary file not shown.

SampleApp/SampleApp/Info.plist

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>co.nearbee.api_key</key>
6+
<string>e62435a78e67ec98bba3b879ba00448650032557</string>
7+
<key>co.nearbee.organization_id</key>
8+
<string>720</string>
9+
<key>NSBluetoothAlwaysUsageDescription</key>
10+
<string>To scan for beacons around you</string>
11+
<key>NSBluetoothPeripheralUsageDescription</key>
12+
<string>To scan for beacons around you</string>
13+
<key>NSLocationAlwaysUsageDescription</key>
14+
<string>To scan for beacons around you</string>
15+
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
16+
<string>To monitor and display notifications for beacons in background</string>
17+
<key>NSLocationWhenInUseUsageDescription</key>
18+
<string>To detect beacons around you</string>
19+
<key>UIBackgroundModes</key>
20+
<array>
21+
<string>bluetooth-central</string>
22+
</array>
23+
<key>CFBundleDevelopmentRegion</key>
24+
<string>$(DEVELOPMENT_LANGUAGE)</string>
25+
<key>CFBundleExecutable</key>
26+
<string>$(EXECUTABLE_NAME)</string>
27+
<key>CFBundleIdentifier</key>
28+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
29+
<key>CFBundleInfoDictionaryVersion</key>
30+
<string>6.0</string>
31+
<key>CFBundleName</key>
32+
<string>$(PRODUCT_NAME)</string>
33+
<key>CFBundlePackageType</key>
34+
<string>APPL</string>
35+
<key>CFBundleShortVersionString</key>
36+
<string>1.0</string>
37+
<key>CFBundleVersion</key>
38+
<string>1</string>
39+
<key>LSRequiresIPhoneOS</key>
40+
<true/>
41+
<key>UILaunchStoryboardName</key>
42+
<string>LaunchScreen</string>
43+
<key>UIMainStoryboardFile</key>
44+
<string>Main</string>
45+
<key>UIRequiredDeviceCapabilities</key>
46+
<array>
47+
<string>armv7</string>
48+
</array>
49+
<key>UISupportedInterfaceOrientations</key>
50+
<array>
51+
<string>UIInterfaceOrientationPortrait</string>
52+
<string>UIInterfaceOrientationLandscapeLeft</string>
53+
<string>UIInterfaceOrientationLandscapeRight</string>
54+
</array>
55+
<key>UISupportedInterfaceOrientations~ipad</key>
56+
<array>
57+
<string>UIInterfaceOrientationPortrait</string>
58+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
59+
<string>UIInterfaceOrientationLandscapeLeft</string>
60+
<string>UIInterfaceOrientationLandscapeRight</string>
61+
</array>
62+
</dict>
63+
</plist>
+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
//
2+
// ViewController.swift
3+
// SampleApp
4+
//
5+
// Created by Sachin Vas on 31/10/18.
6+
// Copyright © 2018 Amit Prabhu. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import NearBee
11+
import CoreData
12+
import UserNotifications
13+
import CoreLocation
14+
import Imaginary
15+
16+
class ViewController: UITableViewController {
17+
18+
var MY_TOKEN = "e62435a78e67ec98bba3b879ba00448650032557" // warning: Make sure to replace this
19+
var MY_ORGANIZATION = 720 // warning: Make sure to replace this
20+
21+
var locationManager = CLLocationManager()
22+
23+
var nearBee: NearBee!
24+
25+
var viewBeacons:[NearBeeBeacon] = []
26+
27+
override func viewDidLoad() {
28+
super.viewDidLoad()
29+
30+
locationManager.requestAlwaysAuthorization()
31+
UNUserNotificationCenter.current().delegate = self
32+
33+
nearBee = NearBee.initNearBee()
34+
nearBee.delegate = self
35+
nearBee.enableBackgroundNotification(true)
36+
nearBee.startScanning()
37+
}
38+
39+
override func viewWillAppear(_ animated: Bool) {
40+
super.viewWillAppear(animated)
41+
nearBee.delegate = self
42+
}
43+
}
44+
45+
extension ViewController {
46+
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
47+
tableView.deselectRow(at: indexPath, animated: true)
48+
49+
guard viewBeacons.count > indexPath.row else {
50+
return
51+
}
52+
53+
let beacon = viewBeacons[indexPath.row]
54+
55+
guard let eddystoneURL = beacon.getBestAvailableAttachment()?.getURL() else {
56+
return
57+
}
58+
59+
nearBee.displayContentOf(eddystoneURL)
60+
}
61+
62+
override func numberOfSections(in tableView: UITableView) -> Int {
63+
return 1
64+
}
65+
66+
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
67+
return viewBeacons.count
68+
}
69+
70+
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
71+
guard let cell = tableView.dequeueReusableCell(withIdentifier: PhysicalWebTableViewCell.cellIdentifier, for: indexPath) as? PhysicalWebTableViewCell, viewBeacons.count > indexPath.row else {
72+
fatalError("Unexpected Index Path")
73+
}
74+
75+
let beacon = viewBeacons[indexPath.row]
76+
77+
// Configure Cell
78+
cell.configureCell(beacon: beacon)
79+
80+
return cell
81+
}
82+
83+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
84+
if let destination = segue.destination as? GeoFenceViewController {
85+
destination.nearBee = nearBee
86+
}
87+
}
88+
}
89+
90+
extension ViewController: NearBeeDelegate {
91+
func didFindBeacons(_ beacons: [NearBeeBeacon]) {
92+
let filteredBeacons = beacons.filter { !viewBeacons.contains($0) }
93+
viewBeacons.append(contentsOf: filteredBeacons)
94+
tableView.reloadData()
95+
}
96+
97+
func didLoseBeacons(_ beacons: [NearBeeBeacon]) {
98+
let filteredBeacons = beacons.filter { !viewBeacons.contains($0) }
99+
viewBeacons.append(contentsOf: filteredBeacons)
100+
tableView.reloadData()
101+
}
102+
103+
func didUpdateBeacons(_ beacons: [NearBeeBeacon]) {
104+
viewBeacons = viewBeacons.filter { !beacons.contains($0) }
105+
tableView.reloadData()
106+
}
107+
108+
func didThrowError(_ error: Error) {
109+
viewBeacons = []
110+
tableView.reloadData()
111+
}
112+
113+
func didUpdateState(_ state: NearBeeState) {
114+
115+
}
116+
}
117+
118+
extension ViewController: UNUserNotificationCenterDelegate {
119+
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
120+
let _ = nearBee.checkAndProcessNearbyNotification(response.notification)
121+
completionHandler()
122+
}
123+
}

0 commit comments

Comments
 (0)