Merge pull request #3955 from RKBoss6/iosLocation
[iOS Integration] Add BangleDumpLocation shortcut compatibilitymaster
commit
0be99812f2
|
|
@ -19,3 +19,4 @@
|
|||
0.18: Fix UTF8 conversion (check for `font` library, not `fonts`)
|
||||
0.19: Convert numeric weather values to int from BangleDumpWeather shortcut
|
||||
0.20: Add feels-like temperature data field to weather parsing from BangleDumpWeather shortcut.
|
||||
0.21: Add BangleDumpLocation shortcut, to update location data on watch without needing to use the watch's GPS, and added more app names/ ids.
|
||||
|
|
|
|||
|
|
@ -35,20 +35,21 @@ for now. It's just a few bucks/pounds/euro's.
|
|||
If you like to try a free app first, you can always use NRF Toolbox or
|
||||
Bluetooth BLE Device Finder to find and connect your Bangle.
|
||||
|
||||
### Weather and Calendar
|
||||
### Weather, Calendar, and Location
|
||||
|
||||
By using the `Shortcuts` app on your phone, you can send weather and calendar data to your watch. This works by sending a notification, which is read by the watch through ANCS. The watch then parses the notification for the data.
|
||||
By using the `Shortcuts` app on your phone, you can send weather, calendar, and location data to your watch. This works by sending a notification, which is read by the watch through ANCS. The watch then parses the notification for the data.
|
||||
|
||||
While you may write your own shortcuts if you prefer (for example, to get weather from a different source), two are provided:
|
||||
While you may write your own shortcuts if you prefer (for example, to get weather from a different source), three are provided:
|
||||
|
||||
- Calendar shortcut: https://www.icloud.com/shortcuts/4eac12548b4c424dbcdb1bd58cff338f
|
||||
- Weather shortcut: https://www.icloud.com/shortcuts/106c68bfac3746fe9a55761a3be8d092
|
||||
- [Calendar shortcut](https://www.icloud.com/shortcuts/4eac12548b4c424dbcdb1bd58cff338f)
|
||||
- [Weather shortcut](https://www.icloud.com/shortcuts/106c68bfac3746fe9a55761a3be8d092)
|
||||
- [Location shortcut](https://www.icloud.com/shortcuts/853c41e09a8e491f893a63b464d73ea1)
|
||||
|
||||
The weather shortcut requires an OpenWeatherMap api key, which you can get for free from https://openweathermap.org/api. The shortcut will prompt you for this when you add it to your phone.
|
||||
Note: The shortcuts must keep the names defaulted by the shortcut in order for the watch to detect the weather, calender, or location data. If you rename it from `BangleDump...` to something else, it will no longer get the info, and just display it as a notification on the watch.
|
||||
|
||||
These shortcuts can also be automated to run periodically, for example every hour, using the `Automation` tab in the Shortcuts app.
|
||||
|
||||
The shortcuts will send a notification, which can be annoying. One potential workaround for this would be to create a focus mode, and have an automation:
|
||||
The shortcuts will send a notification. Even though the notification is deleted as soon as Bangle.js receives it, it can be quite annoying. One potential workaround for this would be to create a focus mode, and have an automation:
|
||||
- activate the focus mode (hiding notifications from the shortcut)
|
||||
- run the shortcut
|
||||
- deactivate the focus mode
|
||||
|
|
@ -60,4 +61,9 @@ Please file any issues on https://github.com/espruino/BangleApps/issues/new?titl
|
|||
|
||||
## Creator
|
||||
|
||||
Gordon Williams
|
||||
- Gordon Williams
|
||||
|
||||
## Contributors
|
||||
|
||||
- RKBoss6
|
||||
- stweedo
|
||||
|
|
|
|||
|
|
@ -80,6 +80,19 @@ E.on('notify',msg=>{
|
|||
"com.apple.TestFlight": "TestFlight",
|
||||
"com.apple.ScreenTimeNotifications": "Screen Time",
|
||||
"com.apple.wifid.usernotification": "WiFi",
|
||||
"com.apple.Maps": "Maps",
|
||||
"com.apple.Music": "Apple Music",
|
||||
"com.apple.AppStore": "App Store",
|
||||
"com.apple.Preferences": "Settings",
|
||||
"com.apple.calculator": "Calculator",
|
||||
"com.apple.camera": "Camera",
|
||||
"com.apple.weather": "Weather",
|
||||
"com.apple.VoiceMemos": "Voice Memos",
|
||||
"com.apple.News": "News",
|
||||
"com.apple.tv": "Apple TV",
|
||||
"com.apple.findmy": "Find My",
|
||||
"com.apple.compass": "Compass",
|
||||
"com.apple.measure": "Measure",
|
||||
"com.atebits.Tweetie2": "Twitter",
|
||||
"com.burbn.instagram": "Instagram",
|
||||
"com.facebook.Facebook": "Facebook",
|
||||
|
|
@ -88,18 +101,33 @@ E.on('notify',msg=>{
|
|||
"com.google.Gmail": "GMail",
|
||||
"com.google.hangouts": "Hangouts",
|
||||
"com.google.ios.youtube": "YouTube",
|
||||
"com.google.ios.chrome": "Google Chrome",
|
||||
"com.google.Maps": "Google Maps",
|
||||
"com.google.Drive": "Google Drive",
|
||||
"com.google.GoogleMobile": "Google",
|
||||
"com.hammerandchisel.discord": "Discord",
|
||||
"com.ifttt.ifttt": "IFTTT",
|
||||
"com.jumbo.app": "Jumbo",
|
||||
"com.linkedin.LinkedIn": "LinkedIn",
|
||||
"com.marktplaats.iphone": "Marktplaats",
|
||||
"com.microsoft.Office.Outlook": "Outlook Mail",
|
||||
"com.microsoft.Office.Word": "Microsoft Word",
|
||||
"com.microsoft.Office.Excel": "Microsoft Excel",
|
||||
"com.microsoft.Office.Powerpoint": "Microsoft PowerPoint",
|
||||
"com.nestlabs.jasper.release": "Nest",
|
||||
"com.netflix.Netflix": "Netflix",
|
||||
"com.reddit.Reddit": "Reddit",
|
||||
"com.skype.skype": "Skype",
|
||||
"com.skype.SkypeForiPad": "Skype",
|
||||
"com.spotify.client": "Spotify",
|
||||
"com.soundcloud.TouchApp": "SoundCloud",
|
||||
"com.disney.disneyplus": "Disney+",
|
||||
"com.hbo.hbonow": "HBO Max",
|
||||
"com.amazon.Amazon": "Amazon Shopping",
|
||||
"com.amazon.AmazonVideo": "Prime Video",
|
||||
"com.dropbox.Dropbox": "Dropbox",
|
||||
"com.evernote.iPhone.Evernote": "Evernote",
|
||||
"com.trello": "Trello",
|
||||
"com.storytel.iphone": "Storytel",
|
||||
"com.strava.stravaride": "Strava",
|
||||
"com.tinyspeck.chatlyio": "Slack",
|
||||
|
|
@ -110,21 +138,23 @@ E.on('notify',msg=>{
|
|||
"com.valvesoftware.Steam": "Steam",
|
||||
"com.vilcsak.bitcoin2": "Coinbase",
|
||||
"com.wordfeud.free": "WordFeud",
|
||||
"com.yourcompany.PPClient": "PayPal",
|
||||
"com.paypal.PPClient": "PayPal",
|
||||
"com.zhiliaoapp.musically": "TikTok",
|
||||
"com.pinterest": "Pinterest",
|
||||
"com.tumblr.tumblr": "Tumblr",
|
||||
"de.no26.Number26": "N26",
|
||||
"io.robbie.HomeAssistant": "Home Assistant",
|
||||
"net.superblock.Pushover": "Pushover",
|
||||
"net.weks.prowl": "Prowl",
|
||||
"net.whatsapp.WhatsApp": "WhatsApp",
|
||||
"nl.ah.Appie": "Albert Heijn",
|
||||
"nl.postnl.TrackNTrace": "PostNL",
|
||||
"org.whispersystems.signal": "Signal",
|
||||
"ph.telegra.Telegraph": "Telegram",
|
||||
"tv.twitch": "Twitch",
|
||||
// could also use NRF.ancsGetAppInfo(msg.appId) here
|
||||
"tv.twitch": "Twitch"
|
||||
};
|
||||
|
||||
|
||||
|
||||
//if (appNames[msg.appId]) msg.a
|
||||
if (msg.title === "BangleDumpCalendar") {
|
||||
// parse the message body into json:
|
||||
|
|
@ -191,7 +221,7 @@ E.on('notify',msg=>{
|
|||
wind: d.wind,
|
||||
wdir: d.wdir,
|
||||
loc: d.loc
|
||||
}
|
||||
};
|
||||
// Convert string fields to numbers for iOS weather shortcut
|
||||
const numFields = ['code', 'wdir', 'temp','feels', 'hi', 'lo', 'hum', 'wind', 'uv', 'rain'];
|
||||
numFields.forEach(field => {
|
||||
|
|
@ -202,6 +232,47 @@ E.on('notify',msg=>{
|
|||
return;
|
||||
}
|
||||
|
||||
if (msg.title === "BangleDumpLocation") {
|
||||
|
||||
const d = JSON.parse(msg.message);
|
||||
|
||||
/* Example:
|
||||
{"lat":"2912.0744", "lon":"2333.332", "city":"Chicago"}*/
|
||||
let locationJson = {
|
||||
t: "location",
|
||||
lat:d.lat,
|
||||
lon:d.lon,
|
||||
city:d.city
|
||||
|
||||
};
|
||||
// Convert string fields to numbers
|
||||
const numFields = ['lat', 'lon'];
|
||||
numFields.forEach(field => {
|
||||
if (locationJson[field] != null) locationJson[field] = +locationJson[field];
|
||||
});
|
||||
|
||||
//load mylocation file
|
||||
let myLocationJson = Object.assign({
|
||||
lat: d.lat,
|
||||
lon: d.lon,
|
||||
location:d.city
|
||||
}, require("Storage").readJSON("mylocation.json", true) || {});
|
||||
//remove notification from phone
|
||||
NRF.ancsAction(msg.uid, false);
|
||||
if(Math.abs(myLocationJson.lat - locationJson.lat) < 0.0001 && Math.abs(myLocationJson.lon -locationJson.lon) < 0.0001){
|
||||
//same location, do not write
|
||||
return;
|
||||
}
|
||||
|
||||
myLocationJson.lon=locationJson.lon;
|
||||
myLocationJson.lat=locationJson.lat;
|
||||
myLocationJson.location=locationJson.city;
|
||||
require("Storage").write("mylocation.json",myLocationJson);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
require("messages").pushMessage({
|
||||
t : msg.event,
|
||||
id : msg.uid,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
{
|
||||
"id": "ios",
|
||||
"name": "iOS Integration",
|
||||
"version": "0.20",
|
||||
"description": "Display/pull notifications, music, weather, and agenda from iOS devices",
|
||||
"version": "0.21",
|
||||
"description": "Display/pull notifications, music, weather, location, and agenda from iOS devices",
|
||||
"icon": "app.png",
|
||||
"tags": "tool,system,ios,apple,messages,notifications",
|
||||
"dependencies": {"messages":"module"},
|
||||
"dependencies" : {"mylocation":"app" },
|
||||
"supports": ["BANGLEJS","BANGLEJS2"],
|
||||
"readme": "README.md",
|
||||
"storage": [
|
||||
|
|
|
|||
Loading…
Reference in New Issue