Skip to content

Commit dc80ead

Browse files
committed
health 0.81: Ensure 'Privacy' (address randomnisation) is only added for Bangle.js 2,
+ and add warnings in documentation that it can cause connection issues
1 parent 64a92e2 commit dc80ead

File tree

4 files changed

+35
-30
lines changed

4 files changed

+35
-30
lines changed

apps/setting/ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,5 @@ of 'Select Clock'
8989
0.78: Fix menu scroll restore on BangleJS1
9090
0.79: Ensure that tapping on pressure/altitude doesn't cause a menu to display temporarily
9191
0.80: Add option to set LCD brightness to 0, keep default brightness at 1.
92+
0.81: Ensure 'Privacy' (address randomnisation) is only added for Bangle.js 2,
93+
and add warnings in documentation that it can cause connection issues

apps/setting/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This is Bangle.js's main settings menu:
1414
* **Locale** Set whether you want 12 hour time, and what day of the week the week starts on.
1515

1616
See below for options under each heading:
17-
17+
1818
## Apps - App-specific settings
1919

2020
This is where you adjust settings for an individual app. (eg. Health app: Adjust how often heart rate tracking should fire.)
@@ -45,6 +45,8 @@ This is where you adjust settings for an individual app. (eg. Health app: Adjust
4545
* **Passkey** allows you to set a passkey that is required to connect and pair to Bangle.js.
4646
* **Whitelist** allows you to specify only specific devices that you will let connect to your Bangle.js. Simply choose the menu item, then `Add Device`, and then connect to Bangle.js with the device you want to add. If you are already connected you will have to disconnect first. Changes will take effect when you exit the `Settings` app.
4747
* **NOTE:** iOS devices and newer Android devices often implement Address Randomisation and change their Bluetooth address every so often. If you device's address changes, you will be unable to connect until you update the whitelist again.
48+
* **Privacy** - (Bangle.js 2 only) enables BLE privacy mode (see [NRF.setSecurity](https://www.espruino.com/Reference#l_NRF_setSecurity)). This randomises the Bangle's MAC address and can also
49+
remove advertising of its name. **This can cause connection issues with apps that expect to keep a permanent connection like iOS/Gadgetbridge**
4850

4951
## LCD
5052

apps/setting/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "setting",
33
"name": "Settings",
4-
"version": "0.80",
4+
"version": "0.81",
55
"description": "A menu for setting up Bangle.js",
66
"icon": "settings.png",
77
"tags": "tool,system",

apps/setting/settings.js

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function BLEMenu() {
192192
var hidN = [/*LANG*/"Off", /*LANG*/"Kbrd & Media", /*LANG*/"Kbrd", /*LANG*/"Kbrd & Mouse", /*LANG*/"Joystick"];
193193
var privacy = [/*LANG*/"Off", /*LANG*/"Show name", /*LANG*/"Hide name"];
194194

195-
return {
195+
var menu = {
196196
'': { 'title': /*LANG*/'Bluetooth' },
197197
'< Back': ()=>popMenu(mainMenu()),
198198
/*LANG*/'Make Connectable': ()=>makeConnectable(),
@@ -210,32 +210,6 @@ function BLEMenu() {
210210
updateSettings();
211211
}
212212
},
213-
/*LANG*/'Privacy': {
214-
min: 0, max: privacy.length-1,
215-
format: v => privacy[v],
216-
value: (() => {
217-
// settings.bleprivacy may be some custom object, but we ignore that for now
218-
if (settings.bleprivacy && settings.blename === false) return 2;
219-
if (settings.bleprivacy) return 1;
220-
return 0;
221-
})(),
222-
onchange: v => {
223-
settings.bleprivacy = 0;
224-
delete settings.blename;
225-
switch (v) {
226-
case 0:
227-
break;
228-
case 1:
229-
settings.bleprivacy = 1;
230-
break;
231-
case 2:
232-
settings.bleprivacy = 1;
233-
settings.blename = false;
234-
break;
235-
}
236-
updateSettings();
237-
}
238-
},
239213
/*LANG*/'HID': {
240214
value: Math.max(0,0 | hidV.indexOf(settings.HID)),
241215
min: 0, max: hidN.length-1,
@@ -252,7 +226,7 @@ function BLEMenu() {
252226
/*LANG*/'Whitelist': {
253227
value:
254228
(
255-
(settings.whitelist_disabled || !settings.whitelist) ? /*LANG*/"off" : /*LANG*/"on"
229+
(settings.whitelist_disabled || !settings.whitelist) ? /*LANG*/"Off" : /*LANG*/"On"
256230
) + (
257231
settings.whitelist
258232
? " (" + settings.whitelist.length + ")"
@@ -261,6 +235,33 @@ function BLEMenu() {
261235
onchange: () => setTimeout(() => pushMenu(whitelistMenu())) // graphical_menu redraws after the call
262236
}
263237
};
238+
if (BANGLEJS2) menu[/*LANG*/'Privacy'] = {
239+
min: 0, max: privacy.length-1,
240+
format: v => privacy[v],
241+
value: (() => {
242+
// settings.bleprivacy may be some custom object, but we ignore that for now
243+
if (settings.bleprivacy && settings.blename === false) return 2;
244+
if (settings.bleprivacy) return 1;
245+
return 0;
246+
})(),
247+
onchange: v => {
248+
settings.bleprivacy = 0;
249+
delete settings.blename;
250+
switch (v) {
251+
case 0:
252+
break;
253+
case 1:
254+
settings.bleprivacy = 1;
255+
break;
256+
case 2:
257+
settings.bleprivacy = 1;
258+
settings.blename = false;
259+
break;
260+
}
261+
updateSettings();
262+
}
263+
};
264+
return menu;
264265
}
265266

266267
function showThemeMenu(pop) {

0 commit comments

Comments
 (0)