Skip to content

Commit

Permalink
Merge pull request #69 from situmtech/release/0.1.22
Browse files Browse the repository at this point in the history
Release/0.1.22
  • Loading branch information
situm-abarros committed Feb 21, 2022
2 parents e928337 + 7134336 commit 16955a5
Show file tree
Hide file tree
Showing 13 changed files with 187 additions and 41 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
All non released changes should be in CHANGELOG_UNRELEASED.md file

---------
## [0.1.22] - 2022-02-21
# Added
* Added method navigateToLocation(floor, lat, lng) on SitumMapLibrary to navigate to a location in the current building.
The location is specified by a floor, a latitude and a longitude

* Added the method setUseRemoteConfig(Bool) to LibrarySettings to start positioning using the Remote Configuration. The default value is false. When this parameter is set to true the local settings will be overwritten.

## [0.1.21] - 2022-02-07

### Addded
Expand Down
16 changes: 8 additions & 8 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ PODS:
- GoogleMaps/Maps (4.2.0):
- GoogleMaps/Base
- Protobuf (3.19.4)
- SitumSDK (2.51.5):
- SitumSDK (2.52.0):
- Protobuf (~> 3.7)
- SSZipArchive (~> 2.4)
- SitumWayfinding (0.1.21):
- SitumWayfinding (0.1.22):
- GoogleMaps (~> 4.2.0)
- SitumSDK (~> 2.51.5)
- SSZipArchive (2.4.2)
- SitumSDK (~> 2.52.0)
- SSZipArchive (2.4.3)

DEPENDENCIES:
- SitumWayfinding (from `../`)
Expand All @@ -30,10 +30,10 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
GoogleMaps: eb03e327edfd70b06de1e6e321653f73712df7ad
Protobuf: 235750e4696ff59fb07d949a9dbbc92b3c0700fe
SitumSDK: cd7bc5724e05db76ecbc7cd3162db66753168d4e
SitumWayfinding: e010b5868e78aab621b4063b9e1dc12e2b134b2f
SSZipArchive: e7b4f3d9e780c2acc1764cd88fbf2de28f26e5b2
SitumSDK: cc0a5b48a90669c463622b12ae6f07588863f5af
SitumWayfinding: 9f56c9004b7136580ab154830c758416fb977919
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef

PODFILE CHECKSUM: 181eb894514efe3e0119ec84dae5349934aaaa20

