Skip to content

Commit 0a3afc0

Browse files
committed
fix: typings fix
1 parent d34f765 commit 0a3afc0

File tree

7 files changed

+29
-20
lines changed

7 files changed

+29
-20
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Want to dive in quickly? Check out [the demo app](https://github.com/EddyVerbrug
3232
#### Prerequisites
3333
- [isBluetoothEnabled](#isbluetoothenabled)
3434
- [hasCoarseLocationPermission](#hascoarselocationpermission)
35-
- [requestCoarseLocationPermission](#requestcoarselocationpermission)
35+
- [requestLocationPermission](#requestLocationPermission)
3636
- [turnBluetoothOn](#turnBluetoothOn)
3737

3838
#### Discovery
@@ -80,18 +80,18 @@ Note that `hasCoarseLocationPermission ` will return true when:
8080
```typescript
8181
bluetooth.hasCoarseLocationPermission().then(
8282
function(granted) {
83-
// if this is 'false' you probably want to call 'requestCoarseLocationPermission' now
83+
// if this is 'false' you probably want to call 'requestLocationPermission' now
8484
console.log("Has Location Permission? " + granted);
8585
}
8686
);
8787
```
8888

89-
### requestCoarseLocationPermission
89+
### requestLocationPermission
9090
__Since plugin version 1.2.0 the `startScanning` function will handle this internally so it's no longer mandatory to add permission checks to your code.__
9191

9292
```typescript
9393
// if no permission was granted previously this will open a user consent screen
94-
bluetooth.requestCoarseLocationPermission().then(
94+
bluetooth.requestLocationPermission().then(
9595
function(granted) {
9696
console.log("Location permission requested, user granted? " + granted);
9797
}

demo/app/main-view-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export class DemoAppModel extends Observable {
142142
public doScanForBeacon() {
143143
this._bluetooth.hasLocationPermission().then(granted => {
144144
if (!granted) {
145-
this._bluetooth.requestCoarseLocationPermission().then(
145+
this._bluetooth.requestLocationPermission().then(
146146
// doing it like this for demo / testing purposes.. better usage is demonstrated in 'doStartScanning' below
147147
granted2 => {
148148
dialogs.alert({

docs/assets/js/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/classes/bluetooth.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
<a href="bluetooth.html#removeeventlistener" class="tsd-kind-icon">remove<wbr>Event<wbr>Listener</a>
207207
</li>
208208
<li class=" tsd-kind-method tsd-parent-kind-class">
209-
<a href="bluetooth.html#requestcoarselocationpermission" class="tsd-kind-icon">request<wbr>Coarse<wbr>Location<wbr>Permission</a>
209+
<a href="bluetooth.html#requestLocationPermission" class="tsd-kind-icon">request<wbr>Coarse<wbr>Location<wbr>Permission</a>
210210
</li>
211211
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
212212
<a href="bluetooth.html#requestlocationpermission" class="tsd-kind-icon">request<wbr>Location<wbr>Permission</a>
@@ -339,7 +339,7 @@ <h3>Methods</h3>
339339
<li class="tsd-kind-method tsd-parent-kind-class"><a href="bluetooth.html#openbluetoothsettings" class="tsd-kind-icon">open<wbr>Bluetooth<wbr>Settings</a></li>
340340
<li class="tsd-kind-method tsd-parent-kind-class"><a href="bluetooth.html#read" class="tsd-kind-icon">read</a></li>
341341
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-inherited"><a href="bluetooth.html#removeeventlistener" class="tsd-kind-icon">remove<wbr>Event<wbr>Listener</a></li>
342-
<li class="tsd-kind-method tsd-parent-kind-class"><a href="bluetooth.html#requestcoarselocationpermission" class="tsd-kind-icon">request<wbr>Coarse<wbr>Location<wbr>Permission</a></li>
342+
<li class="tsd-kind-method tsd-parent-kind-class"><a href="bluetooth.html#requestLocationPermission" class="tsd-kind-icon">request<wbr>Coarse<wbr>Location<wbr>Permission</a></li>
343343
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="bluetooth.html#requestlocationpermission" class="tsd-kind-icon">request<wbr>Location<wbr>Permission</a></li>
344344
<li class="tsd-kind-method tsd-parent-kind-class"><a href="bluetooth.html#requestmtu" class="tsd-kind-icon">request<wbr>Mtu</a></li>
345345
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="bluetooth.html#sendevent" class="tsd-kind-icon">send<wbr>Event</a></li>
@@ -1484,7 +1484,7 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</spa
14841484
</ul>
14851485
</section>
14861486
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
1487-
<a name="requestcoarselocationpermission" class="tsd-anchor"></a>
1487+
<a name="requestLocationPermission" class="tsd-anchor"></a>
14881488
<h3>request<wbr>Coarse<wbr>Location<wbr>Permission</h3>
14891489
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
14901490
<li class="tsd-signature tsd-kind-icon">request<wbr>Coarse<wbr>Location<wbr>Permission<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></li>

docs/globals.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ <h4>Prerequisites</h4>
8181
<ul>
8282
<li><a href="#isbluetoothenabled">isBluetoothEnabled</a></li>
8383
<li><a href="#hascoarselocationpermission">hasCoarseLocationPermission</a></li>
84-
<li><a href="#requestcoarselocationpermission">requestCoarseLocationPermission</a></li>
84+
<li><a href="#requestLocationPermission">requestLocationPermission</a></li>
8585
<li><a href="#turnBluetoothOn">turnBluetoothOn</a></li>
8686
</ul>
8787
<a href="#discovery" id="discovery" style="color: inherit; text-decoration: none;">
@@ -135,16 +135,16 @@ <h3>hasCoarseLocationPermission</h3>
135135
</ul>
136136
<pre><code class="language-typescript">bluetooth.hasCoarseLocationPermission().then(
137137
<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">granted</span>) </span>{
138-
<span class="hljs-comment">// if this is &#x27;false&#x27; you probably want to call &#x27;requestCoarseLocationPermission&#x27; now</span>
138+
<span class="hljs-comment">// if this is &#x27;false&#x27; you probably want to call &#x27;requestLocationPermission&#x27; now</span>
139139
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;Has Location Permission? &quot;</span> + granted);
140140
}
141141
);</code></pre>
142-
<a href="#requestcoarselocationpermission" id="requestcoarselocationpermission" style="color: inherit; text-decoration: none;">
143-
<h3>requestCoarseLocationPermission</h3>
142+
<a href="#requestLocationPermission" id="requestLocationPermission" style="color: inherit; text-decoration: none;">
143+
<h3>requestLocationPermission</h3>
144144
</a>
145145
<p><strong>Since plugin version 1.2.0 the <code>startScanning</code> function will handle this internally so it&#39;s no longer mandatory to add permission checks to your code.</strong></p>
146146
<pre><code class="language-typescript"><span class="hljs-comment">// if no permission was granted previously this will open a user consent screen</span>
147-
bluetooth.requestCoarseLocationPermission().then(
147+
bluetooth.requestLocationPermission().then(
148148
<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">granted</span>) </span>{
149149
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;Location permission requested, user granted? &quot;</span> + granted);
150150
}

docs/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ <h4>Prerequisites</h4>
8181
<ul>
8282
<li><a href="#isbluetoothenabled">isBluetoothEnabled</a></li>
8383
<li><a href="#hascoarselocationpermission">hasCoarseLocationPermission</a></li>
84-
<li><a href="#requestcoarselocationpermission">requestCoarseLocationPermission</a></li>
84+
<li><a href="#requestLocationPermission">requestLocationPermission</a></li>
8585
<li><a href="#turnBluetoothOn">turnBluetoothOn</a></li>
8686
</ul>
8787
<a href="#discovery" id="discovery" style="color: inherit; text-decoration: none;">
@@ -135,16 +135,16 @@ <h3>hasCoarseLocationPermission</h3>
135135
</ul>
136136
<pre><code class="language-typescript">bluetooth.hasCoarseLocationPermission().then(
137137
<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">granted</span>) </span>{
138-
<span class="hljs-comment">// if this is &#x27;false&#x27; you probably want to call &#x27;requestCoarseLocationPermission&#x27; now</span>
138+
<span class="hljs-comment">// if this is &#x27;false&#x27; you probably want to call &#x27;requestLocationPermission&#x27; now</span>
139139
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;Has Location Permission? &quot;</span> + granted);
140140
}
141141
);</code></pre>
142-
<a href="#requestcoarselocationpermission" id="requestcoarselocationpermission" style="color: inherit; text-decoration: none;">
143-
<h3>requestCoarseLocationPermission</h3>
142+
<a href="#requestLocationPermission" id="requestLocationPermission" style="color: inherit; text-decoration: none;">
143+
<h3>requestLocationPermission</h3>
144144
</a>
145145
<p><strong>Since plugin version 1.2.0 the <code>startScanning</code> function will handle this internally so it&#39;s no longer mandatory to add permission checks to your code.</strong></p>
146146
<pre><code class="language-typescript"><span class="hljs-comment">// if no permission was granted previously this will open a user consent screen</span>
147-
bluetooth.requestCoarseLocationPermission().then(
147+
bluetooth.requestLocationPermission().then(
148148
<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">granted</span>) </span>{
149149
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;Location permission requested, user granted? &quot;</span> + granted);
150150
}

src/bluetooth.d.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,16 @@ export class Bluetooth extends BluetoothCommon {
100100
/**
101101
* Required for Android 6+ to be able to scan for peripherals in the background.
102102
*/
103-
requestCoarseLocationPermission(): Promise<any>;
103+
requestLocationPermission(): Promise<any>;
104104

105105
startScanning(options: StartScanningOptions): Promise<void>;
106106

107107
stopScanning(): Promise<any>;
108108

109109
connect(options: ConnectOptions): Promise<any>;
110110

111+
isConnected(options: ConnectOptions): Promise<boolean>;
112+
111113
disconnect(options: DisconnectOptions): Promise<any>;
112114

113115
read(options: ReadOptions): Promise<ReadResult>;
@@ -132,6 +134,13 @@ export class Bluetooth extends BluetoothCommon {
132134
stop();
133135

134136
public clearAdvertismentCache();
137+
138+
139+
// ios only
140+
centralManager: any; // CBCentralManager;
141+
142+
// android only
143+
getAndroidLocationManager(): any; //android.location.LocationManager
135144
}
136145
export function getBluetoothInstance(): Bluetooth;
137146

0 commit comments

Comments
 (0)