Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP indoors #341

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ docs/undocumented.json
*.xcarchive
IntegrationExamples

**/.build/
17 changes: 13 additions & 4 deletions Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
self.requestLocationPermissions()

// Replace with a valid test publishable key
Radar.initialize(publishableKey: "prj_test_pk_0000000000000000000000000000000000000000")
Radar.initialize(publishableKey: "prj_test_pk_2236cce4dabfd26f891738e119b66270be6d3d01")
Radar.setDelegate(self)
Radar.setVerifiedDelegate(self)

/*
Radar.doIndoorSurvey("IGNORE example app survey label from swift", forLength: 5) {result in
print("indoor survey done!", result);
}
*/

let options = RadarTrackingOptions.presetContinuous
Radar.startTracking(trackingOptions: options)

return true

if UIApplication.shared.applicationState != .background {
Radar.getLocation { (status, location, stopped) in
print("Location: status = \(Radar.stringForStatus(status)); location = \(String(describing: location))")
Expand All @@ -36,9 +47,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
}

let options = RadarTrackingOptions.presetContinuous
Radar.startTracking(trackingOptions: options)

Radar.getContext { (status, location, context) in
print("Context: status = \(Radar.stringForStatus(status)); location = \(String(describing: location)); context?.geofences = \(String(describing: context?.geofences)); context?.place = \(String(describing: context?.place)); context?.country = \(String(describing: context?.country))")
}
Expand Down Expand Up @@ -238,6 +246,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD

func didReceiveEvents(_ events: [RadarEvent], user: RadarUser?) {
for event in events {
print("didReceiveEvent!", event)
notify(Utils.stringForRadarEvent(event))
}
}
Expand Down
53 changes: 29 additions & 24 deletions Example/Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,41 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSPinnedDomains</key>
<dict>
<key>api-verified.radar.io</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSPinnedLeafIdentities</key>
<array>
<dict>
<key>SPKI-SHA256-BASE64</key>
<string>15ktYXSSU2llpy7YyCgeqUKDBkjcimK/weUcec960sI=</string>
</dict>
<dict>
<key>SPKI-SHA256-BASE64</key>
<string>15ktYXSSU2llpy7YyCgeqUKDBkjcimK/weUcec960sI=</string>
</dict>
</array>
</dict>
</dict>
</dict>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Please enable Bluetooth for indoors location</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Please enable Bluetooth for indoors location</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Your background location usage description goes here.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your foreground location usage description goes here.</string>
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-central</string>
<string>location</string>
</array>
<key>UIRequiredDeviceCapabilities</key>
Expand All @@ -47,29 +76,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSPinnedDomains</key>
<dict>
<key>api-verified.radar.io</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSPinnedLeafIdentities</key>
<array>
<dict>
<key>SPKI-SHA256-BASE64</key>
<string>15ktYXSSU2llpy7YyCgeqUKDBkjcimK/weUcec960sI=</string>
</dict>
<dict>
<key>SPKI-SHA256-BASE64</key>
<string>15ktYXSSU2llpy7YyCgeqUKDBkjcimK/weUcec960sI=</string>
</dict>
</array>
</dict>
</dict>
</dict>
</dict>
</plist>
4 changes: 4 additions & 0 deletions Example/Example/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import RadarSDK
class Utils {

static func stringForRadarEvent(_ event: RadarEvent) -> String {
print("event", event)

let confidenceStr = Utils.stringForRadarEventConfidence(event.confidence)

switch event.type {
Expand Down Expand Up @@ -38,6 +40,8 @@ class Utils {
return "Exited country \(event.region!.name) (\(event.region!.code)) with \(confidenceStr)"
case .conversion:
return "Received conversion event with name \(event.conversionName!)"
case .indoorLocation:
return "Received indoor location event with .... TODO TODO TODO"
default:
return "Unknown"
}
Expand Down
2 changes: 1 addition & 1 deletion RadarSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RadarSDK'
s.version = '3.13.0'
s.version = '3.9.12'
s.summary = 'iOS SDK for Radar, the leading geofencing and location tracking platform'
s.homepage = 'https://radar.com'
s.author = { 'Radar Labs, Inc.' => 'support@radar.com' }
Expand Down
Loading