COCOAPODS: 1.10.2
COCOAPODS: 1.11.2
1 change: 1 addition & 0 deletions Example/SitumWayfinding/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import UIKit
import SitumSDK

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand Down
44 changes: 38 additions & 6 deletions Example/SitumWayfinding/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -24,7 +24,7 @@
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="30" translatesAutoresizingMaskIntoConstraints="NO" id="ieK-q5-HVl">
<rect key="frame" x="20" y="84" width="374" height="144"/>
<rect key="frame" x="20" y="84" width="374" height="202"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kYz-PR-o25">
<rect key="frame" x="116" y="0.0" width="142" height="28"/>
Expand Down Expand Up @@ -80,14 +80,41 @@
<action selector="loadAndNavigateTapped:" destination="BYZ-38-t0r" eventType="touchUpInside" id="jLO-sh-BlP"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Z1c-hI-Wjv">
<rect key="frame" x="16.5" y="174" width="341" height="28"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<gestureRecognizers/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<inset key="contentEdgeInsets" minX="10" minY="5" maxX="10" maxY="5"/>
<state key="normal" title="Load Wayfinding and navigate to coordinate">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="loadAndNavigateToLocation:" destination="BYZ-38-t0r" eventType="touchUpInside" id="tj2-tq-dij"/>
</connections>
</button>
</subviews>
</stackView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="zvr-7g-CxO">
<rect key="frame" x="0.0" y="298.5" width="414" height="509.5"/>
<rect key="frame" x="0.0" y="356.5" width="414" height="451.5"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</tableView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="List of available POIs" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TUz-42-YwY">
<rect key="frame" x="20" y="268" width="374" height="20.5"/>
<rect key="frame" x="20" y="326" width="374" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fJ1-WX-D4c">
<rect key="frame" x="30" y="294" width="51" height="31"/>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Use remote configuratioon" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Dl-6u-dKQ">
<rect key="frame" x="85" y="299" width="203" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -100,19 +127,24 @@
<constraint firstItem="ieK-q5-HVl" firstAttribute="top" secondItem="LYZ-5T-B5U" secondAttribute="bottom" constant="30" id="1Uq-iX-031"/>
<constraint firstItem="rGn-7e-utf" firstAttribute="trailing" secondItem="TUz-42-YwY" secondAttribute="trailing" constant="20" id="1dl-ej-bui"/>
<constraint firstItem="rGn-7e-utf" firstAttribute="trailing" secondItem="ieK-q5-HVl" secondAttribute="trailing" constant="20" id="4Rw-Jl-WZM"/>
<constraint firstItem="TUz-42-YwY" firstAttribute="top" secondItem="ieK-q5-HVl" secondAttribute="bottom" constant="40" id="Bac-UE-ejq"/>
<constraint firstItem="LYZ-5T-B5U" firstAttribute="top" secondItem="rGn-7e-utf" secondAttribute="top" constant="30" id="CWs-qc-DfG"/>
<constraint firstItem="rGn-7e-utf" firstAttribute="bottom" secondItem="zvr-7g-CxO" secondAttribute="bottom" id="Fn2-Iu-aeb"/>
<constraint firstItem="8Dl-6u-dKQ" firstAttribute="top" secondItem="fJ1-WX-D4c" secondAttribute="top" id="IoI-I4-QA3"/>
<constraint firstItem="rGn-7e-utf" firstAttribute="trailing" secondItem="zvr-7g-CxO" secondAttribute="trailing" id="L69-eY-4GU"/>
<constraint firstItem="ieK-q5-HVl" firstAttribute="leading" secondItem="rGn-7e-utf" secondAttribute="leading" constant="20" id="Zmi-cy-xRT"/>
<constraint firstItem="8Dl-6u-dKQ" firstAttribute="leading" secondItem="fJ1-WX-D4c" secondAttribute="trailing" constant="6" id="anl-uI-SIM"/>
<constraint firstItem="fJ1-WX-D4c" firstAttribute="top" secondItem="Z1c-hI-Wjv" secondAttribute="bottom" constant="8" symbolic="YES" id="f1i-Aq-7Tx"/>
<constraint firstItem="zvr-7g-CxO" firstAttribute="leading" secondItem="rGn-7e-utf" secondAttribute="leading" id="gBj-Z6-83T"/>
<constraint firstItem="fJ1-WX-D4c" firstAttribute="leading" secondItem="rGn-7e-utf" secondAttribute="leading" constant="30" id="leR-wH-Llw"/>
<constraint firstItem="LYZ-5T-B5U" firstAttribute="centerX" secondItem="rGn-7e-utf" secondAttribute="centerX" id="n7B-k8-6cW"/>
<constraint firstItem="TUz-42-YwY" firstAttribute="leading" secondItem="rGn-7e-utf" secondAttribute="leading" constant="20" id="nnK-k6-qee"/>
<constraint firstItem="zvr-7g-CxO" firstAttribute="top" secondItem="TUz-42-YwY" secondAttribute="bottom" constant="10" id="vkg-Se-JnS"/>
<constraint firstItem="TUz-42-YwY" firstAttribute="top" secondItem="fJ1-WX-D4c" secondAttribute="bottom" constant="1" id="wvE-yH-t59"/>
</constraints>
</view>
<connections>
<outlet property="loadButton" destination="kYz-PR-o25" id="iNN-Y5-fdK"/>
<outlet property="remoteConfigSwitch" destination="fJ1-WX-D4c" id="kpl-JH-ftK"/>
<outlet property="tableView" destination="zvr-7g-CxO" id="8Yk-zt-9Q0"/>
<segue destination="uIe-Uw-TaB" kind="show" identifier="loadWayfindingSegue" id="JYy-W1-OV2"/>
</connections>
Expand Down
36 changes: 33 additions & 3 deletions Example/SitumWayfinding/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ class ViewController: UIViewController {

private var credentials: Credentials!
private var buildingId: String = ""
private var currentFloor: SITFloor? = nil
private var location: (lat: String, lng: String)!
private var pois: [SITPOI]? = nil
private var selectedPoi: SITPOI? = nil
private var action: WYFAction?
private let cellId = "cell"

@IBOutlet weak var remoteConfigSwitch: UISwitch!


override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -35,6 +40,7 @@ class ViewController: UIViewController {
googleMapsApiKey: "YOUR_GOOGLEMAPS_APIKEY"
)
buildingId = "YOUR_BUILDING_ID"
location = (lat: "YOUR_LATITUDE", lng: "YOUR_LONGITUDE")

loadPois()
}
Expand Down Expand Up @@ -69,21 +75,42 @@ class ViewController: UIViewController {
action = .navigateToPoi(selectedPoi)
self.performSegue(withIdentifier: "loadWayfindingSegue", sender: self)
}

@IBAction func loadAndNavigateToLocation(_ sender: Any) {
guard let floor = currentFloor else {
self.showError(title: "Navigate to Location", message: "You must wait until building is downloaded")
return
}
guard let lat = Double(location.lat), let lng = Double(location.lng) else {
self.showError(title: "Latitude or longitude incorrect",
message: "You set latitude and longitude in code (ViewController.location) to a correct value")
return
}

action = .navigateToLocation(floor: floor, lat: lat, lng: lng)
self.performSegue(withIdentifier: "loadWayfindingSegue", sender: self)
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "loadWayfindingSegue" {
if let vc = segue.destination as? WayfindingController {
vc.credentials = credentials
vc.buildingId = buildingId
vc.action = action
vc.useRemoteConfig = remoteConfigSwitch.isOn
}
}
}

