HealthKit single workout location - swiftui

Workouts recorded by Apple Workouts app on Apple Watch assign a location to stationary workouts, which is displayed as a pin in the Apple Fitness app.
This does not seem to be a HKWorkoutRoute (displayed as a route heatmap in Apple Fitness), which is used for workouts that have moved (such as cycling or running), as trying to load the HKWorkoutRoute for this workout leads to an empty list.
It's not a workout metadata either (like weather and humidity are). The documentation from Apple only offers guidance on HKWorkoutRoutes and not this singular location property.
How is this single location added to workouts from Apple Workouts, how can I as a developer read the location to display a map with a pin in my app, and how can I as a developer assign a location to the workouts I am writing to Apple Health, to ensure the best interoperability with Apple Fitness and other apps reading my workout type?

This is stored/used by Workout/Fitness apps and isn't available as API. You can try storing a workout route with a single location to get effectively the same behaviour for your app.

Related

Document has been modified or corrupted since signed! (data)

I'm working in HCL Notes application. I have developed a summary view to show calculated figures to the user. Then the user clicks one of the action buttons and I open a detailed view, but for that view I setup Selection Formula on the fly so that it shows the records filtered specific to that button conditions. It was working almost fine for a few days, but now most of the time it shows some previously shown (filtered) data no matter what button the user has clicked. Means it doesn't set the Selection Formula of the view and shows the view with the old formula and it won't get back to normal condition even if they restart Notes application.
When the user is stuck in this particular condition, and they peep through the status bar it shows this message:
Document has been modified or corrupted since signed! (data).
The necessary code-snippet is as below:
*Set dtlView = db.GetView("Report_Dtl")
dtlView.SelectionFormula =formula
Call dtlView.Refresh()*
where formula is the dynamically built formula. Looks like the line
dtlView.SelectionFormula =formula
is unable to update the selection formula and then the line below generates the above error message:
Call uidb.OpenView(dtlView.Name,,False, False)
Please help!
Thanks
For "on the fly" modification of the view selection formula your user need "Designer"- access to the database, and that is never a good idea. The help document to the function you are using is explicitly stating that this is not a good idea (emphasise of mine):
This is not a good way to display a selected set of documents for a specific user. When you use this property to change the view selection, it applies to all users of the view.
There are problems with using this method to make a view display a new selection of documents for an end user:
Do not give end-users Designer access to an application.
If it is a shared view, users will interfere with each other's searches.
The NotesĀ® client caches design information, and there's no way to tell it to update its cache (except for outlines). Exiting and re-entering the application usually works, but it's hard to programmatically ensure the user exited the application entirely.
In addition the modification of the view selection formula can break the signature of the design element and then other errors occur.
Better use another approach:
Use a Folder for every user and put the selected documents in there (after doing a NotesDatabase.Search with the formula
Use a separate view for every user and let a server agent manipulate its selection formula with a user that has access.
For having a separate view / folder for every user you could use "Shared, Private on first use"- views (they are not easy to maintain), or any process that generates them and is able to assign every view to the users they belong to... in both cases this needs some effort, but at least it will work.

Changing language with React Native and django-modeltranslation

I would like to add option to mobile app to change language. Im using django on backend and RN as mobile. So I installed django-modeltranslation and added my model I want to translate. On mobile I display available languages. When user clicks on specific language I would like to get translated data. I have huge problem to create logic how to do it. I'm not asking about code just some hints and idea
EDIT:
For example: I added translation from django-modeltranslation to my model (i.e GameTask with field title, description etc). In my settings.py I have declared languages ('en','de','uk',etc) and added translations in database (for every field of GameTask, I added title(en), title(de) etc). When I change language in settings.py, values on mobile are changing too (so working as intended). So im not storing any translated text in app files, just in database (except of static errors and informations). Now I just want to send info from mobile with chosen language and activate this language on backend to return content in specific language
If you want to completely make your application multi-language, you need two things.
Translation system for your app
Translation system for your api.
First, use a pre-built context api or create your own to support changing language in-app. Something like this: https://medium.com/#ally_20818/multi-language-text-with-react-native-react-context-b76d5677346d
When user changes the language, store the language name or key in async-storage or some other database.
Change the texts in the react-native side based on the selected language.
When you're making a api call, send the selected language too. Get the selected language on api side and return appropriate texts based on language.
UPDATE:
Since you're not storing any text on react-native side, you only need to add a picker (react-native-picker/picker is a native picker) and store the selected language key (en, de, uk etc in your case) in a database like react-native-async-storage. When you're making api requests with react-native, include an additional header or post data which includes selected language key. And you can get and use that key in your django back-end.

Sitecore page components aren't versioned with page

For a website we're working on, we had a pretty complex design to support. So, we chose the strategy where all content on each page is made up of components. Authors can insert various components such as a heading, rich text block, images, etc, allowing them flexibility in laying out pages. This was the only away we could support the complex design that was created.
This set up is working well except when it comes to versioning and search. When pages are versioned, the components on the page are not. When items are indexed for search, the components on the pages are not being indexed as part of the page. We think we may be able to solve the search issue with a custom search index, but the versioning issue seems much more complex.
Has anyone else faced these issues or have thoughts on solutions? We're on Sitecore 7.5.
A simple answer would be to upgrade to version 8 as soon as its released as version 8 will add versioning to the renderings field.
My Guess is that you are setting the content of the fields on the rendering parameters of each item? If that is the case I would suggest taking a slightly different approach. Use DataSources. You could have a few templates that hold the data, e.g. RichTextTemplate, SingleLineTextTemplate, ImageTemplate - all with a single field in, then when you add a heading or rich text block to the page, setup the rendering to all the editor to create the data source.
This way all the content can be versioned properly and you are still separating your content and presentation.
To keep the tree un-cluttered, we use an "Assets" folder under the item for all content:
Example Tree:
Sitecore
Content
Home
Assets
Page 1
Assets
Heading
Rich Text Block
Page 2
Assets
Heading
Rich Text Block
Image Block
etc...
The search problem sounds similar to this post: How to index sub-content in Sitecore with Lucene?
That suggests a computed field. In your computed field, check that your template is a page and then get all the renderings for that page. Once you have those, get the renderings DataSource items and you can build a big search field using the content from the DataSource item's fields.
This would save having an extra index with a custom access layer. It all stays within the Sitecore API.

Saving locations using Google Maps without violating T&Cs

I am currently working on an app (not live yet) that will allow users to create projects and set the location of each.
I originally added an autocomplete field that worked with the Google maps lookup to help the user type in the location and also it would find the latitude and longitude of the place/location and show it on a map.
At this point I was saving the location, latitude and longitude to database fields.
This made the user experience quite straight forward.
However, I now think this idea of storing the autocompleted location violates 10.1.3 of Google Maps T&Cs.
I need to include the locations in my list page and Google allows short term caching for performance purposes but surely that would mean I would need to update the cache or something for each entry at least every 30 days which isn't really an option.
This would also mean that the location data belongs to Google which limits any future use of this data (an API on my site for instance).
I wondered if it would be an option to use openstreetmap data to get the full location (although I'm not sure if it can be used to provide an autocomplete facility) and then pass that to the google maps lookup so that the location provided by the openstreetmap autocomplete with looser restrictions can be saved to the database. However, even if that was all possible it could be confusing for the user if the openstreetmap autocomplete failed to find a location/place that exists on google or it was labelled differently.
I'm not sure if that's an option or not.
I am currently tending towards a plain text box with an example location shown alongside it so the user can see the extent that the location needs to be typed (ie a full address) so that when it is used to lookup the location via Google it will bring back the correct latitude and longitude but will also be informative to users when they see it on the list page.
This does mean that the location field content is ok to store in the database then but it puts more reliance on the user typing the address in correctly and if they don't type it in properly the auto lookup may fail to locate it and/or it may not be viewer-friendly on the list page.
Can anyone offer any better ways that I could help users to type in an accurate location (which could be a place with address or just an address) so that it doesn't violate the terms and conditions and allows my site to have ownership of the location?
Thanks

Google Maps Location and Area Fields for Django

I am looking for two Django model fields that are easy to use in admin and gives a Google maps interactive interface.
LocationField
Stores longitude and latitude, admin user clicks on a map to mark the location.
AreaField
Stores a comma separated string of locations, admin user creates a shape on a map to mark an area.
I found a number of them but which one would you recommend for the above requirements?
http://pypi.python.org/pypi/django-easy-maps
http://code.google.com/p/django-gmapi/
http://code.google.com/p/django-coordinatesfield/
There is of course also geodjango but it seems a bit overkill for this project.
I know this post is old but in case anyone needs another tool, i've been using the django-geoposition app that helps to create a model field that can hold a geoposition and a corresponding admin widget.
We have been using django-easy-maps but with a custom (non-admin) interface. If Google can't find the location from the street address, we present a navigable map and allow the user to select a position, then store the latitude and longitude. Otherwise, there is likely to be too many street addresses that the Google maps can't parse.