Skip to content

Commit

Permalink
Merge pull request #58 from IndoorAtlas/react-native-sdk-3.5
Browse files Browse the repository at this point in the history
Update IndoorAtlas SDKs to 3.5.5
  • Loading branch information
matti-ida authored Aug 23, 2022
2 parents 721156d + c50be95 commit 4423d39
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 27 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Version 3.5.1 - August 2022
----------------
* Fix status callback

Version 3.5.0 - August 2022
----------------
* Update IndoorAtlas SDKs to 3.5.5
* iOS: fix JSON serialization issue with position object
* Android: add BLUETOOTH_SCAN permission. The plugin now requires compile and target sdk version 31

Version 3.4.5 - February 2022
----------------
* Update IndoorAtlas SDKs to 3.4.12
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-indooratlas",
"version": "3.4.5",
"version": "3.5.1",
"description": "React.Native plugin using IndoorAtlas SDK.",
"homepage": "https://github.com/indooratlas/cordova-plugin/tree/react-native",
"repository": {
Expand Down
8 changes: 5 additions & 3 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-indooratlas"
version="3.4.5">
version="3.5.1">

<name>IndoorAtlas</name>
<description>IndoorAtlas Cordova Plugin.</description>
<engines>
<engine name="cordova" version=">=3.6.0"/>
<engine name="cordova-plugman" version=">=4.2.0"/><!-- needed for gradleReference support -->
<engine name="cordova" version=">=11.0.0"/>
<engine name="cordova-android" version=">=11.0.0"/>
<engine name="cordova-ios" version=">=6.2.0"/>
</engines>

<js-module src="www/Coordinates.js" name="Coordinates">
Expand Down Expand Up @@ -93,6 +94,7 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
</config-file>
Expand Down
10 changes: 5 additions & 5 deletions src/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion 31
buildToolsVersion "30.0.2"

defaultConfig {
minSdkVersion 16
targetSdkVersion 22
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
}
Expand All @@ -27,6 +27,6 @@ repositories {

dependencies {
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.indooratlas.android:indooratlas-android-sdk:3.4.12'
implementation 'com.indooratlas.android:indooratlas-android-sdk:3.5.5'
implementation project(':react-native-cordova')
}
1 change: 1 addition & 0 deletions src/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.indooratlas.android.sdk.reactnative">
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.ialocation.plugin;

import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Arrays;
import java.util.stream.Collectors;

import android.Manifest;
import android.content.pm.PackageManager;
Expand Down Expand Up @@ -47,13 +49,18 @@ public class IALocationPlugin extends CordovaPlugin {
private static final int PERMISSION_REQUEST = 101;

private IALocationManager mLocationManager;
private String[] permissions = new String[]{
private List<String> permissions = new ArrayList<>(Arrays.asList(new String[]{
Manifest.permission.CHANGE_WIFI_STATE,
Manifest.permission.ACCESS_WIFI_STATE,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.INTERNET
};
}));
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
permissions.add(Manifest.permission.BLUETOOTH_SCAN);
}
}
private CallbackContext mCbContext;
private IndoorLocationListener mListener;
private boolean mLocationServiceRunning = false;
Expand Down Expand Up @@ -85,7 +92,7 @@ public boolean hasPermisssion() {
*/
//@Override
public void requestPermissions(int requestCode) {
cordova.requestPermissions(this, requestCode, permissions);
cordova.requestPermissions(this, requestCode, permissions.toArray(new String[]{}));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ INDOORATLAS_API
/**
* Mapped floors that the venue has
*/
@property (nonatomic, readonly, nonnull) NSArray *floorplans;
@property (nonatomic, readonly, nonnull) NSArray<IAFloorPlan*> *floorplans;
/**
* ID of the venue in IndoorAtlas developer console
*/
Expand Down Expand Up @@ -657,7 +657,8 @@ INDOORATLAS_API
* If updates were deferred or if multiple locations arrived before they could be delivered, the array may contain additional entries.
* The objects in the array are organized in the order in which they occured. Threfore, the most recent location update is at the end of the array.
*/
- (void)indoorLocationManager:(nonnull IALocationManager*)manager didUpdateLocations:(nonnull NSArray*)locations;
- (void)indoorLocationManager:(nonnull IALocationManager*)manager didUpdateLocations:(nonnull NSArray<IALocation*>*)locations;
- (void)indoorLocationManager:(nonnull IALocationManager*)manager didUpdateLocationsDeprecated:(nonnull NSArray*)locations NS_SWIFT_NAME(indoorLocationManager(_:didUpdateLocations:));

/**
* Tells the delegate that the user entered the specified region.
Expand Down
Binary file modified src/ios/IndoorAtlas/IndoorAtlas.framework/IndoorAtlas
Binary file not shown.
Binary file modified src/ios/IndoorAtlas/IndoorAtlas.framework/Info.plist
Binary file not shown.
4 changes: 2 additions & 2 deletions src/ios/IndoorLocation.m
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ - (void)returnLocationInfo:(id)callbackId andKeepCallback:(BOOL)keepCallback
} else if (lData && lData.locationInfo) {
CLLocation *lInfo = lData.locationInfo;
NSMutableDictionary *returnInfo = [NSMutableDictionary dictionaryWithCapacity:10];
NSNumber *timestamp = [NSNumber numberWithDouble:([lInfo.timestamp timeIntervalSince1970] * 1000)];
NSNumber *timestamp = [NSNumber numberWithUnsignedLongLong:([lInfo.timestamp timeIntervalSince1970] * 1000)];
[returnInfo setObject:timestamp forKey:@"timestamp"];
[returnInfo setObject:[NSNumber numberWithDouble:lInfo.speed] forKey:@"velocity"];
[returnInfo setObject:[NSNumber numberWithDouble:lInfo.verticalAccuracy] forKey:@"altitudeAccuracy"];
Expand Down Expand Up @@ -310,7 +310,7 @@ - (void)returnStatusInformation:(NSString *)statusString code:(NSUInteger) code
- (NSDictionary *)formatRegionInfo:(IARegion *)regionInfo andTransitionType:(IndoorLocationTransitionType)transitionType
{
NSMutableDictionary *result = [@{@"regionId": regionInfo.identifier,
@"timestamp": [NSNumber numberWithDouble:([regionInfo.timestamp timeIntervalSince1970] * 1000)],
@"timestamp": [NSNumber numberWithUnsignedLongLong:([regionInfo.timestamp timeIntervalSince1970] * 1000)],
@"regionType": [NSNumber numberWithInt:regionInfo.type],
@"transitionType": [NSNumber numberWithInteger:transitionType]
} mutableCopy];
Expand Down
13 changes: 3 additions & 10 deletions www/IndoorAtlas.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ var ___; // this dummy variable helps with automatic docs generation

// react.native
var pluginVersion = require('react-native-indooratlas/package.json').version;
var isAndroid = require('@remobile/react-native-cordova').isandroid;
var cordovaExec = require('@remobile/react-native-cordova').exec;
import { NativeEventEmitter, NativeModules } from 'react-native';
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
var eventEmitter = new NativeEventEmitter(NativeModules.IndoorAtlas);
var Position = require('./Position');
var RegionChangeObserver = require('./RegionChangeObserver');
Expand All @@ -61,12 +60,6 @@ var Geofence = require('./Geofence');
var DEFAULT_WATCH_ID = 'default-watch';
var DEFAULT_REGION_WATCH_ID = 'default-region-watch';

// react.native
function getDeviceType() {
if (isAndroid) return 'Android';
else return 'iOS';
}

function isNumber(value) {
return typeof value === 'number' && isFinite(value);
}
Expand Down Expand Up @@ -279,7 +272,7 @@ function IndoorAtlas() {
initialized = true;

native('addStatusChangedCallback', [], function (status) {
lastStatus = new CurrentStatus(status.code, status.message);
var lastStatus = new CurrentStatus(status.code, status.message);
if (lastStatus.name === 'AVAILABLE') {
if (debug) debug('status available');
var wasAvailable = statusHasBeenAvailable;
Expand All @@ -304,7 +297,7 @@ function IndoorAtlas() {
var config = [apiKey, 'dummy-secret'];
// plugin version
config.push(pluginVersion);
if (getDeviceType() == 'Android') {
if (Platform.OS === 'android') {
// get permission
native('getPermissions', [], function () {
native('initializeIndoorAtlas', config, initSuccess);
Expand Down

0 comments on commit 4423d39

Please sign in to comment.