private func showUnselectedPoiError() {
self.showError(title: "Select POI",
message: "You must select a POI in the list of available POIs to perform the action")
}

private func showError(title: String, message: String) {
let alert = UIAlertController(
title: "Select POI",
message: "You must select a POI in the list of available POIs to perform the action",
title: title,
message: message,
preferredStyle: .alert
)
alert.addAction(UIAlertAction(title: "Ok", style: .default))
Expand All @@ -95,6 +122,9 @@ class ViewController: UIViewController {
SITCommunicationManager.shared().fetchBuildingInfo(buildingId, withOptions: nil, success: { [weak self] mapping in
guard mapping != nil, let buildingInfo = mapping!["results"] as? SITBuildingInfo else {return}
self?.pois = buildingInfo.indoorPois
if buildingInfo.floors.count > 0 {
self?.currentFloor = buildingInfo.floors[0]
}
self?.tableView.reloadData()
}, failure: { error in
print("fetchBuildingInfo \(error)")
Expand Down Expand Up @@ -137,5 +167,5 @@ extension ViewController: UITableViewDelegate {
}

enum WYFAction {
case selectPoi(SITPOI), navigateToPoi(SITPOI)
case selectPoi(SITPOI), navigateToPoi(SITPOI), navigateToLocation(floor: SITFloor, lat: Double, lng: Double)
}
10 changes: 5 additions & 5 deletions Example/SitumWayfinding/WayfindingController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class WayfindingController: UIViewController, OnPoiSelectionListener, OnFloorCha
var action: WYFAction?
var credentials: Credentials!
var buildingId: String!
var useRemoteConfig: Bool = false

var library: SitumMapsLibrary?

Expand All @@ -30,6 +31,7 @@ class WayfindingController: UIViewController, OnPoiSelectionListener, OnFloorCha
let settings = LibrarySettings.Builder()
.setCredentials(credentials: credentials)
.setBuildingId(buildingId: buildingId)
.setUseRemoteConfig(useRemoteConfig: useRemoteConfig)
.build()
self.library = SitumMapsLibrary(containedBy: self.containerView, controlledBy: self, withSettings: settings)

Expand Down Expand Up @@ -77,7 +79,9 @@ class WayfindingController: UIViewController, OnPoiSelectionListener, OnFloorCha
case .selectPoi(let poi):
selectPoi(poi: poi)
case .navigateToPoi(let poi):
self.navigateToPoi(poi: poi)
self.library?.navigateToPoi(poi: poi)
case .navigateToLocation(let floor, let lat, let lng):
self.library?.navigateToLocation(floor: floor, lat: lat, lng: lng)
}
}
}
Expand All @@ -93,10 +97,6 @@ class WayfindingController: UIViewController, OnPoiSelectionListener, OnFloorCha
}
}

private func navigateToPoi(poi: SITPOI) {
self.library?.navigateToPoi(poi: poi)
}

private func processSelectionError(error: Error) {
if let error = error as? WayfindingError {
switch error {
Expand Down
4 changes: 2 additions & 2 deletions SitumWayfinding.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'SitumWayfinding'
s.version = '0.1.21'
s.version = '0.1.22'
s.summary = 'Indoor Location for iOS.'
s.static_framework = true

Expand All @@ -28,6 +28,6 @@ Pod::Spec.new do |s|
s.source_files = 'SitumWayfinding/Classes/**/*'
s.resources = ['SitumWayfinding/Assets/*.storyboard', 'SitumWayfinding/Assets/Images/**/*.png']
s.dependency 'GoogleMaps', '~> 4.2.0'
s.dependency 'SitumSDK', '~> 2.51.5'
s.dependency 'SitumSDK', '~> 2.52.0'

end
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class PositioningPresenter: NSObject, SITLocationDelegate, SITDirectionsDelegate
var route: SITRoute? = nil
var locationManager: SITLocationManager = SITLocationManager.sharedInstance()

var useRemoteConfig: Bool = false

let compassCalibrationAlertTitle = "Compass calibration needed"
let oobAlertTitle = "User outside building"
let outsideRouteAlertTitle = "User ouside route"
Expand Down Expand Up @@ -71,7 +73,7 @@ class PositioningPresenter: NSObject, SITLocationDelegate, SITDirectionsDelegate
func requestLocationUpdates() {
var request: SITLocationRequest = RequestBuilder.buildLocationRequest(buildingId: buildingInfo.building.identifier)
request = self.interceptorsManager.onLocationRequest(request)
self.locationManager.requestLocationUpdates(request)
self.locationManager.requestLocationUpdates(SITServices.isUsingRemoteConfig() && useRemoteConfig ? nil: request)
view?.change(.calculating, centerCamera: true)
}

Expand Down

0 comments on commit 16955a5

Please sign in to comment.